{"openapi":"3.1.0","info":{"title":"Sage Data Science Agent","description":"AI-powered data science agent with 51+ professional tools","version":"2.0.0"},"paths":{"/health":{"get":{"tags":["Health"],"summary":"Health Check","description":"Simple health check endpoint","operationId":"health_check_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health/detailed":{"get":{"tags":["Health"],"summary":"Detailed Health Check","description":"Detailed health check with workspace diagnostics","operationId":"detailed_health_check_health_detailed_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/register":{"post":{"tags":["Authentication","authentication"],"summary":"Register User","description":"Register a new user with optional email verification bypass","operationId":"register_user_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RegisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSignupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/login":{"post":{"tags":["Authentication","authentication"],"summary":"Login User","description":"Login user with email and password","operationId":"login_user_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/verify":{"post":{"tags":["Authentication","authentication"],"summary":"Verify Email","description":"Verify email address and activate account","operationId":"verify_email_auth_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/resend-verification":{"post":{"tags":["Authentication","authentication"],"summary":"Resend Verification","description":"Resend verification email","operationId":"resend_verification_auth_resend_verification_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/user/register":{"post":{"tags":["Authentication","authentication"],"summary":"User Register","description":"Register a new user for the pre-configured tenant.\n\nThis is the self-service registration flow:\n1. User provides email\n2. System creates pending user\n3. Verification email is sent\n4. User verifies to receive API key\n\nThe tenant is pre-configured (DEFAULT_TENANT_ID), so users don't\nneed to specify which tenant they're joining.","operationId":"user_register_auth_user_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRegisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRegisterResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/user/login":{"post":{"tags":["Authentication","authentication"],"summary":"User Login","description":"Login for team members (users in sage-tenant-users table).\n\nThis endpoint authenticates users who registered via /user/register\n(Prism users, team members) as opposed to tenant owners who use /login.","operationId":"user_login_auth_user_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google/login":{"post":{"tags":["Authentication","authentication"],"summary":"Google Login","description":"Authenticate a user via Google OAuth authorization code.\n\nExchanges the code for tokens, fetches user identity from Google,\nthen finds or creates the user in sage-tenant-users and issues a JWT\nidentical in shape to /user/login.","operationId":"google_login_auth_google_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleLoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google/callback":{"get":{"tags":["Google OAuth","google-oauth"],"summary":"Oauth Callback","description":"Handle OAuth 2.0 callback from Google.\n\nThis endpoint is called by Google after user grants (or denies) consent.\nIt exchanges the authorization code for tokens and stores them.\n\nArgs:\n    code: Authorization code to exchange for tokens\n    state: State parameter to verify request authenticity\n    error: Error message if user denied consent\n\nReturns:\n    Redirects to frontend with success/error status","operationId":"oauth_callback_auth_google_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","description":"Authorization code from Google","title":"Code"},"description":"Authorization code from Google"},{"name":"state","in":"query","required":true,"schema":{"type":"string","description":"State parameter for CSRF verification","title":"State"},"description":"State parameter for CSRF verification"},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Error if authorization denied","title":"Error"},"description":"Error if authorization denied"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/user/verify":{"post":{"tags":["Authentication","authentication"],"summary":"User Verify","description":"Verify email and receive API key.\n\nAfter clicking the verification link, the user submits the token\nand receives their API key. The key is shown only once and should\nbe saved to ~/.sage/config.json by the CLI.","operationId":"user_verify_auth_user_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserVerifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserVerifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/user/verify/{token}":{"get":{"tags":["Authentication","authentication"],"summary":"User Verify Link","description":"Handle verification link click from email.\n\nThis endpoint is for web-based verification. It could:\n1. Verify the token\n2. Redirect to a success page with the API key\n3. Or return JSON for CLI callback","operationId":"user_verify_link_auth_user_verify__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/user/me":{"get":{"tags":["Authentication","authentication"],"summary":"User Me","description":"Get current user profile from API key.\n\nRequires valid API key in Authorization header.\nReturns user identity, role, and scopes.","operationId":"user_me_auth_user_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserMeResponse"}}}}}}},"/auth/user/status":{"get":{"tags":["Authentication","authentication"],"summary":"User Registration Status","description":"Check registration/verification status for an email.\n\nUsed by CLI to poll for verification completion.","operationId":"user_registration_status_auth_user_status_get","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","title":"Email"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/auth/token/refresh":{"post":{"tags":["Authentication","authentication"],"summary":"Refresh Token","description":"Silently refresh an expired Casino JWT without re-entering credentials.\n\nAccepts the current (expired) JWT in Authorization: Bearer <token>.\nVerifies the signature + that the session was valid (not revoked) within\nthe last 24 hours, then issues a fresh token with the same identity.\n\nFrontend calls this on receiving 401 instead of immediately logging out.","operationId":"refresh_token_auth_auth_token_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/broker/resolve-origin":{"get":{"tags":["Authentication","authentication"],"summary":"Resolve Broker Origin","description":"Public: resolve a broker return-origin against the live custom-domain\nregistry + static allowlist. Returns {allowed, site_id, tenant_id}. The\nbroker accepts an origin (and pins its postMessage target to it) only when\nallowed — so the session token never reaches an unverified origin.","operationId":"resolve_broker_origin_auth_broker_resolve_origin_get","parameters":[{"name":"origin","in":"query","required":false,"schema":{"type":"string","default":"","title":"Origin"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents":{"get":{"tags":["Streaming"],"summary":"List Agents","description":"DEPRECATED (P0-90): the multi-agent roster this endpoint described was\nremoved in P0-73's mono-sage collapse. The modern equivalent is the meta-tool\ncategory catalog exposed at `GET /capabilities` — use that instead.\n\nThis handler remains as a no-op so any SDK client that hasn't upgraded to\n`useCapabilities()` doesn't 404 during the deprecation window. It returns\nan empty catalog with a `deprecated_use` pointer. Will be removed in a\nfollow-up release once all clients have migrated.","operationId":"list_agents_agents_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/stream":{"post":{"tags":["Streaming"],"summary":"Stream Query","description":"Stream a query using native Strands SSE streaming.\n\nThis endpoint demonstrates the power of native Strands streaming:\n- No custom event processing needed\n- All sub-agent events automatically visible\n- Tool calls and results stream in real-time\n- <10ms first event latency\n- Zero maintenance burden\n\nArgs:\n    request: Query request with session/workspace info\n    tenant_context: Tenant isolation context (injected)\n\nReturns:\n    StreamingResponse with SSE events\n\nEvent Types:\n    - text: Progressive text responses\n    - tool_use: Tool execution started\n    - tool_result: Tool completed with results\n    - reasoning_content: Agent reasoning (if enabled)\n    - error: Error information\n    - done: Stream completion\n\nExample Usage:\n    ```javascript\n    const eventSource = new EventSource('/stream', {\n        method: 'POST',\n        body: JSON.stringify({\n            query: \"Analyze sales data\",\n            session_id: \"user-123\"\n        })\n    });\n\n    eventSource.onmessage = (event) => {\n        const data = JSON.parse(event.data);\n        console.log(data.event, data.data);\n    };\n    ```","operationId":"stream_query_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamQueryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stream-simple":{"post":{"tags":["Streaming"],"summary":"Stream Query Simple","description":"Legacy endpoint for backward compatibility.\n\nThis is an alias to /stream for existing Sage Dashboard clients.\nNew clients should use /stream instead.\n\nDeprecated: Use /stream endpoint instead.","operationId":"stream_query_simple_stream_simple_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamQueryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stream/pii-preview":{"post":{"tags":["Streaming"],"summary":"Pii Preview","description":"Preview which PII entities would be masked in a query, without sending it.\n\nReturns detected entities with original text, type, confidence, and whether\nthey would actually be masked given the tenant's current PII settings.\nUsed by the frontend to show a pre-send warning with Allow buttons.","operationId":"pii_preview_stream_pii_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PiiPreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stream/interrupt":{"post":{"tags":["Streaming"],"summary":"Interrupt Stream","description":"Signal the running agent to interrupt and pause.\n\nSets a flag that the UserInterruptHook checks before each tool call.\nWhen the hook fires, the agent stops, summarizes progress, and the\nSSE stream emits an 'interrupt' event before completing.\n\nThe user can then send a follow-up message via the regular /stream\nendpoint — S3SessionManager preserves conversation context, so the\nagent picks up where it left off with the user's new direction.","operationId":"interrupt_stream_stream_interrupt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InterruptRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stream/status":{"get":{"tags":["Streaming"],"summary":"Agent Status","description":"Poll the lifecycle state of a streaming agent run for a workspace.\n\nClients use this when their SSE connection drops (e.g. app backgrounded\non iOS). Instead of giving up or sending a recap query, they poll here\nevery 3s until status transitions to \"completed\" or \"error\", then fetch\n/conversations for the full result.\n\nStates:\n    \"running\"   — agent task is executing\n    \"completed\" — agent finished, S3SessionManager has persisted results\n    \"error\"     — agent failed (error field has details)\n    \"unknown\"   — no record for this workspace (never ran or state expired)","operationId":"agent_status_stream_status_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stream/resume":{"post":{"tags":["Streaming"],"summary":"Resume From Interrupt","description":"Resume after an interrupt by sending a new query.\n\nThis is functionally equivalent to /stream — S3SessionManager\npreserves the full conversation, so the agent has context from\nbefore the interrupt. The user's message is treated as the next\nturn in the conversation.\n\nExists as a semantic alias so clients can distinguish between\n\"new query\" and \"resume after interrupt\" in their UX.","operationId":"resume_from_interrupt_stream_resume_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StreamQueryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/prewarm":{"post":{"tags":["Streaming"],"summary":"Prewarm Swarm Endpoint","description":"Pre-warm the swarm for a tenant+workspace before first query.\n\nCall this endpoint when:\n- User lands on the dashboard\n- User selects a workspace\n- User authenticates\n\nThis creates the swarm in the background so the first /stream call\nis near-instant (~90% latency reduction).\n\nReturns immediately (fire-and-forget) - swarm creation happens in background.","operationId":"prewarm_swarm_endpoint_prewarm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrewarmRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/swarm-cache-stats":{"get":{"tags":["Streaming"],"summary":"Get Swarm Cache Stats","description":"Get swarm cache statistics (for monitoring/debugging).\n\nReturns information about cached swarms, TTL, and cache utilization.","operationId":"get_swarm_cache_stats_swarm_cache_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/datasets":{"get":{"tags":["Datasets"],"summary":"List Datasets","description":"List datasets in session/workspace","operationId":"list_datasets_datasets_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/datasets/{dataset_name}/download":{"get":{"tags":["Datasets"],"summary":"Download Dataset","description":"Download dataset in specified format (csv, json, parquet, xlsx)","operationId":"download_dataset_datasets__dataset_name__download_get","parameters":[{"name":"dataset_name","in":"path","required":true,"schema":{"type":"string","title":"Dataset Name"}},{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(csv|json|parquet|xlsx)$","default":"csv","title":"Format"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/visualizations":{"get":{"tags":["Datasets"],"summary":"List Visualizations","description":"List visualizations in session/workspace - matches datasets endpoint pattern","operationId":"list_visualizations_visualizations_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/session/{session_id}/visualizations":{"get":{"tags":["Datasets"],"summary":"Get Session Visualizations","description":"Get all visualizations for a session - DEPRECATED, use /visualizations instead","operationId":"get_session_visualizations_session__session_id__visualizations_get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations":{"get":{"tags":["Conversations"],"summary":"Get Conversation History","description":"Get conversation history for a session/workspace.\n\nReads directly from Strands S3SessionManager paths.\nRequired scope: conversation:read","operationId":"get_conversation_history_conversations_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","description":"Maximum number of messages to return","default":50,"title":"Limit"},"description":"Maximum number of messages to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","description":"Number of messages to skip","default":0,"title":"Offset"},"description":"Number of messages to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations/search":{"post":{"tags":["Conversations"],"summary":"Search Conversations","description":"Search conversation history for specific content.\n\nReads from Strands S3 paths and filters by query string.\nRequired scope: conversation:read","operationId":"search_conversations_conversations_search_post","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"query","in":"query","required":true,"schema":{"type":"string","description":"Search query","title":"Query"},"description":"Search query"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations/context":{"get":{"tags":["Conversations"],"summary":"Get Conversation Context","description":"Get contextual summary for a query based on conversation history.\n\nReads from Strands S3 paths and returns recent context.\nRequired scope: conversation:read","operationId":"get_conversation_context_conversations_context_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"query","in":"query","required":true,"schema":{"type":"string","description":"Current query to generate context for","title":"Query"},"description":"Current query to generate context for"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations/scope":{"get":{"tags":["Conversations"],"summary":"List Conversations For Scope","description":"List conversations for the authenticated user, newest first.\n\nBuilt apps call this to populate the conversation list sidebar.\nRequired scope: ``conversation:read`` OR ``workspace:read``.","operationId":"list_conversations_for_scope_conversations_scope_get","parameters":[{"name":"app_scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"App scope id (builder-only override)","title":"App Scope"},"description":"App scope id (builder-only override)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"include_deleted","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Deleted"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations/{session_id}/messages":{"get":{"tags":["Conversations"],"summary":"Get Conversation Messages","description":"Fetch the full message history for a specific conversation.\n\nReads from Strands S3SessionManager (same path as the legacy session/\nworkspace route). Authorised by requiring the caller own the scope\nthat the conversation lives under.","operationId":"get_conversation_messages_conversations__session_id__messages_get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"app_scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Scope"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":200,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations/{session_id}":{"delete":{"tags":["Conversations"],"summary":"Soft Delete Conversation","description":"Soft-delete a conversation. Hidden from the sidebar immediately;\nphysical rows purged after the grace period by the sweep job.","operationId":"soft_delete_conversation_conversations__session_id__delete","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"app_scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Scope"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations/backfill-titles":{"post":{"tags":["Conversations"],"summary":"Backfill Auto Titles","description":"One-off sweep that retroactively auto-titles existing sessions (≥3\nturns, not user-renamed, not already auto-titled). Only touches the\nauthenticated user's own scope — no admin role required. Rate-limited\nto 1 Haiku call per second to stay well under API concurrency limits.","operationId":"backfill_auto_titles_conversations_backfill_titles_post","parameters":[{"name":"app_scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"App scope id (builder-only override)","title":"App Scope"},"description":"App scope id (builder-only override)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"dry_run","in":"query","required":false,"schema":{"type":"boolean","description":"Return candidates without writing","default":false,"title":"Dry Run"},"description":"Return candidates without writing"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/conversations/{session_id}/title":{"post":{"tags":["Conversations"],"summary":"Rename Conversation","description":"Rename a conversation. Sets ``custom_title`` which overrides the\nauto-generated title derived from the first user message.","operationId":"rename_conversation_conversations__session_id__title_post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"app_scope","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Scope"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationRenameRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tools":{"get":{"tags":["Tools"],"summary":"List Tools","description":"List available tools for the agent","operationId":"list_tools_tools_get","parameters":[{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},{"name":"page","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Page number (1-based)","default":1,"title":"Page"},"description":"Page number (1-based)"},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":100,"minimum":1},{"type":"null"}],"description":"Number of tools per page (max 100)","title":"Limit"},"description":"Number of tools per page (max 100)"},{"name":"agent_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by agent type (e.g., 'data_loading', 'mongodb')","title":"Agent Type"},"description":"Filter by agent type (e.g., 'data_loading', 'mongodb')"},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by tool category","title":"Category"},"description":"Filter by tool category"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tools/summary":{"get":{"tags":["Tools"],"summary":"Get Tools Summary","description":"Get a summary of tools organized by agent type - optimized for the sage agent's tool listing","operationId":"get_tools_summary_tools_summary_get","parameters":[{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tools/execute":{"post":{"tags":["Tools"],"summary":"Execute Tool","description":"Execute a visualization tool directly with provided parameters.\n\nThis endpoint allows direct tool execution without going through the LLM,\nproviding faster responses for visualization creation from the UI.\n\nOnly visualization tools are whitelisted for direct execution for security.","operationId":"execute_tool_tools_execute_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolExecutionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolExecutionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tools/schemas":{"get":{"tags":["Tools"],"summary":"Get Tool Schemas","description":"Get detailed parameter schemas for tools in a specific category.\n\nThis provides the UI with information needed to build dynamic forms\nfor tool execution, including parameter types, defaults, and descriptions.","operationId":"get_tool_schemas_tools_schemas_get","parameters":[{"name":"category","in":"query","required":false,"schema":{"type":"string","description":"Tool category (currently only 'visualization' supported)","default":"visualization","title":"Category"},"description":"Tool category (currently only 'visualization' supported)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/workspaces":{"get":{"tags":["Workspaces","workspaces"],"summary":"List Workspaces V1","description":"List workspaces for a tenant with pagination support (v1 endpoint for backward compatibility)\n\nThis endpoint provides backward compatibility with the frontend calling /api/v1/workspaces.\nIt's equivalent to GET /tenants/{tenant_id}/workspaces but uses query parameter.\n\nQuery params:\n    tenant_id: Tenant ID to list workspaces for\n    limit: Maximum number of workspaces to return (default: 20)\n    offset: Number of workspaces to skip for pagination (default: 0)\n\nRequired scope: workspace:read","operationId":"list_workspaces_v1_api_v1_workspaces_get","parameters":[{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/workspaces":{"get":{"tags":["Workspaces","workspaces"],"summary":"List Tenant Workspaces","description":"List workspaces for a tenant with pagination support\n\nQuery params:\n    limit: Maximum number of workspaces to return (default: 20)\n    offset: Number of workspaces to skip for pagination (default: 0)\n\nRequired scope: workspace:read","operationId":"list_tenant_workspaces_tenants__tenant_id__workspaces_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Workspaces","workspaces"],"summary":"Create Workspace","description":"Create a new workspace for a tenant\n\nThe workspace is owned by the user creating it (owner_user_id).\nNon-admin users will only see workspaces they own.\n\nRequired scope: workspace:write","operationId":"create_workspace_tenants__tenant_id__workspaces_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/workspaces/{workspace_id}":{"patch":{"tags":["Workspaces","workspaces"],"summary":"Update Workspace","description":"Rename or update workspace metadata.\n\nRequired scope: workspace:write","operationId":"update_workspace_tenants__tenant_id__workspaces__workspace_id__patch","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Workspaces","workspaces"],"summary":"Get Workspace Details","description":"Get complete workspace details including datasets, visualizations, and models.\n\nThis endpoint provides full workspace information by directly scanning S3,\nensuring complete and up-to-date listings of all workspace resources.\n\nPhase 5 - Workspace Isolation:\n- Admins can access all workspaces in their tenant\n- Regular users can only access workspaces they own\n\nRequired scope: workspace:read","operationId":"get_workspace_details_tenants__tenant_id__workspaces__workspace_id__get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Workspaces","workspaces"],"summary":"Delete Workspace","description":"Delete a workspace (metadata only, S3 data preserved)\n\nDeletes workspace metadata from DynamoDB. S3 data is NOT deleted to prevent\naccidental data loss. Requires workspace:write scope and admin/owner permissions.\n\nArgs:\n    tenant_id: The tenant ID\n    workspace_id: The workspace ID to delete\n\nRequired scope: workspace:write\nRequired permission: admin OR workspace owner\n\nReturns:\n    Dict with deletion status including whether S3 data exists","operationId":"delete_workspace_tenants__tenant_id__workspaces__workspace_id__delete","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces/{workspace_id}/sessions":{"get":{"tags":["Workspaces","workspaces"],"summary":"List Workspace Sessions","description":"List all analysis sessions for a workspace\n\nPhase 5 - Workspace Isolation:\n- Admins can access all workspaces in their tenant\n- Regular users can only access workspaces they own\n\nRequired scope: workspace:read","operationId":"list_workspace_sessions_workspaces__workspace_id__sessions_get","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/workspaces/{workspace_id}/query":{"post":{"tags":["Workspaces","workspaces"],"summary":"Query Workspace","description":"Execute a query in a specific workspace context\n\nPhase 5 - Workspace Isolation:\n- Admins can access all workspaces in their tenant\n- Regular users can only access workspaces they own\n\nRequired scope: agent:query","operationId":"query_workspace_workspaces__workspace_id__query_post","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/sage_agent__api__routes__admin__QueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/workspaces/{workspace_id}/usage":{"get":{"tags":["Workspaces","workspaces"],"summary":"Get Workspace Usage","description":"Get storage and resource usage metrics for a workspace.\n\nReturns detailed breakdown of storage consumption by resource type\n(datasets, visualizations, reports, conversations) and resource counts.\n\nPhase 5 - Workspace Isolation:\n- Admins can access all workspaces in their tenant\n- Regular users can only access workspaces they own\n\nRequired scope: workspace:read\n\nResponse:\n{\n    \"success\": true,\n    \"workspace_id\": \"my-workspace\",\n    \"tenant_id\": \"t_abc123\",\n    \"storage\": {\n        \"datasets_bytes\": 52428800,\n        \"visualizations_bytes\": 10485760,\n        \"reports_bytes\": 1048576,\n        \"conversations_bytes\": 524288,\n        \"total_bytes\": 64487424,\n        \"total_mb\": 61.5,\n        \"total_gb\": 0.06\n    },\n    \"resource_counts\": {\n        \"datasets\": 15,\n        \"visualizations\": 8,\n        \"reports\": 3\n    },\n    \"limits\": {\n        \"storage_bytes\": 10737418240,\n        \"storage_percent_used\": 0.6\n    }\n}","operationId":"get_workspace_usage_tenants__tenant_id__workspaces__workspace_id__usage_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/workspaces/{workspace_id}/pii-settings":{"get":{"tags":["Workspaces","workspaces"],"summary":"Get Pii Settings","description":"Get PII masking settings for the caller's tenant.\n\nReturns the merged defaults + stored overrides for query masking entity types.\nFile masking is always aggressive and not configurable.\n\nThe `workspace_id` path parameter is retained for API compatibility and\nownership enforcement, but PII settings are stored per-tenant (P0-15) so\nthey apply across every workspace the builder owns.","operationId":"get_pii_settings_api_v1_workspaces__workspace_id__pii_settings_get","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Workspaces","workspaces"],"summary":"Update Pii Settings","description":"Update PII masking settings for the caller's tenant (partial merge).\n\nExample body:\n  {\"query_masking\": {\"entity_types\": {\"LOCATION\": true}}}\n\nSettings are tenant-scoped (P0-15) — updates apply to every workspace and\nbuilt app the builder owns. The `workspace_id` path parameter is retained\nfor API compatibility and ownership enforcement.","operationId":"update_pii_settings_api_v1_workspaces__workspace_id__pii_settings_patch","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PiiSettingsUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/workspaces/{workspace_id}/pii-allowlist":{"get":{"tags":["Workspaces","workspaces"],"summary":"Get Pii Allowlist","description":"Get the PII allowlist for the caller's tenant.","operationId":"get_pii_allowlist_api_v1_workspaces__workspace_id__pii_allowlist_get","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Workspaces","workspaces"],"summary":"Add Pii Allowlist Term","description":"Add a term to the PII allowlist. Rejects ALWAYS_MASK entity types.","operationId":"add_pii_allowlist_term_api_v1_workspaces__workspace_id__pii_allowlist_post","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PiiAllowlistAddRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Workspaces","workspaces"],"summary":"Remove Pii Allowlist Term","description":"Remove a term from the PII allowlist.","operationId":"remove_pii_allowlist_term_api_v1_workspaces__workspace_id__pii_allowlist_delete","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PiiAllowlistRemoveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/visualizations":{"get":{"tags":["Visualizations","visualizations"],"summary":"List Tenant Visualizations","description":"List ALL visualizations across all workspaces for a tenant.\n\nThis endpoint aggregates all visualizations from all tenant workspaces\nand returns CloudFront URLs for efficient access. This is the primary\nendpoint for visualization gallery views.\n\nRequired scope: admin:read (tenant-wide access requires admin)\n\nReturns:\n    {\n        \"success\": True,\n        \"visualizations\": [\n            {\n                \"name\": \"chart_name\",\n                \"url\": \"https://sagecdn.flowstack.fun/...\",\n                \"workspace_id\": \"ws_123\",\n                \"tenant_id\": \"t_abc\",\n                \"size_bytes\": 12345,\n                \"last_modified\": \"2025-01-06T...\",\n                \"metadata\": {...}  # Optional enrichment\n            }\n        ],\n        \"total_count\": 42,\n        \"tenant_id\": \"t_abc\"\n    }","operationId":"list_tenant_visualizations_tenants__tenant_id__visualizations_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/workspaces/{workspace_id}/visualizations":{"get":{"tags":["Visualizations","visualizations"],"summary":"List Workspace Visualizations","description":"List visualizations for a specific workspace with CloudFront URLs.\n\nThis endpoint provides detailed visualization information for a single workspace,\nincluding CloudFront URLs for direct image access.\n\nRequired scope: workspace:read\n\nReturns:\n    {\n        \"success\": True,\n        \"visualizations\": [\n            {\n                \"name\": \"chart_name\",\n                \"url\": \"https://sagecdn.flowstack.fun/...\",\n                \"s3_key\": \"t_abc/ws_123/visualizations/chart.png\",\n                \"size_bytes\": 12345,\n                \"last_modified\": \"2025-01-06T...\",\n                \"metadata\": {...}\n            }\n        ],\n        \"total_count\": 5,\n        \"workspace_id\": \"ws_123\",\n        \"tenant_id\": \"t_abc\"\n    }","operationId":"list_workspace_visualizations_tenants__tenant_id__workspaces__workspace_id__visualizations_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/datasets":{"get":{"tags":["Visualizations","visualizations"],"summary":"List Tenant Datasets","description":"List ALL datasets across all workspaces for a tenant.\n\nThis endpoint aggregates all datasets from all tenant workspaces.\nUseful for tenant-wide dataset search and management.\n\nRequired scope: admin:read (tenant-wide access requires admin)\n\nReturns:\n    {\n        \"success\": True,\n        \"datasets\": [\n            {\n                \"name\": \"dataset_name\",\n                \"workspace_id\": \"ws_123\",\n                \"tenant_id\": \"t_abc\",\n                \"s3_key\": \"t_abc/ws_123/datasets/data.parquet\",\n                \"size_bytes\": 54321,\n                \"last_modified\": \"2025-01-06T...\",\n                \"metadata\": {...}\n            }\n        ],\n        \"total_count\": 12,\n        \"tenant_id\": \"t_abc\"\n    }","operationId":"list_tenant_datasets_tenants__tenant_id__datasets_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials":{"post":{"tags":["Provider Credentials","provider-credentials"],"summary":"Create Provider Credential","description":"Create a new LLM provider credential for the authenticated user.\n\nAllows users to bring their own API keys for Anthropic, OpenAI, or Google.\nUse purpose=\"code_interpreter\" for Claude code execution sandbox credentials.\n\nRequired scope: workspace:write","operationId":"create_provider_credential_api_v1_user_provider_credentials_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProviderCredentialRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderCredentialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"List Provider Credentials","description":"List all provider credentials for the authenticated user.\n\nQuery Parameters:\n    purpose (str, optional): Filter by purpose - \"llm\" or \"code_interpreter\".\n                            If not specified, returns all credentials.\n\nReturns credentials with masked API keys for security.\n\nRequired scope: workspace:read","operationId":"list_provider_credentials_api_v1_user_provider_credentials_get","parameters":[{"name":"purpose","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Purpose"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials/default":{"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"Get Default Provider Credential","description":"Get the default provider credential for the authenticated user.\n\nQuery Parameters:\n    decrypt (bool): If True, returns the decrypted API key.\n                   If False, returns a masked preview.\n                   Default is False for security.\n\nReturns the default credential with either:\n- Full decrypted API key (if decrypt=True) - for SDK/CLI usage\n- Masked API key preview (if decrypt=False) - for display purposes\n\nRequired scope: workspace:read","operationId":"get_default_provider_credential_api_v1_user_provider_credentials_default_get","parameters":[{"name":"decrypt","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Decrypt"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials/purposes":{"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"Get Supported Purposes","description":"Get information about all supported credential purposes.\n\nReturns metadata for UI display including:\n- Purpose name and description\n- Category (agent vs sandbox)\n- Allowed providers\n- Whether API key is required\n- Default models per provider\n\nRequired scope: workspace:read","operationId":"get_supported_purposes_api_v1_user_provider_credentials_purposes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/user/provider-credentials/components":{"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"Get All Component Credentials","description":"Get all component credentials for the authenticated user.\n\nReturns credentials for all supported purposes (llm, swarm, thinking,\ncode_interpreter, code_sandbox) in a single response.\n\nQuery Parameters:\n    decrypt (bool): If True, returns decrypted API keys.\n                   Default is False for security.\n\nUseful for:\n- Dashboard settings page to show all configured components\n- Agent initialization to load all credentials at once\n- Status overview of configured vs missing credentials\n\nRequired scope: workspace:read","operationId":"get_all_component_credentials_api_v1_user_provider_credentials_components_get","parameters":[{"name":"decrypt","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Decrypt"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials/purpose/{purpose}":{"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"Get Credential For Purpose","description":"Get the credential for a specific purpose.\n\nPath Parameters:\n    purpose (str): The purpose - one of: llm, swarm, thinking,\n                  code_interpreter, code_sandbox\n\nQuery Parameters:\n    decrypt (bool): If True, returns decrypted API key. Default is False.\n    fallback (bool): If True and no credential exists for purpose,\n                    falls back to 'llm' credential for agent purposes.\n                    Default is True.\n\nFallback behavior (when fallback=True):\n- swarm → falls back to llm\n- thinking → falls back to llm\n- code_interpreter, code_sandbox → no fallback (require explicit config)\n\nRequired scope: workspace:read","operationId":"get_credential_for_purpose_api_v1_user_provider_credentials_purpose__purpose__get","parameters":[{"name":"purpose","in":"path","required":true,"schema":{"type":"string","title":"Purpose"}},{"name":"decrypt","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Decrypt"}},{"name":"fallback","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Fallback"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Provider Credentials","provider-credentials"],"summary":"Create Credential For Purpose","description":"Create a credential for a specific purpose.\n\nPath Parameters:\n    purpose (str): The purpose - one of: llm, swarm, thinking,\n                  code_interpreter, code_sandbox\n\nProvider restrictions by purpose:\n- code_interpreter: Anthropic only\n- llm, swarm, thinking, code_sandbox: Any provider (anthropic, openai, gemini)\n\nRequired scope: workspace:write","operationId":"create_credential_for_purpose_api_v1_user_provider_credentials_purpose__purpose__post","parameters":[{"name":"purpose","in":"path","required":true,"schema":{"type":"string","title":"Purpose"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateComponentCredentialRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderCredentialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials/code-interpreter":{"post":{"tags":["Provider Credentials","provider-credentials"],"summary":"Create Code Interpreter Credential","description":"Create an Anthropic API key specifically for code interpreter.\n\nThis is a convenience endpoint that enforces:\n- provider=\"anthropic\" (code interpreter only works with Anthropic)\n- purpose=\"code_interpreter\"\n\nThe API key will be used when executing Python code via Claude's sandbox.\n\nRequired scope: workspace:write","operationId":"create_code_interpreter_credential_api_v1_user_provider_credentials_code_interpreter_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCodeInterpreterCredentialRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderCredentialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"Get Code Interpreter Credential","description":"Get the code interpreter credential for the authenticated user.\n\nReturns the Anthropic API key configured for code execution.\n\nQuery Parameters:\n    decrypt (bool): If True, returns the decrypted API key.\n                   If False, returns a masked preview.\n                   Default is False for security.\n\nRequired scope: workspace:read","operationId":"get_code_interpreter_credential_api_v1_user_provider_credentials_code_interpreter_get","parameters":[{"name":"decrypt","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Decrypt"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials/routing-preference":{"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"Get Routing Preference","description":"Get the tenant's local/cloud routing preference.","operationId":"get_routing_preference_api_v1_user_provider_credentials_routing_preference_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"tags":["Provider Credentials","provider-credentials"],"summary":"Set Routing Preference","description":"Set the tenant's local/cloud routing preference.","operationId":"set_routing_preference_api_v1_user_provider_credentials_routing_preference_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoutingPreferenceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials/{credential_id}":{"get":{"tags":["Provider Credentials","provider-credentials"],"summary":"Get Provider Credential","description":"Get a specific provider credential (with masked API key).\n\nRequired scope: workspace:read","operationId":"get_provider_credential_api_v1_user_provider_credentials__credential_id__get","parameters":[{"name":"credential_id","in":"path","required":true,"schema":{"type":"string","title":"Credential Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderCredentialResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Provider Credentials","provider-credentials"],"summary":"Update Provider Credential","description":"Update a provider credential.\n\nCan update API key, model ID, or default status.\n\nRequired scope: workspace:write","operationId":"update_provider_credential_api_v1_user_provider_credentials__credential_id__put","parameters":[{"name":"credential_id","in":"path","required":true,"schema":{"type":"string","title":"Credential Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProviderCredentialRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Provider Credentials","provider-credentials"],"summary":"Delete Provider Credential","description":"Delete a provider credential.\n\nRequired scope: workspace:write","operationId":"delete_provider_credential_api_v1_user_provider_credentials__credential_id__delete","parameters":[{"name":"credential_id","in":"path","required":true,"schema":{"type":"string","title":"Credential Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/provider-credentials/{credential_id}/set-default":{"post":{"tags":["Provider Credentials","provider-credentials"],"summary":"Set Default Provider Credential","description":"Set a credential as the default for the user.\n\nRequired scope: workspace:write","operationId":"set_default_provider_credential_api_v1_user_provider_credentials__credential_id__set_default_post","parameters":[{"name":"credential_id","in":"path","required":true,"schema":{"type":"string","title":"Credential Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data-sources/test-connection":{"post":{"tags":["Data Sources","data-sources"],"summary":"Test New Connection","description":"Test a data source connection WITHOUT saving it.\n\nUse this to validate credentials before creating a data source.\n\nRequired scope: workspace:read","operationId":"test_new_connection_data_sources_test_connection_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestNewConnectionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data-sources":{"post":{"tags":["Data Sources","data-sources"],"summary":"Create Data Source","description":"Create a new data source credential for the authenticated user/tenant.\n\nData sources are USER-SCOPED by default for security isolation.\nOnly users with 'admin:write' scope can create tenant-wide sources.\n\nRequired scope: workspace:write","operationId":"create_data_source_data_sources_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDataSourceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Data Sources","data-sources"],"summary":"List Data Sources","description":"List all data sources accessible to the authenticated user.\n\nReturns both tenant-wide and user-specific data sources.\nIf workspace_id is provided, only returns sources scoped to that workspace.\n\nRequired scope: workspace:read","operationId":"list_data_sources_data_sources_get","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data-sources/{source_id}":{"get":{"tags":["Data Sources","data-sources"],"summary":"Get Data Source","description":"Get a specific data source (with masked credentials).\n\nRequired scope: workspace:read","operationId":"get_data_source_data_sources__source_id__get","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Data Sources","data-sources"],"summary":"Update Data Source","description":"Update a data source.\n\nCan update name, credentials, auth_method, or metadata.\n\nRequired scope: workspace:write","operationId":"update_data_source_data_sources__source_id__put","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDataSourceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Data Sources","data-sources"],"summary":"Delete Data Source","description":"Delete a data source.\n\nRequired scope: workspace:write","operationId":"delete_data_source_data_sources__source_id__delete","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data-sources/{source_id}/test":{"post":{"tags":["Data Sources","data-sources"],"summary":"Test Data Source Connection","description":"Test connection to a data source.\n\nCan test an existing data source or provide temporary credentials to test.\n\nRequired scope: workspace:read","operationId":"test_data_source_connection_data_sources__source_id__test_post","parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/TestConnectionRequest"},{"type":"null"}],"title":"Test Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/api-keys":{"post":{"tags":["API Keys","api-keys"],"summary":"Create Tenant Api Key","description":"Create a new API key for a tenant. Tenant ownership is enforced below.","operationId":"create_tenant_api_key_tenants__tenant_id__api_keys_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["API Keys","api-keys"],"summary":"List Tenant Api Keys","description":"List all API keys for a tenant. Tenant ownership is enforced below.","operationId":"list_tenant_api_keys_tenants__tenant_id__api_keys_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ApiKeyResponse"},"title":"Response List Tenant Api Keys Tenants  Tenant Id  Api Keys Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/api-keys/{key_id}":{"delete":{"tags":["API Keys","api-keys"],"summary":"Revoke Tenant Api Key","description":"Revoke (deactivate) an API key. Tenant ownership is enforced below.","operationId":"revoke_tenant_api_key_tenants__tenant_id__api_keys__key_id__delete","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/api-keys/stats":{"get":{"tags":["API Keys","api-keys"],"summary":"Get Tenant Api Key Stats","description":"Get API key usage statistics for a tenant (requires admin scope)","operationId":"get_tenant_api_key_stats_tenants__tenant_id__api_keys_stats_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/observability/workspace/{workspace_id}":{"get":{"tags":["Observability","observability"],"summary":"Get Workspace Telemetry","description":"Get aggregated telemetry data for a workspace.\n\nReturns comprehensive usage metrics including:\n- Total queries executed\n- Tools usage statistics\n- Data processing metrics\n- Resource consumption\n- Error rates\n- Library usage\n\nRequired scope: analytics:read","operationId":"get_workspace_telemetry_observability_workspace__workspace_id__get","parameters":[{"name":"workspace_id","in":"path","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date (ISO8601)","title":"Start Date"},"description":"Start date (ISO8601)"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date (ISO8601)","title":"End Date"},"description":"End date (ISO8601)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/observability/session/{session_id}":{"get":{"tags":["Observability","observability"],"summary":"Get Session Telemetry","description":"Get telemetry data for a specific session.\n\nReturns detailed session metrics including:\n- Session duration\n- Query history\n- Tool executions\n- Resource usage\n- Data operations\n\nRequired scope: analytics:read","operationId":"get_session_telemetry_observability_session__session_id__get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/observability/billing-metrics":{"get":{"tags":["Observability","observability"],"summary":"Get Billing Metrics","description":"Get billing-relevant metrics for usage tracking.\n\nReturns metrics for billing calculations:\n- API calls count\n- Compute time (CPU time)\n- Memory usage\n- Data processed (GB)\n- Tool executions\n- Storage usage\n\nRequired scope: billing:read","operationId":"get_billing_metrics_observability_billing_metrics_get","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by workspace","title":"Workspace Id"},"description":"Filter by workspace"},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date (ISO8601)","title":"Start Date"},"description":"Start date (ISO8601)"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date (ISO8601)","title":"End Date"},"description":"End date (ISO8601)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/observability/tools-analytics":{"get":{"tags":["Observability","observability"],"summary":"Get Tools Analytics","description":"Get analytics on tool usage patterns.\n\nReturns:\n- Most used tools\n- Tool success rates\n- Average execution times\n- Common tool chains\n\nRequired scope: analytics:read","operationId":"get_tools_analytics_observability_tools_analytics_get","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/upload":{"post":{"tags":["Files","files"],"summary":"Upload File","description":"Upload a file and load it as a dataset.\n\nRequired scope: dataset:write\n\nSupports multiple file formats:\n- CSV, TSV, PSV (comma/tab/pipe separated)\n- Excel (xlsx, xls)\n- JSON, JSONL (JSON lines)\n- Parquet\n- AVRO\n- HDF5\n- Pickle (for serialized DataFrames)\n\nLarge files are streamed to S3 and processed asynchronously.","operationId":"upload_file_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_file_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/load-from-url":{"post":{"tags":["Files","files"],"summary":"Load Dataset From Url","description":"Load a dataset from a URL (S3, HTTP, etc.).\n\nRequired scope: dataset:write","operationId":"load_dataset_from_url_load_from_url_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_load_dataset_from_url_load_from_url_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/files/{session_id}":{"get":{"tags":["Files","files"],"summary":"List Session Files","description":"List all files in a session's local data directory.\n\nArgs:\n    session_id: Session identifier\n    workspace_id: Optional workspace ID\n    file_type: Optional filter by subdirectory type\n\nReturns:\n    Dictionary mapping file types to lists of file metadata","operationId":"list_session_files_data_files__session_id__get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},{"name":"file_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by type: datasets, visualizations, models, reports, uploads","title":"File Type"},"description":"Filter by type: datasets, visualizations, models, reports, uploads"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/download/{session_id}/{file_type}/{filename}":{"get":{"tags":["Files","files"],"summary":"Download File","description":"Download a specific file from the session's data directory.\n\nArgs:\n    session_id: Session identifier\n    file_type: Type of file (datasets, visualizations, models, reports, uploads)\n    filename: Name of the file\n    workspace_id: Optional workspace ID\n\nReturns:\n    File download response","operationId":"download_file_data_download__session_id___file_type___filename__get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"file_type","in":"path","required":true,"schema":{"type":"string","title":"File Type"}},{"name":"filename","in":"path","required":true,"schema":{"type":"string","title":"Filename"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/upload/{session_id}":{"post":{"tags":["Files","files"],"summary":"Upload File To Session","description":"Upload a file (CSV/Excel) to the session's data directory and load as dataset.\n\nArgs:\n    session_id: Session identifier\n    file: File to upload\n    workspace_id: Optional workspace ID\n    dataset_name: Optional name for the dataset (defaults to filename without extension)\n\nReturns:\n    Upload result with dataset info","operationId":"upload_file_to_session_data_upload__session_id__post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_file_to_session_data_upload__session_id__post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/cleanup/{session_id}":{"delete":{"tags":["Files","files"],"summary":"Cleanup Session Data","description":"Remove all local files for a session.\n\nArgs:\n    session_id: Session identifier\n    workspace_id: Optional workspace ID\n\nReturns:\n    Cleanup result","operationId":"cleanup_session_data_data_cleanup__session_id__delete","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/data/sync/{session_id}":{"post":{"tags":["Files","files"],"summary":"Sync Session To Local","description":"Sync all workspace data from S3 to local filesystem.\n\nArgs:\n    session_id: Session identifier\n    workspace_id: Optional workspace ID\n\nReturns:\n    Sync result","operationId":"sync_session_to_local_data_sync__session_id__post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/upload-document":{"post":{"tags":["Files","files"],"summary":"Upload Document","description":"Upload a document (PDF, DOCX, image) for agent ingestion and analysis.\n\nThe file is stored in the workspace uploads/ prefix where the\ningest_document tool can find it. The agent is notified so it can\nextract text, search content, and analyze the document.\n\nSupported formats: PDF, DOCX, DOC, PNG, JPG, JPEG, TIFF, BMP, TXT, MD, HTML\n\nRequired scope: dataset:write","operationId":"upload_document_upload_document_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_upload_document_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/documents":{"get":{"tags":["Files","files"],"summary":"List User Documents","description":"List all user-level documents (legal, health, tax, financial).\n\nReturns documents with presigned download URLs. These live at the user\nlevel, not scoped to any workspace — visible from anywhere.","operationId":"list_user_documents_api_v1_user_documents_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/user/artifacts":{"get":{"tags":["Files","files"],"summary":"List User Artifacts","description":"List ALL user artifacts across workspaces + user-level documents.\n\nReturns a unified view: HTML reports, markdown reports, visualizations,\nand user-level documents — everything the user has ever generated.","operationId":"list_user_artifacts_api_v1_user_artifacts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/admin/session":{"get":{"tags":["Admin","admin"],"summary":"Get Session Info","description":"Get session information","operationId":"get_session_info_admin_session_get","parameters":[{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/reset-context":{"post":{"tags":["Admin","admin"],"summary":"Reset Conversation Context","description":"Reset conversation context to prevent unbounded growth.\n\nThis endpoint clears all cached agents and sessions, forcing fresh agent creation\nwith clean conversation history. Useful for:\n- Starting fresh on new queries without residual context\n- Recovering from error states (e.g., rate limit errors from context explosion)\n- Testing with clean slate\n- Reducing costs by clearing large contexts\n\nNote: This is a global reset that affects all sessions. In production, this\nshould be scoped per session or tenant.","operationId":"reset_conversation_context_admin_reset_context_post","parameters":[{"name":"session_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/sessions/{session_id}/clear":{"delete":{"tags":["Admin","admin"],"summary":"Clear Session Conversation Endpoint","description":"Clear conversation history for a specific session while preserving datasets and models.\n\nThis endpoint clears only the conversation context (message history) for a specific session,\nallowing the user to start fresh without losing their data:\n- Datasets remain accessible\n- Models remain accessible\n- Visualizations remain accessible\n- Only conversation history is cleared\n\nUse cases:\n- Start a new conversation thread with clean context\n- Reduce token usage by clearing accumulated messages\n- Reset after hitting rate limits or context size errors\n- Clean slate for new analysis without losing data\n\nArgs:\n    session_id: Session ID to clear\n    req: FastAPI request object for tenant extraction\n\nReturns:\n    Status dict with result info","operationId":"clear_session_conversation_endpoint_admin_sessions__session_id__clear_delete","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/query":{"post":{"tags":["Admin","admin"],"summary":"Process Query","description":"Process a natural language query with tenant context","operationId":"process_query_admin_query_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/sage_agent__api__routes__admin__QueryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/visualize":{"post":{"tags":["Admin","admin"],"summary":"Create Visualization","description":"Create a visualization (endpoint for compatibility)\n\nRequired scope: visualization:create","operationId":"create_visualization_admin_visualize_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/admin/users":{"get":{"tags":["Admin","admin"],"summary":"Admin List Users","description":"List all users in the tenant. Requires admin role.\n\nSupports both API key (CLI) and JWT (dashboard) authentication.","operationId":"admin_list_users_admin_users_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantUsersListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users/{user_id}":{"get":{"tags":["Admin","admin"],"summary":"Admin Get User","description":"Get detailed information about a specific user. Requires admin role.\n\nSupports both API key (CLI) and JWT (dashboard) authentication.","operationId":"admin_get_user_admin_users__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantUserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/roles":{"get":{"tags":["Admin","admin"],"summary":"Admin List Roles","description":"List all roles in the tenant. Requires admin role.","operationId":"admin_list_roles_admin_roles_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantRolesListResponse"}}}}}}},"/admin/keys":{"get":{"tags":["Admin","admin"],"summary":"Admin List Keys","description":"List all API keys in the tenant. Requires admin role.","operationId":"admin_list_keys_admin_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantKeysListResponse"}}}}}}},"/admin/keys/{key_id}/revoke":{"post":{"tags":["Admin","admin"],"summary":"Admin Revoke Key","description":"Revoke an API key. Requires admin role.","operationId":"admin_revoke_key_admin_keys__key_id__revoke_post","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/requests":{"get":{"tags":["Admin","admin"],"summary":"Admin List Requests","description":"List API key requests (pending by default). Requires admin role.","operationId":"admin_list_requests_admin_requests_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantRequestsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/requests/{request_id}/approve":{"post":{"tags":["Admin","admin"],"summary":"Admin Approve Request","description":"Approve an API key request. Requires admin role.","operationId":"admin_approve_request_admin_requests__request_id__approve_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/requests/{request_id}/deny":{"post":{"tags":["Admin","admin"],"summary":"Admin Deny Request","description":"Deny an API key request. Requires admin role.","operationId":"admin_deny_request_admin_requests__request_id__deny_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/mongo-capacity":{"get":{"tags":["Admin","admin"],"summary":"Mongo Capacity","description":"P0-139 Phase 2c — MongoDB namespace + connection capacity snapshot.\n\nAdmin-only. Reports database count by family (the ``u_`` per-user count is the\nO(end-users) growth curve) and Atlas ``connections.current``/``available`` so the\nPhase 1 pool and the Problem-2 namespace pressure are observable. The default\nreport is metadata-cheap; ``include_collection_counts`` opts into a bounded sample.\nNever returns a connection string (Phase 5 invariant).","operationId":"mongo_capacity_admin_mongo_capacity_get","parameters":[{"name":"include_collection_counts","in":"query","required":false,"schema":{"type":"boolean","description":"Also sample per-DB collection/index counts (slower — bounded by max_dbs).","default":false,"title":"Include Collection Counts"},"description":"Also sample per-DB collection/index counts (slower — bounded by max_dbs)."},{"name":"max_dbs","in":"query","required":false,"schema":{"type":"integer","maximum":2000,"minimum":1,"description":"Cap DBs sampled for collection counts.","default":200,"title":"Max Dbs"},"description":"Cap DBs sampled for collection counts."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/subscriptions/grant":{"post":{"tags":["Admin","admin"],"summary":"Grant Subscription","description":"Grant a non-Stripe subscription for internal testing while the feature\nis dark (SUBSCRIPTIONS_ENABLED=false). The allowance ladder consumes from\nit exactly like a paid plan; row carries stripe_subscription_id='internal'.","operationId":"grant_subscription_admin_subscriptions_grant_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionGrantRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/provider-credentials/am-i-admin":{"get":{"tags":["Admin - Providers","admin-providers"],"summary":"Am I Tenant Admin","description":"Non-throwing variant: returns {is_admin: bool, user_id, tenant_id}.\nUsed by Casino's UI to decide whether to render admin-only sections.","operationId":"am_i_tenant_admin_admin_provider_credentials_am_i_admin_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/admin/provider-credentials":{"post":{"tags":["Admin - Providers","admin-providers"],"summary":"Create Admin Provider Credential","operationId":"create_admin_provider_credential_admin_provider_credentials_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAdminProviderCredentialRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminProviderCredentialOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Admin - Providers","admin-providers"],"summary":"List Admin Provider Credentials","operationId":"list_admin_provider_credentials_admin_provider_credentials_get","parameters":[{"name":"purpose","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Purpose"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminProviderCredentialOut"},"title":"Response List Admin Provider Credentials Admin Provider Credentials Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/provider-credentials/{credential_id}":{"delete":{"tags":["Admin - Providers","admin-providers"],"summary":"Delete Admin Provider Credential","operationId":"delete_admin_provider_credential_admin_provider_credentials__credential_id__delete","parameters":[{"name":"credential_id","in":"path","required":true,"schema":{"type":"string","title":"Credential Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/provider-credentials/live-model-map":{"get":{"tags":["Admin - Providers","admin-providers"],"summary":"Get Live Model Map","operationId":"get_live_model_map_admin_provider_credentials_live_model_map_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/LiveModelMapEntry"},"type":"array","title":"Response Get Live Model Map Admin Provider Credentials Live Model Map Get"}}}}}}},"/admin/provider-credentials/existing":{"get":{"tags":["Admin - Providers","admin-providers"],"summary":"List Existing Credentials","description":"List non-platform credentials owned by the caller's tenant — these are\ncandidates for the \"Promote to platform\" action.","operationId":"list_existing_credentials_admin_provider_credentials_existing_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ExistingCredentialOut"},"type":"array","title":"Response List Existing Credentials Admin Provider Credentials Existing Get"}}}}}}},"/admin/provider-credentials/promote":{"post":{"tags":["Admin - Providers","admin-providers"],"summary":"Promote Existing Credential","description":"Clone a credential already owned by this tenant into the tenant's\nplatform pool. Source row is preserved for audit.","operationId":"promote_existing_credential_admin_provider_credentials_promote_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteCredentialRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminProviderCredentialOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports":{"get":{"tags":["Reports"],"summary":"List Reports","description":"List all text reports in the session/workspace.\n\nReports are text-based files (markdown, txt, html, xml, json, csv) created\nby agents during analysis workflows - such as summaries, documentation,\nor structured outputs.\n\nArgs:\n    session_id: Session identifier (required)\n    workspace_id: Optional workspace identifier\n\nReturns:\n    List of reports with metadata and presigned URLs","operationId":"list_reports_reports_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}":{"get":{"tags":["Reports"],"summary":"Get Report","description":"Get a specific report with its content and metadata.\n\nArgs:\n    report_id: Report identifier\n    session_id: Session identifier (required)\n    workspace_id: Optional workspace identifier\n\nReturns:\n    Report content, metadata, and presigned URL","operationId":"get_report_reports__report_id__get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}},{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/reports/{report_id}/download":{"get":{"tags":["Reports"],"summary":"Download Report","description":"Download a report as a file with proper content-type.\n\nArgs:\n    report_id: Report identifier\n    session_id: Session identifier (required)\n    workspace_id: Optional workspace identifier\n\nReturns:\n    File response with appropriate content-type header","operationId":"download_report_reports__report_id__download_get","parameters":[{"name":"report_id","in":"path","required":true,"schema":{"type":"string","title":"Report Id"}},{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/usage":{"get":{"tags":["Billing","Billing"],"summary":"Get Usage","description":"Get usage metrics for a date range.\n\nReturns aggregated usage metrics for the specified period.\n\nArgs:\n    start_date: Start of period (YYYY-MM-DD)\n    end_date: End of period (YYYY-MM-DD)\n\nReturns:\n    Usage metrics including totals and daily breakdown","operationId":"get_usage_billing_usage_get","parameters":[{"name":"start_date","in":"query","required":true,"schema":{"type":"string","description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageRangeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/usage/today":{"get":{"tags":["Billing","Billing"],"summary":"Get Today Usage","description":"Get today's usage metrics.\n\nReturns usage metrics for the current day.","operationId":"get_today_usage_billing_usage_today_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DailyUsageResponse"}}}}}}},"/billing/usage/monthly":{"get":{"tags":["Billing","Billing"],"summary":"Get Monthly Usage","description":"Get monthly usage totals.\n\nReturns aggregated usage for the specified month.\n\nArgs:\n    year: Year (defaults to current year)\n    month: Month 1-12 (defaults to current month)\n\nReturns:\n    Aggregated monthly usage metrics","operationId":"get_monthly_usage_billing_usage_monthly_get","parameters":[{"name":"year","in":"query","required":false,"schema":{"type":"integer","description":"Year (defaults to current)","title":"Year"},"description":"Year (defaults to current)"},{"name":"month","in":"query","required":false,"schema":{"type":"integer","description":"Month 1-12 (defaults to current)","title":"Month"},"description":"Month 1-12 (defaults to current)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/usage/user":{"get":{"tags":["Billing","Billing"],"summary":"Get User Usage","description":"Get usage metrics for a specific user within the tenant.\n\nReturns aggregated usage for the specified user and date range.\nDefaults to current month if no dates provided.","operationId":"get_user_usage_billing_usage_user_get","parameters":[{"name":"user_id","in":"query","required":true,"schema":{"type":"string","description":"User ID to query","title":"User Id"},"description":"User ID to query"},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Start date (YYYY-MM-DD)","title":"Start Date"},"description":"Start date (YYYY-MM-DD)"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"End date (YYYY-MM-DD)","title":"End Date"},"description":"End date (YYYY-MM-DD)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/infer/balance":{"get":{"tags":["Billing","Billing"],"summary":"Get Infer Balance","description":"Get INFER token balance for the authenticated wallet user.","operationId":"get_infer_balance_billing_infer_balance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InferBalanceResponse"}}}}}}},"/billing/agent/balance":{"get":{"tags":["Billing","Billing"],"summary":"Get Agent Balance","description":"Get AGENT token balance for the authenticated wallet user.","operationId":"get_agent_balance_billing_agent_balance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentBalanceResponse"}}}}}}},"/billing/agent/sponsor-gas":{"post":{"tags":["Billing","Billing"],"summary":"Sponsor Agent Gas","description":"Top up a wallet-funded AGENT user with enough ETH to self-deposit (P0-146).\n\nIdempotent-ish by construction: a no-op (sponsored=False) when the wallet\nalready has gas or holds no AGENT, so the frontend can call it unconditionally\nbefore starting the approve+deposit flow.","operationId":"sponsor_agent_gas_billing_agent_sponsor_gas_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SponsorGasResponse"}}}}}}},"/billing/credits/status":{"get":{"tags":["Billing","Billing"],"summary":"Get Credit Status","description":"Get daily free credit status for the authenticated user.","operationId":"get_credit_status_billing_credits_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditStatusResponse"}}}}}}},"/billing/compute/auto-topup":{"get":{"tags":["Billing","Billing"],"summary":"Get Compute Auto Topup","operationId":"get_compute_auto_topup_billing_compute_auto_topup_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoTopupConfig"}}}}}},"put":{"tags":["Billing","Billing"],"summary":"Put Compute Auto Topup","operationId":"put_compute_auto_topup_billing_compute_auto_topup_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoTopupUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoTopupConfig"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/stripe/checkout":{"post":{"tags":["Billing","Billing"],"summary":"Create Checkout Session","description":"Create a Stripe Checkout session for purchasing credits.\n\nReturns a Stripe-hosted checkout URL. The user is redirected there\nto complete payment. On success, Stripe fires the webhook which\ncredits the user's balance.","operationId":"create_checkout_session_billing_stripe_checkout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/stripe/subscribe":{"post":{"tags":["Billing","Billing"],"summary":"Create Subscription Checkout","description":"Create a Stripe Checkout session for a monthly credit plan (P0-154).\n\nmode=\"subscription\" — distinct from the one-time pack checkout above.\n404 while SUBSCRIPTIONS_ENABLED is off (feature is dark; the flag gates\nacquisition only — webhooks/status keep working for granted test subs).","operationId":"create_subscription_checkout_billing_stripe_subscribe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscribeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscribeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/subscription/status":{"get":{"tags":["Billing","Billing"],"summary":"Get Subscription Status","description":"Subscription plan + allowance remaining. Works regardless of the\nSUBSCRIPTIONS_ENABLED flag (read-only; granted test subs need it).","operationId":"get_subscription_status_billing_subscription_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionStatusResponse"}}}}}}},"/billing/plans":{"get":{"tags":["Billing","Billing"],"summary":"Get Plans","description":"Subscription plan catalog. Always 200 — `enabled` is the frontend's\nsingle switch for showing/hiding all subscription surfaces.","operationId":"get_plans_billing_plans_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/billing/subscription/cancel":{"post":{"tags":["Billing","Billing"],"summary":"Cancel Subscription","description":"Cancel at period end (the allowance stays usable until then).\nAvailable whenever a subscription row exists — the ENABLED flag gates\nacquisition, not management.","operationId":"cancel_subscription_billing_subscription_cancel_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/billing/stripe/buy-agent":{"post":{"tags":["Billing","Billing"],"summary":"Create Agent Checkout","description":"Create a Stripe Checkout Session for an end-user to buy AGENT tokens via card.\n\nNo Casino user auth required — any visitor can buy AGENT and have it minted\nto their wallet on Arbitrum. On successful payment the webhook mints AGENT\nto the provided wallet address via the StripeBridge → AgentPaymentV3 path.\n\nDeep-link entry from built apps: the SDK <NeedsAgent> component sends\n?returnTo=...&need=N to OIF /buy, which calls this endpoint with the\nsuccess_url pointing back to the built app.","operationId":"create_agent_checkout_billing_stripe_buy_agent_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyAgentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BuyAgentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/stripe/webhook":{"post":{"tags":["Billing","Billing"],"summary":"Stripe Webhook","description":"Handle Stripe webhook events.\n\nExempt from TenantIsolationMiddleware (added to EXEMPT_PATHS in auth_middleware.py).\nVerifies the Stripe-Signature header to authenticate the webhook.\n\nOn checkout.session.completed: credits the user's purchased balance.\nIdempotent — checks credited flag before applying credits.","operationId":"stripe_webhook_billing_stripe_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/billing/credits/purchased":{"get":{"tags":["Billing","Billing"],"summary":"Get Purchased Credits","description":"Get purchased (Stripe) credit balance for the authenticated user.","operationId":"get_purchased_credits_billing_credits_purchased_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchasedCreditResponse"}}}}}}},"/billing/stripe/mint/health":{"get":{"tags":["Billing","Billing"],"summary":"Stripe Mint Health","description":"Health check for the Stripe → AGENT bridge.\n\nReturns every dependency needed for a successful mint: DynamoDB tables,\nsigner configuration, RPC reachability, and — critically — the backend\nminter wallet's gas balance. This exists because on 2026-04-05 the mint\nflow silently failed after a Stripe payment because the minter wallet had\n0 ETH for gas. That failure mode must be detectable before it costs the\nnext customer their purchase.\n\nUnauthenticated: ops can curl it without JWT juggling during incidents.\nReturns 200 even when unhealthy — the response body is the signal, not\nthe HTTP status, so monitors can alert on `healthy: false` without being\nfooled by retriable 5xx.","operationId":"stripe_mint_health_billing_stripe_mint_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/billing/stripe/mints":{"get":{"tags":["Billing","Billing"],"summary":"List Stripe Mints","description":"Return all Stripe → AGENT mint records for the authenticated user.\n\nUsed by the recovery UI in WalletSettingsContent to surface pending_wallet\nand failed mints so users can recover AGENT they paid for but didn't receive.\n\nPrefers the `user_id-created_at-index` GSI for efficient queries; falls\nback to a scan if the GSI doesn't exist yet (during migration windows).","operationId":"list_stripe_mints_billing_stripe_mints_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/MintRecord"},"type":"array","title":"Response List Stripe Mints Billing Stripe Mints Get"}}}}}}},"/billing/stripe/mint-retry":{"post":{"tags":["Billing","Billing"],"summary":"Retry Stripe Mint","description":"Trigger a retry for a specific Stripe session's AGENT mint.\n\nOnly allowed for the caller's own sessions in a retryable state\n(pending, pending_wallet, or failed).","operationId":"retry_stripe_mint_billing_stripe_mint_retry_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MintRetryRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MintRetryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/connect/onboard":{"post":{"tags":["Builder Payouts","Builder Payouts"],"summary":"Connect Onboard","description":"Create (or reuse) the builder's Express account and return an onboarding link.","operationId":"connect_onboard_billing_connect_onboard_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/connect/status":{"get":{"tags":["Builder Payouts","Builder Payouts"],"summary":"Connect Status","description":"Live Stripe account status; refreshes the cached flags.","operationId":"connect_status_billing_connect_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/billing/builder/earnings":{"get":{"tags":["Builder Payouts","Builder Payouts"],"summary":"Builder Earnings","description":"Builder earnings across both rails — P0-152 FR3.\n\nThe five original top-level fields (earned_cents, paid_cents,\navailable_cents, min_payout_cents, currency — Stripe-rail aggregate) are\npreserved verbatim for existing consumers. New alongside them:\n  rails.stripe   — accrued/pending/paid cents + cached Connect state\n  rails.agent    — accrued/pending/paid AGENT (wei strings + decimal\n                   strings; pending = escrowed shares awaiting a payout\n                   wallet, per FR1)\n  self_query     — owner-on-own-app charges, labeled non-earning (FR5)\n  apps[]         — per-app per-rail breakdown with the\n                   \"set payout wallet to release N AGENT\" action","operationId":"builder_earnings_billing_builder_earnings_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/billing/builder/payout":{"post":{"tags":["Builder Payouts","Builder Payouts"],"summary":"Builder Payout","description":"Withdraw the builder's available balance to their connected account.","operationId":"builder_payout_billing_builder_payout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/analytics/public/agents":{"get":{"tags":["Public Analytics","Public Analytics"],"summary":"Public Agents","description":"All deployed agents + network totals. No auth. Counts only.","operationId":"public_agents_analytics_public_agents_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/models":{"get":{"tags":["Models"],"summary":"List Models","description":"List ML models in session/workspace","operationId":"list_models_models_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/models/{model_name}":{"get":{"tags":["Models"],"summary":"Get Model","description":"Get model metadata and download URL","operationId":"get_model_models__model_name__get","parameters":[{"name":"model_name","in":"path","required":true,"schema":{"type":"string","title":"Model Name"}},{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/models/{model_name}/download":{"get":{"tags":["Models"],"summary":"Download Model","description":"Download model binary","operationId":"download_model_models__model_name__download_get","parameters":[{"name":"model_name","in":"path","required":true,"schema":{"type":"string","title":"Model Name"}},{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scripts":{"get":{"tags":["Scripts"],"summary":"List Scripts","description":"List all scripts in the workspace.\n\nReturns:\n    List of script names","operationId":"list_scripts_scripts_get","parameters":[{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"},"title":"Response List Scripts Scripts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scripts/detailed":{"get":{"tags":["Scripts"],"summary":"List Scripts Detailed","description":"List all scripts with detailed metadata.\n\nReturns:\n    Dict with scripts list and count","operationId":"list_scripts_detailed_scripts_detailed_get","parameters":[{"name":"session_id","in":"query","required":false,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Scripts Detailed Scripts Detailed Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scripts/{script_name}":{"get":{"tags":["Scripts"],"summary":"Get Script","description":"Get a specific script's content and metadata.\n\nArgs:\n    script_name: Name of the script (with or without extension)\n\nReturns:\n    Dict with script content and metadata","operationId":"get_script_scripts__script_name__get","parameters":[{"name":"script_name","in":"path","required":true,"schema":{"type":"string","title":"Script Name"}},{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Script Scripts  Script Name  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scripts/{script_name}/download":{"get":{"tags":["Scripts"],"summary":"Download Script","description":"Download a script file.\n\nArgs:\n    script_name: Name of the script\n\nReturns:\n    Script content as downloadable file","operationId":"download_script_scripts__script_name__download_get","parameters":[{"name":"script_name","in":"path","required":true,"schema":{"type":"string","title":"Script Name"}},{"name":"session_id","in":"query","required":true,"schema":{"type":"string","title":"Session Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/scripts":{"get":{"tags":["Scripts"],"summary":"List Tenant Scripts","description":"List scripts for a tenant, optionally filtered by workspace.\n\nArgs:\n    tenant_id: Tenant ID\n    workspace_id: Optional workspace ID filter\n\nReturns:\n    List of scripts with metadata","operationId":"list_tenant_scripts_tenants__tenant_id__scripts_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Tenant Scripts Tenants  Tenant Id  Scripts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google/start":{"get":{"tags":["Google OAuth","google-oauth"],"summary":"Start Oauth Flow","description":"Start Google OAuth 2.0 authorization flow.\n\nReturns an authorization URL that the user should open in their browser.\nAfter authorization, Google redirects to /auth/google/callback with a code.\n\nArgs:\n    scopes: Which Google services to request access to (comma-separated):\n        - \"analytics\" - Google Analytics\n        - \"ads\" - Google Ads\n        - \"drive\" - Google Drive\n        - \"youtube\" - YouTube Data & Analytics\n        - \"all\" - All services (default)\n        - e.g., \"analytics,drive\" for multiple services\n    redirect_uri: Frontend URL to redirect after OAuth completion\n\nReturns:\n    auth_url: URL to redirect user to for Google consent\n    state: CSRF token to verify callback","operationId":"start_oauth_flow_auth_google_start_get","parameters":[{"name":"scopes","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated services: analytics,ads,drive,youtube,all","title":"Scopes"},"description":"Comma-separated services: analytics,ads,drive,youtube,all"},{"name":"redirect_uri","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Frontend URL to redirect after OAuth","title":"Redirect Uri"},"description":"Frontend URL to redirect after OAuth"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStartResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google/status":{"get":{"tags":["Google OAuth","google-oauth"],"summary":"Get Oauth Status","description":"Get Google OAuth connection status for current user.\n\nReturns whether Google is connected and list of connected accounts.","operationId":"get_oauth_status_auth_google_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStatusResponse"}}}}}}},"/auth/google/revoke":{"post":{"tags":["Google OAuth","google-oauth"],"summary":"Revoke Oauth","description":"Revoke Google OAuth tokens and disconnect account.\n\nThis revokes tokens with Google and removes them from storage.\n\nArgs:\n    provider_user_id: Specific account to revoke (e.g., \"google:user@example.com\").\n                     If not specified, revokes the current user's Google account.","operationId":"revoke_oauth_auth_google_revoke_post","parameters":[{"name":"provider_user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Specific account to revoke (default: user's account)","title":"Provider User Id"},"description":"Specific account to revoke (default: user's account)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthRevokeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/google/test":{"get":{"tags":["Google OAuth","google-oauth"],"summary":"Test Oauth Connection","description":"Test if Google OAuth connection is working for the current user.\n\nAttempts to use the stored token to make a simple API call.\nUseful for verifying tokens are valid and not expired.","operationId":"test_oauth_connection_auth_google_test_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/health-data/ingest":{"post":{"tags":["Health Data"],"summary":"Ingest Health Data","description":"Store HealthKit data in S3 and optionally trigger analysis.\n\nThe iOS app calls this after reading HealthKit sleep data. The raw\npayload is written to S3 under the workspace's health/ prefix.\nIf ``trigger_analysis`` is True, the HealthAgent is invoked in a\nbackground task and the analysis_id is returned for polling.","operationId":"ingest_health_data_api_v1_health_data_ingest_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthIngestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthIngestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/health-data/analysis/{analysis_id}":{"get":{"tags":["Health Data"],"summary":"Get Analysis Result","description":"Poll the status/result of a triggered health analysis.","operationId":"get_analysis_result_api_v1_health_data_analysis__analysis_id__get","parameters":[{"name":"analysis_id","in":"path","required":true,"schema":{"type":"string","title":"Analysis Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthAnalysisResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/health-data/register-phone":{"post":{"tags":["Health Data"],"summary":"Register Phone","description":"Register the user's phone number for SMS health reports.","operationId":"register_phone_api_v1_health_data_register_phone_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneRegistrationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/health-data/test-mms":{"post":{"tags":["Health Data"],"summary":"Test Mms Delivery","description":"Test MMS delivery without running analysis.\n\nExercises the full Twilio path: Secrets Manager credential fetch,\nDynamoDB phone lookup (or phone_override), and Twilio API call.\nRequires JWT auth.","operationId":"test_mms_delivery_api_v1_health_data_test_mms_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestMmsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/health-data/follow-up":{"get":{"tags":["Health Data"],"summary":"Follow Up Query","description":"Handle follow-up query from a report chip link.\n\nVerifies HMAC signature (no JWT needed), runs the query through\nthe agent, generates a new report, and SMSes the link. Returns\na simple confirmation HTML page immediately.","operationId":"follow_up_query_api_v1_health_data_follow_up_get","parameters":[{"name":"workspace_id","in":"query","required":true,"schema":{"type":"string","title":"Workspace Id"}},{"name":"query","in":"query","required":true,"schema":{"type":"string","title":"Query"}},{"name":"sig","in":"query","required":true,"schema":{"type":"string","title":"Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/health-data/report-preview":{"get":{"tags":["Health Data"],"summary":"Preview Health Report","description":"Render a health report with real workspace artifacts for preview.","operationId":"preview_health_report_api_v1_health_data_report_preview_get","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"type":"string","default":"test-health-3","title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/s/{short_id}":{"get":{"tags":["Short URLs"],"summary":"Short Url Redirect","description":"Redirect a short URL to its stored presigned S3 URL.","operationId":"short_url_redirect_s__short_id__get","parameters":[{"name":"short_id","in":"path","required":true,"schema":{"type":"string","title":"Short Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/digest/generate":{"post":{"tags":["Digest"],"summary":"Generate Digest Endpoint","description":"Trigger a personal intelligence digest.\n\nFetches from all connected sources, synthesizes via the agent,\ngenerates an HTML report, and optionally SMSes the link.\nRuns in background — returns immediately with a confirmation.","operationId":"generate_digest_endpoint_api_v1_digest_generate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DigestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/digest/sources":{"get":{"tags":["Digest"],"summary":"List Digest Sources","description":"List all connected digest sources for the current user.","operationId":"list_digest_sources_api_v1_digest_sources_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/digest/interests":{"get":{"tags":["Digest"],"summary":"Get Interests","description":"Get the user's current interest profile.","operationId":"get_interests_api_v1_digest_interests_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Digest"],"summary":"Update Interests","description":"Set the user's interest topics for feed selection.","operationId":"update_interests_api_v1_digest_interests_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateInterestsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/digest/feed-catalog":{"get":{"tags":["Digest"],"summary":"Get Feed Catalog","description":"List the full feed catalog with categories.","operationId":"get_feed_catalog_api_v1_digest_feed_catalog_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/digest/rss-feeds":{"get":{"tags":["Digest"],"summary":"List Rss Feeds","description":"List the user's configured RSS feeds.","operationId":"list_rss_feeds_api_v1_digest_rss_feeds_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Digest"],"summary":"Add Rss Feed","description":"Add an RSS feed to the user's digest sources.","operationId":"add_rss_feed_api_v1_digest_rss_feeds_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddRSSFeedRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/digest/rss-feeds/{feed_id}":{"delete":{"tags":["Digest"],"summary":"Remove Rss Feed","description":"Remove an RSS feed.","operationId":"remove_rss_feed_api_v1_digest_rss_feeds__feed_id__delete","parameters":[{"name":"feed_id","in":"path","required":true,"schema":{"type":"string","title":"Feed Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites":{"get":{"tags":["Sites"],"summary":"List Sites","description":"List all published sites for the current user.\n\nB3: a single human routinely has several user_ids (Privy-wallet `u_…`, legacy\n`user_…`) under one verified email. Sites stay keyed under whichever identity\npublished them, so the current session can own zero. We discover the caller's\nsibling identities (same email+tenant) and union their sites so \"My Sites\"\nshows everything the account owns — independent of the active login shard.","operationId":"list_sites_api_v1_sites_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Sites"],"summary":"Create Site","description":"Create and publish a new site.\n\nIf `files` is provided, publishes immediately (inline mode).\nIf `files` is omitted, creates a staging area — use PUT /files/{path}\nto add files, then POST /{site_id}/publish to deploy.","operationId":"create_site_api_v1_sites_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSiteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}":{"delete":{"tags":["Sites"],"summary":"Delete Site","description":"Delete a published site by ID.","operationId":"delete_site_api_v1_sites__site_id__delete","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Sites"],"summary":"Get Site","description":"Get metadata for a single published site.","operationId":"get_site_api_v1_sites__site_id__get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Sites"],"summary":"Rename Site Endpoint","description":"Rename a site (display name in manifest + DynamoDB metadata).","operationId":"rename_site_endpoint_api_v1_sites__site_id__patch","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameSiteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/files/{file_path}":{"put":{"tags":["Sites"],"summary":"Stage Site File","description":"Add or update a single file in the site staging area.\n\nCall this for each file, then POST /api/v1/sites/{site_id}/publish to deploy.","operationId":"stage_site_file_api_v1_sites__site_id__files__file_path__put","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"file_path","in":"path","required":true,"schema":{"type":"string","title":"File Path"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StagedFileRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/publish":{"post":{"tags":["Sites"],"summary":"Publish Staged Site Endpoint","description":"Publish a staged site to CDN.\n\nReads all files from the staging area and publishes to CloudFront.\nThe staging area is cleaned up after publish.","operationId":"publish_staged_site_endpoint_api_v1_sites__site_id__publish_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/migrate-legacy":{"post":{"tags":["Sites"],"summary":"Migrate Legacy Sites","description":"Migrate legacy sites to versioned path structure.\n\nLegacy sites (published before versioned hosting) only have files at\n{tenant}/{user}/sites/{site_id}/. CloudFront subdomain routing expects\nfiles at sites/{site_id}/live/. This endpoint copies files to the new\npath and creates a version manifest (meta.json) for each legacy site.","operationId":"migrate_legacy_sites_api_v1_sites_migrate_legacy_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/sites/daily/generate":{"post":{"tags":["Sites"],"summary":"Generate Daily Site","description":"Trigger daily brief generation in the background.\n\nCreates a new daily personal website from all workspace artifacts,\ndigest sources, and health data.","operationId":"generate_daily_site_api_v1_sites_daily_generate_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/sites/daily/latest":{"get":{"tags":["Sites"],"summary":"Get Latest Daily Site","description":"Get the most recent daily site URL.","operationId":"get_latest_daily_site_api_v1_sites_daily_latest_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/sites/{site_id}/versions":{"get":{"tags":["Sites"],"summary":"Get Site Versions","description":"Get version history for a site.","operationId":"get_site_versions_api_v1_sites__site_id__versions_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/promote":{"post":{"tags":["Sites"],"summary":"Promote Version","description":"Promote a specific version to live.","operationId":"promote_version_api_v1_sites__site_id__promote_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteVersionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/versions/{version}":{"delete":{"tags":["Sites"],"summary":"Delete Version","description":"Delete a specific version (cannot delete the live version).","operationId":"delete_version_api_v1_sites__site_id__versions__version__delete","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"version","in":"path","required":true,"schema":{"type":"integer","title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/alias":{"post":{"tags":["Sites"],"summary":"Set Alias","description":"Set a friendly alias for a site (e.g., my-crm → my-crm.casino.flowstack.fun).","operationId":"set_alias_api_v1_sites__site_id__alias_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetAliasRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Sites"],"summary":"Remove Alias","description":"Remove the friendly alias for a site.","operationId":"remove_alias_api_v1_sites__site_id__alias_delete","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/source":{"get":{"tags":["Sites"],"summary":"Get Site Source","description":"Get a version's source files as {path: content} (live version by default).","operationId":"get_site_source_api_v1_sites__site_id__source_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"version","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/staged":{"post":{"tags":["Sites"],"summary":"Stage Site Files","description":"Stage multiple files in one call (batch form of the single-file PUT).","operationId":"stage_site_files_api_v1_sites__site_id__staged_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StageFilesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Sites"],"summary":"List Staged Files","description":"List currently staged files for a site.","operationId":"list_staged_files_api_v1_sites__site_id__staged_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Sites"],"summary":"Clear Staged Files","description":"Clear all staged files for a site (the .staging marker is preserved).","operationId":"clear_staged_files_api_v1_sites__site_id__staged_delete","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/data-plan":{"get":{"tags":["Sites"],"summary":"Get Site Data Plan","description":"Get the saved mongoCollections schema for a site.","operationId":"get_site_data_plan_api_v1_sites__site_id__data_plan_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Sites"],"summary":"Set Site Data Plan","description":"Merge collection schemas into the site's data plan (PUT-with-merge, mirrors MCP).","operationId":"set_site_data_plan_api_v1_sites__site_id__data_plan_put","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataPlanRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/seo":{"get":{"tags":["Sites"],"summary":"Get Site Seo","description":"Get the builder SEO config for a site (P0-176; mirrors casino_get_seo).","operationId":"get_site_seo_api_v1_sites__site_id__seo_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Sites"],"summary":"Set Site Seo","description":"Merge builder SEO metadata into the site's seo block (P0-176; mirrors casino_set_seo).","operationId":"set_site_seo_api_v1_sites__site_id__seo_put","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeoRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/agents":{"get":{"tags":["Sites"],"summary":"List Site Agents","description":"List the app's registered agent personas ([] when none yet).","operationId":"list_site_agents_api_v1_sites__site_id__agents_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Sites"],"summary":"Create Site Agent","description":"Create-or-replace an agent persona (upsert, mirrors casino_create_agent).","operationId":"create_site_agent_api_v1_sites__site_id__agents_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSiteAgentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/agents/{agent_name}":{"patch":{"tags":["Sites"],"summary":"Update Site Agent","description":"Patch only the provided fields of an existing agent persona (404 if missing).","operationId":"update_site_agent_api_v1_sites__site_id__agents__agent_name__patch","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"agent_name","in":"path","required":true,"schema":{"type":"string","title":"Agent Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSiteAgentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/import-library":{"post":{"tags":["Sites"],"summary":"Import Library Item","description":"Copy one of the caller's library items into the site's upload area.","operationId":"import_library_item_api_v1_sites__site_id__import_library_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportLibraryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/upload-source":{"post":{"tags":["Sites"],"summary":"Upload Source","description":"Upload source files for verification and deployment.\n\nRuns submitted source through the verification pipeline (static checks +\nDaytona build). If the build passes, publishes as a draft version.\nThe developer can then call POST /api/v1/sites/{site_id}/promote to go live.","operationId":"upload_source_api_v1_sites__site_id__upload_source_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceUploadRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/sites/{site_id}/publish-github":{"post":{"tags":["Sites"],"summary":"Publish To Github","description":"Push site source code to a GitHub repository.","operationId":"publish_to_github_api_v1_sites__site_id__publish_github_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublishGitHubRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/reddit/start":{"get":{"tags":["Social OAuth"],"summary":"Reddit Start","description":"Start Reddit OAuth flow.","operationId":"reddit_start_auth_reddit_start_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/reddit/callback":{"get":{"tags":["Social OAuth"],"summary":"Reddit Callback","description":"Handle Reddit OAuth callback.","operationId":"reddit_callback_auth_reddit_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/reddit/status":{"get":{"tags":["Social OAuth"],"summary":"Reddit Status","description":"Check Reddit connection status.\n\nReddit killed self-service API app creation. Data is fetched via\npublic JSON endpoints — no OAuth needed. Return configured=False\nso the mobile app doesn't show a Connect button.","operationId":"reddit_status_auth_reddit_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/strava/start":{"get":{"tags":["Social OAuth"],"summary":"Strava Start","description":"Start Strava OAuth flow.","operationId":"strava_start_auth_strava_start_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/strava/callback":{"get":{"tags":["Social OAuth"],"summary":"Strava Callback","description":"Handle Strava OAuth callback.","operationId":"strava_callback_auth_strava_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/strava/status":{"get":{"tags":["Social OAuth"],"summary":"Strava Status","description":"Check Strava connection status.","operationId":"strava_status_auth_strava_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/twitter/start":{"get":{"tags":["Social OAuth"],"summary":"Twitter Start","description":"Start X/Twitter OAuth 2.0 flow with PKCE.","operationId":"twitter_start_auth_twitter_start_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/twitter/callback":{"get":{"tags":["Social OAuth"],"summary":"Twitter Callback","description":"Handle X/Twitter OAuth callback.","operationId":"twitter_callback_auth_twitter_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/twitter/status":{"get":{"tags":["Social OAuth"],"summary":"Twitter Status","description":"Check X/Twitter connection status.","operationId":"twitter_status_auth_twitter_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/webhooks/twilio/inbound":{"post":{"tags":["Webhooks"],"summary":"Twilio Inbound Sms","description":"Handle inbound SMS from Twilio.\n\nFlow:\n1. Validate Twilio request signature\n2. Extract From phone number and Body text\n3. Look up workspace by phone number\n4. Return 204 immediately (Twilio expects fast response)\n5. Run swarm query in background, send reply via SMS","operationId":"twilio_inbound_sms_webhooks_twilio_inbound_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/privy-verify":{"post":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Privy Verify","description":"Verify a Privy auth token and issue a Casino JWT.\n\nFlow:\n1. SDK sends Privy auth token after user signs up with email/Google\n2. We verify the token with Privy's API\n3. Extract the embedded wallet address\n4. Create/lookup user in shared tenant\n5. Return JWT with wallet_address claim","operationId":"privy_verify_auth_privy_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivyVerifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletAuthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/privy-refresh":{"post":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Privy Refresh","description":"P0-137 1B/1C — re-mint a `wallet_pending` session with the canonical wallet.\n\n`/auth/privy-verify` mints a `wallet_pending` JWT when the ERC-4337 smart\nwallet hasn't provisioned yet. The frontend calls this once the wallet\nappears (no 2s retry needed here — the caller already knows it exists). On\nresolution we:\n  * mint a fresh JWT carrying the smart `wallet_address` (clearing pending),\n  * persist the wallet mapping + award the deferred signup bonus once, and\n  * link the prior `u_{did}` identity to the wallet identity (1C unify).\n\nStill no wallet? Re-issue a `wallet_pending` JWT so the client can retry.","operationId":"privy_refresh_auth_privy_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivyRefreshRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletAuthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/wallet/nonce":{"get":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Get Siwe Nonce","description":"Generate a random nonce for SIWE message construction.\n\nThe nonce must be included in the SIWE message and verified on submission.\nNonces expire after 5 minutes.","operationId":"get_siwe_nonce_auth_wallet_nonce_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NonceResponse"}}}}}}},"/auth/wallet/verify":{"post":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Siwe Verify","description":"Verify a SIWE (EIP-4361) signed message and issue a Casino JWT.\n\nFlow:\n1. User signs SIWE message with MetaMask/WalletConnect\n2. SDK sends message + signature here\n3. We verify the signature and extract wallet address\n4. Create/lookup user in shared tenant\n5. Return JWT with wallet_address claim","operationId":"siwe_verify_auth_wallet_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SIWEVerifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletAuthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/wallet/link":{"post":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Link Wallet","description":"Link a wallet to an existing Google OAuth user account.\n\nUnlike /auth/wallet/verify (creates a new user), this endpoint:\n1. Requires an existing Bearer token (user already authenticated via Google)\n2. Verifies the SIWE signature to prove wallet ownership\n3. Issues a new JWT preserving existing user_id/tenant_id/email + wallet_address\n4. Stores wallet_address on the user record in DynamoDB","operationId":"link_wallet_auth_wallet_link_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WalletLinkRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/guest":{"post":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Issue Guest Token","description":"Mint a short-lived guest JWT for a site that has opted into guest chat.\n\nPublic (in EXEMPT_PATHS). Returns 403 unless the site's app_config sets\n``allowGuestChat: true``. The token is app-scoped to the site and carries a\nsynthetic ``guest_…`` user_id so the visitor is isolated to that site.","operationId":"issue_guest_token_auth_guest_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuestTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/email/otp/request":{"post":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Email Otp Request","description":"Send a per-site-branded 6-digit login code to ``email`` (P0-182).\n\nPublic (in EXEMPT_PATHS). Enumeration-safe: always returns ``{sent: true}``\nfor a well-formed request regardless of whether the address has an account.\nOnly a tripped request throttle surfaces (429).","operationId":"email_otp_request_auth_email_otp_request_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpRequestBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/email/otp/verify":{"post":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Email Otp Verify","description":"Verify a login code → issue a wallet_pending session JWT (P0-182 Tranche A).\n\nOn a valid code we run the P0-178 email-first ``adopt_or_link`` primitive so\nthe OTP login lands on the person's canonical account (or anchors a new one),\nthen mint the same ``wallet_pending`` session the walletless Privy path issues\ntoday. Privy custom-auth (the wallet leg) is Tranche B — not wired here.","operationId":"email_otp_verify_auth_email_otp_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpVerifyBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/oauth/{provider}/start":{"get":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Oauth Broker Start","description":"Per-site OAuth broker start (Tranche B scaffolding). 404 while disabled.","operationId":"oauth_broker_start_auth_oauth__provider__start_get","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/oauth/{provider}/callback":{"get":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Oauth Broker Callback","description":"Per-site OAuth broker callback (Tranche B scaffolding). 404 while disabled.","operationId":"oauth_broker_callback_auth_oauth__provider__callback_get","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/.well-known/jwks.json":{"get":{"tags":["Wallet Auth","Wallet Auth"],"summary":"Privy Custom Auth Jwks","description":"Public JWKS for Privy custom auth (P0-182). 404 while the feature is dark —\nwe don't advertise a signing key Privy could pin before the spike proves it.","operationId":"privy_custom_auth_jwks__well_known_jwks_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/collections/query":{"get":{"tags":["Collections"],"summary":"Query Collection","description":"Query a MongoDB collection directly. Used by the SDK's useCollection hook.\n\nRequires app_scope in JWT — only built-app users can access this endpoint.\nCollection name is auto-prefixed with app_scope (e.g. \"transactions\" -> \"site_abc__transactions\").\nDatabase is derived from user_id hash (u_{sha256(user_id)[:16]}).","operationId":"query_collection_collections_query_get","parameters":[{"name":"collection","in":"query","required":true,"schema":{"type":"string","description":"Collection name (auto-prefixed with app_scope)","title":"Collection"},"description":"Collection name (auto-prefixed with app_scope)"},{"name":"filter","in":"query","required":false,"schema":{"type":"string","description":"MongoDB query as JSON string","default":"{}","title":"Filter"},"description":"MongoDB query as JSON string"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"sort","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Sort spec as JSON, e.g. {\"date\": -1}","title":"Sort"},"description":"Sort spec as JSON, e.g. {\"date\": -1}"},{"name":"projection","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Field selection as JSON","title":"Projection"},"description":"Field selection as JSON"},{"name":"layer","in":"query","required":false,"schema":{"type":"string","description":"Data layer: auto, user, shared (P0-27), or room (P0-180)","default":"auto","title":"Layer"},"description":"Data layer: auto, user, shared (P0-27), or room (P0-180)"},{"name":"room_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Room id — required when layer=room (P0-180)","title":"Room Id"},"description":"Room id — required when layer=room (P0-180)"},{"name":"include_provenance","in":"query","required":false,"schema":{"type":"boolean","description":"Include _flowstack metadata in results","default":false,"title":"Include Provenance"},"description":"Include _flowstack metadata in results"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/collections/insert":{"post":{"tags":["Collections"],"summary":"Insert Documents","description":"Insert one or more documents into a MongoDB collection.\n\nProvide either `document` (single) or `documents` (batch, max 100).\nCollection name is auto-prefixed with app_scope.","operationId":"insert_documents_collections_insert_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsertRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/collections/update":{"post":{"tags":["Collections"],"summary":"Update Documents","description":"Update documents in a MongoDB collection matching the filter.\n\nThe `update` field must use MongoDB update operators ($set, $push, $pull, $inc, $unset).\nCollection name is auto-prefixed with app_scope.","operationId":"update_documents_collections_update_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/collections/delete":{"post":{"tags":["Collections"],"summary":"Delete Documents","description":"Delete documents from a MongoDB collection matching the filter.\n\nFilter must not be empty (prevents accidental collection wipe).\nCollection name is auto-prefixed with app_scope.","operationId":"delete_documents_collections_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/rooms":{"get":{"tags":["Rooms"],"summary":"My Rooms","operationId":"my_rooms_rooms_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["Rooms"],"summary":"Create Room","operationId":"create_room_rooms_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRoomRequest","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/rooms/{room_id}/members":{"post":{"tags":["Rooms"],"summary":"Add Member","operationId":"add_member_rooms__room_id__members_post","parameters":[{"name":"room_id","in":"path","required":true,"schema":{"type":"string","title":"Room Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddMemberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/rooms/{room_id}/invites":{"post":{"tags":["Rooms"],"summary":"Invite Member","description":"Pre-authorize an email to join. Caller must already be a member. The invite\ngrants NO access until the invited user signs in and claims it.","operationId":"invite_member_rooms__room_id__invites_post","parameters":[{"name":"room_id","in":"path","required":true,"schema":{"type":"string","title":"Room Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/rooms/claim":{"post":{"tags":["Rooms"],"summary":"Claim Invites","description":"Claim every pending invite addressed to the caller's VERIFIED JWT email,\nconverting each into a real membership. The invite (scoped to the exact email)\nis the authorization — no prior membership required. Returns the rooms joined.","operationId":"claim_invites_rooms_claim_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/rooms/{room_id}/notify":{"post":{"tags":["Rooms"],"summary":"Notify Members","description":"Email every OTHER member of the room the app-composed notification. Sends\nonly to members whose verified login email is on file — no client-supplied\nrecipient, so a member can only ever notify their own room's co-members.","operationId":"notify_members_rooms__room_id__notify_post","parameters":[{"name":"room_id","in":"path","required":true,"schema":{"type":"string","title":"Room Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotifyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/rooms/{room_id}/members/{member_user_id}":{"delete":{"tags":["Rooms"],"summary":"Remove Member","operationId":"remove_member_rooms__room_id__members__member_user_id__delete","parameters":[{"name":"room_id","in":"path","required":true,"schema":{"type":"string","title":"Room Id"}},{"name":"member_user_id","in":"path","required":true,"schema":{"type":"string","title":"Member User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tool/invoke":{"post":{"tags":["Tool Invoke"],"summary":"Invoke Tool","description":"Invoke an agent tool directly, bypassing LLM orchestration.\n\nThis endpoint resolves the named agent from the cached swarm, looks up\nthe requested tool in its tool_registry, validates it against the\nwhitelist, builds invocation_state for proper tenant/workspace context,\nand executes the tool synchronously.\n\nReturns a JSON response (not SSE) with the tool output.\n\nArgs:\n    request: ToolInvokeRequest with agent_name, tool_name, kwargs\n    raw_request: Raw FastAPI request for accessing request.state\n    tenant_context: Tenant isolation context (injected via Depends)\n\nReturns:\n    JSON: {\"status\": \"success\", \"result\": <tool_output>}\n\nErrors:\n    401 — missing auth\n    403 — tool not whitelisted\n    404 — agent or tool not found\n    500 — tool execution failure","operationId":"invoke_tool_tool_invoke_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolInvokeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github/status":{"get":{"tags":["GitHub"],"summary":"Github Status","description":"Check if user has a valid GitHub connection.","operationId":"github_status_auth_github_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/github/start":{"get":{"tags":["GitHub"],"summary":"Github Start","description":"Start GitHub OAuth flow — returns auth_url for popup.","operationId":"github_start_auth_github_start_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/github/callback":{"get":{"tags":["GitHub"],"summary":"Github Callback","description":"Handle GitHub OAuth callback — exchanges code for token.","operationId":"github_callback_auth_github_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/github/disconnect":{"post":{"tags":["GitHub"],"summary":"Github Disconnect","description":"Disconnect GitHub — removes stored token.","operationId":"github_disconnect_auth_github_disconnect_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/github/repos":{"get":{"tags":["GitHub"],"summary":"List Repos","description":"List user's GitHub repositories.","operationId":"list_repos_api_v1_github_repos_get","parameters":[{"name":"q","in":"query","required":false,"schema":{"type":"string","default":"","title":"Q"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Page"}},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Per Page"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/github/import":{"post":{"tags":["GitHub"],"summary":"Import Repo","description":"Import files from a GitHub repo into workspace scripts folder.","operationId":"import_repo_api_v1_github_import_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GitHubImportRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/github/webhook":{"post":{"tags":["GitHub"],"summary":"Github Webhook","description":"Handle GitHub push events — auto-build and publish as draft version.\n\nTriggered when a developer pushes to a Casino-linked GitHub repo.\nVerifies the HMAC signature, fetches the pushed source, runs the\nverification pipeline (static checks + Daytona build), and publishes\nas a draft version. Reports build status back via GitHub commit status API.","operationId":"github_webhook_api_v1_github_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/user/data-overview":{"get":{"tags":["User Data","User Data"],"summary":"Get Data Overview","description":"Unified summary of all user-owned data: workspaces + sites + MongoDB.","operationId":"get_data_overview_api_v1_user_data_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/user/collections":{"get":{"tags":["User Data","User Data"],"summary":"List User Collections","description":"List all MongoDB collections the user owns across all sites.","operationId":"list_user_collections_api_v1_user_collections_get","parameters":[{"name":"site_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by site ID","title":"Site Id"},"description":"Filter by site ID"},{"name":"include_schema","in":"query","required":false,"schema":{"type":"boolean","description":"Include schema inference (slower)","default":false,"title":"Include Schema"},"description":"Include schema inference (slower)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/collections/{collection}/documents":{"get":{"tags":["User Data","User Data"],"summary":"Get Collection Documents","description":"Query documents in a specific collection with pagination.","operationId":"get_collection_documents_api_v1_user_collections__collection__documents_get","parameters":[{"name":"collection","in":"path","required":true,"schema":{"type":"string","title":"Collection"}},{"name":"filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"MongoDB filter as JSON string","title":"Filter"},"description":"MongoDB filter as JSON string"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"sort","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Sort spec as JSON string","title":"Sort"},"description":"Sort spec as JSON string"},{"name":"projection","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Projection as JSON string","title":"Projection"},"description":"Projection as JSON string"},{"name":"database","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Database name (user or builder)","title":"Database"},"description":"Database name (user or builder)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/collections/{collection}/schema":{"get":{"tags":["User Data","User Data"],"summary":"Get Collection Schema","description":"Infer schema from sampled documents in a collection.","operationId":"get_collection_schema_api_v1_user_collections__collection__schema_get","parameters":[{"name":"collection","in":"path","required":true,"schema":{"type":"string","title":"Collection"}},{"name":"sample_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":10,"title":"Sample Size"}},{"name":"database","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Database"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/collections/{collection}":{"delete":{"tags":["User Data","User Data"],"summary":"Delete User Collection","description":"Delete a collection from the user's database. Requires ?confirm=true.","operationId":"delete_user_collection_api_v1_user_collections__collection__delete","parameters":[{"name":"collection","in":"path","required":true,"schema":{"type":"string","title":"Collection"}},{"name":"confirm","in":"query","required":false,"schema":{"type":"boolean","description":"Must be true to delete","default":false,"title":"Confirm"},"description":"Must be true to delete"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/user/collections/{collection}/export":{"post":{"tags":["User Data","User Data"],"summary":"Export User Collection","description":"Export a collection as JSON or CSV.","operationId":"export_user_collection_api_v1_user_collections__collection__export_post","parameters":[{"name":"collection","in":"path","required":true,"schema":{"type":"string","title":"Collection"}},{"name":"database","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Database"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/datasets":{"get":{"tags":["Library"],"summary":"List Library Datasets","operationId":"list_library_datasets_library_datasets_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/datasets/{name}":{"get":{"tags":["Library"],"summary":"Get Library Dataset","operationId":"get_library_dataset_library_datasets__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Delete Library Dataset","operationId":"delete_library_dataset_library_datasets__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"hard","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hard"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/visualizations":{"get":{"tags":["Library"],"summary":"List Library Visualizations","operationId":"list_library_visualizations_library_visualizations_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/visualizations/{name}":{"get":{"tags":["Library"],"summary":"Get Library Visualization","operationId":"get_library_visualization_library_visualizations__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Delete Library Visualization","operationId":"delete_library_visualization_library_visualizations__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"hard","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hard"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/code":{"get":{"tags":["Library"],"summary":"List Library Code","operationId":"list_library_code_library_code_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/code/{name}":{"get":{"tags":["Library"],"summary":"Get Library Code","operationId":"get_library_code_library_code__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Delete Library Code","operationId":"delete_library_code_library_code__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"hard","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hard"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/documents":{"get":{"tags":["Library"],"summary":"List Library Documents","operationId":"list_library_documents_library_documents_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/documents/{name}":{"get":{"tags":["Library"],"summary":"Get Library Document","operationId":"get_library_document_library_documents__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Delete Library Document","operationId":"delete_library_document_library_documents__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"hard","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hard"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/reports":{"get":{"tags":["Library"],"summary":"List Library Reports","operationId":"list_library_reports_library_reports_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/reports/{name}":{"get":{"tags":["Library"],"summary":"Get Library Report","operationId":"get_library_report_library_reports__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Delete Library Report","operationId":"delete_library_report_library_reports__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"hard","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hard"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/models":{"get":{"tags":["Library"],"summary":"List Library Models","operationId":"list_library_models_library_models_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/models/{name}":{"get":{"tags":["Library"],"summary":"Get Library Model","operationId":"get_library_model_library_models__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Delete Library Model","operationId":"delete_library_model_library_models__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"hard","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hard"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/conversations/recent":{"get":{"tags":["Library"],"summary":"List Recent Conversations","description":"Top-of-library Resume section payload. Returns the N most recent\nconversations for the caller sorted by last_activity_at DESC.","operationId":"list_recent_conversations_library_conversations_recent_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":20,"minimum":1,"default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/conversations":{"get":{"tags":["Library"],"summary":"List Conversations","description":"Paginated list of conversations — powers the Conversations tab.\nWhen `starred=true`, filters to starred-only via the GSI filter expression.\n`search` does in-memory substring match on title + first_message_preview\n(small result sets, so no DynamoDB FilterExpression round-trip needed).","operationId":"list_conversations_library_conversations_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"cursor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cursor"}},{"name":"starred","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Starred"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/conversations/{conversation_id}":{"get":{"tags":["Library"],"summary":"Get Conversation","description":"Full metadata for a single conversation. 404 if absent or owned by\nanother user (cross-user reads are blocked at the WM layer).","operationId":"get_conversation_library_conversations__conversation_id__get","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Delete Conversation","description":"Delete the lightweight metadata row. The underlying S3 session history\nis unaffected — session_store.py owns that lifecycle. Phase 6 may make\nthis a soft-delete with restore; Phase 4 ships hard-delete.","operationId":"delete_conversation_library_conversations__conversation_id__delete","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/conversations/{conversation_id}/star":{"post":{"tags":["Library"],"summary":"Star Conversation","description":"Mark a conversation as starred. Body may include `{title}` to set the\ndisplay name at the same time.","operationId":"star_conversation_library_conversations__conversation_id__star_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Unstar Conversation","description":"Remove the starred flag. Does not delete the conversation row.","operationId":"unstar_conversation_library_conversations__conversation_id__star_delete","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/trash":{"get":{"tags":["Library"],"summary":"List Trash","description":"List all trashed library items for the caller across every type.\nSorted by `trashed_at` DESC (most-recently-deleted first).","operationId":"list_trash_library_trash_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Library"],"summary":"Empty Trash","description":"Hard-delete every trashed item for the caller. Used by \"Empty Trash\".","operationId":"empty_trash_library_trash_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/library/trash/{item_type}/{name}/restore":{"post":{"tags":["Library"],"summary":"Restore Trashed Item","description":"Unmark a trashed item so it returns to normal listings.","operationId":"restore_trashed_item_library_trash__item_type___name__restore_post","parameters":[{"name":"item_type","in":"path","required":true,"schema":{"type":"string","title":"Item Type"}},{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/trash/{item_type}/{name}":{"delete":{"tags":["Library"],"summary":"Hard Delete Trashed Item","description":"Immediately hard-delete a single trashed item (DynamoDB row + S3 object).","operationId":"hard_delete_trashed_item_library_trash__item_type___name__delete","parameters":[{"name":"item_type","in":"path","required":true,"schema":{"type":"string","title":"Item Type"}},{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/search":{"get":{"tags":["Library"],"summary":"Search Library","description":"Cross-type search across the caller's library.\n\nFans out to per-type queries in parallel (via asyncio.gather), each\napplying a case-insensitive substring filter on `name`. Results are\nmerged and ranked by:\n  1. name match score (prefix > substring, shorter-name bias for ties)\n  2. recency — newer `updated_at` wins within the same score bucket.\n\nTrashed items are excluded (the per-type query already filters them).\n\nThis is a thin aggregator, not a new data store — scales fine up to\n~6-10 types at Casino-user volumes. Replace with a dedicated search\nindex if we need full-text over artifact content (BRD §11.4 v2).","operationId":"search_library_library_search_get","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":200,"title":"Q"}},{"name":"types","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated list of types to search. Default: all six standard artifact types.","title":"Types"},"description":"Comma-separated list of types to search. Default: all six standard artifact types."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/agents/upload":{"post":{"tags":["Agents"],"summary":"Upload Agent","description":"Upload a markdown agent definition to the user library.","operationId":"upload_agent_library_agents_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_agent_library_agents_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/agents":{"get":{"tags":["Agents"],"summary":"List Agents","description":"List all agent definitions visible to this user.\n\nAggregates two sources:\n1. Library-uploaded .md agents (source=user) — stored at\n   {tenant}/{user}/library/agents/ so they are already user-scoped.\n2. Agents created via MCP casino_create_agent stored in\n   app_configs/{tenant}/{site_id}.json. That prefix is tenant-wide, so\n   we must intersect with the user's owned site_ids (list_published_sites\n   is keyed on workspace_id=user_{user_id}) — otherwise every user in\n   the tenant sees every other user's agents.","operationId":"list_agents_library_agents_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/agents/{name}":{"get":{"tags":["Agents"],"summary":"Get Agent","description":"Get a specific agent definition by name.\n\nChecks library first (uploaded .md), then falls back to MCP app-config agents.","operationId":"get_agent_library_agents__name__get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Agents"],"summary":"Delete Agent","description":"Delete a user-defined agent from the library.","operationId":"delete_agent_library_agents__name__delete","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/agents/{name}/runs":{"get":{"tags":["Agents"],"summary":"List Agent Runs","description":"List runs for a specific agent.","operationId":"list_agent_runs_library_agents__name__runs_get","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/library/agents/{name}/invoke":{"post":{"tags":["Agents"],"summary":"Invoke Agent","description":"Run a subagent to completion via HTTP and stream progress over SSE.\n\nReplaces the pattern where the only way to run a subagent was to ask the\nLLM to call `spawn_subagent(...)`. Lets the Casino Agents tab's \"Run\"\nbutton invoke a user-defined agent directly with a prompt.\n\nStreaming events (when stream=true):\n    * subagent:start     — {\"agent\": name, \"run_id\": ...}\n    * progress           — {\"data\": \"...\"}  (from runner.py)\n    * subagent:complete  — {\"agent\": name, \"run_id\": ..., \"response\": ..., \"run_path\": ..., \"stats\": {...}}\n\nNon-streaming (stream=false) returns the final run record as JSON.\nRuns charge against the caller's credit gate through the usual middleware\nchain; the agent's `max_cost_usd` caps the per-run spend.","operationId":"invoke_agent_library_agents__name__invoke_post","parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","title":"Name"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubagentInvokeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/registry":{"get":{"tags":["Agents"],"summary":"List Agent Registry","description":"List the tenant's registered agents (capability-routing catalog, P0-130).","operationId":"list_agent_registry_agents_registry_get","parameters":[{"name":"include_disabled","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Disabled"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/route":{"post":{"tags":["Agents"],"summary":"Route Agent","description":"Rank the tenant's agents for a task and return candidates best-first (P0-130).","operationId":"route_agent_agents_route_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RouteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/agents/spend":{"get":{"tags":["Agents"],"summary":"Agent Spend","description":"Per-agent spend aggregation for the tenant's society (P0-130 Phase 4).","operationId":"agent_spend_agents_spend_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/integrations":{"post":{"tags":["Integrations","integrations"],"summary":"Create Integration","description":"Register a new HTTP API integration.","operationId":"create_integration_integrations_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateIntegrationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Integrations","integrations"],"summary":"List Integrations","description":"List integrations accessible to the authenticated user.","operationId":"list_integrations_integrations_get","parameters":[{"name":"workspace_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/integrations/{integration_id}":{"get":{"tags":["Integrations","integrations"],"summary":"Get Integration","description":"Get a single integration by ID.","operationId":"get_integration_integrations__integration_id__get","parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Integrations","integrations"],"summary":"Update Integration","description":"Update an integration.","operationId":"update_integration_integrations__integration_id__put","parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateIntegrationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Integrations","integrations"],"summary":"Delete Integration","description":"Delete an integration.","operationId":"delete_integration_integrations__integration_id__delete","parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations":{"get":{"tags":["Automations","automations"],"summary":"List Automations","operationId":"list_automations_automations_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/AutomationOut"},"type":"array","title":"Response List Automations Automations Get"}}}}}},"post":{"tags":["Automations","automations"],"summary":"Create Automation","operationId":"create_automation_automations_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAutomationRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/{automation_id}":{"get":{"tags":["Automations","automations"],"summary":"Get Automation","operationId":"get_automation_automations__automation_id__get","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Automations","automations"],"summary":"Update Automation","operationId":"update_automation_automations__automation_id__put","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAutomationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Automations","automations"],"summary":"Delete Automation","operationId":"delete_automation_automations__automation_id__delete","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/{automation_id}/pause":{"post":{"tags":["Automations","automations"],"summary":"Pause Automation","operationId":"pause_automation_automations__automation_id__pause_post","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/{automation_id}/resume":{"post":{"tags":["Automations","automations"],"summary":"Resume Automation","operationId":"resume_automation_automations__automation_id__resume_post","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/{automation_id}/run":{"post":{"tags":["Automations","automations"],"summary":"Run Automation Now","description":"Invoke the executor Lambda synchronously for this automation. Returns\nthe run record (status: success | failed | timeout).","operationId":"run_automation_now_automations__automation_id__run_post","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/preflight":{"post":{"tags":["Automations","automations"],"summary":"Preflight Automation","description":"P0-183 BR-4 — pre-dispatch Google credential health check.\n\nCalled by the executor Lambda before it invokes /stream. Returns\n``{ok, status, emailed}``; the Lambda skips the run (and the owner has\nalready been emailed) when ``ok`` is False. Fails OPEN on any internal\nerror so a probe issue never silences the automation fleet.","operationId":"preflight_automation_automations_preflight_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreflightRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/{automation_id}/runs":{"get":{"tags":["Automations","automations"],"summary":"List Automation Runs","operationId":"list_automation_runs_automations__automation_id__runs_get","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AutomationRunOut"},"title":"Response List Automation Runs Automations  Automation Id  Runs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/{automation_id}/runs/{run_id}":{"get":{"tags":["Automations","automations"],"summary":"Get Automation Run","operationId":"get_automation_run_automations__automation_id__runs__run_id__get","parameters":[{"name":"automation_id","in":"path","required":true,"schema":{"type":"string","title":"Automation Id"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRunOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/automations/_meta/limits":{"get":{"tags":["Automations","automations"],"summary":"Get Automation Limits","operationId":"get_automation_limits_automations__meta_limits_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/user/model-preference":{"get":{"tags":["User Preferences","user-preferences"],"summary":"Get Model Preference","operationId":"get_model_preference_user_model_preference_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelPreferenceResponse"}}}}}},"put":{"tags":["User Preferences","user-preferences"],"summary":"Set Model Preference","operationId":"set_model_preference_user_model_preference_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetModelPreferenceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModelPreferenceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/user/model-preference/options":{"get":{"tags":["User Preferences","user-preferences"],"summary":"List Model Preference Options","description":"Platform credentials available to this user in their tenant's pool.","operationId":"list_model_preference_options_user_model_preference_options_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ModelOption"},"type":"array","title":"Response List Model Preference Options User Model Preference Options Get"}}}}}}},"/capabilities":{"get":{"tags":["Capabilities"],"summary":"Get Capabilities","description":"Return the live meta-tool catalog for the calling user.","operationId":"get_capabilities_capabilities_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/session/current":{"get":{"tags":["Sessions"],"summary":"Get Current Session","description":"Return the user's current active session row, or 404 if none.","operationId":"get_current_session_session_current_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/session/{session_id}/lock-status":{"get":{"tags":["Sessions"],"summary":"Get Lock Status","description":"Point-in-time view used before claim: is the lock available, held by\na different device, or held by me already?","operationId":"get_lock_status_session__session_id__lock_status_get","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/session/claim":{"post":{"tags":["Sessions"],"summary":"Claim Session","description":"Attempt to claim (or refresh) the lock for this device.\n\n* force=false: succeeds if no lock exists OR caller already holds it;\n  otherwise returns 409 with the current holder.\n* force=true: unconditional overwrite. The UI must confirm before calling.","operationId":"claim_session_session_claim_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ClaimBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/session/release":{"post":{"tags":["Sessions"],"summary":"Release Session","description":"Relinquish the lock. The session_id stays as the user's most-recent\nbut device_id/lock_token are cleared so the next device can claim freely.","operationId":"release_session_session_release_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/session/{session_id}/activity":{"put":{"tags":["Sessions"],"summary":"Heartbeat","description":"Refresh the TTL and last_activity_at. Returns 409 if the caller's\nlock_token doesn't match the server's current token (i.e., another\ndevice took over — the caller should stop talking).","operationId":"heartbeat_session__session_id__activity_put","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/collections/{collection}/insert":{"post":{"tags":["Public Collections","Public Collections"],"summary":"Public Insert","description":"Insert a document into a public collection.\n\nNo user JWT required.  The collection must be declared in the app's\npublicCollections config.  Rate-limited per IP.","operationId":"public_insert_public_collections__collection__insert_post","parameters":[{"name":"collection","in":"path","required":true,"schema":{"type":"string","title":"Collection"}},{"name":"x-app-scope","in":"header","required":true,"schema":{"type":"string","description":"Built-app site_id (required)","title":"X-App-Scope"},"description":"Built-app site_id (required)"},{"name":"x-tenant-id","in":"header","required":true,"schema":{"type":"string","description":"Casino tenant ID (required)","title":"X-Tenant-Id"},"description":"Casino tenant ID (required)"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicInsertRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/collections/{collection}/documents":{"get":{"tags":["Public Collections","Public Collections"],"summary":"Public Query","description":"Query documents from a public collection.\n\nNo auth required.  submitter_ip_hash is stripped from all responses.\nResults are sorted by submission time (newest first) by default.","operationId":"public_query_public_collections__collection__documents_get","parameters":[{"name":"collection","in":"path","required":true,"schema":{"type":"string","title":"Collection"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":25,"title":"Limit"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"sort_field","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sort Field"}},{"name":"sort_dir","in":"query","required":false,"schema":{"type":"integer","description":"1=asc, -1=desc","default":-1,"title":"Sort Dir"},"description":"1=asc, -1=desc"},{"name":"filter_json","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"JSON filter object","title":"Filter Json"},"description":"JSON filter object"},{"name":"x-app-scope","in":"header","required":true,"schema":{"type":"string","description":"Built-app site_id (required)","title":"X-App-Scope"},"description":"Built-app site_id (required)"},{"name":"x-tenant-id","in":"header","required":true,"schema":{"type":"string","description":"Casino tenant ID (required)","title":"X-Tenant-Id"},"description":"Casino tenant ID (required)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/checkout":{"post":{"tags":["App Billing","App Billing"],"summary":"Create App Checkout","description":"Create a Stripe Checkout session for an end-user to unlock paid app access.\n\nThe calling party is the end-user (via the built app).  We use their\nauthenticated user_id and the target site_id to build the session.\nWe look up the app_config to get the price and the builder_user_id.","operationId":"create_app_checkout_billing_app_access_checkout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppCheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppCheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/subscribe":{"post":{"tags":["App Billing","App Billing"],"summary":"Create App Subscription Checkout","description":"Create a Stripe Checkout session (mode=subscription) for an end-user to\nsubscribe to a builder's monthly plan (P0-162 SPEC §5.1).\n\nDestination charge: the payment lands on the builder's Connect account\n(transfer_data.destination) with the platform's cut taken as\napplication_fee_percent — unlike unlocks, no later Transfer is needed.","operationId":"create_app_subscription_checkout_billing_app_access_subscribe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppSubscribeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppSubscribeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/subscription/cancel":{"post":{"tags":["App Billing","App Billing"],"summary":"Cancel App Subscription","description":"Cancel at period end (P0-162 SPEC §5.3) — standard SaaS behavior;\naccess continues until current_period_end. Immediate cancel is not offered.","operationId":"cancel_app_subscription_billing_app_access_subscription_cancel_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppSubscriptionCancelRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/status":{"get":{"tags":["App Billing","App Billing"],"summary":"Get App Access Status","description":"Returns whether the authenticated end-user has access to a built app,\nand their free query usage if they are on the free tier.","operationId":"get_app_access_status_billing_app_access_status_get","parameters":[{"name":"site_id","in":"query","required":true,"schema":{"type":"string","description":"Site ID of the built app","title":"Site Id"},"description":"Site ID of the built app"},{"name":"builder_tenant_id","in":"query","required":false,"schema":{"type":"string","description":"Builder's tenant ID (needed to load app config)","title":"Builder Tenant Id"},"description":"Builder's tenant ID (needed to load app config)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppAccessStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/monetization/{site_id}":{"get":{"tags":["App Billing","App Billing"],"summary":"Get Site Monetization","description":"Return the current monetization block for one of the caller's apps.","operationId":"get_site_monetization_billing_app_access_monetization__site_id__get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonetizationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["App Billing","App Billing"],"summary":"Set Site Monetization Config","description":"Enable/update monetization for one of the caller's apps.\n\nBody is a partial monetization block (deep-merged) — e.g.\n{\"enabled\": true, \"payment_mode\": \"both\",\n \"stripe\": {\"unlock_price_cents\": 999, \"unlock_price_label\": \"$9.99 lifetime\"},\n \"agent\": {\"cost_per_query\": 2, \"builder_wallet\": \"0x...\"}}.","operationId":"set_site_monetization_config_billing_app_access_monetization__site_id__post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonetizationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/credits":{"get":{"tags":["App Billing","App Billing"],"summary":"Get App Credits","description":"Balance + free-remaining + purchasable packs for the calling end-user.\n\nRead-only: reports free_remaining from config vs the ledger's free_used but\nnever stamps the row (the free grant is consumed atomically at charge time,\nnot on a status read — a browsing user must not burn free events).","operationId":"get_app_credits_billing_app_access_credits_get","parameters":[{"name":"site_id","in":"query","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppCreditsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/credits/checkout":{"post":{"tags":["App Billing","App Billing"],"summary":"Create Credits Checkout","description":"Stripe Checkout (mode=payment) to buy a credit pack. Destination charge —\nthe pack revenue lands on the builder's Connect account with the platform\nfee taken as application_fee (same rails as /subscribe). The webhook grants\nthe credits (idempotent on session.id); nothing is granted here.","operationId":"create_credits_checkout_billing_app_access_credits_checkout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsCheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditsCheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/app-access/connection/charge":{"post":{"tags":["App Billing","App Billing"],"summary":"Charge Connection Route","description":"Server-authoritative billable moment (P0-175 §4): debit the initiator and\nmint the paid stamp the DM/reveal path is gated on. The ONLY way to get a\nstamp for a pair. Idempotent on pair_key; 402 insufficient_credit when the\nbalance is empty (the app opens its buy-credits sheet).","operationId":"charge_connection_route_billing_app_access_connection_charge_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionChargeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionChargeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/apps/{site_id}/domains":{"post":{"tags":["Custom Domains"],"summary":"Connect Domain","description":"Start connecting a custom domain to a Casino-built app.\n\nValidates the domain, requests an ACM cert (DNS validation), stores the\npending record, and returns the two DNS entries the builder must add at\ntheir registrar:\n1. The ACM CNAME validation record (proves they own the domain)\n2. The CloudFront routing CNAME (points traffic at Casino's CDN)","operationId":"connect_domain_api_v1_apps__site_id__domains_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectDomainRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Custom Domains"],"summary":"List Domains","description":"List all custom domains connected to a site.","operationId":"list_domains_api_v1_apps__site_id__domains_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/apps/{site_id}/domains/{domain}/status":{"get":{"tags":["Custom Domains"],"summary":"Domain Status","description":"Poll the status of a custom domain connection.\n\nStatus values:\n- validating: ACM cert pending DNS validation\n- issued: cert issued, builder still needs to add the routing CNAME\n- activating: activate_domain called, CloudFront update in progress\n- live: domain is serving traffic\n- failed: cert validation or CloudFront update failed","operationId":"domain_status_api_v1_apps__site_id__domains__domain__status_get","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/apps/{site_id}/domains/{domain}/activate":{"post":{"tags":["Custom Domains"],"summary":"Activate Domain","description":"Activate a custom domain once its ACM cert has been issued.\n\nAdds the domain as a CloudFront alternate name (with the issued cert),\nwrites the domain→site_id KVS entry so the CF function can route it,\nand marks the domain as live.\n\nCloudFront distribution updates take ~5-15 minutes to propagate globally.","operationId":"activate_domain_api_v1_apps__site_id__domains__domain__activate_post","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/apps/{site_id}/domains/{domain}":{"delete":{"tags":["Custom Domains"],"summary":"Disconnect Domain","description":"Disconnect and remove a custom domain from a Casino-built app.\n\nRemoves the domain from CloudFront, deletes the KVS entry,\ndeletes the ACM cert, and removes the DynamoDB record.","operationId":"disconnect_domain_api_v1_apps__site_id__domains__domain__delete","parameters":[{"name":"site_id","in":"path","required":true,"schema":{"type":"string","title":"Site Id"}},{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/registrar/check":{"get":{"tags":["Registrar"],"summary":"Check Availability","description":"Check availability and pricing for a domain name across multiple TLDs.\n\nReturns {results: [{domain, available, price_usd, aws_cost_usd}], degraded}.\n``degraded: true`` means every lookup failed (P0-163 — surfaced loudly by\nthe panel instead of silent \"—\" rows).","operationId":"check_availability_api_v1_registrar_check_get","parameters":[{"name":"name","in":"query","required":true,"schema":{"type":"string","description":"Domain name without TLD","title":"Name"},"description":"Domain name without TLD"},{"name":"tlds","in":"query","required":false,"schema":{"type":"string","description":"Comma-separated TLD list","default":"com,xyz,io,ai,fun","title":"Tlds"},"description":"Comma-separated TLD list"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/registrar/prices":{"get":{"tags":["Registrar"],"summary":"Get Prices","description":"Return Casino retail prices for a list of TLDs.","operationId":"get_prices_api_v1_registrar_prices_get","parameters":[{"name":"tlds","in":"query","required":true,"schema":{"type":"string","description":"Comma-separated TLD list","title":"Tlds"},"description":"Comma-separated TLD list"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/registrar/purchase":{"post":{"tags":["Registrar"],"summary":"Purchase Domain","description":"Register a domain via Route 53 on behalf of the builder.\n\nCreates the Stripe Checkout Session; the actual Route 53 registration\nfires from the Stripe webhook (billing.py) when payment succeeds.","operationId":"purchase_domain_api_v1_registrar_purchase_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseDomainRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/registrar/my-domains":{"get":{"tags":["Registrar"],"summary":"List My Domains","description":"List all domains registered through Casino by the current user.","operationId":"list_my_domains_api_v1_registrar_my_domains_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/registrar/{domain}/toggle-renewal":{"post":{"tags":["Registrar"],"summary":"Toggle Renewal","description":"Enable or disable auto-renewal for a Casino-registered domain.","operationId":"toggle_renewal_api_v1_registrar__domain__toggle_renewal_post","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToggleRenewalRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/registrar/{domain}/transfer-out":{"post":{"tags":["Registrar"],"summary":"Transfer Out","description":"Initiate a transfer-out: retrieve the auth code the builder needs\nto transfer the domain to another registrar.\n\nNote: ICANN 60-day transfer lock applies after initial registration.","operationId":"transfer_out_api_v1_registrar__domain__transfer_out_post","parameters":[{"name":"domain","in":"path","required":true,"schema":{"type":"string","title":"Domain"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/identity/orphaned-data":{"get":{"tags":["Identity","Identity"],"summary":"Get Orphaned Data","description":"Discover user_ids with data that belongs to this account but is invisible in the\ncurrent session. Returns counts only — no actual data is ever exposed.\n\nSafe to call on every My Data page load. The response informs whether to show\nthe identity merge banner.","operationId":"get_orphaned_data_auth_identity_orphaned_data_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/identity/link":{"post":{"tags":["Identity","Identity"],"summary":"Link Identity","description":"Link a historical user_id to the current session's canonical_user_id.\n\nProof requirements:\n- Privy wallet user_ids (u_{hash}): valid Privy access token for the wallet\n  that derives to auth_method_user_id via keccak256[:12].\n- Legacy IDs (user_*, email-format): API key whose created_by_user_id matches\n  the claimed auth_method_user_id and whose tenant_id matches the session.\n\nRate-limited to 3 attempts/minute per IP (rate_limiter.py).\nEvery attempt — success or failure — is audit-logged at WARN/INFO level.","operationId":"link_identity_auth_identity_link_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/identity/links":{"get":{"tags":["Identity","Identity"],"summary":"List My Links","description":"List all identity links for the current user's canonical identity.","operationId":"list_my_links_auth_identity_links_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/identity/links/{auth_method_user_id}":{"delete":{"tags":["Identity","Identity"],"summary":"Unlink Identity","description":"Remove a previously linked identity from the current canonical user.","operationId":"unlink_identity_auth_identity_links__auth_method_user_id__delete","parameters":[{"name":"auth_method_user_id","in":"path","required":true,"schema":{"type":"string","title":"Auth Method User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/apps/{app_scope}/threads/{pair_key}/consent":{"post":{"tags":["App Messaging","App Messaging"],"summary":"Open Thread","description":"Record the caller's consent for a thread. Flips status→open when both consent.\n\n``pair_key`` identifies the counterpart: it is ``sorted(caller, other)`` joined by\n``::``. The caller must be one of its two members; the counterpart is derived from\nthe other half. We re-derive the pair_key server-side from (caller, other) so a\nforged pair_key cannot consent on someone else's behalf.","operationId":"open_thread_apps__app_scope__threads__pair_key__consent_post","parameters":[{"name":"app_scope","in":"path","required":true,"schema":{"type":"string","title":"App Scope"}},{"name":"pair_key","in":"path","required":true,"schema":{"type":"string","title":"Pair Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/apps/{app_scope}/messages":{"post":{"tags":["App Messaging","App Messaging"],"summary":"Send Message","description":"Send a message. 403 unless the (caller, to_user_key) thread is open.","operationId":"send_message_apps__app_scope__messages_post","parameters":[{"name":"app_scope","in":"path","required":true,"schema":{"type":"string","title":"App Scope"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessageBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["App Messaging","App Messaging"],"summary":"Get Messages","description":"Return messages in the caller's thread with ``with``. ACL'd to caller.","operationId":"get_messages_apps__app_scope__messages_get","parameters":[{"name":"app_scope","in":"path","required":true,"schema":{"type":"string","title":"App Scope"}},{"name":"with","in":"query","required":true,"schema":{"type":"string","title":"With"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Before"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/apps/{app_scope}/threads":{"get":{"tags":["App Messaging","App Messaging"],"summary":"Get Threads","description":"List the caller's threads (counterpart key, last message, unread count).","operationId":"get_threads_apps__app_scope__threads_get","parameters":[{"name":"app_scope","in":"path","required":true,"schema":{"type":"string","title":"App Scope"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/apps/{app_scope}/messages/{message_id}/read":{"post":{"tags":["App Messaging","App Messaging"],"summary":"Mark Message Read","description":"Mark a message read. Only the recipient may do so.","operationId":"mark_message_read_apps__app_scope__messages__message_id__read_post","parameters":[{"name":"app_scope","in":"path","required":true,"schema":{"type":"string","title":"App Scope"}},{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recipes.json":{"get":{"tags":["Recipes","Recipes"],"summary":"Get Recipes","description":"All shipped recipes as JSON, plus contract-bearing spec summaries.","operationId":"get_recipes_recipes_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/app-email/unsubscribe":{"get":{"tags":["App Email","App Email"],"summary":"Unsubscribe","description":"One-click unsubscribe — flips the user's email_opt_in off.","operationId":"unsubscribe_app_email_unsubscribe_get","parameters":[{"name":"u","in":"query","required":true,"schema":{"type":"string","description":"user_id","title":"U"},"description":"user_id"},{"name":"sig","in":"query","required":true,"schema":{"type":"string","description":"HMAC signature","title":"Sig"},"description":"HMAC signature"}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["App Email","App Email"],"summary":"Unsubscribe One Click","description":"RFC 8058 one-click unsubscribe — the POST Gmail/Yahoo fire from the\n``List-Unsubscribe`` header (body ``List-Unsubscribe=One-Click``). Same effect\nas the GET link, but returns a bare 200 (no HTML page) as the spec expects.","operationId":"unsubscribe_one_click_app_email_unsubscribe_post","parameters":[{"name":"u","in":"query","required":true,"schema":{"type":"string","description":"user_id","title":"U"},"description":"user_id"},{"name":"sig","in":"query","required":true,"schema":{"type":"string","description":"HMAC signature","title":"Sig"},"description":"HMAC signature"}],"responses":{"200":{"description":"Successful Response","content":{"text/plain":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mono/stream":{"post":{"tags":["Mono-Sage","mono-sage"],"summary":"Mono Stream","description":"Mono-sage streaming endpoint. SSE-compatible with existing Casino frontend.\n\nRuns alongside /stream as a staging endpoint. Phase 3 will replace /stream.","operationId":"mono_stream_mono_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonoStreamRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mono/health":{"get":{"tags":["Mono-Sage","mono-sage"],"summary":"Mono Health","description":"Health check for the mono-sage endpoint.","operationId":"mono_health_mono_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/mcp/oauth/authorization-server":{"get":{"tags":["MCP"],"summary":"Oauth Metadata","description":"OAuth 2.0 Authorization Server Metadata (RFC 8414).","operationId":"oauth_metadata_mcp_oauth_authorization_server_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/mcp/oauth/token":{"post":{"tags":["MCP"],"summary":"Oauth Token","description":"OAuth 2.0 token endpoint — client_credentials grant only.\n\nclient_id = Casino API key ID (key_1xxx)\nclient_secret = Casino API key value (sage_xxx)\n\nReturns the API key itself as the access_token so existing Bearer\nvalidation in MCPAuthMiddleware and our SSE auth work unchanged.","operationId":"oauth_token_mcp_oauth_token_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_oauth_token_mcp_oauth_token_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/mcp/":{"get":{"tags":["MCP"],"summary":"Streamable Http Get","description":"Stateless server — no server-initiated GET stream (spec-legal 405).","operationId":"streamable_http_get_mcp__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["MCP"],"summary":"Streamable Http Endpoint","description":"Streamable HTTP MCP transport — stateless, scales horizontally.\n\nClient sends JSON-RPC request, server responds in the same HTTP response.\nSupports both single responses (application/json) and streaming responses\n(text/event-stream) depending on the Accept header.","operationId":"streamable_http_endpoint_mcp__post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/mcp":{"get":{"tags":["MCP"],"summary":"Streamable Http Get","description":"Stateless server — no server-initiated GET stream (spec-legal 405).","operationId":"streamable_http_get_mcp_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["MCP"],"summary":"Streamable Http Endpoint","description":"Streamable HTTP MCP transport — stateless, scales horizontally.\n\nClient sends JSON-RPC request, server responds in the same HTTP response.\nSupports both single responses (application/json) and streaming responses\n(text/event-stream) depending on the Accept header.","operationId":"streamable_http_endpoint_mcp_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/mcp/sse":{"get":{"tags":["MCP"],"summary":"Sse Endpoint","description":"SSE connection — establishes MCP session, streams server responses.","operationId":"sse_endpoint_mcp_sse_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/mcp/messages":{"post":{"tags":["MCP"],"summary":"Messages Endpoint","description":"Receive JSON-RPC messages from the MCP client.\n\nIf the session belongs to a different container (cross-task ALB routing),\nproxy the request to the right container via its private VPC IP.","operationId":"messages_endpoint_mcp_messages_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/":{"get":{"summary":"Root","description":"Root endpoint - returns API information.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ActivityBody":{"properties":{"device_id":{"type":"string","title":"Device Id"},"lock_token":{"type":"string","title":"Lock Token"}},"type":"object","required":["device_id","lock_token"],"title":"ActivityBody"},"AddMemberRequest":{"properties":{"user_id":{"type":"string","title":"User Id"}},"type":"object","required":["user_id"],"title":"AddMemberRequest"},"AddRSSFeedRequest":{"properties":{"name":{"type":"string","title":"Name"},"url":{"type":"string","title":"Url"},"category":{"type":"string","title":"Category","default":"general"}},"type":"object","required":["name","url"],"title":"AddRSSFeedRequest"},"AdminProviderCredentialOut":{"properties":{"credential_id":{"type":"string","title":"Credential Id"},"provider":{"type":"string","title":"Provider"},"purpose":{"type":"string","title":"Purpose"},"scope":{"type":"string","title":"Scope"},"model_id":{"type":"string","title":"Model Id"},"is_default":{"type":"boolean","title":"Is Default"},"masked_key":{"type":"string","title":"Masked Key"},"created_at":{"type":"integer","title":"Created At"},"updated_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["credential_id","provider","purpose","scope","model_id","is_default","masked_key","created_at"],"title":"AdminProviderCredentialOut"},"AgentBalanceResponse":{"properties":{"wallet_address":{"type":"string","title":"Wallet Address"},"balance_wei":{"type":"string","title":"Balance Wei"},"held_wei":{"type":"string","title":"Held Wei"},"available_wei":{"type":"string","title":"Available Wei"},"deposited_wei":{"type":"string","title":"Deposited Wei","default":"0"},"wallet_wei":{"type":"string","title":"Wallet Wei","default":"0"},"agent_balance":{"type":"number","title":"Agent Balance"},"agent_available":{"type":"number","title":"Agent Available"},"build_credits":{"type":"integer","title":"Build Credits"}},"type":"object","required":["wallet_address","balance_wei","held_wei","available_wei","agent_balance","agent_available","build_credits"],"title":"AgentBalanceResponse","description":"AGENT token balance for a wallet user."},"ApiKeyResponse":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"created_at":{"type":"string","title":"Created At"},"last_used":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["key_id","name","created_at","is_active"],"title":"ApiKeyResponse"},"AppAccessStatusResponse":{"properties":{"has_access":{"type":"boolean","title":"Has Access"},"queries_used":{"type":"integer","title":"Queries Used"},"queries_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Queries Remaining"},"payment_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Mode"},"unlock_price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Unlock Price Cents"},"unlock_price_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unlock Price Label"},"subscription":{"anyOf":[{"$ref":"#/components/schemas/AppSubscriptionStatusBlock"},{"type":"null"}]}},"type":"object","required":["has_access","queries_used","queries_remaining","payment_mode","unlock_price_cents","unlock_price_label"],"title":"AppAccessStatusResponse"},"AppCheckoutRequest":{"properties":{"site_id":{"type":"string","title":"Site Id"},"success_url":{"type":"string","title":"Success Url"},"cancel_url":{"type":"string","title":"Cancel Url"}},"type":"object","required":["site_id","success_url","cancel_url"],"title":"AppCheckoutRequest"},"AppCheckoutResponse":{"properties":{"url":{"type":"string","title":"Url"},"site_id":{"type":"string","title":"Site Id"}},"type":"object","required":["url","site_id"],"title":"AppCheckoutResponse"},"AppCreditsResponse":{"properties":{"site_id":{"type":"string","title":"Site Id"},"enabled":{"type":"boolean","title":"Enabled"},"unit":{"type":"string","title":"Unit","default":"connection"},"balance":{"type":"integer","title":"Balance","default":0},"free_remaining":{"type":"integer","title":"Free Remaining","default":0},"packs":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Packs","default":[]}},"type":"object","required":["site_id","enabled"],"title":"AppCreditsResponse","description":"End-user credit state for one app. `packs` mirror the builder's config so\nthe buy-credits sheet renders without a second round-trip."},"AppSubscribeRequest":{"properties":{"site_id":{"type":"string","title":"Site Id"},"success_url":{"type":"string","title":"Success Url"},"cancel_url":{"type":"string","title":"Cancel Url"}},"type":"object","required":["site_id","success_url","cancel_url"],"title":"AppSubscribeRequest"},"AppSubscribeResponse":{"properties":{"url":{"type":"string","title":"Url"},"site_id":{"type":"string","title":"Site Id"}},"type":"object","required":["url","site_id"],"title":"AppSubscribeResponse"},"AppSubscriptionCancelRequest":{"properties":{"site_id":{"type":"string","title":"Site Id"}},"type":"object","required":["site_id"],"title":"AppSubscriptionCancelRequest"},"AppSubscriptionStatusBlock":{"properties":{"state":{"type":"string","title":"State"},"queries_used":{"type":"integer","title":"Queries Used","default":0},"queries_per_month":{"type":"integer","title":"Queries Per Month","default":0},"current_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Period End"},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","default":false},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","required":["state"],"title":"AppSubscriptionStatusBlock","description":"P0-162 SPEC §5.2 — additive subscription block on /status."},"AutoTopupConfig":{"properties":{"enabled":{"type":"boolean","title":"Enabled","default":false},"threshold_credits":{"type":"integer","title":"Threshold Credits","default":0},"pack":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pack"},"has_card":{"type":"boolean","title":"Has Card","default":false},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"}},"type":"object","title":"AutoTopupConfig"},"AutoTopupUpdate":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"threshold_credits":{"type":"integer","title":"Threshold Credits"},"pack":{"type":"string","title":"Pack"}},"type":"object","required":["enabled","threshold_credits","pack"],"title":"AutoTopupUpdate"},"AutomationOut":{"properties":{"automation_id":{"type":"string","title":"Automation Id"},"user_id":{"type":"string","title":"User Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"prompt":{"type":"string","title":"Prompt"},"target_agents":{"items":{"type":"string"},"type":"array","title":"Target Agents"},"schedule":{"type":"string","title":"Schedule"},"timezone":{"type":"string","title":"Timezone"},"status":{"type":"string","title":"Status"},"output_config":{"additionalProperties":true,"type":"object","title":"Output Config"},"max_runtime_seconds":{"type":"integer","title":"Max Runtime Seconds"},"retry_on_failure":{"type":"boolean","title":"Retry On Failure"},"max_retries":{"type":"integer","title":"Max Retries"},"created_at":{"type":"integer","title":"Created At"},"updated_at":{"type":"integer","title":"Updated At"},"last_run_at":{"type":"integer","title":"Last Run At"},"last_run_status":{"type":"string","title":"Last Run Status"},"run_count":{"type":"integer","title":"Run Count"},"failure_count":{"type":"integer","title":"Failure Count"}},"type":"object","required":["automation_id","user_id","tenant_id","name","description","prompt","target_agents","schedule","timezone","status","output_config","max_runtime_seconds","retry_on_failure","max_retries","created_at","updated_at","last_run_at","last_run_status","run_count","failure_count"],"title":"AutomationOut"},"AutomationRunOut":{"properties":{"automation_id":{"type":"string","title":"Automation Id"},"run_id":{"type":"string","title":"Run Id"},"status":{"type":"string","title":"Status"},"started_at":{"type":"integer","title":"Started At"},"completed_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Completed At"},"duration_ms":{"type":"integer","title":"Duration Ms"},"credits_used":{"type":"integer","title":"Credits Used"},"output_summary":{"type":"string","title":"Output Summary"},"output_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Output Url"},"error_msg":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Msg"}},"type":"object","required":["automation_id","run_id","status","started_at","duration_ms","credits_used","output_summary"],"title":"AutomationRunOut"},"Body_load_dataset_from_url_load_from_url_post":{"properties":{"url":{"type":"string","title":"Url"},"dataset_name":{"type":"string","title":"Dataset Name"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},"type":"object","required":["url","dataset_name"],"title":"Body_load_dataset_from_url_load_from_url_post"},"Body_oauth_token_mcp_oauth_token_post":{"properties":{"grant_type":{"type":"string","title":"Grant Type","default":""},"client_id":{"type":"string","title":"Client Id","default":""},"client_secret":{"type":"string","title":"Client Secret","default":""}},"type":"object","title":"Body_oauth_token_mcp_oauth_token_post"},"Body_upload_agent_library_agents_upload_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_agent_library_agents_upload_post"},"Body_upload_document_upload_document_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"document_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Name"}},"type":"object","required":["file"],"title":"Body_upload_document_upload_document_post"},"Body_upload_file_to_session_data_upload__session_id__post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"dataset_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset Name"}},"type":"object","required":["file"],"title":"Body_upload_file_to_session_data_upload__session_id__post"},"Body_upload_file_upload_post":{"properties":{"file":{"type":"string","format":"binary","title":"File"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"dataset_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dataset Name"}},"type":"object","required":["file"],"title":"Body_upload_file_upload_post"},"BuyAgentRequest":{"properties":{"wallet_address":{"type":"string","title":"Wallet Address"},"amount_agent":{"type":"number","title":"Amount Agent"},"success_url":{"type":"string","title":"Success Url"},"cancel_url":{"type":"string","title":"Cancel Url"}},"type":"object","required":["wallet_address","amount_agent","success_url","cancel_url"],"title":"BuyAgentRequest","description":"Request to purchase AGENT tokens via Stripe Checkout (card)."},"BuyAgentResponse":{"properties":{"session_url":{"type":"string","title":"Session Url"},"session_id":{"type":"string","title":"Session Id"},"amount_agent":{"type":"number","title":"Amount Agent"},"usd_cents":{"type":"integer","title":"Usd Cents"}},"type":"object","required":["session_url","session_id","amount_agent","usd_cents"],"title":"BuyAgentResponse"},"CheckoutRequest":{"properties":{"package":{"type":"string","title":"Package"}},"type":"object","required":["package"],"title":"CheckoutRequest","description":"Request to create a Stripe Checkout session."},"CheckoutResponse":{"properties":{"url":{"type":"string","title":"Url"},"package":{"type":"string","title":"Package"},"credits":{"type":"integer","title":"Credits"}},"type":"object","required":["url","package","credits"],"title":"CheckoutResponse"},"ClaimBody":{"properties":{"session_id":{"type":"string","title":"Session Id"},"device_id":{"type":"string","title":"Device Id"},"device_description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Description"},"force":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Force","default":false}},"type":"object","required":["session_id","device_id"],"title":"ClaimBody"},"ConnectDomainRequest":{"properties":{"domain":{"type":"string","title":"Domain"}},"type":"object","required":["domain"],"title":"ConnectDomainRequest"},"ConnectionChargeRequest":{"properties":{"site_id":{"type":"string","title":"Site Id"},"pair_key":{"type":"string","title":"Pair Key"}},"type":"object","required":["site_id","pair_key"],"title":"ConnectionChargeRequest"},"ConnectionChargeResponse":{"properties":{"paid":{"type":"boolean","title":"Paid"},"charge_source":{"type":"string","title":"Charge Source"},"balance":{"type":"integer","title":"Balance"}},"type":"object","required":["paid","charge_source","balance"],"title":"ConnectionChargeResponse"},"ConversationRenameRequest":{"properties":{"title":{"type":"string","title":"Title"}},"type":"object","required":["title"],"title":"ConversationRenameRequest"},"CreateAdminProviderCredentialRequest":{"properties":{"provider":{"type":"string","title":"Provider","description":"anthropic | openai | gemini | deepseek | xai"},"api_key":{"type":"string","minLength":1,"title":"Api Key","description":"Plain-text API key (encrypted server-side)"},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id","description":"Model ID (uses provider default if omitted)"},"purpose":{"type":"string","title":"Purpose","description":"Credential purpose (default, code_sandbox, …)","default":"default"},"is_default":{"type":"boolean","title":"Is Default","description":"Mark as the default for this purpose","default":true}},"type":"object","required":["provider","api_key"],"title":"CreateAdminProviderCredentialRequest"},"CreateApiKeyRequest":{"properties":{"name":{"type":"string","title":"Name"},"scopes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Scopes"}},"type":"object","required":["name"],"title":"CreateApiKeyRequest"},"CreateAutomationRequest":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"prompt":{"type":"string","maxLength":2000,"minLength":1,"title":"Prompt"},"schedule":{"type":"string","title":"Schedule","description":"CRON (5-field Unix format)"},"timezone":{"type":"string","title":"Timezone","default":"America/New_York"},"target_agents":{"items":{"type":"string"},"type":"array","title":"Target Agents"},"output_config":{"$ref":"#/components/schemas/OutputConfig"},"max_runtime_seconds":{"type":"integer","title":"Max Runtime Seconds","default":300},"retry_on_failure":{"type":"boolean","title":"Retry On Failure","default":true},"max_retries":{"type":"integer","title":"Max Retries","default":2},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["name","prompt","schedule"],"title":"CreateAutomationRequest"},"CreateCodeInterpreterCredentialRequest":{"properties":{"api_key":{"type":"string","title":"Api Key"},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id"},"is_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Default","default":true},"model_settings":{"anyOf":[{"$ref":"#/components/schemas/ModelSettingsRequest"},{"type":"null"}]}},"type":"object","required":["api_key"],"title":"CreateCodeInterpreterCredentialRequest","description":"Simplified request for code interpreter credentials (always Anthropic)."},"CreateComponentCredentialRequest":{"properties":{"provider":{"type":"string","title":"Provider"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"host":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host"},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id"},"is_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Default","default":true},"model_settings":{"anyOf":[{"$ref":"#/components/schemas/ModelSettingsRequest"},{"type":"null"}]}},"type":"object","required":["provider"],"title":"CreateComponentCredentialRequest","description":"Request for creating credentials for specific agent components or sandboxes."},"CreateDataSourceRequest":{"properties":{"source_type":{"type":"string","title":"Source Type"},"name":{"type":"string","title":"Name"},"credentials":{"additionalProperties":true,"type":"object","title":"Credentials"},"auth_method":{"type":"string","title":"Auth Method"},"is_tenant_wide":{"type":"boolean","title":"Is Tenant Wide","default":false},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["source_type","name","credentials","auth_method"],"title":"CreateDataSourceRequest"},"CreateIntegrationRequest":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"base_url":{"type":"string","title":"Base Url"},"auth_type":{"type":"string","title":"Auth Type","default":"bearer"},"auth_config":{"additionalProperties":true,"type":"object","title":"Auth Config","default":{}},"endpoints":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Endpoints","default":[]},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},"type":"object","required":["name","description","base_url"],"title":"CreateIntegrationRequest"},"CreateProviderCredentialRequest":{"properties":{"provider":{"type":"string","title":"Provider"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"host":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host"},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id"},"is_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Default","default":true},"purpose":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Purpose","default":"llm"},"model_settings":{"anyOf":[{"$ref":"#/components/schemas/ModelSettingsRequest"},{"type":"null"}]}},"type":"object","required":["provider"],"title":"CreateProviderCredentialRequest"},"CreateRoomRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","title":"CreateRoomRequest"},"CreateSiteAgentRequest":{"properties":{"name":{"type":"string","title":"Name"},"system_prompt":{"type":"string","title":"System Prompt"},"capabilities":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Capabilities"},"description":{"type":"string","title":"Description","default":""},"tools":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tools"},"route_when":{"type":"string","title":"Route When","default":""},"cost_hint":{"type":"string","title":"Cost Hint","default":"medium"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},"type":"object","required":["name","system_prompt"],"title":"CreateSiteAgentRequest"},"CreateSiteRequest":{"properties":{"site_name":{"type":"string","title":"Site Name"},"site_type":{"type":"string","title":"Site Type","default":"on_demand"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"files":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Files"}},"type":"object","required":["site_name"],"title":"CreateSiteRequest"},"CreditStatusResponse":{"properties":{"daily_limit":{"type":"integer","title":"Daily Limit"},"used_today":{"type":"integer","title":"Used Today"},"remaining":{"type":"integer","title":"Remaining"},"resets_at":{"type":"string","title":"Resets At"},"purchased_remaining":{"type":"integer","title":"Purchased Remaining","default":0},"total_remaining":{"type":"integer","title":"Total Remaining","default":0},"subscription_remaining":{"type":"integer","title":"Subscription Remaining","default":0},"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan"},"builder_compute_remaining":{"type":"integer","title":"Builder Compute Remaining","default":0},"low_builder_balance":{"type":"boolean","title":"Low Builder Balance","default":false},"compute_alert":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Compute Alert"}},"type":"object","required":["daily_limit","used_today","remaining","resets_at"],"title":"CreditStatusResponse","description":"Daily free credit status for the authenticated user."},"CreditsCheckoutRequest":{"properties":{"site_id":{"type":"string","title":"Site Id"},"pack_id":{"type":"string","title":"Pack Id"},"success_url":{"type":"string","title":"Success Url"},"cancel_url":{"type":"string","title":"Cancel Url"}},"type":"object","required":["site_id","pack_id","success_url","cancel_url"],"title":"CreditsCheckoutRequest"},"CreditsCheckoutResponse":{"properties":{"url":{"type":"string","title":"Url"},"site_id":{"type":"string","title":"Site Id"}},"type":"object","required":["url","site_id"],"title":"CreditsCheckoutResponse"},"DailyUsageResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"date":{"type":"string","title":"Date"},"metrics":{"$ref":"#/components/schemas/UsageMetrics"}},"type":"object","required":["tenant_id","date","metrics"],"title":"DailyUsageResponse","description":"Daily usage response."},"DataPlanRequest":{"properties":{"collections":{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object","title":"Collections"}},"type":"object","required":["collections"],"title":"DataPlanRequest"},"DataSourceResponse":{"properties":{"source_id":{"type":"string","title":"Source Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"source_type":{"type":"string","title":"Source Type"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"auth_method":{"type":"string","title":"Auth Method"},"is_tenant_wide":{"type":"boolean","title":"Is Tenant Wide"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"credentials_preview":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Credentials Preview"},"created_at":{"type":"integer","title":"Created At"},"updated_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["source_id","tenant_id","source_type","name","auth_method","is_tenant_wide","created_at"],"title":"DataSourceResponse"},"DeleteRequest":{"properties":{"collection":{"type":"string","title":"Collection"},"filter":{"additionalProperties":true,"type":"object","title":"Filter"},"layer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Layer","default":"auto"},"room_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Room Id"}},"type":"object","required":["collection","filter"],"title":"DeleteRequest"},"DeviceMetadata":{"properties":{"platform":{"type":"string","const":"ios","title":"Platform","default":"ios"},"os_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Os Version"},"app_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Version"},"device_model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Model"},"healthkit_source_ids":{"items":{"type":"string"},"type":"array","title":"Healthkit Source Ids"}},"type":"object","title":"DeviceMetadata","description":"Device information from the iOS app."},"DigestRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"deliver_sms":{"type":"boolean","title":"Deliver Sms","default":true}},"type":"object","required":["workspace_id"],"title":"DigestRequest"},"EmailOtpRequestBody":{"properties":{"email":{"type":"string","title":"Email"},"site_id":{"type":"string","title":"Site Id"}},"type":"object","required":["email","site_id"],"title":"EmailOtpRequestBody"},"EmailOtpVerifyBody":{"properties":{"email":{"type":"string","title":"Email"},"code":{"type":"string","title":"Code"},"site_id":{"type":"string","title":"Site Id"}},"type":"object","required":["email","code","site_id"],"title":"EmailOtpVerifyBody"},"ExistingCredentialOut":{"properties":{"credential_id":{"type":"string","title":"Credential Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"provider":{"type":"string","title":"Provider"},"purpose":{"type":"string","title":"Purpose"},"scope":{"type":"string","title":"Scope"},"model_id":{"type":"string","title":"Model Id"},"is_default":{"type":"boolean","title":"Is Default"},"api_key_preview":{"type":"string","title":"Api Key Preview"},"created_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["credential_id","tenant_id","provider","purpose","scope","model_id","is_default","api_key_preview"],"title":"ExistingCredentialOut"},"ExportRequest":{"properties":{"format":{"type":"string","title":"Format","default":"json"},"filter":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Filter"},"limit":{"type":"integer","title":"Limit","default":10000}},"type":"object","title":"ExportRequest"},"GitHubImportRequest":{"properties":{"repo_full_name":{"type":"string","title":"Repo Full Name"},"branch":{"type":"string","title":"Branch","default":"main"},"path":{"type":"string","title":"Path","default":""},"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["repo_full_name","workspace_id"],"title":"GitHubImportRequest"},"GoogleLoginRequest":{"properties":{"code":{"type":"string","title":"Code"},"redirect_uri":{"type":"string","title":"Redirect Uri"}},"type":"object","required":["code","redirect_uri"],"title":"GoogleLoginRequest"},"GuestTokenRequest":{"properties":{"site_id":{"type":"string","title":"Site Id"}},"type":"object","required":["site_id"],"title":"GuestTokenRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthAnalysisResult":{"properties":{"analysis_id":{"type":"string","title":"Analysis Id"},"status":{"$ref":"#/components/schemas/HealthAnalysisStatus"},"summary_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Text"},"artifact_urls":{"items":{"type":"string"},"type":"array","title":"Artifact Urls"},"follow_up_suggestions":{"items":{"type":"string"},"type":"array","title":"Follow Up Suggestions"},"metrics":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metrics"},"mms_status":{"anyOf":[{"type":"string","enum":["queued","sent","failed"]},{"type":"null"}],"title":"Mms Status"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["analysis_id","status"],"title":"HealthAnalysisResult","description":"Response body for GET /api/v1/health-data/analysis/{analysis_id}."},"HealthAnalysisStatus":{"type":"string","enum":["pending","processing","complete","error"],"title":"HealthAnalysisStatus","description":"Lifecycle states for an async health analysis task."},"HealthDataType":{"type":"string","enum":["sleep_analysis","heart_rate","steps","workouts","activity"],"title":"HealthDataType","description":"Supported health data types from HealthKit."},"HealthIngestRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"data_type":{"$ref":"#/components/schemas/HealthDataType"},"payload":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Payload"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"device_metadata":{"anyOf":[{"$ref":"#/components/schemas/DeviceMetadata"},{"type":"null"}]},"trigger_analysis":{"type":"boolean","title":"Trigger Analysis","default":false}},"type":"object","required":["workspace_id","data_type","payload"],"title":"HealthIngestRequest","description":"Request body for POST /api/v1/health-data/ingest.","example":{"data_type":"sleep_analysis","payload":[{"duration":29700,"endDate":"2026-03-14T06:45:00.000Z","sourceId":"com.apple.health.9A1B2C","sourceName":"Apple Watch","startDate":"2026-03-13T22:30:00.000Z","uuid":"ABCD-1234","value":"asleepCore"}],"timestamp":"2026-03-27T10:00:00.000Z","trigger_analysis":true,"workspace_id":"ws_abc123"}},"HealthIngestResponse":{"properties":{"status":{"type":"string","enum":["accepted","error"],"title":"Status"},"s3_key":{"type":"string","title":"S3 Key"},"records_count":{"type":"integer","title":"Records Count"},"analysis_triggered":{"type":"boolean","title":"Analysis Triggered","default":false},"analysis_task_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Analysis Task Id"}},"type":"object","required":["status","s3_key","records_count"],"title":"HealthIngestResponse","description":"Response body for POST /api/v1/health-data/ingest."},"ImportLibraryRequest":{"properties":{"item_type":{"type":"string","title":"Item Type"},"name":{"type":"string","title":"Name"}},"type":"object","required":["item_type","name"],"title":"ImportLibraryRequest"},"InferBalanceResponse":{"properties":{"wallet_address":{"type":"string","title":"Wallet Address"},"balance_wei":{"type":"string","title":"Balance Wei"},"held_wei":{"type":"string","title":"Held Wei"},"available_wei":{"type":"string","title":"Available Wei"},"infer_balance":{"type":"number","title":"Infer Balance"},"infer_available":{"type":"number","title":"Infer Available"},"query_credits":{"type":"integer","title":"Query Credits"}},"type":"object","required":["wallet_address","balance_wei","held_wei","available_wei","infer_balance","infer_available","query_credits"],"title":"InferBalanceResponse","description":"INFER token balance for a wallet user."},"InsertRequest":{"properties":{"collection":{"type":"string","title":"Collection"},"document":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Document"},"documents":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Documents"},"layer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Layer","default":"auto"},"room_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Room Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","required":["collection"],"title":"InsertRequest"},"InterruptRequest":{"properties":{"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","title":"InterruptRequest","description":"Request model for interrupting a running stream."},"InviteRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"InviteRequest"},"LinkRequest":{"properties":{"auth_method_user_id":{"type":"string","title":"Auth Method User Id"},"proof":{"type":"string","title":"Proof"}},"type":"object","required":["auth_method_user_id","proof"],"title":"LinkRequest"},"LiveModelMapEntry":{"properties":{"purpose":{"type":"string","title":"Purpose"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id"},"credential_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credential Id"},"configured":{"type":"boolean","title":"Configured"}},"type":"object","required":["purpose","configured"],"title":"LiveModelMapEntry"},"LoginRequest":{"properties":{"email":{"type":"string","title":"Email"},"password":{"type":"string","title":"Password"},"app_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Scope"}},"type":"object","required":["email","password"],"title":"LoginRequest"},"LoginResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"user_id":{"type":"string","title":"User Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"session_token":{"type":"string","title":"Session Token"},"expires_at":{"type":"string","title":"Expires At"}},"type":"object","required":["success","user_id","tenant_id","session_token","expires_at"],"title":"LoginResponse","description":"User login response"},"MintRecord":{"properties":{"stripe_session_id":{"type":"string","title":"Stripe Session Id"},"usd_cents":{"type":"integer","title":"Usd Cents"},"agent_amount_wei":{"type":"string","title":"Agent Amount Wei"},"status":{"type":"string","title":"Status"},"wallet_address":{"type":"string","title":"Wallet Address"},"created_at":{"type":"string","title":"Created At"},"submitted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Submitted At"},"mint_tx_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mint Tx Hash"},"deposit_tx_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deposit Tx Hash"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["stripe_session_id","usd_cents","agent_amount_wei","status","wallet_address","created_at"],"title":"MintRecord","description":"A single Stripe → AGENT mint record for the recovery UI."},"MintRetryRequest":{"properties":{"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["session_id"],"title":"MintRetryRequest"},"MintRetryResponse":{"properties":{"status":{"type":"string","title":"Status"},"minted":{"type":"boolean","title":"Minted"},"message":{"type":"string","title":"Message"}},"type":"object","required":["status","minted","message"],"title":"MintRetryResponse"},"ModelOption":{"properties":{"credential_id":{"type":"string","title":"Credential Id"},"provider":{"type":"string","title":"Provider"},"model_id":{"type":"string","title":"Model Id"},"purpose":{"type":"string","title":"Purpose"},"is_default":{"type":"boolean","title":"Is Default"}},"type":"object","required":["credential_id","provider","model_id","purpose","is_default"],"title":"ModelOption"},"ModelPreferenceResponse":{"properties":{"preferred_credential_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Credential Id"},"resolved_provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolved Provider"},"resolved_model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolved Model Id"},"is_auto":{"type":"boolean","title":"Is Auto","default":true}},"type":"object","title":"ModelPreferenceResponse"},"ModelSettingsRequest":{"properties":{"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature"},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens"},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P"},"frequency_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Frequency Penalty"},"presence_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Presence Penalty"}},"type":"object","title":"ModelSettingsRequest","description":"Model settings for fine-tuning LLM behavior."},"ModelSettingsResponse":{"properties":{"temperature":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Temperature"},"max_tokens":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Tokens"},"top_p":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Top P"},"frequency_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Frequency Penalty"},"presence_penalty":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Presence Penalty"}},"type":"object","title":"ModelSettingsResponse","description":"Model settings returned in responses."},"MonetizationResponse":{"properties":{"site_id":{"type":"string","title":"Site Id"},"monetization":{"additionalProperties":true,"type":"object","title":"Monetization"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings","default":[]}},"type":"object","required":["site_id","monetization"],"title":"MonetizationResponse"},"MonoStreamRequest":{"properties":{"query":{"type":"string","title":"Query"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"},"source_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Type"},"attachments":{"items":{"$ref":"#/components/schemas/sage_agent__mono_sage__api__stream__Attachment"},"type":"array","title":"Attachments","default":[]},"chat_context":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Chat Context"},"force_new_session":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Force New Session","default":false},"allowed_terms":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Terms"},"target_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Agent"},"target_agents":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Target Agents"},"capabilities":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Capabilities"}},"type":"object","required":["query"],"title":"MonoStreamRequest"},"MonthlyUsageResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"year":{"type":"integer","title":"Year"},"month":{"type":"integer","title":"Month"},"totals":{"$ref":"#/components/schemas/UsageMetrics"},"days_with_usage":{"type":"integer","title":"Days With Usage"}},"type":"object","required":["tenant_id","year","month","totals","days_with_usage"],"title":"MonthlyUsageResponse","description":"Monthly usage totals."},"NonceResponse":{"properties":{"nonce":{"type":"string","title":"Nonce"}},"type":"object","required":["nonce"],"title":"NonceResponse"},"NotifyRequest":{"properties":{"title":{"type":"string","title":"Title"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"}},"type":"object","required":["title"],"title":"NotifyRequest"},"OAuthRevokeResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"OAuthRevokeResponse","description":"Response for OAuth revocation."},"OAuthStartResponse":{"properties":{"auth_url":{"type":"string","title":"Auth Url"},"state":{"type":"string","title":"State"}},"type":"object","required":["auth_url","state"],"title":"OAuthStartResponse","description":"Response for starting OAuth flow."},"OAuthStatusResponse":{"properties":{"connected":{"type":"boolean","title":"Connected"},"accounts":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Accounts"},"ads":{"type":"boolean","title":"Ads","default":false},"analytics":{"type":"boolean","title":"Analytics","default":false},"drive":{"type":"boolean","title":"Drive","default":false},"youtube":{"type":"boolean","title":"Youtube","default":false},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"}},"type":"object","required":["connected","accounts"],"title":"OAuthStatusResponse","description":"Response for OAuth connection status."},"OnboardBody":{"properties":{"return_url":{"type":"string","title":"Return Url"},"refresh_url":{"type":"string","title":"Refresh Url"}},"type":"object","required":["return_url","refresh_url"],"title":"OnboardBody"},"OutputConfig":{"properties":{"type":{"type":"string","title":"Type","default":"silent"},"to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"To"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"headers":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Headers"},"format":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Format"},"subject_template":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subject Template"}},"type":"object","title":"OutputConfig"},"PhoneRegistrationRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"phone_number":{"type":"string","title":"Phone Number"}},"type":"object","required":["workspace_id","phone_number"],"title":"PhoneRegistrationRequest","description":"Request body for POST /api/v1/health-data/register-phone."},"PiiAllowlistAddRequest":{"properties":{"term":{"type":"string","title":"Term"},"entity_type":{"type":"string","title":"Entity Type"}},"type":"object","required":["term","entity_type"],"title":"PiiAllowlistAddRequest"},"PiiAllowlistRemoveRequest":{"properties":{"term":{"type":"string","title":"Term"}},"type":"object","required":["term"],"title":"PiiAllowlistRemoveRequest"},"PiiPreviewRequest":{"properties":{"query":{"type":"string","title":"Query"}},"type":"object","required":["query"],"title":"PiiPreviewRequest","description":"Request model for PII masking preview — analysis only, no masking."},"PiiSettingsUpdate":{"properties":{"query_masking":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Query Masking"}},"type":"object","title":"PiiSettingsUpdate","description":"Partial update — only send fields you want to change."},"PreflightRequest":{"properties":{"target_agents":{"items":{"type":"string"},"type":"array","title":"Target Agents"}},"type":"object","title":"PreflightRequest"},"PrewarmRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"}},"type":"object","required":["workspace_id"],"title":"PrewarmRequest","description":"Request model for swarm pre-warming."},"PrivyRefreshRequest":{"properties":{"privy_token":{"type":"string","title":"Privy Token"},"app_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Scope"}},"type":"object","required":["privy_token"],"title":"PrivyRefreshRequest","description":"P0-137 1B: re-mint a `wallet_pending` session once the smart wallet provisions."},"PrivyVerifyRequest":{"properties":{"privy_token":{"type":"string","title":"Privy Token"},"app_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Scope"}},"type":"object","required":["privy_token"],"title":"PrivyVerifyRequest"},"PromoteCredentialRequest":{"properties":{"credential_id":{"type":"string","title":"Credential Id"},"is_default":{"type":"boolean","title":"Is Default","default":true}},"type":"object","required":["credential_id"],"title":"PromoteCredentialRequest"},"PromoteVersionRequest":{"properties":{"version":{"type":"integer","title":"Version"}},"type":"object","required":["version"],"title":"PromoteVersionRequest"},"ProviderCredentialResponse":{"properties":{"credential_id":{"type":"string","title":"Credential Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"provider":{"type":"string","title":"Provider"},"purpose":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Purpose","default":"llm"},"model_id":{"type":"string","title":"Model Id"},"is_default":{"type":"boolean","title":"Is Default"},"api_key_preview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key Preview"},"host":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Host"},"model_settings":{"anyOf":[{"$ref":"#/components/schemas/ModelSettingsResponse"},{"type":"null"}]},"created_at":{"type":"integer","title":"Created At"},"updated_at":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["credential_id","tenant_id","provider","model_id","is_default","created_at"],"title":"ProviderCredentialResponse"},"PublicInsertRequest":{"properties":{"document":{"additionalProperties":true,"type":"object","title":"Document"}},"type":"object","required":["document"],"title":"PublicInsertRequest"},"PublishGitHubRequest":{"properties":{"repo_name":{"type":"string","title":"Repo Name"},"private":{"type":"boolean","title":"Private","default":true},"version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Version"}},"type":"object","required":["repo_name"],"title":"PublishGitHubRequest"},"PurchaseDomainRequest":{"properties":{"domain":{"type":"string","title":"Domain"},"tld":{"type":"string","title":"Tld"},"registrant":{"$ref":"#/components/schemas/RegistrantContact"},"auto_renew":{"type":"boolean","title":"Auto Renew","default":true},"whois_privacy":{"type":"boolean","title":"Whois Privacy","default":true},"site_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Site Id"}},"type":"object","required":["domain","tld","registrant"],"title":"PurchaseDomainRequest"},"PurchasedCreditResponse":{"properties":{"purchased":{"type":"integer","title":"Purchased"},"used":{"type":"integer","title":"Used"},"remaining":{"type":"integer","title":"Remaining"},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id"}},"type":"object","required":["purchased","used","remaining"],"title":"PurchasedCreditResponse","description":"Purchased credit balance."},"RegisterRequest":{"properties":{"email":{"type":"string","title":"Email"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"password":{"type":"string","title":"Password"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"skip_email_verification":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Skip Email Verification","default":false}},"type":"object","required":["email","password"],"title":"RegisterRequest"},"RegistrantContact":{"properties":{"first_name":{"type":"string","title":"First Name"},"last_name":{"type":"string","title":"Last Name"},"email":{"type":"string","title":"Email"},"phone":{"type":"string","title":"Phone"},"address_line1":{"type":"string","title":"Address Line1"},"city":{"type":"string","title":"City"},"state":{"type":"string","title":"State"},"zip_code":{"type":"string","title":"Zip Code"},"country_code":{"type":"string","title":"Country Code"}},"type":"object","required":["first_name","last_name","email","phone","address_line1","city","state","zip_code","country_code"],"title":"RegistrantContact"},"ReleaseBody":{"properties":{"device_id":{"type":"string","title":"Device Id"},"lock_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Lock Token"}},"type":"object","required":["device_id"],"title":"ReleaseBody"},"RenameSiteRequest":{"properties":{"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"RenameSiteRequest"},"ResendVerificationRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"Email address"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id","description":"Tenant ID if known"}},"type":"object","required":["email"],"title":"ResendVerificationRequest","description":"Request to resend verification email"},"RouteRequest":{"properties":{"task":{"type":"string","title":"Task"},"capabilities":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Capabilities"},"limit":{"type":"integer","title":"Limit","default":3}},"type":"object","required":["task"],"title":"RouteRequest"},"RoutingPreferenceRequest":{"properties":{"preference":{"type":"string","title":"Preference"}},"type":"object","required":["preference"],"title":"RoutingPreferenceRequest"},"SIWEVerifyRequest":{"properties":{"message":{"type":"string","title":"Message"},"signature":{"type":"string","title":"Signature"}},"type":"object","required":["message","signature"],"title":"SIWEVerifyRequest"},"SendMessageBody":{"properties":{"to_user_key":{"type":"string","minLength":1,"title":"To User Key"},"body":{"type":"string","minLength":1,"title":"Body"}},"type":"object","required":["to_user_key","body"],"title":"SendMessageBody"},"SeoRequest":{"properties":{"config":{"additionalProperties":true,"type":"object","title":"Config"}},"type":"object","required":["config"],"title":"SeoRequest"},"SetAliasRequest":{"properties":{"alias":{"type":"string","title":"Alias"}},"type":"object","required":["alias"],"title":"SetAliasRequest"},"SetModelPreferenceRequest":{"properties":{"credential_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credential Id","description":"Platform credential_id to pin, or null to reset to auto"}},"type":"object","title":"SetModelPreferenceRequest"},"SourceUploadRequest":{"properties":{"files":{"additionalProperties":{"type":"string"},"type":"object","title":"Files"},"message":{"type":"string","title":"Message","default":"External update"}},"type":"object","required":["files"],"title":"SourceUploadRequest"},"SponsorGasResponse":{"properties":{"sponsored":{"type":"boolean","title":"Sponsored"},"reason":{"type":"string","title":"Reason"},"tx_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tx Hash"},"granted_wei":{"type":"string","title":"Granted Wei","default":"0"},"eth_balance_wei":{"type":"string","title":"Eth Balance Wei","default":"0"},"wallet_agent_wei":{"type":"string","title":"Wallet Agent Wei","default":"0"}},"type":"object","required":["sponsored","reason"],"title":"SponsorGasResponse"},"StageFilesRequest":{"properties":{"files":{"additionalProperties":{"type":"string"},"type":"object","title":"Files"}},"type":"object","required":["files"],"title":"StageFilesRequest"},"StagedFileRequest":{"properties":{"content":{"type":"string","title":"Content"}},"type":"object","required":["content"],"title":"StagedFileRequest"},"StreamQueryRequest":{"properties":{"query":{"type":"string","title":"Query"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"source_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Id"},"source_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Type"},"code_interpreter_network_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code Interpreter Network Mode"},"target_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Agent"},"target_agents":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Target Agents"},"capabilities":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Capabilities"},"attachments":{"items":{"$ref":"#/components/schemas/sage_agent__api__routes__streaming__Attachment"},"type":"array","title":"Attachments","default":[]},"chat_context":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Chat Context"},"force_new_session":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Force New Session","default":false},"allowed_terms":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Terms"}},"type":"object","required":["query"],"title":"StreamQueryRequest","description":"Request model for streaming queries."},"SubagentInvokeRequest":{"properties":{"prompt":{"type":"string","title":"Prompt"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"stream":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Stream","default":true}},"type":"object","required":["prompt"],"title":"SubagentInvokeRequest","description":"POST body for /library/agents/{name}/invoke."},"SubscribeRequest":{"properties":{"plan":{"type":"string","title":"Plan"}},"type":"object","required":["plan"],"title":"SubscribeRequest","description":"Request to create a Stripe subscription Checkout session."},"SubscribeResponse":{"properties":{"url":{"type":"string","title":"Url"},"plan":{"type":"string","title":"Plan"},"monthly_credits":{"type":"integer","title":"Monthly Credits"}},"type":"object","required":["url","plan","monthly_credits"],"title":"SubscribeResponse"},"SubscriptionGrantRequest":{"properties":{"user_id":{"type":"string","title":"User Id"},"plan":{"type":"string","title":"Plan"},"days":{"type":"integer","title":"Days","default":30}},"type":"object","required":["user_id","plan"],"title":"SubscriptionGrantRequest"},"SubscriptionStatusResponse":{"properties":{"status":{"type":"string","title":"Status"},"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan"},"monthly_credits":{"type":"integer","title":"Monthly Credits","default":0},"used":{"type":"integer","title":"Used","default":0},"remaining":{"type":"integer","title":"Remaining","default":0},"current_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Period End"},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","default":false}},"type":"object","required":["status"],"title":"SubscriptionStatusResponse","description":"Current subscription state + allowance for the authenticated user."},"TenantKeyResponse":{"properties":{"key_id":{"type":"string","title":"Key Id"},"name":{"type":"string","title":"Name"},"tenant_id":{"type":"string","title":"Tenant Id"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","title":"Created At"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"}},"type":"object","required":["key_id","name","tenant_id","is_active","created_at","scopes"],"title":"TenantKeyResponse"},"TenantKeysListResponse":{"properties":{"keys":{"items":{"$ref":"#/components/schemas/TenantKeyResponse"},"type":"array","title":"Keys"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["keys","total"],"title":"TenantKeysListResponse"},"TenantRequestResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"user_id":{"type":"string","title":"User Id"},"user_email":{"type":"string","title":"User Email"},"tenant_id":{"type":"string","title":"Tenant Id"},"status":{"type":"string","title":"Status"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["request_id","user_id","user_email","tenant_id","status","reason","created_at"],"title":"TenantRequestResponse"},"TenantRequestsListResponse":{"properties":{"requests":{"items":{"$ref":"#/components/schemas/TenantRequestResponse"},"type":"array","title":"Requests"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["requests","total"],"title":"TenantRequestsListResponse"},"TenantRoleResponse":{"properties":{"role_id":{"type":"string","title":"Role Id"},"name":{"type":"string","title":"Name"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"is_default":{"type":"boolean","title":"Is Default"},"is_system":{"type":"boolean","title":"Is System"}},"type":"object","required":["role_id","name","scopes","is_default","is_system"],"title":"TenantRoleResponse"},"TenantRolesListResponse":{"properties":{"roles":{"items":{"$ref":"#/components/schemas/TenantRoleResponse"},"type":"array","title":"Roles"}},"type":"object","required":["roles"],"title":"TenantRolesListResponse"},"TenantSignupResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"status":{"type":"string","title":"Status","default":"pending"},"message":{"type":"string","title":"Message","default":"Please check your email to verify your account"},"email":{"type":"string","title":"Email"}},"type":"object","required":["tenant_id","email"],"title":"TenantSignupResponse","description":"Initial signup response (before verification)"},"TenantUserResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"tenant_id":{"type":"string","title":"Tenant Id"},"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name"},"status":{"type":"string","title":"Status"},"has_api_key":{"type":"boolean","title":"Has Api Key"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"scopes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Scopes"}},"type":"object","required":["user_id","email","tenant_id","role_id","role_name","status","has_api_key"],"title":"TenantUserResponse"},"TenantUsersListResponse":{"properties":{"users":{"items":{"$ref":"#/components/schemas/TenantUserResponse"},"type":"array","title":"Users"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["users","total"],"title":"TenantUsersListResponse"},"TestConnectionRequest":{"properties":{"credentials":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Credentials"},"auth_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Method"}},"type":"object","title":"TestConnectionRequest","description":"Optional request body for providing test credentials without saving"},"TestMmsRequest":{"properties":{"workspace_id":{"type":"string","title":"Workspace Id"},"message":{"type":"string","title":"Message","default":"This is a test MMS from Sage Health Agent."},"phone_override":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Override"}},"type":"object","required":["workspace_id"],"title":"TestMmsRequest","description":"Request body for POST /api/v1/health-data/test-mms."},"TestNewConnectionRequest":{"properties":{"source_type":{"type":"string","title":"Source Type"},"credentials":{"additionalProperties":true,"type":"object","title":"Credentials"},"auth_method":{"type":"string","title":"Auth Method"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["source_type","credentials","auth_method"],"title":"TestNewConnectionRequest","description":"Request body for testing a connection before saving"},"ToggleRenewalRequest":{"properties":{"enabled":{"type":"boolean","title":"Enabled"}},"type":"object","required":["enabled"],"title":"ToggleRenewalRequest"},"ToolExecutionRequest":{"properties":{"tool_name":{"type":"string","title":"Tool Name"},"parameters":{"additionalProperties":true,"type":"object","title":"Parameters"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","required":["tool_name","parameters"],"title":"ToolExecutionRequest"},"ToolExecutionResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"execution_time":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Execution Time"},"visualization_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visualization Url"}},"type":"object","required":["success"],"title":"ToolExecutionResponse"},"ToolInvokeRequest":{"properties":{"agent_name":{"type":"string","title":"Agent Name"},"tool_name":{"type":"string","title":"Tool Name"},"kwargs":{"additionalProperties":true,"type":"object","title":"Kwargs","default":{}},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},"type":"object","required":["agent_name","tool_name"],"title":"ToolInvokeRequest","description":"Request model for direct tool invocation."},"UpdateAutomationRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Name"},"prompt":{"anyOf":[{"type":"string","maxLength":2000,"minLength":1},{"type":"null"}],"title":"Prompt"},"schedule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Schedule"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"target_agents":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Target Agents"},"output_config":{"anyOf":[{"$ref":"#/components/schemas/OutputConfig"},{"type":"null"}]},"max_runtime_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Runtime Seconds"},"retry_on_failure":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Retry On Failure"},"max_retries":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Retries"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","title":"UpdateAutomationRequest"},"UpdateDataSourceRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"credentials":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Credentials"},"auth_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Method"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","title":"UpdateDataSourceRequest"},"UpdateIntegrationRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"base_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Base Url"},"auth_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Auth Config"},"endpoints":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Endpoints"}},"type":"object","title":"UpdateIntegrationRequest"},"UpdateInterestsRequest":{"properties":{"topics":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Topics"},"subreddits":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Subreddits"}},"type":"object","title":"UpdateInterestsRequest"},"UpdateProviderCredentialRequest":{"properties":{"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"model_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model Id"},"is_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Default"},"model_settings":{"anyOf":[{"$ref":"#/components/schemas/ModelSettingsRequest"},{"type":"null"}]}},"type":"object","title":"UpdateProviderCredentialRequest"},"UpdateRequest":{"properties":{"collection":{"type":"string","title":"Collection"},"filter":{"additionalProperties":true,"type":"object","title":"Filter"},"update":{"additionalProperties":true,"type":"object","title":"Update"},"upsert":{"type":"boolean","title":"Upsert","default":false},"layer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Layer","default":"auto"},"room_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Room Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"}},"type":"object","required":["collection","filter","update"],"title":"UpdateRequest"},"UpdateSiteAgentRequest":{"properties":{"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"capabilities":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Capabilities"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"tools":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Tools"},"route_when":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Route When"},"cost_hint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cost Hint"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"}},"type":"object","title":"UpdateSiteAgentRequest"},"UsageMetrics":{"properties":{"api_calls":{"type":"integer","title":"Api Calls","default":0},"input_tokens":{"type":"integer","title":"Input Tokens","default":0},"output_tokens":{"type":"integer","title":"Output Tokens","default":0},"total_tokens":{"type":"integer","title":"Total Tokens","default":0},"llm_calls":{"type":"integer","title":"Llm Calls","default":0},"data_processed_mb":{"type":"number","title":"Data Processed Mb","default":0.0},"request_count":{"type":"integer","title":"Request Count","default":0}},"type":"object","title":"UsageMetrics","description":"Usage metrics for a period."},"UsageRangeResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"},"totals":{"$ref":"#/components/schemas/UsageMetrics"},"daily_breakdown":{"items":{"$ref":"#/components/schemas/DailyUsageResponse"},"type":"array","title":"Daily Breakdown","default":[]}},"type":"object","required":["tenant_id","start_date","end_date","totals"],"title":"UsageRangeResponse","description":"Usage for a date range."},"UserMeResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"tenant_id":{"type":"string","title":"Tenant Id"},"role_id":{"type":"string","title":"Role Id"},"role_name":{"type":"string","title":"Role Name"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"status":{"type":"string","title":"Status"},"has_api_key":{"type":"boolean","title":"Has Api Key"}},"type":"object","required":["user_id","email","tenant_id","role_id","role_name","scopes","status","has_api_key"],"title":"UserMeResponse","description":"Current user profile"},"UserRegisterRequest":{"properties":{"email":{"type":"string","title":"Email"},"callback_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Url"},"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password"},"skip_email_verification":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Skip Email Verification","default":false},"app_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Scope"}},"type":"object","required":["email"],"title":"UserRegisterRequest","description":"Request for user self-registration"},"UserRegisterResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"tenant_id":{"type":"string","title":"Tenant Id"},"verification_required":{"type":"boolean","title":"Verification Required","default":true},"session_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Token"}},"type":"object","required":["success","message","user_id","email","tenant_id"],"title":"UserRegisterResponse","description":"Response after registration (pending verification)"},"UserUsageResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"user_id":{"type":"string","title":"User Id"},"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"},"totals":{"$ref":"#/components/schemas/UsageMetrics"},"days_with_usage":{"type":"integer","title":"Days With Usage"}},"type":"object","required":["tenant_id","user_id","start_date","end_date","totals","days_with_usage"],"title":"UserUsageResponse","description":"Per-user usage response."},"UserVerifyRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"UserVerifyRequest","description":"Request to verify email"},"UserVerifyResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"api_key":{"type":"string","title":"Api Key"},"api_key_id":{"type":"string","title":"Api Key Id"}},"type":"object","required":["success","message","user_id","email","tenant_id","role","scopes","api_key","api_key_id"],"title":"UserVerifyResponse","description":"Response after verification (includes API key)"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerificationRequest":{"properties":{"token":{"type":"string","title":"Token","description":"Verification token from email"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant ID from signup"}},"type":"object","required":["token","tenant_id"],"title":"VerificationRequest","description":"Email verification request"},"VerificationResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"api_key":{"type":"string","title":"Api Key"},"dashboard_url":{"type":"string","title":"Dashboard Url"},"documentation_url":{"type":"string","title":"Documentation Url","default":"https://docs.flowstack.fun/quickstart"},"message":{"type":"string","title":"Message","default":"Email verified successfully!"}},"type":"object","required":["tenant_id","api_key","dashboard_url"],"title":"VerificationResponse","description":"Email verification response with API key"},"WalletAuthResponse":{"properties":{"session_token":{"type":"string","title":"Session Token"},"tenant_id":{"type":"string","title":"Tenant Id"},"user_id":{"type":"string","title":"User Id"},"wallet_address":{"type":"string","title":"Wallet Address"},"expires_at":{"type":"string","title":"Expires At"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"}},"type":"object","required":["session_token","tenant_id","user_id","wallet_address","expires_at"],"title":"WalletAuthResponse"},"WalletLinkRequest":{"properties":{"message":{"type":"string","title":"Message"},"signature":{"type":"string","title":"Signature"}},"type":"object","required":["message","signature"],"title":"WalletLinkRequest"},"sage_agent__api__routes__admin__QueryRequest":{"properties":{"query":{"type":"string","title":"Query"},"session_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Session Id"},"workspace_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workspace Id"}},"type":"object","required":["query"],"title":"QueryRequest"},"sage_agent__api__routes__streaming__Attachment":{"properties":{"filename":{"type":"string","title":"Filename"},"content_type":{"type":"string","title":"Content Type"},"data":{"type":"string","title":"Data"}},"type":"object","required":["filename","content_type","data"],"title":"Attachment","description":"A file attachment included with a streaming query."},"sage_agent__mono_sage__api__stream__Attachment":{"properties":{"filename":{"type":"string","title":"Filename"},"content_type":{"type":"string","title":"Content Type"},"data":{"type":"string","title":"Data"}},"type":"object","required":["filename","content_type","data"],"title":"Attachment"}}}}