{
  "openapi": "3.1.0",
  "info": {
    "title": "Rapid Test Web API — public discovery",
    "version": "1.0.0",
    "description": "Public health, login availability and OAuth discovery endpoints. This is the public discovery subset, not a complete specification of the first-party session-based web API. Use the separately cataloged MCP API for automated authoring and reporting."
  },
  "servers": [{"url": "https://rapidtest.uz"}],
  "externalDocs": {"url": "https://rapidtest.uz/developers/#web-api"},
  "paths": {
    "/api/health/live": {
      "get": {
        "operationId": "getLiveness",
        "summary": "Check that the API is running",
        "responses": {"200": {"description": "API is alive", "content": {"application/json": {"schema": {"type": "object", "required": ["status", "service"], "properties": {"status": {"const": "alive"}, "service": {"const": "rapid-test-api"}}}}}}}
      }
    },
    "/api/health/ready": {
      "get": {
        "operationId": "getReadiness",
        "summary": "Check database, storage and attempt service readiness",
        "responses": {
          "200": {"description": "Dependencies are ready", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Readiness"}}}},
          "503": {"description": "One or more dependencies are unavailable", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Readiness"}}}}
        }
      }
    },
    "/api/auth/status": {
      "get": {
        "operationId": "getLoginAvailability",
        "summary": "Get Telegram login availability",
        "responses": {"200": {"description": "Login configuration", "content": {"application/json": {"schema": {"type": "object", "required": ["login_enabled", "bot_username"], "properties": {"login_enabled": {"type": "boolean"}, "bot_username": {"type": ["string", "null"]}}}}}}}
      }
    },
    "/.well-known/oauth-authorization-server": {
      "get": {
        "operationId": "getAuthorizationServerMetadata",
        "summary": "Discover MCP OAuth authorization endpoints and scopes",
        "responses": {"200": {"description": "OAuth authorization server metadata; public clients use S256 PKCE and client metadata documents", "content": {"application/json": {"schema": {"type": "object", "required": ["issuer", "authorization_endpoint", "token_endpoint"], "properties": {"issuer": {"type": "string", "format": "uri"}, "authorization_endpoint": {"type": "string", "format": "uri"}, "token_endpoint": {"type": "string", "format": "uri"}, "scopes_supported": {"type": "array", "items": {"type": "string"}}}}}}}}
      }
    }
  },
  "components": {"schemas": {"Readiness": {"type": "object", "required": ["status", "environment", "checks"], "properties": {"status": {"enum": ["ready", "unavailable"]}, "environment": {"type": "string"}, "checks": {"type": "object", "required": ["database", "storage", "attempts"], "properties": {"database": {"type": "boolean"}, "storage": {"type": "boolean"}, "attempts": {"type": "boolean"}}}}}}}
}
