{
  "components": {
    "schemas": {
      "AuditLog": {
        "properties": {
          "action": {
            "type": "string"
          },
          "actor": {
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Instant"
          },
          "entityId": {
            "type": "string"
          },
          "entityType": {
            "type": "string"
          },
          "hash": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/UUID"
          },
          "payload": {
            "type": "string"
          },
          "prevHash": {
            "type": "string"
          },
          "seq": {
            "format": "int64",
            "type": "integer"
          },
          "tenantId": {
            "$ref": "#/components/schemas/UUID"
          }
        },
        "type": "object"
      },
      "AuditVerificationResult": {
        "properties": {
          "brokenAtSeq": {
            "format": "int64",
            "type": "integer"
          },
          "entries": {
            "format": "int64",
            "type": "integer"
          },
          "message": {
            "type": "string"
          },
          "valid": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "CrossTenantPermission": {
        "properties": {
          "expiresAt": {
            "$ref": "#/components/schemas/Instant"
          },
          "grantedAt": {
            "$ref": "#/components/schemas/Instant"
          },
          "grantedBy": {
            "type": "string"
          },
          "granteeId": {
            "type": "string"
          },
          "granteeType": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/UUID"
          },
          "resourceId": {
            "type": "string"
          },
          "resourceType": {
            "type": "string"
          },
          "revokedAt": {
            "$ref": "#/components/schemas/Instant"
          },
          "sourceTenantId": {
            "$ref": "#/components/schemas/UUID"
          },
          "status": {
            "$ref": "#/components/schemas/PermissionStatus"
          },
          "targetTenantId": {
            "$ref": "#/components/schemas/UUID"
          }
        },
        "type": "object"
      },
      "FileUpload": {
        "type": "object"
      },
      "GrantPermissionRequest": {
        "properties": {
          "grantedBy": {
            "type": "string"
          },
          "granteeId": {
            "pattern": "\\S",
            "type": "string"
          },
          "granteeType": {
            "pattern": "\\S",
            "type": "string"
          },
          "resourceId": {
            "type": "string"
          },
          "resourceType": {
            "pattern": "\\S",
            "type": "string"
          },
          "sourceTenantId": {
            "$ref": "#/components/schemas/UUID"
          },
          "targetTenantId": {
            "$ref": "#/components/schemas/UUID"
          },
          "ttlDays": {
            "format": "int64",
            "type": "integer"
          }
        },
        "required": [
          "granteeType",
          "granteeId",
          "resourceType",
          "sourceTenantId",
          "targetTenantId"
        ],
        "type": "object"
      },
      "Instant": {
        "example": "2022-03-10T16:15:50Z",
        "format": "date-time",
        "type": "string"
      },
      "PermissionCheckResponse": {
        "properties": {
          "allowed": {
            "type": "boolean"
          },
          "expiresAt": {
            "$ref": "#/components/schemas/Instant"
          },
          "permissionId": {
            "$ref": "#/components/schemas/UUID"
          },
          "reason": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "PermissionStatus": {
        "enum": [
          "ACTIVE",
          "REVOKED",
          "EXPIRED"
        ],
        "type": "string"
      },
      "RegisterUserRequest": {
        "properties": {
          "attributes": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "email": {
            "pattern": "\\S",
            "type": "string"
          },
          "name": {
            "pattern": "\\S",
            "type": "string"
          },
          "password": {
            "pattern": "\\S",
            "type": "string"
          },
          "role": {
            "pattern": "\\S",
            "type": "string"
          }
        },
        "required": [
          "name",
          "email",
          "password",
          "role"
        ],
        "type": "object"
      },
      "SettingsUpdate": {
        "properties": {
          "alertAdminOnAtRisk": {
            "type": "boolean"
          },
          "enableAiCopilot": {
            "type": "boolean"
          },
          "enableForum": {
            "type": "boolean"
          },
          "enableLiveClasses": {
            "type": "boolean"
          },
          "enableQuizzes": {
            "type": "boolean"
          },
          "hubLocation": {
            "type": "string"
          },
          "notifyMentorsOnSubmission": {
            "type": "boolean"
          },
          "organization": {
            "type": "string"
          },
          "platformName": {
            "type": "string"
          },
          "requireEmailVerification": {
            "type": "boolean"
          },
          "sendWeeklyDigest": {
            "type": "boolean"
          },
          "supportEmail": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "Tenant": {
        "properties": {
          "activePrograms": {
            "format": "int32",
            "type": "integer"
          },
          "code": {
            "type": "string"
          },
          "config": {
            "type": "string"
          },
          "createdAt": {
            "$ref": "#/components/schemas/Instant"
          },
          "foundersCount": {
            "format": "int32",
            "type": "integer"
          },
          "hub": {
            "type": "boolean"
          },
          "id": {
            "$ref": "#/components/schemas/UUID"
          },
          "isHub": {
            "type": "boolean"
          },
          "localePriority": {
            "type": "string"
          },
          "mentorsCount": {
            "format": "int32",
            "type": "integer"
          },
          "name": {
            "type": "string"
          },
          "sectorTags": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "status": {
            "type": "string"
          },
          "updatedAt": {
            "$ref": "#/components/schemas/Instant"
          }
        },
        "type": "object"
      },
      "UUID": {
        "format": "uuid",
        "pattern": "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}",
        "type": "string"
      }
    },
    "securitySchemes": {
      "keycloak-bearer": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Access token issued by the Keycloak realm `startupos`. Send it as `Authorization: Bearer <token>`. A missing, expired or invalid token returns 401; a valid token without the required role returns 403."
      },
      "stream-token": {
        "type": "apiKey",
        "in": "query",
        "name": "token",
        "description": "Short-lived, enrolment-scoped stream token minted by the matching authenticated `stream-token` operation. Used because a cross-origin video element cannot send an Authorization header."
      },
      "livekit-signature": {
        "type": "apiKey",
        "in": "header",
        "name": "Authorization",
        "description": "JWT signed by the LiveKit server, sent without a `Bearer ` prefix and verified by the service. Only the LiveKit server calls this operation."
      }
    }
  },
  "info": {
    "title": "StartupOS identity service",
    "version": "a54687de",
    "description": "Generated at build time from the service's JAX-RS resources (SmallRye OpenAPI) and annotated by the overlay in docs-site/openapi/overlays. Every operation requires a Keycloak access token unless the operation says otherwise. Health and metrics endpoints are internal and are not documented."
  },
  "openapi": "3.0.3",
  "paths": {
    "/api/v1/audit": {
      "get": {
        "operationId": "AuditResource_list",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "default": 100,
              "format": "int32",
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/AuditLog"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          }
        },
        "tags": [
          "Audit"
        ],
        "summary": "List"
      }
    },
    "/api/v1/audit/verify": {
      "get": {
        "operationId": "AuditResource_verify",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditVerificationResult"
                }
              }
            },
            "description": "OK"
          }
        },
        "tags": [
          "Audit"
        ],
        "summary": "Verify"
      }
    },
    "/api/v1/identity/me": {
      "get": {
        "operationId": "IdentityResource_getCurrentUser",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Identity"
        ],
        "summary": "Get current user"
      }
    },
    "/api/v1/identity/register": {
      "post": {
        "operationId": "IdentityResource_registerUser",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RegisterUserRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Identity"
        ],
        "summary": "Register user"
      }
    },
    "/api/v1/identity/settings": {
      "get": {
        "operationId": "PlatformSettingsResource_get",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Platform settings"
        ],
        "summary": "Get"
      },
      "put": {
        "operationId": "PlatformSettingsResource_update",
        "parameters": [
          {
            "in": "header",
            "name": "X-User-Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SettingsUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Platform settings"
        ],
        "summary": "Update"
      }
    },
    "/api/v1/identity/users": {
      "get": {
        "operationId": "IdentityResource_listUsers",
        "parameters": [
          {
            "in": "query",
            "name": "first",
            "schema": {
              "default": 0,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "max",
            "schema": {
              "default": 50,
              "format": "int32",
              "type": "integer"
            }
          },
          {
            "in": "query",
            "name": "role",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Identity"
        ],
        "summary": "List users"
      }
    },
    "/api/v1/identity/users/{userId}": {
      "get": {
        "operationId": "IdentityResource_getUserById",
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Identity"
        ],
        "summary": "Get user by id"
      }
    },
    "/api/v1/identity/users/{userId}/approve": {
      "put": {
        "operationId": "IdentityResource_approveUser",
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Identity"
        ],
        "summary": "Approve user"
      }
    },
    "/api/v1/identity/users/{userId}/attributes": {
      "put": {
        "operationId": "IdentityResource_updateAttributes",
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": {
                  "type": "string"
                },
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Identity"
        ],
        "summary": "Update attributes"
      }
    },
    "/api/v1/identity/users/{userId}/disable": {
      "put": {
        "operationId": "IdentityResource_disableUser",
        "parameters": [
          {
            "in": "path",
            "name": "userId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Identity"
        ],
        "summary": "Disable user"
      }
    },
    "/api/v1/import": {
      "post": {
        "operationId": "ImportResource_importByType",
        "parameters": [
          {
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "X-User-Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "file": {
                    "$ref": "#/components/schemas/FileUpload"
                  }
                },
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Import"
        ],
        "summary": "Import by type"
      }
    },
    "/api/v1/import/founders": {
      "post": {
        "operationId": "ImportResource_importFounders",
        "parameters": [
          {
            "in": "header",
            "name": "X-User-Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "file": {
                    "$ref": "#/components/schemas/FileUpload"
                  }
                },
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Import"
        ],
        "summary": "Import founders"
      }
    },
    "/api/v1/import/mentors": {
      "post": {
        "operationId": "ImportResource_importMentors",
        "parameters": [
          {
            "in": "header",
            "name": "X-User-Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "properties": {
                  "file": {
                    "$ref": "#/components/schemas/FileUpload"
                  }
                },
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Import"
        ],
        "summary": "Import mentors"
      }
    },
    "/api/v1/permissions": {
      "get": {
        "operationId": "CrossTenantPermissionResource_list",
        "parameters": [
          {
            "in": "query",
            "name": "granteeId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "targetTenant",
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/CrossTenantPermission"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          }
        },
        "tags": [
          "Cross-tenant permissions"
        ],
        "summary": "List"
      },
      "post": {
        "operationId": "CrossTenantPermissionResource_grant",
        "parameters": [
          {
            "in": "header",
            "name": "X-User-Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GrantPermissionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Cross-tenant permissions"
        ],
        "summary": "Grant"
      }
    },
    "/api/v1/permissions/check": {
      "get": {
        "operationId": "CrossTenantPermissionResource_check",
        "parameters": [
          {
            "in": "query",
            "name": "granteeId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "resourceId",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "resourceType",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "targetTenant",
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PermissionCheckResponse"
                }
              }
            },
            "description": "OK"
          }
        },
        "tags": [
          "Cross-tenant permissions"
        ],
        "summary": "Check"
      }
    },
    "/api/v1/permissions/{id}": {
      "delete": {
        "operationId": "CrossTenantPermissionResource_revoke",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          },
          {
            "in": "header",
            "name": "X-User-Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Cross-tenant permissions"
        ],
        "summary": "Revoke"
      }
    },
    "/api/v1/permissions/{id}/revoke": {
      "post": {
        "operationId": "CrossTenantPermissionResource_revokeViaPost",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          },
          {
            "in": "header",
            "name": "X-User-Id",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Cross-tenant permissions"
        ],
        "summary": "Revoke via post"
      }
    },
    "/api/v1/tenants": {
      "get": {
        "operationId": "TenantResource_listTenants",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "items": {
                    "$ref": "#/components/schemas/Tenant"
                  },
                  "type": "array"
                }
              }
            },
            "description": "OK"
          }
        },
        "tags": [
          "Tenants"
        ],
        "summary": "List tenants"
      },
      "post": {
        "operationId": "TenantResource_createTenant",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tenant"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Tenants"
        ],
        "summary": "Create tenant"
      }
    },
    "/api/v1/tenants/code/{code}": {
      "get": {
        "operationId": "TenantResource_getTenantByCode",
        "parameters": [
          {
            "in": "path",
            "name": "code",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Tenants"
        ],
        "summary": "Get tenant by code"
      }
    },
    "/api/v1/tenants/{id}": {
      "get": {
        "operationId": "TenantResource_getTenant",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Tenants"
        ],
        "summary": "Get tenant"
      },
      "put": {
        "operationId": "TenantResource_updateTenant",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Tenant"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Tenants"
        ],
        "summary": "Update tenant"
      }
    },
    "/api/v1/tenants/{id}/config": {
      "put": {
        "operationId": "TenantResource_updateTenantConfig",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/UUID"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "additionalProperties": {},
                "type": "object"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "tags": [
          "Tenants"
        ],
        "summary": "Update tenant config"
      }
    }
  },
  "security": [
    {
      "keycloak-bearer": []
    }
  ],
  "tags": [
    {
      "name": "Audit",
      "description": "Read the audit log and verify its integrity."
    },
    {
      "name": "Cross-tenant permissions",
      "description": "Grant, list, check and revoke access that crosses tenant boundaries."
    },
    {
      "name": "Identity",
      "description": "The signed-in user's profile, registration, and user administration (approve, disable, attributes)."
    },
    {
      "name": "Import",
      "description": "Bulk import of founders and mentors."
    },
    {
      "name": "Platform settings",
      "description": "Read and update platform-wide settings."
    },
    {
      "name": "Tenants",
      "description": "Tenant records and per-tenant configuration."
    }
  ]
}
