{"openapi":"3.1.0","info":{"title":"SeedQL API","description":"Generate realistic, referentially-consistent test data for a SQL database.\n\n**Authentication.** Every endpoint takes `Authorization: Bearer <token>`. Two credential types are accepted:\n\n* an **API key** (`sk_live_...`) for scripts and CI. Mint one from Settings while signed in. This is what you want for automation.\n* a **Supabase session token**, used by the web app itself.\n\nClick **Authorize** and paste an API key to try any endpoint below.\n\nThe operator console (`/api/admin/*`) is intentionally absent from this document and refuses API keys outright: it requires an interactive login.","version":"0.3.0"},"paths":{"/api/auth/me":{"get":{"summary":"Me","description":"Return the authenticated user's app.users row.\n\nStable contract for the frontend's /api/auth/me consumers (settings\npage, tier badge, role-aware UI). Token validation, app.users lookup,\nand soft-delete check all happen inside `get_current_user`.","operationId":"me_api_auth_me_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"summary":"Update Me","description":"Update the caller's own profile. Only `display_name` is mutable.\n\nAlways scoped to the token holder — there is no user_id parameter, so\nthis endpoint cannot be pointed at another account.","operationId":"update_me_api_auth_me_patch","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProfileRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/tiers":{"get":{"summary":"List Tiers","description":"List the catalog of tiers the user can upgrade to. Authenticated so\na leaked endpoint URL doesn't leak the price card to scrapers.","operationId":"list_tiers_api_billing_tiers_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"},"title":"Response List Tiers Api Billing Tiers Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/me":{"get":{"summary":"Billing Me","operationId":"billing_me_api_billing_me_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingMe"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/upgrade":{"post":{"summary":"Upgrade Tier","description":"Create a Stripe Checkout session for the requested tier upgrade.\n\nQA3-01 (Cycle 4): this endpoint **no longer changes User.tier**. Only\nthe Stripe webhook handler (POST /api/webhooks/stripe) — gated by\nsignature validation — can write tier. That makes the endpoint safe\nto expose without payment guarantees breaking.\n\nErrors:\n  • 409 — already on requested tier\n  • 422 — Pydantic catches unknown tier (Literal validator)\n  • 400 — paid tier without a Stripe Price ID configured (e.g.\n          \"enterprise\" with the contact-sales pattern)\n  • 503 — Stripe not configured (dev / staging without a real key)","operationId":"upgrade_tier_api_billing_upgrade_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpgradeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/intent":{"post":{"summary":"Record Purchase Intent","operationId":"record_purchase_intent_api_billing_intent_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseIntentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseIntentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals":{"post":{"summary":"Create Approval Request","description":"Create a pending approval request.\n\nUAT3-07 (Cycle 3.6 hardening): gated to editor/admin/owner via\n`require_role`. Viewers are read-only per PMO §2.1 (\"Option A:\nviewer = read-only\"); the `/restore/check` endpoint already\nsurfaces 403 for them, but defense-in-depth requires the same\ngate at the create boundary so a direct-API client (curl, hostile\nFE, Postman) cannot bypass the UI check. 403 carries the\nstructured `{error: insufficient_role, required: [...], got: ...}`\nbody produced by `require_role`.\n\nAdmins/owners typically arrive here only when surfacing requests on\nbehalf of editors; they normally bypass the request flow entirely\nvia `/restore/check` returning allowed=True.","operationId":"create_approval_request_api_approvals_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRequestBody"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRequestPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Approvals","description":"List approvals visible to the caller.\n\nVisibility rules (DESIGN §5):\n  • viewers / editors → only their own requests (always); `mine=True`\n    is implicit for them\n  • admins / owners → all requests, optionally filtered by project\n    and/or status\n\nFilters: `status_filter` matches the row's `status`; `kind` filters\nby approval kind; `project_id` scopes to one project.","operationId":"list_approvals_api_approvals_get","parameters":[{"name":"mine","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Mine"}},{"name":"status_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status Filter"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals/{request_id}":{"get":{"summary":"Get Approval Detail","description":"Fetch a single request + its append-only audit trail.\n\nViewable by the requester OR any admin/owner. Members trying to\nread another member's request get a 404 (don't leak existence).","operationId":"get_approval_detail_api_approvals__request_id__get","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals/{request_id}/approve":{"post":{"summary":"Approve Request","description":"Admin/Owner approves. Note optional.","operationId":"approve_request_api_approvals__request_id__approve_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalDecisionBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRequestPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals/{request_id}/deny":{"post":{"summary":"Deny Request","description":"Admin/Owner denies. `note` is REQUIRED — lifecycle enforces.","operationId":"deny_request_api_approvals__request_id__deny_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalDecisionBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRequestPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals/{request_id}/cancel":{"post":{"summary":"Cancel Request","description":"Requester cancels own pending request.","operationId":"cancel_request_api_approvals__request_id__cancel_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRequestPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals/{request_id}/consume":{"post":{"summary":"Consume Request","description":"Requester consumes approved request. Content-hash bound.\n\nUAT3-07 (Cycle 3.6 hardening): viewers were able to reach this\nendpoint directly via API even though the UI never offers it to\nthem. Gated to editor/admin/owner via `require_role` for the same\ndefense-in-depth reasoning as `create_approval_request`. The\nlifecycle layer enforces the existing \"requester-only\" check\nindependently — this gate is strictly additive.","operationId":"consume_request_api_approvals__request_id__consume_post","parameters":[{"name":"request_id","in":"path","required":true,"schema":{"type":"string","title":"Request Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsumeBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRequestPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals/restore/check":{"post":{"summary":"Restore Check","description":"Tell the client whether direct restore is allowed for this\nuser + target, or whether an approval request is required.\n\nAdmin / owner → always allowed.\nViewer        → not allowed at all (read-only); return 403.\nEditor        → must file approval; surface existing pending if any.","operationId":"restore_check_api_approvals_restore_check_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreCheckBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RestoreCheckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/approvals/branch/record":{"post":{"summary":"Record Branch","description":"Record a branch_created audit event. Editor / admin / owner only —\nviewers cannot branch per PMO §2.4 (role-gate enforced by\nrequire_role).","operationId":"record_branch_api_approvals_branch_record_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BranchRecordBody"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Record Branch Api Approvals Branch Record Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/notifications":{"get":{"summary":"List Notifications","description":"List notifications for the current user, newest first.\n\n`unread_only=True` is the bell-counter query the topbar uses. The\nfull list is limited to 200 rows; pagination is a Cycle-6 hardening\nitem (filed in the backlog alongside per-org TTL config).","operationId":"list_notifications_api_notifications_get","parameters":[{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Unread Only"}},{"name":"kind","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kind"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationList"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/notifications/{notification_id}/read":{"post":{"summary":"Mark Read","description":"Mark one notification as read. Only the owning user can mark\ntheir own; cross-user attempts return 404 (don't leak existence).","operationId":"mark_read_api_notifications__notification_id__read_post","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"integer","title":"Notification Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Mark Read Api Notifications  Notification Id  Read Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/notifications/read-all":{"post":{"summary":"Mark All Read","description":"Mark every unread notification as read in one query. Returns\nthe count flipped so the FE can update the bell badge without a\nfollow-up GET.","operationId":"mark_all_read_api_notifications_read_all_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Mark All Read Api Notifications Read All Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs/{job_id}":{"get":{"summary":"Get Job Status","description":"Current envelope for `job_id`.\n\nLock 12: `pushed_to_db` is derived from `status == completed AND\nrows_pushed == rows_requested`; partial/failed/cancelled report false\nwith the actual `rows_pushed`.","operationId":"get_job_status_api_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Job Status Api Jobs  Job Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/jobs/{job_id}/cancel":{"post":{"summary":"Cancel Job Endpoint","description":"Request cancellation. The runner polls and transitions to CANCELLED at\nthe next safe checkpoint. Always returns the LATEST envelope.","operationId":"cancel_job_endpoint_api_jobs__job_id__cancel_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Cancel Job Endpoint Api Jobs  Job Id  Cancel Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/stripe":{"post":{"summary":"Stripe Webhook","description":"Stripe webhook ingress.\n\nReturns 200 with `{received, applied, idempotent}` on success.\nReturns 400 on signature failure.\nReturns 503 if Stripe is not configured (defensive — shouldn't happen\nin production because of the fail-closed startup check, and\nshouldn't be called in dev).","operationId":"stripe_webhook_api_webhooks_stripe_post","parameters":[{"name":"stripe-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Stripe Webhook Api Webhooks Stripe Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/bmc":{"post":{"summary":"Bmc Webhook","description":"BMC webhook ingress.\n\nReturns 200 with `{received, applied, idempotent, detail}` on success.\nReturns 400 on signature failure; 503 when the secret is unconfigured.\nAlways 200 for verified-but-odd payloads (BMC retries non-2xx).","operationId":"bmc_webhook_api_webhooks_bmc_post","parameters":[{"name":"x-signature-sha256","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Signature-Sha256"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Bmc Webhook Api Webhooks Bmc Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contact":{"post":{"summary":"Submit Contact","operationId":"submit_contact_api_contact_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactLeadIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/requests":{"post":{"summary":"Submit Capacity Request","operationId":"submit_capacity_request_api_requests_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CapacityRequestIn"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/orgs":{"get":{"summary":"List Orgs","description":"List every org this user is a member of, with their role.","operationId":"list_orgs_api_orgs_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects":{"get":{"summary":"List Projects","operationId":"list_projects_api_projects_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProjectWithMeta"},"title":"Response List Projects Api Projects Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Project","operationId":"create_project_api_projects_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}":{"get":{"summary":"Get Project","description":"E2.2-Prereqs (L58): single-project fetch in the FE-compatible shape.\nThe project detail pages (`projects/[id]/*`) need this; previously they\nread the whole list from localStorage and `.find()`-ed.","operationId":"get_project_api_projects__project_id__get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectWithMeta"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"summary":"Update Project","operationId":"update_project_api_projects__project_id__patch","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Project","operationId":"delete_project_api_projects__project_id__delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/snapshots":{"get":{"summary":"List Snapshots","operationId":"list_snapshots_api_projects__project_id__snapshots_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SnapshotPublic"},"title":"Response List Snapshots Api Projects  Project Id  Snapshots Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Snapshot","operationId":"create_snapshot_api_projects__project_id__snapshots_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SnapshotCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SnapshotPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/generations":{"get":{"summary":"List Generations","operationId":"list_generations_api_projects__project_id__generations_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GenerationPublic"},"title":"Response List Generations Api Projects  Project Id  Generations Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Generation","description":"Create a generation record in 'queued' status. The engine (or a\nbackground job) flips status to running/completed/failed and writes\nrows_generated as it progresses. We do NOT execute the engine\nsynchronously here — that contract belongs to the existing\n/api/generate route in routes.py (untouched this cycle). This route\nis the record-of-intent.","operationId":"create_generation_api_projects__project_id__generations_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/generations":{"get":{"summary":"List Generations For Org","description":"Generation runs across the org. The automation view of History.","operationId":"list_generations_for_org_api_generations_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/GenerationPublic"},"title":"Response List Generations For Org Api Generations Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/snapshots":{"get":{"summary":"List Snapshots For Org","description":"Snapshots across the org, including those captured by schedules.","operationId":"list_snapshots_for_org_api_snapshots_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/SnapshotPublic"},"title":"Response List Snapshots For Org Api Snapshots Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/templates":{"get":{"summary":"List Templates","description":"List all available data generation templates.","operationId":"list_templates_api_templates_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Template E2","description":"Org-scoped template create. (E2 surface — distinct path from the\nlegacy /api/templates built-in catalog in routes.py.)","operationId":"create_template_e2_api_templates_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatePublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/exports/{export_id}/download":{"get":{"summary":"Download Export","description":"Return a short-lived signed URL or download token. The real\nSupabase-Storage signed-URL mint is delegated to the storage layer\n(Cycle E2.1 wires in `supabase.storage.from_().createSignedUrl(...)`).\nFor Phase 3 we return the storage_path + audit the download intent.","operationId":"download_export_api_exports__export_id__download_get","parameters":[{"name":"export_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Export Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Download Export Api Exports  Export Id  Download Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/audit-log":{"get":{"summary":"List Audit Log","description":"Read the org's audit log. Admin/owner-only (enforced server-side\nAND by RLS). The RLS policy is the canonical gate; this in-app\ncheck provides a clearer 403 detail.","operationId":"list_audit_log_api_audit_log_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditLogPublic"},"title":"Response List Audit Log Api Audit Log Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/audit-log":{"get":{"summary":"List Project Audit Log","description":"Project-scoped audit log for the per-project admin area (TIER 1).\n\nGated on _require_project_role(owner/admin) — a project editor/viewer\nor a non-member is refused (403). Scoped to the project's org AND the\nproject as audit target (target_id = project_id), so a project admin\nsees the project's own events without the whole org's audit stream\n(which stays on the platform-owner console / org admin/owner view).","operationId":"list_project_audit_log_api_projects__project_id__audit_log_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AuditLogPublic"},"title":"Response List Project Audit Log Api Projects  Project Id  Audit Log Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/orgs/{org_id}/invitations":{"post":{"summary":"Create Invitation","description":"Invite a user by email. Owner/admin only. Sends via Resend (or dev\nlog-fallback). The invite row is the source of truth; email is best-\neffort (the row persists even if send fails).","operationId":"create_invitation_api_orgs__org_id__invitations_post","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitationPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Invitations","operationId":"list_invitations_api_orgs__org_id__invitations_get","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/InvitationPublic"},"title":"Response List Invitations Api Orgs  Org Id  Invitations Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/orgs/{org_id}/invitations/{inv_id}":{"delete":{"summary":"Revoke Invitation","operationId":"revoke_invitation_api_orgs__org_id__invitations__inv_id__delete","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"inv_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Inv Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/orgs/{org_id}/members":{"get":{"summary":"List Members","description":"List members + roles. Any member may read the roster.","operationId":"list_members_api_orgs__org_id__members_get","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MemberPublic"},"title":"Response List Members Api Orgs  Org Id  Members Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/orgs/{org_id}/members/{member_user_id}":{"patch":{"summary":"Change Member Role","description":"Change a member's role. Owner/admin only. Cannot demote the last owner.","operationId":"change_member_role_api_orgs__org_id__members__member_user_id__patch","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"member_user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member User Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleChange"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Remove Member","description":"Remove a member. Owner/admin only. Cannot remove the last owner.","operationId":"remove_member_api_orgs__org_id__members__member_user_id__delete","parameters":[{"name":"org_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"member_user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member User Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/my-role":{"get":{"summary":"Get My Project Role","description":"Return the caller's effective project role + capability flags. 403 if\nthe caller has no access to the project (mirrors _require_project_access).","operationId":"get_my_project_role_api_projects__project_id__my_role_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyProjectRole"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/members":{"get":{"summary":"List Project Members","description":"List a project's members + roles. Any project member (or org\nowner/admin via override) may read the roster.","operationId":"list_project_members_api_projects__project_id__members_get","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ProjectMemberPublic"},"title":"Response List Project Members Api Projects  Project Id  Members Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Add Project Member","description":"Add a member to a project. Project owner/admin (or org owner/admin)\nonly. The target user must already belong to the project's org.","operationId":"add_project_member_api_projects__project_id__members_post","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectMemberAdd"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectMemberPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/projects/{project_id}/members/{member_user_id}":{"patch":{"summary":"Change Project Member Role","description":"Change a project member's role. Owner/admin only. Cannot demote\nthe last project owner.","operationId":"change_project_member_role_api_projects__project_id__members__member_user_id__patch","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"member_user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member User Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectRoleChange"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProjectMemberPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Remove Project Member","description":"Remove a member from a project. Owner/admin only. Cannot remove\nthe last project owner.","operationId":"remove_project_member_api_projects__project_id__members__member_user_id__delete","parameters":[{"name":"project_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Project Id"}},{"name":"member_user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Member User Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/activity":{"get":{"summary":"List Activity","description":"Recent activity for an org (any member). UI-friendly projection of\nthe audit_log — note audit_log SELECT RLS is admin/owner only, but\n*activity feed* is broader, so we membership-gate here and read via the\nservice-role backend connection (the in-app gate is the boundary).","operationId":"list_activity_api_activity_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ActivityEntry"},"title":"Response List Activity Api Activity Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/usage":{"get":{"summary":"Get Usage","description":"Org's total rows generated + the caller's tier request-limit. Any\nmember may read.","operationId":"get_usage_api_usage_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/usage/history":{"get":{"summary":"Usage History","description":"Generation runs (newest first). Org-wide, or one project when\nproject_id is given. Scoped to projects the caller can access.","operationId":"usage_history_api_usage_history_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UsageHistoryRow"},"title":"Response Usage History Api Usage History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/usage/series":{"get":{"summary":"Usage Series","description":"Rows generated over time, bucketed daily (range=30d) or monthly\n(range=12m). Bucketing is done in Python off the ISO timestamp prefix\nso it is identical on SQLite (TEXT) and Postgres (timestamptz) — no\ndate_trunc/strftime dialect split.","operationId":"usage_series_api_usage_series_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"range","in":"query","required":false,"schema":{"type":"string","pattern":"^(30d|12m)$","default":"30d","title":"Range"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UsageSeriesPoint"},"title":"Response Usage Series Api Usage Series Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/usage/by-project":{"get":{"summary":"Usage By Project","description":"Total rows + run count per project, biggest first. Scoped to\nprojects the caller can access.","operationId":"usage_by_project_api_usage_by_project_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UsageByProjectRow"},"title":"Response Usage By Project Api Usage By Project Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/run-approvals":{"post":{"summary":"Create Run Approval","operationId":"create_run_approval_api_run_approvals_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Run Approvals","operationId":"list_run_approvals_api_run_approvals_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"project_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Project Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/RunApprovalPublic"},"title":"Response List Run Approvals Api Run Approvals Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/run-approvals/{approval_id}/approve":{"post":{"summary":"Approve Run Approval","operationId":"approve_run_approval_api_run_approvals__approval_id__approve_post","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalDecision"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/run-approvals/{approval_id}/reject":{"post":{"summary":"Reject Run Approval","operationId":"reject_run_approval_api_run_approvals__approval_id__reject_post","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalDecision"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/run-approvals/{approval_id}/cancel":{"post":{"summary":"Cancel Run Approval","operationId":"cancel_run_approval_api_run_approvals__approval_id__cancel_post","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/run-approvals/{approval_id}/consume":{"post":{"summary":"Consume Run Approval","operationId":"consume_run_approval_api_run_approvals__approval_id__consume_post","parameters":[{"name":"approval_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Approval Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunApprovalPublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/exports":{"get":{"summary":"List Exports","operationId":"list_exports_api_exports_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ExportPublic"},"title":"Response List Exports Api Exports Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/exports/{export_id}":{"delete":{"summary":"Revoke Export","description":"Revoke an export. Project owner/admin (or org owner/admin via the\noverride). Expires it immediately + records audit.","operationId":"revoke_export_api_exports__export_id__delete","parameters":[{"name":"export_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Export Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/templates/{template_id}":{"patch":{"summary":"Update Template","operationId":"update_template_api_templates__template_id__patch","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplatePublic"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Template","description":"Hard-delete a template (admin/owner). Templates have no soft-delete\ncolumn; the row is removed and the action audited.","operationId":"delete_template_api_templates__template_id__delete","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/redeem":{"post":{"summary":"Redeem Promo","description":"Queue a promo-code redemption for operator approval.\n\nNote this requires only a signed-in user, NOT admin/owner — unlike the\nBMC purchase-intent endpoint. A promo is a free personal trial rather\nthan a workspace purchase, so gating it behind workspace-admin would lock\nout exactly the individual developers a Product Hunt launch brings in.\nThe approval step is what makes that safe.","operationId":"redeem_promo_api_billing_redeem_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/redeem/mine":{"get":{"summary":"My Claim","description":"Status of the caller's own claim, so the page can show 'pending'.","operationId":"my_claim_api_billing_redeem_mine_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyClaimResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/community/posts":{"get":{"summary":"List Posts","operationId":"list_posts_api_community_posts_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"},"title":"Response List Posts Api Community Posts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Post","operationId":"create_post_api_community_posts_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Create Post Api Community Posts Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/community/posts/{post_id}":{"get":{"summary":"Get Post","operationId":"get_post_api_community_posts__post_id__get","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Post Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Get Post Api Community Posts  Post Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Post","operationId":"delete_post_api_community_posts__post_id__delete","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Post Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Delete Post Api Community Posts  Post Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/community/posts/{post_id}/comments":{"post":{"summary":"Add Comment","operationId":"add_comment_api_community_posts__post_id__comments_post","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Post Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CommentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Add Comment Api Community Posts  Post Id  Comments Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/community/posts/{post_id}/like":{"post":{"summary":"Like Post","operationId":"like_post_api_community_posts__post_id__like_post","parameters":[{"name":"post_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Post Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Like Post Api Community Posts  Post Id  Like Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/community/comments/{comment_id}":{"delete":{"summary":"Delete Comment","operationId":"delete_comment_api_community_comments__comment_id__delete","parameters":[{"name":"comment_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Comment Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Delete Comment Api Community Comments  Comment Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/keys":{"post":{"summary":"Create Key","operationId":"create_key_api_keys_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKeyRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Create Key Api Keys Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Keys","operationId":"list_keys_api_keys_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"},"title":"Response List Keys Api Keys Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/keys/{key_id}":{"delete":{"summary":"Revoke Key","operationId":"revoke_key_api_keys__key_id__delete","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Key Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Revoke Key Api Keys  Key Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/schedules":{"get":{"summary":"List Schedules","operationId":"list_schedules_api_schedules_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"},"title":"Response List Schedules Api Schedules Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Create Schedule","operationId":"create_schedule_api_schedules_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Create Schedule Api Schedules Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/schedule-runs":{"get":{"summary":"List Schedule Runs For Org","description":"Every scheduled fire across the org, newest first.\n\nExists for automation: a monitoring job answers \"did last night's backups\nrun?\" in one request rather than walking each schedule's /runs.","operationId":"list_schedule_runs_for_org_api_schedule_runs_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","format":"uuid","title":"Org Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"},"title":"Response List Schedule Runs For Org Api Schedule Runs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/schedules/{schedule_id}":{"patch":{"summary":"Patch Schedule","operationId":"patch_schedule_api_schedules__schedule_id__patch","parameters":[{"name":"schedule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Schedule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchedulePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Patch Schedule Api Schedules  Schedule Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Remove Schedule","operationId":"remove_schedule_api_schedules__schedule_id__delete","parameters":[{"name":"schedule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Schedule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Remove Schedule Api Schedules  Schedule Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/schedules/{schedule_id}/run":{"post":{"summary":"Run Now","description":"Manual fire (\"Run now\"). Same capture path as the worker, same\nentitlement re-check, and next_run_at is NOT advanced: an ad-hoc capture\nshould not postpone the scheduled one.","operationId":"run_now_api_schedules__schedule_id__run_post","parameters":[{"name":"schedule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Schedule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Run Now Api Schedules  Schedule Id  Run Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/schedules/{schedule_id}/runs":{"get":{"summary":"Schedule Runs","operationId":"schedule_runs_api_schedules__schedule_id__runs_get","parameters":[{"name":"schedule_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Schedule Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object"},"title":"Response Schedule Runs Api Schedules  Schedule Id  Runs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test-connection":{"post":{"summary":"Test Conn","description":"Test database connectivity.","operationId":"test_conn_api_test_connection_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestConnectionResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/introspect":{"post":{"summary":"Introspect","description":"Introspect a database schema.","operationId":"introspect_api_introspect_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaInfo-Output"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/generate":{"post":{"summary":"Generate","description":"Generate test data and export in the requested format.\n\nReturns the exported data plus precise usage metadata in headers:\n- X-Total-Rows: exact billing-grade row count\n- X-Per-Table: JSON of per-table counts\n- X-Seed: seed used (for reproducibility)\n- X-Elapsed: generation time","operationId":"generate_api_generate_post","parameters":[{"name":"X-Org-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Org-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/generate/push":{"post":{"summary":"Generate And Push","description":"Generate data and push it directly into the connected database.\n\nReturns precise usage data for billing.","operationId":"generate_and_push_api_generate_push_post","parameters":[{"name":"X-Org-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Org-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/generate/push-async":{"post":{"summary":"Generate And Push Async","description":"Enqueue a generate+push as a durable background job → 202 + job_id.\n\nThe offload path for large pushes: the request returns immediately and\nthe per-process jobs worker (app/jobs/worker.py) executes outside the\nrequest cycle, so a 10M-row push can no longer starve other users.\nClients poll GET /api/jobs/{job_id} (Lock 12 envelope).\n\nFail-fast parity with the sync path: the tier/credit gate (402) and the\nlive-target schema/table pre-flight (400) run at ENQUEUE time, so a bad\nrequest is rejected instantly instead of becoming a doomed queued job.\n\nDeliberately `def` (not `async def`): FastAPI runs it in the threadpool,\nso the pre-flight connection to the user's DB never blocks the event\nloop — unlike the legacy sync handler this endpoint exists to replace.\n\nSecurity: the connection string is Fernet-encrypted at rest in the job\nrow (key derived from SECRET_KEY), never placed in payload_summary or\nany response, and wiped on terminal transition (migration 014).","operationId":"generate_and_push_async_api_generate_push_async_post","parameters":[{"name":"X-Org-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Org-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/data/push":{"post":{"summary":"Push Edited Data","description":"Push pre-generated / user-edited data directly into the connected DB.\n\nThe Data Editor lets users mutate rows after a generation run; this\nendpoint takes the resulting payload and INSERTs it into the live DB\nwithout re-running the generator. Reuses the existing pusher so all\nthe FK ordering, batching, and TRUNCATE-on-request behaviour is\nidentical to /generate/push — the only difference is the data source.\n\nErrors during INSERT (FK violations, NOT NULL on a column the user\nblanked, type mismatches from edits) are reported back per-table in\nthe response so the UI can highlight which rows are wrong.","operationId":"push_edited_data_api_data_push_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataPushRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/data/push-incremental":{"post":{"summary":"Push Incremental","description":"Apply row-level mutations (INSERT/UPDATE/DELETE) to the connected DB.\n\nThis is the v3 \"tweak a few rows, push only the diff\" path that lets\nusers iterate without TRUNCATE. Each mutation set is bound to a\ntable; the handler walks the supplied table list and applies:\n\n    1. DELETEs in REVERSE table order (children first) so FK\n       constraints don't fire when removing parent rows whose\n       children already went away.\n    2. INSERTs in FORWARD table order (parents first) so child rows\n       always find their FK target.\n    3. UPDATEs in forward table order (order rarely matters for\n       UPDATE, but consistent is friendlier in logs).\n\nThe whole thing runs in one transaction — any single failure rolls\nevery mutation back, so partial state never lands in the DB. We\nreturn per-op counts so the UI can show \"12 updated, 3 inserted, 2\ndeleted across 4 tables.\"","operationId":"push_incremental_api_data_push_incremental_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncrementalPushRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/generate/quick":{"post":{"summary":"Quick Generate","description":"Generate data from a pre-built template without a DB connection.\n\nAccepts an optional JSON body with per-table row counts, e.g.\n{\"organizations\": 1, \"users\": 10}.  When provided, those exact\ncounts are used and only the listed tables are enabled.  When\nomitted, falls back to the template defaults scaled by\nrow_multiplier.\n\nReturns data plus precise usage metadata.","operationId":"quick_generate_api_generate_quick_post","parameters":[{"name":"template","in":"query","required":false,"schema":{"type":"string","default":"ecommerce","title":"Template"}},{"name":"row_multiplier","in":"query","required":false,"schema":{"type":"number","default":1.0,"title":"Row Multiplier"}},{"name":"export_format","in":"query","required":false,"schema":{"type":"string","default":"json","title":"Export Format"}},{"name":"seed","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"}},{"name":"X-Org-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Org-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":{"type":"integer"}},{"type":"null"}],"title":"Table Rows"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/generate/custom":{"post":{"summary":"Custom Generate","description":"Generate data from a user-defined schema passed inline.","operationId":"custom_generate_api_generate_custom_post","parameters":[{"name":"X-Org-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Org-Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomGenerateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/templates/{template_id}/schema":{"get":{"summary":"Get Template Schema Endpoint","description":"Full SchemaInfo (tables + columns + constraints + FKs) for one template.\n\nThe frontend calls this when a user picks a template from /projects/new so\nthe project is created with the real column shape up-front — otherwise the\nproject page renders \"0 cols\" until the first generate, which leaves app\nteams guessing whether they need to edit the schema.","operationId":"get_template_schema_endpoint_api_templates__template_id__schema_get","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaInfo-Output"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/regex/preview":{"post":{"summary":"Regex Preview","description":"Validate a regex pattern and return sample generations.\n\nRequest body: {\"pattern\": \"[A-Z]{3}-\\d{4}\", \"count\": 5}\nResponse:     {\"valid\": true, \"samples\": [...]} on success, or\n              {\"valid\": false, \"error\": \"...\"} on bad pattern.","operationId":"regex_preview_api_regex_preview_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Root","description":"Small landing route so the backend URL isn't a bare 404.","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ActivityEntry":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"actor_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor User Id"},"action":{"type":"string","title":"Action"},"target_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Type"},"target_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Id"},"metadata":{"type":"object","title":"Metadata"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","organization_id","actor_user_id","action","target_type","target_id","metadata","created_at"],"title":"ActivityEntry"},"ApprovalDecisionBody":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Note"}},"type":"object","title":"ApprovalDecisionBody","description":"Inbound body for /approve and /deny. note is REQUIRED on deny;\nenforced by the lifecycle layer."},"ApprovalDetail":{"properties":{"request":{"$ref":"#/components/schemas/ApprovalRequestPublic"},"events":{"items":{"$ref":"#/components/schemas/ApprovalEventPublic"},"type":"array","title":"Events"}},"type":"object","required":["request","events"],"title":"ApprovalDetail","description":"Wire shape for GET /api/approvals/{id} — request + audit trail."},"ApprovalEventPublic":{"properties":{"id":{"type":"integer","title":"Id"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"actor_id":{"type":"integer","title":"Actor Id"},"event_type":{"type":"string","title":"Event Type"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"project_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Id"},"payload_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payload Json"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","request_id","actor_id","event_type","note","ip_address","project_id","payload_json","created_at"],"title":"ApprovalEventPublic"},"ApprovalList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ApprovalRequestPublic"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"ApprovalList"},"ApprovalRequestPublic":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind"},"status":{"type":"string","title":"Status"},"target_kind":{"type":"string","title":"Target Kind"},"target_id":{"type":"string","title":"Target Id"},"target_project_id":{"type":"string","title":"Target Project Id"},"snapshot_content_hash":{"type":"string","title":"Snapshot Content Hash"},"requester_id":{"type":"integer","title":"Requester Id"},"reviewer_id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reviewer Id"},"summary_json":{"type":"string","title":"Summary Json"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"review_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Note"},"consumed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consumed At"},"is_terminal":{"type":"boolean","title":"Is Terminal"}},"type":"object","required":["id","kind","status","target_kind","target_id","target_project_id","snapshot_content_hash","requester_id","reviewer_id","summary_json","created_at","updated_at","expires_at","review_note","consumed_at","is_terminal"],"title":"ApprovalRequestPublic","description":"Wire shape returned by all approval endpoints. Includes derived\n`is_terminal` so the FE doesn't have to enumerate terminal states."},"AuditLogPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"actor_user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Actor User Id"},"action":{"type":"string","title":"Action"},"target_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Type"},"target_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Target Id"},"metadata":{"type":"object","title":"Metadata"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","organization_id","actor_user_id","action","target_type","target_id","metadata","created_at"],"title":"AuditLogPublic"},"BillingMe":{"properties":{"user":{"$ref":"#/components/schemas/UserPublic"},"tier":{"type":"string","enum":["free","pro","platinum","enterprise"],"title":"Tier"},"rows_per_request":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rows Per Request"}},"type":"object","required":["user","tier","rows_per_request"],"title":"BillingMe"},"BranchRecordBody":{"properties":{"project_id":{"type":"string","maxLength":64,"minLength":1,"title":"Project Id"},"parent_snapshot_id":{"type":"string","maxLength":64,"minLength":1,"title":"Parent Snapshot Id"},"new_snapshot_id":{"type":"string","maxLength":64,"minLength":1,"title":"New Snapshot Id"}},"type":"object","required":["project_id","parent_snapshot_id","new_snapshot_id"],"title":"BranchRecordBody","description":"Inbound body for /branch/record. F3 branching emits an audit\nrow but creates no approval request."},"CapacityRequestIn":{"properties":{"email":{"type":"string","maxLength":254,"minLength":3,"title":"Email"},"request_type":{"type":"string","maxLength":40,"title":"Request Type","default":"rows"},"amount":{"type":"string","maxLength":200,"title":"Amount","default":""},"current_tier":{"type":"string","maxLength":40,"title":"Current Tier","default":""},"message":{"type":"string","maxLength":2000,"title":"Message","default":""},"website":{"type":"string","maxLength":200,"title":"Website","default":""}},"type":"object","required":["email"],"title":"CapacityRequestIn"},"CheckoutSessionResponse":{"properties":{"checkout_url":{"type":"string","title":"Checkout Url"},"session_id":{"type":"string","title":"Session Id"},"tier":{"type":"string","enum":["free","pro","platinum","enterprise"],"title":"Tier"}},"type":"object","required":["checkout_url","session_id","tier"],"title":"CheckoutSessionResponse","description":"Returned by POST /upgrade — frontend redirects to `url`."},"ColumnInfo":{"properties":{"name":{"type":"string","title":"Name"},"data_type":{"type":"string","title":"Data Type"},"is_primary_key":{"type":"boolean","title":"Is Primary Key","default":false},"is_nullable":{"type":"boolean","title":"Is Nullable","default":true},"is_unique":{"type":"boolean","title":"Is Unique","default":false},"is_foreign_key":{"type":"boolean","title":"Is Foreign Key","default":false},"fk_table":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fk Table"},"fk_column":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fk Column"},"default_value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Value"},"max_length":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Length"},"enum_values":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Enum Values"},"check_values":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Check Values"},"check_pattern":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Check Pattern"},"check_min":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Check Min"},"check_max":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Check Max"},"detected_generator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detected Generator"}},"type":"object","required":["name","data_type"],"title":"ColumnInfo"},"ColumnOverride":{"properties":{"generator":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Generator"},"params":{"type":"object","title":"Params","default":{}}},"type":"object","title":"ColumnOverride"},"CommentCreate":{"properties":{"body":{"type":"string","maxLength":5000,"minLength":1,"title":"Body"}},"type":"object","required":["body"],"title":"CommentCreate"},"ConnectionRequest":{"properties":{"db_type":{"$ref":"#/components/schemas/DBType","default":"postgresql"},"connection_string":{"type":"string","title":"Connection String"},"schema_name":{"type":"string","title":"Schema Name","default":"public"}},"type":"object","required":["connection_string"],"title":"ConnectionRequest"},"ConsumeBody":{"properties":{"snapshot_content_hash":{"type":"string","maxLength":64,"minLength":64,"pattern":"^[0-9a-f]{64}$","title":"Snapshot Content Hash"}},"type":"object","required":["snapshot_content_hash"],"title":"ConsumeBody","description":"Inbound body for /consume. Carries the SHA-256 of the snapshot\nbytes the consumer is about to restore — server recomputes vs the\nstored hash and rejects on mismatch (PMO §2.2)."},"ContactLeadIn":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"email":{"type":"string","maxLength":254,"minLength":3,"title":"Email"},"country":{"type":"string","maxLength":80,"minLength":1,"title":"Country"},"phone":{"type":"string","maxLength":40,"minLength":3,"title":"Phone"},"company":{"type":"string","maxLength":160,"minLength":1,"title":"Company"},"message":{"type":"string","maxLength":2000,"title":"Message","default":""},"website":{"type":"string","maxLength":200,"title":"Website","default":""}},"type":"object","required":["name","email","country","phone","company"],"title":"ContactLeadIn"},"ContactResponse":{"properties":{"ok":{"type":"boolean","title":"Ok"}},"type":"object","required":["ok"],"title":"ContactResponse"},"CreateKeyRequest":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"organization_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Organization Id"}},"type":"object","required":["name"],"title":"CreateKeyRequest"},"CreateRequestBody":{"properties":{"kind":{"type":"string","const":"snapshot_restore","title":"Kind","default":"snapshot_restore"},"target_kind":{"type":"string","const":"snapshot","title":"Target Kind","default":"snapshot"},"target_id":{"type":"string","maxLength":64,"minLength":1,"title":"Target Id"},"target_project_id":{"type":"string","maxLength":64,"minLength":1,"title":"Target Project Id"},"snapshot_content_hash":{"type":"string","maxLength":64,"minLength":64,"pattern":"^[0-9a-f]{64}$","title":"Snapshot Content Hash","description":"Lower-case hex SHA-256 of canonical-JSON snapshot payload"},"summary_json":{"type":"string","maxLength":8192,"title":"Summary Json","description":"Human-readable digest surfaced to reviewers"}},"type":"object","required":["target_id","target_project_id","snapshot_content_hash","summary_json"],"title":"CreateRequestBody","description":"Inbound body for POST /api/approvals.\n\n`kind` is the operation type ('snapshot_restore' is the only kind\nin 0.3.0). `target_id` is the snapshot id; `target_project_id`\nscopes the approval to a project (per Q-3 disposition). The\n`snapshot_content_hash` binds the approval to specific bytes\n(PMO §2.2)."},"CustomGenerateRequest":{"properties":{"schema":{"$ref":"#/components/schemas/SchemaInfo-Input"},"tables":{"items":{"$ref":"#/components/schemas/TableGenConfig"},"type":"array","title":"Tables","default":[]},"export_format":{"$ref":"#/components/schemas/ExportFormat","default":"json"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"}},"type":"object","required":["schema"],"title":"CustomGenerateRequest","description":"Generate from a user-defined schema sent inline (no DB connection).\n\nThe frontend keeps the template definition in localStorage and\nships the full `schema` on every request. No database access\nhappens — the schema feeds straight into the generation engine.\n\nNote: the inbound JSON uses `schema` as the field name for\nergonomics. We alias to `schema_def` internally because `schema`\nis a reserved attribute on Pydantic BaseModel."},"DBType":{"type":"string","enum":["postgresql"],"title":"DBType"},"DataPushRequest":{"properties":{"connection":{"$ref":"#/components/schemas/ConnectionRequest"},"data":{"additionalProperties":{"items":{"type":"object"},"type":"array"},"type":"object","title":"Data"},"table_order":{"items":{"type":"string"},"type":"array","title":"Table Order"},"truncate_first":{"type":"boolean","title":"Truncate First","default":false},"truncate_cascade":{"type":"boolean","title":"Truncate Cascade","default":false}},"type":"object","required":["connection","data","table_order"],"title":"DataPushRequest","description":"Push *pre-generated* (and possibly user-edited) data into a database.\n\nDistinct from PushRequest: this endpoint does NOT re-run the generator.\nIt takes an explicit `data` payload that already lives in the\nfrontend's IndexedDB (typically after the user edited rows in the\nData Editor) and INSERTs it as-is. This is what powers the\n\"Push edits to database\" flow on /projects/[id]/data/[runId].\n\ntable_order is the topologically-sorted parent-first table list that\nthe pusher needs for FK-safe inserts. The frontend computes it from\nthe introspected schema and passes it through."},"ExportFormat":{"type":"string","enum":["sql","csv","json"],"title":"ExportFormat"},"ExportPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"generation_id":{"type":"string","format":"uuid","title":"Generation Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"format":{"type":"string","title":"Format"},"storage_path":{"type":"string","title":"Storage Path"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","generation_id","organization_id","format","storage_path","expires_at","created_at"],"title":"ExportPublic"},"GenerateRequest":{"properties":{"connection":{"$ref":"#/components/schemas/ConnectionRequest"},"tables":{"items":{"$ref":"#/components/schemas/TableGenConfig"},"type":"array","title":"Tables"},"export_format":{"$ref":"#/components/schemas/ExportFormat","default":"sql"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"}},"type":"object","required":["connection","tables"],"title":"GenerateRequest"},"GenerationCreate":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"},"rows_generated":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rows Generated"},"tables_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tables Count"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},"type":"object","required":["project_id"],"title":"GenerationCreate"},"GenerationPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"created_by":{"type":"string","format":"uuid","title":"Created By"},"rows_generated":{"type":"integer","title":"Rows Generated"},"tables_count":{"type":"integer","title":"Tables Count"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"},"status":{"type":"string","title":"Status"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","project_id","organization_id","created_by","rows_generated","tables_count","seed","status","error_message","started_at","completed_at","created_at"],"title":"GenerationPublic"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IncrementalPushRequest":{"properties":{"connection":{"$ref":"#/components/schemas/ConnectionRequest"},"mutations":{"items":{"$ref":"#/components/schemas/TableMutations"},"type":"array","title":"Mutations"}},"type":"object","required":["connection","mutations"],"title":"IncrementalPushRequest","description":"Apply row-level INSERT/UPDATE/DELETE mutations to a database.\n\nThis powers the v3 \"push tweaks without truncate\" flow. Mutations\narrive grouped by table in parent-first FK order. The handler\nDELETEs in reverse, INSERTs in forward, then UPDATEs — all inside a\nsingle transaction so partial failures roll back."},"InvitationCreate":{"properties":{"email":{"type":"string","maxLength":320,"pattern":"^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$","title":"Email"},"role":{"type":"string","enum":["viewer","editor","admin","owner"],"title":"Role","default":"editor"}},"type":"object","required":["email"],"title":"InvitationCreate"},"InvitationPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"status":{"type":"string","title":"Status"},"invited_by":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Invited By"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","organization_id","email","role","status","invited_by","expires_at","created_at"],"title":"InvitationPublic"},"MemberPublic":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"email":{"type":"string","title":"Email"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"role":{"type":"string","enum":["viewer","editor","admin","owner"],"title":"Role"},"joined_at":{"type":"string","format":"date-time","title":"Joined At"}},"type":"object","required":["user_id","email","role","joined_at"],"title":"MemberPublic"},"MyClaimResponse":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},"type":"object","title":"MyClaimResponse"},"MyProjectRole":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"role":{"type":"string","enum":["owner","admin","editor","data_fabricator","approver","viewer"],"title":"Role"},"can_manage_members":{"type":"boolean","title":"Can Manage Members"},"can_generate":{"type":"boolean","title":"Can Generate"},"can_review_approvals":{"type":"boolean","title":"Can Review Approvals"},"can_delete_project":{"type":"boolean","title":"Can Delete Project"}},"type":"object","required":["project_id","role","can_manage_members","can_generate","can_review_approvals","can_delete_project"],"title":"MyProjectRole","description":"The current user's effective role + derived capability flags for a\nproject. Stage 4 frontend reads this to gate UI (generate/push, approval\nreview, member management) without re-deriving the rules client-side."},"NotificationList":{"properties":{"items":{"items":{"$ref":"#/components/schemas/NotificationPublic"},"type":"array","title":"Items"},"unread_count":{"type":"integer","title":"Unread Count"}},"type":"object","required":["items","unread_count"],"title":"NotificationList"},"NotificationPublic":{"properties":{"id":{"type":"integer","title":"Id"},"kind":{"type":"string","title":"Kind"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"},"project_id":{"type":"string","title":"Project Id"},"payload_json":{"type":"string","title":"Payload Json"},"read_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Read At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","kind","request_id","project_id","payload_json","read_at","created_at"],"title":"NotificationPublic"},"OrgMembershipPublic":{"properties":{"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"organization_name":{"type":"string","title":"Organization Name"},"organization_slug":{"type":"string","title":"Organization Slug"},"role":{"type":"string","enum":["viewer","editor","admin","owner"],"title":"Role"},"plan_tier":{"type":"string","enum":["free","pro","platinum","enterprise"],"title":"Plan Tier"},"joined_at":{"type":"string","format":"date-time","title":"Joined At"}},"type":"object","required":["organization_id","organization_name","organization_slug","role","plan_tier","joined_at"],"title":"OrgMembershipPublic","description":"One org-membership row from the user's POV."},"OrgsResponse":{"properties":{"memberships":{"items":{"$ref":"#/components/schemas/OrgMembershipPublic"},"type":"array","title":"Memberships"}},"type":"object","required":["memberships"],"title":"OrgsResponse"},"PostCreate":{"properties":{"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"body":{"type":"string","maxLength":10000,"minLength":1,"title":"Body"}},"type":"object","required":["title","body"],"title":"PostCreate"},"ProjectCreate":{"properties":{"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Description"},"engine":{"type":"string","enum":["postgresql","mysql","sqlite"],"title":"Engine","default":"postgresql"},"schema_name":{"type":"string","maxLength":120,"minLength":1,"title":"Schema Name","default":"public"}},"type":"object","required":["organization_id","name"],"title":"ProjectCreate"},"ProjectMemberAdd":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"role":{"type":"string","enum":["owner","admin","editor","data_fabricator","approver","viewer"],"title":"Role","default":"viewer"}},"type":"object","required":["user_id"],"title":"ProjectMemberAdd"},"ProjectMemberPublic":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"email":{"type":"string","title":"Email"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"role":{"type":"string","enum":["owner","admin","editor","data_fabricator","approver","viewer"],"title":"Role"},"added_by":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Added By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["user_id","email","role","added_by","created_at"],"title":"ProjectMemberPublic"},"ProjectPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"created_by":{"type":"string","format":"uuid","title":"Created By"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"engine":{"type":"string","title":"Engine"},"schema_name":{"type":"string","title":"Schema Name"},"settings":{"type":"object","title":"Settings"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","organization_id","created_by","name","description","engine","schema_name","settings","created_at","updated_at"],"title":"ProjectPublic"},"ProjectRoleChange":{"properties":{"role":{"type":"string","enum":["owner","admin","editor","data_fabricator","approver","viewer"],"title":"Role"}},"type":"object","required":["role"],"title":"ProjectRoleChange"},"ProjectUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Description"},"schema_name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Schema Name"},"settings":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Settings"}},"type":"object","title":"ProjectUpdate"},"ProjectWithMeta":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"created_by":{"type":"string","format":"uuid","title":"Created By"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"engine":{"type":"string","title":"Engine"},"schema_name":{"type":"string","title":"Schema Name"},"settings":{"type":"object","title":"Settings"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"source":{"type":"string","title":"Source"},"schema_json":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Schema Json"},"last_generated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Generated At"},"total_rows_generated":{"type":"integer","title":"Total Rows Generated","default":0}},"type":"object","required":["id","organization_id","created_by","name","description","engine","schema_name","settings","created_at","updated_at","source"],"title":"ProjectWithMeta","description":"E2.2-Prereqs (L58) — FE-compatible Project shape.\n\nAdds the four fields the FE `Project` model renders that the bare\n`app.projects` row does not carry. Sourced via correlated subqueries\n(portable across the SQLite unit-test substrate and live Postgres);\nthe canonical Postgres-native equivalent is the security_invoker view\n`app.projects_with_meta` in migration 005, which the live RLS test\nprobes directly."},"PurchaseIntentRequest":{"properties":{"tier":{"type":"string","enum":["free","pro","platinum","enterprise"],"title":"Tier"}},"type":"object","required":["tier"],"title":"PurchaseIntentRequest"},"PurchaseIntentResponse":{"properties":{"ok":{"type":"boolean","title":"Ok"},"tier":{"type":"string","title":"Tier"},"account_email":{"type":"string","title":"Account Email"},"note_hint":{"type":"string","title":"Note Hint"}},"type":"object","required":["ok","tier","account_email","note_hint"],"title":"PurchaseIntentResponse"},"PushRequest":{"properties":{"connection":{"$ref":"#/components/schemas/ConnectionRequest"},"tables":{"items":{"$ref":"#/components/schemas/TableGenConfig"},"type":"array","title":"Tables"},"truncate_first":{"type":"boolean","title":"Truncate First","default":false},"truncate_cascade":{"type":"boolean","title":"Truncate Cascade","default":false},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"}},"type":"object","required":["connection","tables"],"title":"PushRequest","description":"Push generated data directly into the connected database."},"RedeemRequest":{"properties":{"code":{"type":"string","maxLength":64,"minLength":1,"title":"Code"}},"type":"object","required":["code"],"title":"RedeemRequest"},"RedeemResponse":{"properties":{"status":{"type":"string","title":"Status"},"code":{"type":"string","title":"Code"},"label":{"type":"string","title":"Label"},"blurb":{"type":"string","title":"Blurb"},"created":{"type":"boolean","title":"Created"},"message":{"type":"string","title":"Message"}},"type":"object","required":["status","code","label","blurb","created","message"],"title":"RedeemResponse"},"RestoreCheckBody":{"properties":{"target_id":{"type":"string","maxLength":64,"minLength":1,"title":"Target Id"},"target_project_id":{"type":"string","maxLength":64,"minLength":1,"title":"Target Project Id"}},"type":"object","required":["target_id","target_project_id"],"title":"RestoreCheckBody","description":"Inbound body for /restore/check. The frontend asks before\ninitiating a restore whether the actor needs to file an approval."},"RestoreCheckResponse":{"properties":{"allowed":{"type":"boolean","title":"Allowed"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"request_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Request Id"}},"type":"object","required":["allowed"],"title":"RestoreCheckResponse","description":"Response shape for /restore/check.\n\n`allowed=True` → the actor can call restore directly (admin/owner).\n`allowed=False` → the actor must file (or surface an existing)\napproval request. `request_id` is populated when a pending approval\nfor the same target already exists, so the UI doesn't create\nduplicates."},"RoleChange":{"properties":{"role":{"type":"string","enum":["viewer","editor","admin","owner"],"title":"Role"}},"type":"object","required":["role"],"title":"RoleChange"},"RowUpdate":{"properties":{"pk":{"type":"object","title":"Pk"},"values":{"type":"object","title":"Values"}},"type":"object","required":["pk","values"],"title":"RowUpdate","description":"One row's worth of UPDATE — `pk` for WHERE, `values` for SET."},"RunApprovalCreate":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"kind":{"type":"string","title":"Kind"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"summary_json":{"type":"object","title":"Summary Json","default":{}},"expires_in_hours":{"type":"integer","title":"Expires In Hours","default":72}},"type":"object","required":["project_id","kind"],"title":"RunApprovalCreate"},"RunApprovalDecision":{"properties":{"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","title":"RunApprovalDecision"},"RunApprovalPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"kind":{"type":"string","title":"Kind"},"status":{"type":"string","title":"Status"},"requested_by":{"type":"string","format":"uuid","title":"Requested By"},"reviewed_by":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Reviewed By"},"reviewed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Reviewed At"},"review_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Review Note"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"},"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"summary_json":{"type":"object","title":"Summary Json"},"expires_at":{"type":"string","format":"date-time","title":"Expires At"},"consumed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Consumed At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"requester_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Requester Email"},"reviewer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewer Email"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"}},"type":"object","required":["id","organization_id","project_id","kind","status","requested_by","reviewed_by","reviewed_at","review_note","reason","run_id","mode","summary_json","expires_at","consumed_at","created_at","updated_at"],"title":"RunApprovalPublic"},"ScheduleCreate":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"interval_minutes":{"type":"integer","maximum":43200.0,"minimum":15.0,"title":"Interval Minutes"}},"type":"object","required":["project_id","name","interval_minutes"],"title":"ScheduleCreate"},"SchedulePatch":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"interval_minutes":{"anyOf":[{"type":"integer","maximum":43200.0,"minimum":15.0},{"type":"null"}],"title":"Interval Minutes"},"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"}},"type":"object","title":"SchedulePatch"},"SchemaInfo-Input":{"properties":{"tables":{"items":{"$ref":"#/components/schemas/TableInfo"},"type":"array","title":"Tables"},"total_columns":{"type":"integer","title":"Total Columns"},"total_fks":{"type":"integer","title":"Total Fks"},"db_type":{"type":"string","title":"Db Type"},"db_version":{"type":"string","title":"Db Version","default":""},"schema_name":{"type":"string","title":"Schema Name","default":"public"}},"type":"object","required":["tables","total_columns","total_fks","db_type"],"title":"SchemaInfo"},"SchemaInfo-Output":{"properties":{"tables":{"items":{"$ref":"#/components/schemas/TableInfo"},"type":"array","title":"Tables"},"total_columns":{"type":"integer","title":"Total Columns"},"total_fks":{"type":"integer","title":"Total Fks"},"db_type":{"type":"string","title":"Db Type"},"db_version":{"type":"string","title":"Db Version","default":""},"schema_name":{"type":"string","title":"Schema Name","default":"public"}},"type":"object","required":["tables","total_columns","total_fks","db_type"],"title":"SchemaInfo"},"SnapshotCreate":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"label":{"type":"string","maxLength":200,"minLength":1,"title":"Label"},"schema_json":{"type":"object","title":"Schema Json"},"content_hash":{"anyOf":[{"type":"string","maxLength":64,"minLength":64},{"type":"null"}],"title":"Content Hash"},"pinned":{"type":"boolean","title":"Pinned","default":false}},"type":"object","required":["project_id","label"],"title":"SnapshotCreate"},"SnapshotPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"created_by":{"type":"string","format":"uuid","title":"Created By"},"label":{"type":"string","title":"Label"},"schema_json":{"type":"object","title":"Schema Json"},"content_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Hash"},"pinned":{"type":"boolean","title":"Pinned"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","project_id","organization_id","created_by","label","content_hash","pinned","created_at"],"title":"SnapshotPublic"},"TableGenConfig":{"properties":{"table_name":{"type":"string","title":"Table Name"},"row_count":{"type":"integer","maximum":500000.0,"minimum":1.0,"title":"Row Count"},"enabled":{"type":"boolean","title":"Enabled","default":true},"column_overrides":{"additionalProperties":{"$ref":"#/components/schemas/ColumnOverride"},"type":"object","title":"Column Overrides","default":{}}},"type":"object","required":["table_name","row_count"],"title":"TableGenConfig"},"TableInfo":{"properties":{"name":{"type":"string","title":"Name"},"schema_name":{"type":"string","title":"Schema Name","default":"public"},"columns":{"items":{"$ref":"#/components/schemas/ColumnInfo"},"type":"array","title":"Columns"},"row_count":{"type":"integer","title":"Row Count","default":0},"estimated_gen_rows":{"type":"integer","title":"Estimated Gen Rows","default":100},"unique_constraints":{"items":{"items":{"type":"string"},"type":"array"},"type":"array","title":"Unique Constraints","default":[]}},"type":"object","required":["name","columns"],"title":"TableInfo"},"TableMutations":{"properties":{"table":{"type":"string","title":"Table"},"inserts":{"items":{"type":"object"},"type":"array","title":"Inserts","default":[]},"updates":{"items":{"$ref":"#/components/schemas/RowUpdate"},"type":"array","title":"Updates","default":[]},"deletes":{"items":{"type":"object"},"type":"array","title":"Deletes","default":[]}},"type":"object","required":["table"],"title":"TableMutations","description":"All mutations targeting a single table, grouped by op."},"TemplateCreate":{"properties":{"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Description"},"body_json":{"type":"object","title":"Body Json"},"is_public":{"type":"boolean","title":"Is Public","default":false}},"type":"object","required":["organization_id","name","body_json"],"title":"TemplateCreate"},"TemplatePublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"created_by":{"type":"string","format":"uuid","title":"Created By"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"body_json":{"type":"object","title":"Body Json"},"is_public":{"type":"boolean","title":"Is Public"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","organization_id","created_by","name","description","body_json","is_public","created_at","updated_at"],"title":"TemplatePublic"},"TemplateUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Description"},"body_json":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Body Json"},"is_public":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Public"}},"type":"object","title":"TemplateUpdate"},"TestConnectionResult":{"properties":{"success":{"type":"boolean","title":"Success"},"version":{"type":"string","title":"Version","default":""},"message":{"type":"string","title":"Message","default":""},"latency_ms":{"type":"number","title":"Latency Ms","default":0},"tables_found":{"type":"integer","title":"Tables Found","default":0}},"type":"object","required":["success"],"title":"TestConnectionResult"},"UpdateProfileRequest":{"properties":{"display_name":{"anyOf":[{"type":"string","maxLength":60},{"type":"null"}],"title":"Display Name"}},"type":"object","title":"UpdateProfileRequest","description":"Set or clear the caller's display name.\n\n`display_name: null` (or an empty/whitespace string) CLEARS it, which\nrestores the derive-from-email default rather than leaving a blank name."},"UpgradeRequest":{"properties":{"tier":{"type":"string","enum":["free","pro","platinum","enterprise"],"title":"Tier","description":"Target tier id (one of TIER_CATALOG ids)"}},"type":"object","required":["tier"],"title":"UpgradeRequest"},"UsageByProjectRow":{"properties":{"project_id":{"type":"string","format":"uuid","title":"Project Id"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"rows_generated":{"type":"integer","title":"Rows Generated"},"run_count":{"type":"integer","title":"Run Count"}},"type":"object","required":["project_id","rows_generated","run_count"],"title":"UsageByProjectRow"},"UsageHistoryRow":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"project_id":{"type":"string","format":"uuid","title":"Project Id"},"project_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Project Name"},"rows_generated":{"type":"integer","title":"Rows Generated"},"tables_count":{"type":"integer","title":"Tables Count"},"status":{"type":"string","title":"Status"},"seed":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seed"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","project_id","rows_generated","tables_count","status","created_at"],"title":"UsageHistoryRow"},"UsageSeriesPoint":{"properties":{"bucket":{"type":"string","title":"Bucket"},"rows_generated":{"type":"integer","title":"Rows Generated"},"run_count":{"type":"integer","title":"Run Count"}},"type":"object","required":["bucket","rows_generated","run_count"],"title":"UsageSeriesPoint"},"UsageSummary":{"properties":{"organization_id":{"type":"string","format":"uuid","title":"Organization Id"},"tier":{"type":"string","title":"Tier"},"rows_generated":{"type":"integer","title":"Rows Generated"},"rows_per_request_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rows Per Request Limit"},"bonus_balance":{"type":"integer","title":"Bonus Balance","default":0},"rows_available_per_request":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Rows Available Per Request"}},"type":"object","required":["organization_id","tier","rows_generated","rows_per_request_limit"],"title":"UsageSummary"},"UserPublic":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"email":{"type":"string","title":"Email"},"tier":{"type":"string","title":"Tier"},"role":{"type":"string","title":"Role","default":"editor"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"is_platform_owner":{"type":"boolean","title":"Is Platform Owner","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","email","tier","created_at"],"title":"UserPublic","description":"The shape returned by /api/auth/me. Stable contract for frontend."},"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"}},"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","description":"An API key (sk_live_...) for automation, or a Supabase session token. Paste the value only, without the word Bearer."}}},"security":[{"BearerAuth":[]}]}