{"openapi":"3.1.0","info":{"title":"Every API","description":"API for the Every application","version":"0.1.0"},"paths":{"/stripe/account":{"post":{"tags":["stripe"],"summary":"Create Account","description":"Create a new Stripe Connect account or return existing one.","operationId":"create_account_stripe_account_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stripe/account_link":{"post":{"tags":["stripe"],"summary":"Create Account Link","description":"Create an account link for onboarding a Stripe Connect account.","operationId":"create_account_link_stripe_account_link_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountLinkRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountLinkResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stripe/account/{account_id}":{"get":{"tags":["stripe"],"summary":"Get Account","description":"Get a Stripe Connect account by ID.","operationId":"get_account_stripe_account__account_id__get","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}},{"name":"user_id","in":"query","required":true,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stripe/account/{account_id}/status":{"get":{"tags":["stripe"],"summary":"Get Account Status","description":"Check if a Stripe Connect account has completed onboarding.","operationId":"get_account_status_stripe_account__account_id__status_get","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountStatusResponse"}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stripe/webhook":{"post":{"tags":["stripe"],"summary":"Stripe Webhook","description":"Handle Stripe webhook events, specifically for Checkout Sessions.","operationId":"stripe_webhook_stripe_webhook_post","parameters":[{"name":"stripe-signature","in":"header","required":false,"schema":{"type":"string","title":"Stripe-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/stripe/create-checkout-session/{public_id}":{"post":{"tags":["stripe"],"summary":"Create Checkout Session","description":"Create a Stripe Checkout session for a public invoice.","operationId":"create_checkout_session_stripe_create_checkout_session__public_id__post","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/resend/webhook":{"post":{"tags":["resend"],"summary":"Resend Webhook","description":"Handle Resend webhook events.","operationId":"resend_webhook_resend_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"404":{"description":"Not found"}}}},"/clerk/webhooks":{"post":{"tags":["clerk"],"summary":"Clerk Webhook","description":"Handle Clerk webhook events.","operationId":"clerk_webhook_clerk_webhooks_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Clerk Webhook Clerk Webhooks Post"}}}},"404":{"description":"Not found"}}}},"/":{"get":{"summary":"Root","operationId":"root__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health":{"get":{"summary":"Health Check","operationId":"health_check","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/user/last-active":{"get":{"summary":"Get User Last Active","description":"Get the user's last_active_at timestamp from Clerk backend API","operationId":"get_user_last_active_user_last_active_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/user/welcome-email":{"post":{"summary":"Trigger Welcome Email","description":"Send the standard welcome email once onboarding is complete.","operationId":"trigger_welcome_email_api_user_welcome_email_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/enrich-client-enhanced":{"post":{"tags":["Client Enrichment"],"summary":"Enrich Client Enhanced","description":"Enhanced client enrichment endpoint with unified flow.\n\nThis endpoint:\n1. Fetches org context (org_prompt, org_defaults) for the agent\n2. Runs the Client Enrichment Agent which:\n   - Enriches ALL contacts using Google context + LinkedIn\n   - Determines if client is individual or business\n   - Enriches client data accordingly\n3. Handles save behavior based on source:\n   - 'clientform': Returns data only (no auto-save)\n   - 'frontend'/'agent': Auto-saves to database\n\nModes:\n- 'full': Overwrites all client fields with enriched data\n- 'fill_empty': Only fills fields that are currently empty","operationId":"enrich_client_enhanced_api_enrich_client_enhanced_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnhancedEnrichmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnhancedEnrichmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/enrich-contact":{"post":{"tags":["Client Enrichment"],"summary":"Enrich Single Contact","description":"Enrich a single contact with data from Google and web sources.\n\nThis endpoint is designed for enriching individual contacts on the ClientView page.\nIt uses the contact_enrichment_agent to find:\n- Job title\n- Phone number\n- LinkedIn profile\n- Other social links","operationId":"enrich_single_contact_api_enrich_contact_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnrichmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactEnrichmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/enrich-contact-preview":{"post":{"tags":["Client Enrichment"],"summary":"Enrich Contact Preview","description":"Enrich a contact without saving to the database.\n\nThis endpoint is designed for the ClientForm page where contacts may not\nbe saved yet. It runs the contact enrichment agent and returns the\nenriched data for the frontend to populate form fields.\n\nUnlike /enrich-contact, this does NOT:\n- Require a contact_id\n- Save any data to the database\n- Create entity_links\n\nIt simply returns the enriched data for preview/form population.","operationId":"enrich_contact_preview_api_enrich_contact_preview_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactPreviewEnrichmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactPreviewEnrichmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/enrich-company":{"post":{"tags":["Client Enrichment"],"summary":"Enrich Company Data","description":"DEPRECATED: Use /enrich-client-enhanced instead.\n\nThis endpoint is kept for backward compatibility only.","operationId":"enrich_company_data_api_enrich_company_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegacyCompanyEnrichmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contacts/import-finalize":{"post":{"tags":["Client Enrichment"],"summary":"Finalize Contact Import","description":"Finalize an imported contact batch and trigger guarded auto-enrichment.\n\nTrust boundary: LinkedIn/Google browser import modals currently insert\ncontacts directly through Supabase, so the backend cannot write a receipt in\nthe same commit. For a receipt not already written by a server import path,\nthis endpoint creates it only after proving every supplied contact belongs\nto the authenticated organization. Newly inserted IDs must have\n``created_at`` within the last 24 hours; matched existing IDs must carry a\ncurrent-user ``contact_known_by`` edge for the claimed Google/LinkedIn\nimport source. Those checks limit which direct-client writes may be claimed\nas an import; they are not proof that the client performed the original write.","operationId":"finalize_contact_import_api_contacts_import_finalize_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFinalizeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFinalizeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/bulk-enrich":{"post":{"tags":["Client Enrichment"],"summary":"Bulk Enrich","description":"Bulk enrich contacts or clients.\n\nThin HTTP wrapper over `bulk_enrich_entities` — the shared implementation\nthe `enrich_contacts` chat tool also calls, so both surfaces write the same\nstructured fields, status stamp, and per-entity enrichment event.","operationId":"bulk_enrich_api_bulk_enrich_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkEnrichRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkEnrichResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/create-thread":{"post":{"tags":["Thread Management"],"summary":"Create Thread","description":"Creates a new thread row.\n\nWHO ACTUALLY CALLS THIS:\n  - `mcp_server/admin/handlers/assistant.py` (the admin MCP server at\n    mcp.every.ai). External AI integrations like Claude.ai and ChatGPT\n    invoke the `ask_assistant` MCP tool, which POSTs here to seed a thread\n    before streaming agent output.\n\nWHO DOES NOT:\n  - The web app (every-react) creates threads via a direct Supabase insert\n    in `packages/agent-chat/contexts/ThreadContext.tsx` — RLS-protected.\n  - The mobile app (every-mobile-app) does the same in\n    `src/stores/threadStore.ts`.\n\nstorage_mode is always \"session\"; the threads table column has the same\nNOT NULL default, so direct Supabase inserts land on the same value.\n\nIdempotency: protected by `idempotency_guard` so MCP retries don't create\nduplicate threads. The MCP server doesn't send `X-Idempotency-Key` today\nbut the guard is in place for future retry logic.\n\nthread_data.metadata (optional) is merged as-is into the threads row's\njsonb `metadata` column — e.g. the MCP handler stamps\n{\"source\": \"chatgpt\"|\"claude\"|\"mcp\"} so non-app clients are attributable\nwithout inferring it from the hardcoded thread name.","operationId":"create_thread_api_create_thread_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateThreadRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/clear-thread/{thread_id}":{"post":{"tags":["Thread Management"],"summary":"Clear Thread","description":"Clears the message history and conversation history for a specific thread.","operationId":"clear_thread_api_clear_thread__thread_id__post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the thread to clear","title":"Thread Id"},"description":"The ID of the thread to clear"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/update-thread-name/{thread_id}":{"post":{"tags":["Thread Management"],"summary":"Update Thread Name Route","description":"Generates a name for the thread based on its conversation history using an AI agent\nand updates the thread record in the database.","operationId":"update_thread_name_route_api_update_thread_name__thread_id__post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the thread to name","title":"Thread Id"},"description":"The ID of the thread to name"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/delete-thread/{thread_id}":{"post":{"tags":["Thread Management"],"summary":"Delete Thread","description":"Permanently deletes a thread and its dependent data.\n\nThis endpoint first deletes all messages for the thread to satisfy\nforeign key constraints, then deletes the thread itself. If the\nthread is using session storage, the session is closed and any\npersisted data is cleaned up by the session manager.","operationId":"delete_thread_api_delete_thread__thread_id__post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the thread to delete","title":"Thread Id"},"description":"The ID of the thread to delete"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/analyze-receipt":{"post":{"tags":["Agent Chat"],"summary":"Analyze Receipt","operationId":"analyze_receipt_api_analyze_receipt_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_analyze_receipt_api_analyze_receipt_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-chat-message-stream-progress":{"post":{"tags":["Agent Chat"],"summary":"Stream Agent Response With Progress","description":"Streaming version of agent chat that provides real-time progress updates.\nUses Server-Sent Events (SSE) to stream progress and final response.","operationId":"stream_agent_response_with_progress_api_agent_chat_message_stream_progress_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatMessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-chat-message-async":{"post":{"tags":["Agent Chat"],"summary":"Send Agent Chat Message Async","description":"Durable (fire-and-forget) chat turn: enqueues an `async_chat_turn` background\njob instead of holding a connection open. For callers that can't reliably\nhold an SSE stream open long enough to see it through (e.g. a mobile\nnotification-tray reply from a backgrounded app) — the worker drives the\nturn via the same `create_agent_chat_stream` path the SSE route uses, so\nthe reply lands (and pushes) even if the caller goes away immediately\nafter the 202.\n\nIdempotent via the shared `X-Idempotency-Key` header infra (see\nsecurity/http_idempotency.py, same mechanism as /api/create-thread and\n/api/analyze-receipt): iOS can redeliver a notification action, and a\nclient-timed-out POST may have already landed server-side. Requests\nwithout the header keep today's at-least-once behavior unchanged.","operationId":"send_agent_chat_message_async_api_agent_chat_message_async_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncChatMessageRequest"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AsyncChatMessageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/system-recommendation":{"post":{"tags":["Agent Chat"],"summary":"System Recommendation","description":"Generate a system recommendation by fetching data and using every_agent.","operationId":"system_recommendation_api_system_recommendation_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Request Data"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/cancel-agent-run":{"post":{"tags":["Agent Chat"],"summary":"Cancel Agent Run","description":"Cancel an active agent run for a specific thread.","operationId":"cancel_agent_run_api_cancel_agent_run_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelRunRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/permission-requests/pending":{"get":{"tags":["Agent Chat"],"summary":"List Pending Permission Requests Route","description":"Approvals waiting on this person that have no chat thread to live in.\n\nToday that means MCP-origin requests (ChatGPT, Claude connector, Cursor, the\nEvery CLI). The destructive-write gate creates a row and waits; the push\nnotification announces it; this is where a surface can actually FIND it.\nWithout this endpoint the gate could only ever block, never be satisfied.\n\nChat-origin approvals are deliberately excluded -- they already appear inline\nin their own thread.","operationId":"list_pending_permission_requests_route_api_permission_requests_pending_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-threads/{thread_id}/permission-requests/pending":{"get":{"tags":["Agent Chat"],"summary":"List Pending Thread Permission Requests Route","description":"The approval still waiting in THIS thread, if any.\n\nThe card is pushed once over SSE and never repeated. A client whose stream\ndied before it arrived (backgrounded app, slept tab, closed chat sheet) has\nno other way to learn an approval is outstanding, so the window burns down\nagainst a user who was shown nothing. Clients call this on thread mount, on\nreturn-to-foreground, and after a stream reconnect.\n\nAuthorization mirrors POST /permission-response's chat branch:\n`fetch_authorized_thread` proves the caller may see this thread, and the\norg + thread it authorized are then applied as FILTERS on the read. Proving\nthread access without binding the query to that thread is exactly the hole\nthat let one caller answer another org's request (see\ntests/unit/test_permission_response_thread_request_binding.py) -- so the\nproof and the filter must not drift apart here either. On a shared/\norg-visible thread (plans/2026-08-05-slack-shared-channel-threads.md\namendment 3), thread access alone no longer implies \"this pending\napproval is mine\" -- `requesting_user_id` additionally excludes another\nmember's stamped request; NULL-stamped (legacy) rows are unaffected.","operationId":"list_pending_thread_permission_requests_route_api_agent_threads__thread_id__permission_requests_pending_get","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/permission-response":{"post":{"tags":["Agent Chat"],"summary":"Respond To Permission Request","description":"Respond to a permission request from the agent.\n\nWhen the agent calls send_invoice, send_proposal, or send_gmail, it emits a\npermission_request event via SSE. The frontend displays a confirmation dialog\nand calls this endpoint with the user's response.\n\nThe agent waits up to 60 seconds for a response. If no response is received,\nthe permission request times out and the tool call is denied.\n\nRequest body:\n    thread_id: The thread ID\n    request_id: The permission request ID (from the permission_request event)\n    approved: True to allow the action, False to deny\n    message: Optional message explaining the decision (shown to agent if denied)\n\nReturns:\n    success: True if the response was handled\n    message: Status message","operationId":"respond_to_permission_request_api_permission_response_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PermissionResponseRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/summary-insights":{"post":{"tags":["Summary Insights"],"summary":"Generate Summary Insights","description":"Generate AI insights for individual summary cards.\n\nThis endpoint processes one card at a time and returns insights immediately.\nThe frontend calls this endpoint in parallel for multiple cards, and each\ncard updates as soon as its insight is ready, providing a smooth user experience.","operationId":"generate_summary_insights_api_summary_insights_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SummaryInsightRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/business-dna/report":{"post":{"tags":["Business Intelligence"],"summary":"Generate Business Dna Report","description":"Create a background job for Business DNA report generation.","operationId":"generate_business_dna_report_api_business_dna_report_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessIntelligenceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessIntelligenceJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/business-intelligence/report":{"post":{"tags":["Business Intelligence"],"summary":"Generate Business Intelligence Report","description":"Deprecated alias for /business-dna/report.","operationId":"generate_business_intelligence_report_api_business_intelligence_report_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessIntelligenceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessIntelligenceJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/business-intelligence/voice-profile":{"post":{"tags":["Business Intelligence"],"summary":"Refresh Voice Profile","description":"Create a background job that refreshes the standalone voice/tone profile.","operationId":"refresh_voice_profile_api_business_intelligence_voice_profile_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceProfileRefreshRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessIntelligenceJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/business-intelligence/user-voice-profile":{"post":{"tags":["Business Intelligence"],"summary":"Refresh User Voice Profile","description":"Refresh only the authenticated member's personal Voice & Tone profile.","operationId":"refresh_user_voice_profile_api_business_intelligence_user_voice_profile_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceProfileRefreshRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessIntelligenceJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent/user-voice-profile":{"get":{"tags":["Business Intelligence"],"summary":"Get User Voice Profile","description":"Return the authenticated human's global personal voice profile.","operationId":"get_user_voice_profile_api_agent_user_voice_profile_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserVoiceProfileStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["Business Intelligence"],"summary":"Put User Voice Profile","description":"Validate and save the authenticated human's global personal voice.","operationId":"put_user_voice_profile_api_agent_user_voice_profile_put","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserVoiceProfileUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserVoiceProfileStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/business-intelligence/import-from-google-workspace":{"post":{"tags":["Business Intelligence"],"summary":"Import From Google Workspace","description":"Create a background job that imports existing clients and active deals from Gmail + Calendar.\n\nTriggered by the React signup flow alongside business_intelligence_report and\nvoice_profile_refresh. Job creates a thread named 'Importing from Inbox + Calendar'\nand runs the add-clients-and-deals-from-google-workspace skill autonomously.","operationId":"import_from_google_workspace_api_business_intelligence_import_from_google_workspace_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleWorkspaceImportRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessIntelligenceJobResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/onboarding/bootstrap-jobs":{"post":{"tags":["Business Intelligence"],"summary":"Onboarding Bootstrap Jobs","description":"Enqueue the signup-time job chain: BI + voice + add_clients(waits on BI).\n\nThis endpoint replaces the React signup flow's prior three-parallel-calls\npattern with a single backend call that wires the dependency correctly:\nadd_clients_and_deals_from_google_workspace is gated on\nbusiness_intelligence_report completing AND writing business_context.\n\nIMPORTANT: This endpoint is for ONBOARDING ONLY. Manual BI refresh\nelsewhere (POST /api/business-intelligence/report) must NOT enqueue\nadd_clients — that endpoint stays single-job by design.","operationId":"onboarding_bootstrap_jobs_api_onboarding_bootstrap_jobs_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingBootstrapJobsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhasedOnboardingBootstrapJobsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-threads/{thread_id}/undo-last-turn":{"post":{"tags":["Agent Undo"],"summary":"Undo Last Agent Turn","operationId":"undo_last_agent_turn_api_agent_threads__thread_id__undo_last_turn_post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","description":"Thread identifier","title":"Thread Id"},"description":"Thread identifier"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/score-merge-candidates":{"post":{"tags":["Contact Dedup"],"summary":"Score Merge Candidates","description":"LLM-score the org's unscored `review`-lane duplicate candidates and persist a\n`{verdict, confidence, rationale}` onto each `contact_merge_candidates` row.\norg_id/user_id come from the auth token — the body never carries org (no\ncross-org scoring). Idempotent: only rows with a null llm_verdict are scored.","operationId":"score_merge_candidates_api_score_merge_candidates_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScoreMergeCandidatesRequest","default":{"limit":40}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScoreMergeCandidatesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent/memory/raw":{"get":{"tags":["Agent Memory Viewer"],"summary":"Get Org Memory Raw","operationId":"get_org_memory_raw_api_agent_memory_raw_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/agent/messages/{message_id}/feedback-signal":{"post":{"tags":["Comms Learning Signal"],"summary":"Submit Feedback Signal","description":"Enqueue comms-learning capture for a message with saved thumbs-down\nfeedback + comment. No-op (not an error) when the message doesn't\nactually carry a thumbs-down comment yet, or isn't a recognizable\nagent-authored draft — the client is expected to call this right after\nsaving that feedback, but this endpoint never guesses at evidence.","operationId":"submit_feedback_signal_api_agent_messages__message_id__feedback_signal_post","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","description":"Message identifier","title":"Message Id"},"description":"Message identifier"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/invoices/{public_id}":{"get":{"summary":"Get Public Invoice","description":"Get a public invoice by its public ID.\n\n`draft` and `void` are intentionally viewable: the authenticated owner's\nPreview button (InvoiceView) opens this same public URL so they can see\nexactly what the client will see before sending.","operationId":"get_public_invoice_public_invoices__public_id__get","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/invoices/{public_id}/generate-pdf":{"post":{"summary":"Generate Public Invoice Pdf","description":"Generate PDF for public invoice using Playwright HTML-to-PDF","operationId":"generate_public_invoice_pdf_public_invoices__public_id__generate_pdf_post","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","description":"The public ID of the invoice to generate PDF for","title":"Public Id"},"description":"The public ID of the invoice to generate PDF for"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/invoices/{public_id}/view":{"post":{"summary":"Track Public Invoice View","description":"DEPRECATED: Use POST /public/track-view instead. Kept for backward compatibility.","operationId":"track_public_invoice_view_public_invoices__public_id__view_post","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","description":"The public ID of the invoice","title":"Public Id"},"description":"The public ID of the invoice"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/pdf":{"get":{"summary":"Generate Invoice Pdf Endpoint","description":"Generate and download PDF for an invoice","operationId":"generate_invoice_pdf_endpoint_invoices__invoice_id__pdf_get","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice to generate PDF for","title":"Invoice Id"},"description":"The ID of the invoice to generate PDF for"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/generate-pdf":{"post":{"summary":"Generate Invoice Pdf Endpoint Post","description":"Generate PDF using Playwright HTML-to-PDF","operationId":"generate_invoice_pdf_endpoint_post_invoices__invoice_id__generate_pdf_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice to generate PDF for","title":"Invoice Id"},"description":"The ID of the invoice to generate PDF for"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/invoices/{invoice_id}/duplicate":{"post":{"summary":"Duplicate Invoice","description":"Duplicate an invoice as a fresh draft for the same organization.","operationId":"duplicate_invoice_api_invoices__invoice_id__duplicate_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice to duplicate","title":"Invoice Id"},"description":"The ID of the invoice to duplicate"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Token Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/events":{"post":{"summary":"Create Invoice Event","description":"Create an invoice event and trigger HubSpot sync if applicable","operationId":"create_invoice_event_invoices__invoice_id__events_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice","title":"Invoice Id"},"description":"The ID of the invoice"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_create_invoice_event_invoices__invoice_id__events_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/send":{"post":{"summary":"Send Invoice","operationId":"send_invoice_invoices__invoice_id__send_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice to send","title":"Invoice Id"},"description":"The ID of the invoice to send"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Token Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/send-test":{"post":{"summary":"Send Test Invoice","description":"Send test invoice to specified test email instead of client email","operationId":"send_test_invoice_invoices__invoice_id__send_test_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice to send as test","title":"Invoice Id"},"description":"The ID of the invoice to send as test"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Body containing test_email, status, and optional custom_message","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/send-payment-reminder":{"post":{"summary":"Send Payment Reminder","description":"Send a payment reminder email for an invoice that is issued but not paid","operationId":"send_payment_reminder_invoices__invoice_id__send_payment_reminder_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice to send payment reminder for","title":"Invoice Id"},"description":"The ID of the invoice to send payment reminder for"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/invoices/{public_id}/payment-claims":{"get":{"summary":"Get Public Payment Claims","description":"Get all client payment claims for a public invoice by its public ID.\nThis endpoint is used by the public invoice view to show payment claim status.\n\nNote: These are client-submitted payment claims (client says \"I paid you\"),\nnot business-sent payment notifications.","operationId":"get_public_payment_claims_public_invoices__public_id__payment_claims_get","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/invoices/next-number":{"get":{"summary":"Get Next Invoice Number","description":"Get the next invoice number for the organization using atomic database function.\nThis prevents race conditions when multiple processes create invoices simultaneously.\n\nReturns:\n    {\"invoice_number\": \"INV-042\"}","operationId":"get_next_invoice_number_api_invoices_next_number_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/get-outstanding-invoices":{"get":{"summary":"Get Outstanding Invoices","description":"Fetches outstanding invoices (issued or overdue) for the current organization.","operationId":"get_outstanding_invoices","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/invoices/{invoice_id}/payment-claims":{"post":{"summary":"Create Payment Claim","description":"Create a payment claim from a client stating they've paid.\n\nNote: This is a client-submitted payment claim (client says \"I paid you\"),\nnot a business-sent payment notification.","operationId":"create_payment_claim_invoices__invoice_id__payment_claims_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice","title":"Invoice Id"},"description":"The ID of the invoice"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Payment claim data","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":"Get Payment Claims","description":"Get all client payment claims for an invoice.\n\nNote: These are client-submitted payment claims (client says \"I paid you\"),\nnot business-sent payment notifications.","operationId":"get_payment_claims_invoices__invoice_id__payment_claims_get","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the invoice","title":"Invoice Id"},"description":"The ID of the invoice"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/payment-claims/{notification_id}/confirm":{"post":{"summary":"Confirm Payment Claim","description":"Confirm a client payment claim and create actual payment record.\n\nNote: This is for client-submitted payment claims (client says \"I paid you\"),\nnot business-sent payment notifications.","operationId":"confirm_payment_claim_payment_claims__notification_id__confirm_post","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the payment claim","title":"Notification Id"},"description":"The ID of the payment claim"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Confirmation data","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/payment-claims/{notification_id}/reject":{"post":{"summary":"Reject Payment Claim","description":"Reject a client payment claim.\n\nNote: This is for client-submitted payment claims (client says \"I paid you\"),\nnot business-sent payment notifications.","operationId":"reject_payment_claim_payment_claims__notification_id__reject_post","parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the payment claim","title":"Notification Id"},"description":"The ID of the payment claim"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Rejection data","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/payments/{payment_id}/send-confirmation-email":{"post":{"summary":"Send Payment Confirmation Email","description":"Send payment confirmation email for a manual payment","operationId":"send_payment_confirmation_email_payments__payment_id__send_confirmation_email_post","parameters":[{"name":"payment_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the payment","title":"Payment Id"},"description":"The ID of the payment"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Email data","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/payments/validate-for-notifications":{"post":{"summary":"Validate Payments For Notifications","description":"Validate which payments can receive notification emails.\n\nThis is a lightweight endpoint that checks payment eligibility without actually sending emails.\nReturns categorized lists of eligible, ineligible, and already-notified payments.\n\nArgs:\n    payment_ids: List of payment IDs to validate (optional if filters provided)\n    filters: Filter criteria to fetch payment IDs (optional if payment_ids provided)\n    user_id: ID of the authenticated user (from auth middleware)\n    org_id: ID of the user's organization (from auth middleware)\n\nReturns:\n    dict: Lists of eligible_ids, ineligible_ids (with reasons), and already_notified_ids","operationId":"validate_payments_for_notifications_payments_validate_for_notifications_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Body containing payment_ids array or filters object","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/payments/send-confirmation-emails":{"post":{"summary":"Send Payment Confirmation Emails Batch","description":"Send payment confirmation emails to multiple payments in batch using Resend's batch API.\n\nThis endpoint efficiently sends payment confirmation emails for multiple payments at once,\nrespecting Resend's rate limits and batch size constraints (up to 100 emails per batch).\n\nArgs:\n    payment_ids: List of payment IDs to send confirmation emails for\n    user_id: ID of the authenticated user (from auth middleware)\n    org_id: ID of the user's organization (from auth middleware)\n\nReturns:\n    dict: Detailed results including sent_count, failed_count, skipped_count, and per-payment results\n    \nRaises:\n    HTTPException: 401 if unauthorized, 400 if invalid input, 500 if server error","operationId":"send_payment_confirmation_emails_batch_payments_send_confirmation_emails_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Body containing payment_ids array","title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/payments/{payment_id}":{"delete":{"summary":"Delete Payment With Invoice Update","description":"Delete a payment and automatically update the related invoice's payment status.\n\nThis endpoint provides intelligent payment deletion that:\n1. Validates payment ownership and permissions\n2. Automatically recalculates and updates the invoice payment status\n3. Creates an audit trail in invoice events\n4. Maintains data consistency across the system\n\nBusiness Rules:\n- Payment status is recalculated based on remaining payments\n- Invoice events are created for audit purposes\n- Only payments belonging to the authenticated organization can be deleted\n- Note: Deleting Stripe payments removes the record but does not refund through Stripe\n\nArgs:\n    payment_id: UUID of the payment to delete\n    user_id: ID of the authenticated user (from auth middleware)\n    org_id: ID of the user's organization (from auth middleware)\n\nReturns:\n    dict: Success response with updated invoice information\n    \nRaises:\n    HTTPException: 401 if unauthorized, 404 if not found, 400 if Stripe payment, 500 if server error","operationId":"delete_payment_with_invoice_update_payments__payment_id__delete","parameters":[{"name":"payment_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the payment to delete","title":"Payment Id"},"description":"The ID of the payment to delete"},{"name":"bulk_operation","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Bulk Operation"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/email-events/{resend_id}":{"get":{"summary":"Get Email Events","description":"Get email data for a specific Resend email ID.\nReturns delivery status and email details.","operationId":"get_email_events_api_email_events__resend_id__get","parameters":[{"name":"resend_id","in":"path","required":true,"schema":{"type":"string","title":"Resend Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/email-preview/contextual":{"post":{"summary":"Render Contextual Email Preview","description":"Render an email exactly as it would be sent for the given entity, without\nsending. Used by the in-dialog EmailPreviewPanel on the frontend.\n\nRead-only: never writes to DB, never sends an email.","operationId":"render_contextual_email_preview_api_email_preview_contextual_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextualPreviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextualPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/email-preview/templates":{"get":{"summary":"List Email Templates","description":"List all available email templates","operationId":"list_email_templates_api_email_preview_templates_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/email-preview/render/{template_name}":{"get":{"summary":"Render Email Template","description":"Render an email template with sample data from the user's organization","operationId":"render_email_template_api_email_preview_render__template_name__get","parameters":[{"name":"template_name","in":"path","required":true,"schema":{"type":"string","title":"Template Name"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/check-overdue":{"post":{"summary":"Trigger Overdue Check","operationId":"trigger_overdue_check_admin_check_overdue_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/oauth-token":{"get":{"tags":["google-api"],"summary":"Get Google Oauth Token","description":"Get the raw Google OAuth access token for the current user.\n\nThis is used by the frontend Google Picker to ensure it uses\nthe same OAuth session as backend API calls.","operationId":"get_google_oauth_token_api_google_oauth_token_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/status":{"get":{"tags":["google-api"],"summary":"Check Google Status","description":"Check if user has Google OAuth connected via Clerk with token validation","operationId":"check_google_status_api_google_status_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/connected":{"post":{"tags":["google-api"],"summary":"Google Connected","operationId":"google_connected_api_google_connected_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/gmail/messages":{"get":{"tags":["google-api"],"summary":"Get Gmail Messages","description":"Get Gmail messages with optional search query","operationId":"get_gmail_messages_api_google_gmail_messages_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Gmail search query","title":"Query"},"description":"Gmail search query"},{"name":"max_results","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":10,"title":"Max Results"}},{"name":"page_token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/gmail/messages/{message_id}":{"get":{"tags":["google-api"],"summary":"Get Gmail Message","description":"Get a specific Gmail message by ID","operationId":"get_gmail_message_api_google_gmail_messages__message_id__get","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"Message format: minimal, full, raw, metadata","default":"full","title":"Format"},"description":"Message format: minimal, full, raw, metadata"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/activity/events/{event_id}/preview":{"get":{"tags":["google-api"],"summary":"Get Google Activity Event Preview","description":"Read one timeline event from its authorized source Google account.","operationId":"get_google_activity_event_preview_api_google_activity_events__event_id__preview_get","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","title":"Event Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/gmail/threads":{"get":{"tags":["google-api"],"summary":"Get Gmail Threads","description":"Get Gmail threads with optional search query","operationId":"get_gmail_threads_api_google_gmail_threads_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Gmail search query","title":"Query"},"description":"Gmail search query"},{"name":"max_results","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":10,"title":"Max Results"}},{"name":"page_token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/gmail/labels":{"get":{"tags":["google-api"],"summary":"Get Gmail Labels","description":"Get Gmail labels","operationId":"get_gmail_labels_api_google_gmail_labels_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/drive/files":{"get":{"tags":["google-api"],"summary":"Get Drive Files","description":"Get Google Drive files with optional search query","operationId":"get_drive_files_api_google_drive_files_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"query","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Drive search query (e.g., 'name contains \"invoice\"')","title":"Query"},"description":"Drive search query (e.g., 'name contains \"invoice\"')"},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":10,"title":"Page Size"}},{"name":"page_token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Page Token"}},{"name":"order_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Order by field","default":"modifiedTime desc","title":"Order By"},"description":"Order by field"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/drive/files/{file_id}":{"get":{"tags":["google-api"],"summary":"Get Drive File Metadata","description":"Get metadata for a specific Google Drive file","operationId":"get_drive_file_metadata_api_google_drive_files__file_id__get","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/drive/search":{"get":{"tags":["google-api"],"summary":"Search Drive Files","description":"Search Google Drive files with filters","operationId":"search_drive_files_api_google_drive_search_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"query","in":"query","required":true,"schema":{"type":"string","description":"Search query","title":"Query"},"description":"Search query"},{"name":"file_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by file type (document, spreadsheet, presentation, pdf, image)","title":"File Type"},"description":"Filter by file type (document, spreadsheet, presentation, pdf, image)"},{"name":"max_results","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Max Results"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/drive/shared":{"get":{"tags":["google-api"],"summary":"List Shared Drive Files","description":"Return Drive files that have been shared with Every via the picker.","operationId":"list_shared_drive_files_api_google_drive_shared_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["google-api"],"summary":"Save Shared Drive Files","description":"Persist Drive file selections made via the picker.","operationId":"save_shared_drive_files_api_google_drive_shared_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DriveFileSelectionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/drive/shared/{file_id}":{"delete":{"tags":["google-api"],"summary":"Delete Shared Drive File","description":"Remove a shared Drive file record for the organization.","operationId":"delete_shared_drive_file_api_google_drive_shared__file_id__delete","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/drive/shared/{file_id}/content":{"get":{"tags":["google-api"],"summary":"Get Shared Drive File Content","description":"Get the content of a shared Drive file.","operationId":"get_shared_drive_file_content_api_google_drive_shared__file_id__content_get","parameters":[{"name":"file_id","in":"path","required":true,"schema":{"type":"string","title":"File Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/drive/download-for-chat":{"post":{"tags":["google-api"],"summary":"Download Drive Files For Chat","description":"Download Drive file contents for chat attachments.\nEstablishes permission association and returns file contents as base64.\nDoes not persist to database - temporary access only.","operationId":"download_drive_files_for_chat_api_google_drive_download_for_chat_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DriveFileForChatRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/contacts":{"get":{"tags":["google-api"],"summary":"Get Google Contacts","description":"Get user's Google contacts.\n\nAlways pulls from People API \"My Contacts\" (`people.connections`). When\n`include_other=True` (default), also pulls \"Other Contacts\" — the bucket\nGmail auto-populates from any email recipient (To/CC/BCC) the user has\nsent to. Per Google's Contacts Help docs, Other Contacts captures the full\nhistory of email recipients, so it covers what a Gmail-sent-folder scan\nwould otherwise return — without the cost of thousands of message reads.\n\n`google_account_id` (optional) selects which of the user's connected Google\naccounts to pull from; default is the primary, unchanged.\n\nReturns a single deduped list. The two buckets are merged on lowercase\nemail; My Contacts wins on collision (richer profile data).","operationId":"get_google_contacts_api_google_contacts_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"max_results","in":"query","required":false,"schema":{"type":"integer","default":100,"title":"Max Results"}},{"name":"fetch_all","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Fetch All"}},{"name":"include_other","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Include Other"}},{"name":"google_account_id","in":"query","required":false,"schema":{"type":"string","title":"Google Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/calendars":{"get":{"tags":["google-api"],"summary":"Get Google Calendars","description":"Get user's Google calendars","operationId":"get_google_calendars_api_google_calendars_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/events":{"get":{"tags":["google-api"],"summary":"Get Google Events","description":"Get events from a specific Google calendar, or all calendars if calendar_id='all'.","operationId":"get_google_events_api_google_events_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"calendar_id","in":"query","required":false,"schema":{"type":"string","default":"primary","title":"Calendar Id"}},{"name":"max_results","in":"query","required":false,"schema":{"type":"integer","default":250,"title":"Max Results"}},{"name":"time_min","in":"query","required":false,"schema":{"type":"string","title":"Time Min"}},{"name":"time_max","in":"query","required":false,"schema":{"type":"string","title":"Time Max"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/events/{event_id}":{"get":{"tags":["google-api"],"summary":"Get Google Event","description":"Get one Google Calendar event by id for a live activity preview.","operationId":"get_google_event_api_google_events__event_id__get","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","title":"Event Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"calendar_id","in":"query","required":false,"schema":{"type":"string","description":"Google calendar id; defaults to primary","default":"primary","title":"Calendar Id"},"description":"Google calendar id; defaults to primary"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/calendar/connection-status":{"get":{"tags":["google-api"],"summary":"Get Calendar Connection Status Route","description":"Check if the org owner has Google Calendar connected.","operationId":"get_calendar_connection_status_route_api_google_calendar_connection_status_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/calendar/events":{"post":{"tags":["google-api"],"summary":"Create Calendar Event","description":"Create a new Google Calendar event","operationId":"create_calendar_event_api_google_calendar_events_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/calendar/events/{event_id}":{"put":{"tags":["google-api"],"summary":"Update Calendar Event","description":"Update an existing Google Calendar event","operationId":"update_calendar_event_api_google_calendar_events__event_id__put","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","title":"Event Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"calendar_id","in":"query","required":false,"schema":{"type":"string","default":"primary","title":"Calendar Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarEventUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["google-api"],"summary":"Delete Calendar Event","description":"Delete a Google Calendar event","operationId":"delete_calendar_event_api_google_calendar_events__event_id__delete","parameters":[{"name":"event_id","in":"path","required":true,"schema":{"type":"string","title":"Event Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"calendar_id","in":"query","required":false,"schema":{"type":"string","default":"primary","title":"Calendar Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/auth-status":{"get":{"tags":["google-api"],"summary":"Get Google Auth Status","description":"Check if user has a valid Google OAuth connection.\nReturns the auth status without making any Google API calls.\nThis is a lightweight check suitable for page load.","operationId":"get_google_auth_status_api_google_auth_status_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/contacts/search":{"get":{"tags":["google-api"],"summary":"Search Google Contacts","description":"Fast search of Google contacts using proper search endpoints","operationId":"search_google_contacts_api_google_contacts_search_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"query","in":"query","required":false,"schema":{"type":"string","default":"","title":"Query"}},{"name":"max_results","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Max Results"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/connect":{"post":{"tags":["google-accounts"],"summary":"Connect Google Account","description":"Build a Google OAuth authorization URL for connecting an ADDITIONAL Google\naccount via Every's own OAuth (NOT Clerk). Returns the URL for the client to\nopen; Google's select_account prompt lets the user choose which account.","operationId":"connect_google_account_api_google_accounts_connect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/callback":{"get":{"tags":["google-accounts"],"summary":"Google Accounts Callback","description":"Handle the Google OAuth redirect: validate+consume state, exchange the code,\nread the verified Google identity, and upsert the account + tokens.","operationId":"google_accounts_callback_api_google_accounts_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},{"name":"error_description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Description"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts":{"get":{"tags":["google-accounts"],"summary":"Get Google Accounts","description":"List the caller's connected Google accounts (metadata + capability flags +\nper-org enablement/default flags). Never returns tokens.\n\nEnsures the Clerk login account is represented first, so it surfaces as the\n'Login account' alongside any Every-owned additional accounts.","operationId":"get_google_accounts_api_google_accounts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/google/accounts/member-onboarding/defaults":{"post":{"tags":["google-accounts"],"summary":"Set Invited Member Google Defaults","description":"Persist privacy-first Google defaults after an invitation is accepted.\n\nThe membership webhook normally wins this race. The authenticated client\ncalls this as an idempotent fallback before showing the member setup dialog,\nso webhook delay or delivery failure cannot turn missing schedule values into\nimplicit automation.","operationId":"set_invited_member_google_defaults_api_google_accounts_member_onboarding_defaults_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/google/accounts/sync":{"post":{"tags":["google-accounts"],"summary":"Sync Google Accounts","description":"Reconcile the Clerk login account into our store, then return the list.\n\nCalled by the client after a Clerk reauthorize/reconnect returns (that flow never\nhits our backend), so it force-reconciles + validates the token to clear a stale\nneeds_reauth badge when the reconnect actually worked.","operationId":"sync_google_accounts_api_google_accounts_sync_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/google/accounts/{account_id}":{"patch":{"tags":["google-accounts"],"summary":"Update Google Account","description":"Update mutable account metadata (currently just the user-set label).","operationId":"update_google_account_api_google_accounts__account_id__patch","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAccountRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["google-accounts"],"summary":"Disconnect Google Account","description":"Soft-disconnect an additional account (the login account can't be removed here).","operationId":"disconnect_google_account_api_google_accounts__account_id__delete","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/{account_id}/import-contacts":{"post":{"tags":["google-accounts"],"summary":"Import Contacts For Account","description":"Import Google contacts from ONE account into this workspace, on explicit\nuser consent (the post-connect dialog).\n\nThis replaces the fire-and-forget import that used to run inside the OAuth\ncallbacks. Two deliberate differences from the old behaviour:\n\n1. **Consent.** Nothing imports until the user says yes.\n2. **One account.** `auto_import_new_contacts` sweeps every contacts-capable\n   account the user owns; this imports only `account_id`. Connecting one\n   mailbox must never pull in the others (2026-08-11: 4,708 contacts from two\n   personal Gmail accounts landed in a customer's org this way).\n\n`authorize_account` is the gate — a non-owner, or an account not enabled in\nthis workspace, cannot be imported from.","operationId":"import_contacts_for_account_api_google_accounts__account_id__import_contacts_post","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/{account_id}/enabled":{"put":{"tags":["google-accounts"],"summary":"Set Google Account Enabled","description":"Enable/disable an account within a workspace.","operationId":"set_google_account_enabled_api_google_accounts__account_id__enabled_put","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnabledRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/{account_id}/default":{"put":{"tags":["google-accounts"],"summary":"Set Google Account Default","description":"Make this account the workspace default for a role: 'send', 'calendar'\n(uses calendar_id), or 'booking' (uses calendar_id).","operationId":"set_google_account_default_api_google_accounts__account_id__default_put","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DefaultRoleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/{account_id}/sharing":{"put":{"tags":["google-accounts"],"summary":"Set Google Account Sharing","description":"Owner sets an account's workspace sharing (private / read_shared / workspace\nmailbox). Sharing is rejected in single-member orgs.","operationId":"set_google_account_sharing_api_google_accounts__account_id__sharing_put","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SharingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/{account_id}/schedule":{"put":{"tags":["google-accounts"],"summary":"Set Google Account Schedule","description":"Update one owned Google account control in this workspace.\n\nBoth controls are user-facing On/Off boundaries. ``real-time`` means On;\ninternal cursor reconciliation and safety scans own cadence. Legacy stored\ncadence values continue to read as On, but new writes accept only\n``real-time`` or ``off``.","operationId":"set_google_account_schedule_api_google_accounts__account_id__schedule_put","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__google_accounts__ScheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/google/accounts/{account_id}/access-log":{"get":{"tags":["google-accounts"],"summary":"Get Google Account Access Log","description":"Owner-visible log of non-owner accesses to a shared account.","operationId":"get_google_account_access_log_api_google_accounts__account_id__access_log_get","parameters":[{"name":"account_id","in":"path","required":true,"schema":{"type":"string","title":"Account Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/setup-watch":{"post":{"tags":["Gmail Integration"],"summary":"Setup Gmail Watch","description":"Set up Gmail watch for real-time notifications","operationId":"setup_gmail_watch_api_gmail_setup_watch_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/stop-watch":{"delete":{"tags":["Gmail Integration"],"summary":"Stop Gmail Watch","description":"Stop the current Gmail watch","operationId":"stop_gmail_watch_api_gmail_stop_watch_delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/watch-status":{"get":{"tags":["Gmail Integration"],"summary":"Get Watch Status","description":"Get current Gmail watch status","operationId":"get_watch_status_api_gmail_watch_status_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/renew-watch":{"post":{"tags":["Gmail Integration"],"summary":"Renew Gmail Watch","description":"Renew the Gmail watch before it expires","operationId":"renew_gmail_watch_api_gmail_renew_watch_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/webhook":{"post":{"tags":["Gmail Integration"],"summary":"Gmail Webhook","description":"Webhook endpoint for Gmail push notifications via Pub/Sub","operationId":"gmail_webhook_api_gmail_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/gmail/emails":{"get":{"tags":["Gmail Integration"],"summary":"Get Recent Emails","description":"Get recent processed emails with attachment information","operationId":"get_recent_emails_api_gmail_emails_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/emails/{message_id}/attachments":{"get":{"tags":["Gmail Integration"],"summary":"Get Email Attachments","description":"Get attachments for a specific email message","operationId":"get_email_attachments_api_gmail_emails__message_id__attachments_get","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/sync":{"post":{"tags":["Gmail Integration"],"summary":"Manual Sync","description":"Manually trigger a sync to check for new emails","operationId":"manual_sync_api_gmail_sync_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/test-connection":{"get":{"tags":["Gmail Integration"],"summary":"Test Gmail Connection","description":"Test Gmail API connection","operationId":"test_gmail_connection_api_gmail_test_connection_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/test-pubsub":{"post":{"tags":["Gmail Integration"],"summary":"Test Pubsub Message","description":"Send a test message to Pub/Sub topic","operationId":"test_pubsub_message_api_gmail_test_pubsub_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/start-pubsub-listener":{"post":{"tags":["Gmail Integration"],"summary":"Start Pubsub Listener","description":"Start the Pub/Sub listener for real-time notifications","operationId":"start_pubsub_listener_api_gmail_start_pubsub_listener_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/stop-pubsub-listener":{"post":{"tags":["Gmail Integration"],"summary":"Stop Pubsub Listener","description":"Stop the Pub/Sub listener","operationId":"stop_pubsub_listener_api_gmail_stop_pubsub_listener_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/stats":{"get":{"tags":["Gmail Integration"],"summary":"Get Gmail Stats","description":"Get Gmail integration statistics","operationId":"get_gmail_stats_api_gmail_stats_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/attachments/{attachment_id}/refresh-url":{"post":{"tags":["Gmail Integration"],"summary":"Refresh Attachment Url","description":"Refresh signed URL for an attachment (when it expires)","operationId":"refresh_attachment_url_api_gmail_attachments__attachment_id__refresh_url_post","parameters":[{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","title":"Attachment Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/gmail/health":{"get":{"tags":["Gmail Integration"],"summary":"Gmail Health Check","description":"Health check for Gmail integration","operationId":"gmail_health_check_api_gmail_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/calendar/webhook":{"post":{"tags":["Calendar Integration"],"summary":"Calendar Webhook","description":"Webhook endpoint for Google Calendar push notifications (direct HTTPS).","operationId":"calendar_webhook_api_calendar_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/calendar/health":{"get":{"tags":["Calendar Integration"],"summary":"Calendar Health Check","description":"Health check for the Calendar integration webhook.","operationId":"calendar_health_check_api_calendar_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/google/stats":{"get":{"tags":["google-stats"],"summary":"Get Google Service Stats","description":"Get data counts for all Google services:\n- Gmail: emails from last year\n- Calendar: meetings from last 90 days and next 90 days\n- Contacts: total contacts","operationId":"get_google_service_stats_api_google_stats_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/relationship-context/{entity_type}/{entity_id}":{"get":{"tags":["relationship-context"],"summary":"Relationship Context Status","operationId":"relationship_context_status_api_relationship_context__entity_type___entity_id__get","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recurring-invoices/{recurring_invoice_id}/execute":{"post":{"summary":"Execute Recurring Invoice Manually","description":"Execute a recurring invoice manually using the shared claim-then-execute service.","operationId":"execute_recurring_invoice_manually_recurring_invoices__recurring_invoice_id__execute_post","parameters":[{"name":"recurring_invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The recurring invoice ID","title":"Recurring Invoice Id"},"description":"The recurring invoice ID"},{"name":"debug","in":"query","required":false,"schema":{"type":"boolean","description":"Execute in debug mode (sends to user email instead of client)","default":false,"title":"Debug"},"description":"Execute in debug mode (sends to user email instead of client)"},{"name":"skip_next","in":"query","required":false,"schema":{"type":"boolean","description":"Skip the next scheduled run by updating last_generated_at and next_generation_date","default":false,"title":"Skip Next"},"description":"Skip the next scheduled run by updating last_generated_at and next_generation_date"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recurring-invoices/{recurring_invoice_id}/test":{"post":{"summary":"Test Recurring Invoice","description":"Test recurring invoice execution (creates test invoice with TEST- prefix)","operationId":"test_recurring_invoice_recurring_invoices__recurring_invoice_id__test_post","parameters":[{"name":"recurring_invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The recurring invoice ID","title":"Recurring Invoice Id"},"description":"The recurring invoice ID"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recurring-invoices/from-invoice/{invoice_id}":{"post":{"summary":"Create Recurring Invoice From Invoice","description":"Create recurring invoice using existing invoice as template - returns template data for frontend to handle creation","operationId":"create_recurring_invoice_from_invoice_recurring_invoices_from_invoice__invoice_id__post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The invoice ID to use as template","title":"Invoice Id"},"description":"The invoice ID to use as template"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Recurring Invoice Data"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recurring-invoices/{recurring_invoice_id}":{"patch":{"summary":"Update Recurring Invoice","description":"Update a recurring invoice - only updates fields that have changed","operationId":"update_recurring_invoice_recurring_invoices__recurring_invoice_id__patch","parameters":[{"name":"recurring_invoice_id","in":"path","required":true,"schema":{"type":"string","description":"The recurring invoice ID","title":"Recurring Invoice Id"},"description":"The recurring invoice ID"},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Recurring Invoice Data"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"Get Recurring Invoice","description":"Get a single recurring invoice with line items and client","operationId":"get_recurring_invoice_recurring_invoices__recurring_invoice_id__get","parameters":[{"name":"recurring_invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Recurring Invoice Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Recurring Invoice","description":"Delete a recurring invoice and its line items","operationId":"delete_recurring_invoice_recurring_invoices__recurring_invoice_id__delete","parameters":[{"name":"recurring_invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Recurring Invoice Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recurring-invoices/":{"post":{"summary":"Create Recurring Invoice","description":"Create a new recurring invoice","operationId":"create_recurring_invoice_recurring_invoices__post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Recurring Invoices","description":"List all recurring invoices for the org","operationId":"list_recurring_invoices_recurring_invoices__get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recurring-invoices/runs/health":{"get":{"summary":"Get Run Health","description":"Get health metrics from the recurring invoice run ledger.","operationId":"get_run_health_recurring_invoices_runs_health_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/recurring-invoices/{recurring_invoice_id}/toggle":{"post":{"summary":"Toggle Recurring Invoice","description":"Toggle a recurring invoice's is_active status","operationId":"toggle_recurring_invoice_recurring_invoices__recurring_invoice_id__toggle_post","parameters":[{"name":"recurring_invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Recurring Invoice Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scheduled-invoice-sends/{invoice_id}":{"post":{"summary":"Schedule Invoice Send","description":"Schedule an invoice to be sent at a future time","operationId":"schedule_invoice_send_scheduled_invoice_sends__invoice_id__post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scheduled-invoice-sends/{send_id}":{"delete":{"summary":"Cancel Scheduled Send","description":"Cancel a pending scheduled send","operationId":"cancel_scheduled_send_scheduled_invoice_sends__send_id__delete","parameters":[{"name":"send_id","in":"path","required":true,"schema":{"type":"string","title":"Send Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scheduled-invoice-sends/invoice/{invoice_id}":{"get":{"summary":"List Scheduled Sends","description":"List scheduled sends for an invoice","operationId":"list_scheduled_sends_scheduled_invoice_sends_invoice__invoice_id__get","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/{job_id}":{"get":{"tags":["background_jobs"],"summary":"Get Job Status","description":"Get status and details for a specific background job.\n\nArgs:\n    job_id: ID of the job to query\n    user_data: Current user and org (from auth)\n    \nReturns:\n    Job status and details\n    \nRaises:\n    HTTPException: If job not found or access denied","operationId":"get_job_status_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs":{"get":{"tags":["background_jobs"],"summary":"List User Jobs","description":"List background jobs for the current organization.\n\nArgs:\n    user_data: Current user and org (from auth)\n    limit: Maximum number of jobs to return (1-50)\n    include_completed: Whether to include completed jobs\n    \nReturns:\n    List of organization's background jobs","operationId":"list_user_jobs_jobs_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Maximum number of jobs to return","default":10,"title":"Limit"},"description":"Maximum number of jobs to return"},{"name":"include_completed","in":"query","required":false,"schema":{"type":"boolean","description":"Whether to include completed jobs","default":true,"title":"Include Completed"},"description":"Whether to include completed jobs"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/{job_id}/cancel":{"post":{"tags":["background_jobs"],"summary":"Cancel Job","description":"Cancel a background job (if it's still pending or processing).\n\nArgs:\n    job_id: ID of the job to cancel\n    user_data: Current user and org (from auth)\n    \nReturns:\n    Cancellation confirmation\n    \nRaises:\n    HTTPException: If job not found, access denied, or cannot be canceled","operationId":"cancel_job_jobs__job_id__cancel_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/jobs/processor/status":{"get":{"tags":["background_jobs"],"summary":"Get Processor Status","description":"Get status of the background job processor.\n\nNote: This is mainly for debugging/monitoring purposes.\n\nArgs:\n    user_data: Current user and org (from auth)\n    \nReturns:\n    Processor status information","operationId":"get_processor_status_jobs_processor_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/jobs/stats/summary":{"get":{"tags":["background_jobs"],"summary":"Get Job Statistics","description":"Get job statistics for the current organization.\n\nArgs:\n    user_data: Current user and org (from auth)\n    \nReturns:\n    Job statistics summary","operationId":"get_job_statistics_jobs_stats_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/images/health":{"get":{"summary":"Image Proxy Health","description":"Health check endpoint for the image proxy service.","operationId":"image_proxy_health_images_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/images/{image_path}":{"head":{"summary":"Proxy Image","description":"Proxy images from Supabase storage through the every.ai domain.\nThis fixes email deliverability issues by serving images from the same domain.\n\nArgs:\n    image_path: The path to the image (e.g., \"every_footer.png\")\n    \nReturns:\n    StreamingResponse with the image content","operationId":"head_image","parameters":[{"name":"image_path","in":"path","required":true,"schema":{"type":"string","title":"Image Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"Proxy Image","description":"Proxy images from Supabase storage through the every.ai domain.\nThis fixes email deliverability issues by serving images from the same domain.\n\nArgs:\n    image_path: The path to the image (e.g., \"every_footer.png\")\n    \nReturns:\n    StreamingResponse with the image content","operationId":"get_image","parameters":[{"name":"image_path","in":"path","required":true,"schema":{"type":"string","title":"Image Path"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scheduled-tasks":{"post":{"summary":"Create Scheduled Task","description":"Create a new scheduled task.\n\nArgs:\n    request: Task creation request\n    user_org_data: Current user and organization data\n    \nReturns:\n    Dictionary with the created task ID","operationId":"create_scheduled_task_scheduled_tasks_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateScheduledTaskRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Create Scheduled Task Scheduled Tasks Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Scheduled Tasks","description":"List scheduled tasks for the current organization.\n\nArgs:\n    user_org_data: Current user and organization data\n    status: Optional status filter\n    limit: Maximum number of tasks to return\n    \nReturns:\n    List of scheduled tasks","operationId":"list_scheduled_tasks_scheduled_tasks_get","parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status","title":"Status"},"description":"Filter by status"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","description":"Maximum number of tasks to return","default":50,"title":"Limit"},"description":"Maximum number of tasks to return"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScheduledTaskResponse"},"title":"Response List Scheduled Tasks Scheduled Tasks Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scheduled-tasks/{task_id}":{"get":{"summary":"Get Scheduled Task","description":"Get a scheduled task by ID.\n\nArgs:\n    task_id: Task ID to retrieve\n    user_org_data: Current user and organization data\n    \nReturns:\n    Scheduled task data","operationId":"get_scheduled_task_scheduled_tasks__task_id__get","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduledTaskResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Update Scheduled Task","description":"Update a scheduled task.\n\nArgs:\n    task_id: Task ID to update\n    request: Update request data\n    user_org_data: Current user and organization data\n    \nReturns:\n    Success message","operationId":"update_scheduled_task_scheduled_tasks__task_id__put","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__scheduled_tasks__UpdateScheduledTaskRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Update Scheduled Task Scheduled Tasks  Task Id  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Cancel Scheduled Task","description":"Cancel a scheduled task.\n\nArgs:\n    task_id: Task ID to cancel\n    user_org_data: Current user and organization data\n    \nReturns:\n    Success message","operationId":"cancel_scheduled_task_scheduled_tasks__task_id__delete","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Cancel Scheduled Task Scheduled Tasks  Task Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scheduled-tasks/resource/{resource_type}/{resource_id}":{"get":{"summary":"Get Scheduled Tasks For Resource","description":"Get scheduled tasks for a specific resource.\n\nArgs:\n    resource_type: Type of resource (invoice, expense, etc.)\n    resource_id: ID of the resource\n    user_org_data: Current user and organization data\n    status: Optional status filter\n    \nReturns:\n    List of scheduled tasks for the resource","operationId":"get_scheduled_tasks_for_resource_scheduled_tasks_resource__resource_type___resource_id__get","parameters":[{"name":"resource_type","in":"path","required":true,"schema":{"type":"string","title":"Resource Type"}},{"name":"resource_id","in":"path","required":true,"schema":{"type":"string","title":"Resource Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status","title":"Status"},"description":"Filter by status"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ScheduledTaskResponse"},"title":"Response Get Scheduled Tasks For Resource Scheduled Tasks Resource  Resource Type   Resource Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/scheduled-tasks/invoice/{invoice_id}/schedule":{"post":{"summary":"Schedule Invoice Send","description":"Convenience endpoint for scheduling an invoice to be sent.\n\nArgs:\n    invoice_id: ID of the invoice to schedule\n    scheduled_at: When to send the invoice\n    user_org_data: Current user and organization data\n    \nReturns:\n    Dictionary with the created task ID","operationId":"schedule_invoice_send_scheduled_tasks_invoice__invoice_id__schedule_post","parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}},{"name":"scheduled_at","in":"query","required":true,"schema":{"type":"string","format":"date-time","title":"Scheduled At"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Schedule Invoice Send Scheduled Tasks Invoice  Invoice Id  Schedule Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/next-number":{"get":{"tags":["proposals"],"summary":"Get Next Proposal Number","description":"Get the next proposal number for the organization using atomic database function.\nThis prevents race conditions when multiple processes create proposals simultaneously.\n\nReturns:\n    {\"proposal_number\": \"PROP-0042\"}","operationId":"get_next_proposal_number_api_proposals_next_number_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/proposals/{proposal_id}":{"get":{"tags":["proposals"],"summary":"Get Proposal","description":"Get a proposal by ID with public_id ensured","operationId":"get_proposal_api_proposals__proposal_id__get","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/send":{"post":{"tags":["proposals"],"summary":"Send Proposal","description":"Send a proposal to the client via email with optional custom message","operationId":"send_proposal_api_proposals__proposal_id__send_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/duplicate":{"post":{"tags":["proposals"],"summary":"Duplicate Proposal","description":"Duplicate an existing proposal — copies EVERYTHING including the\nblock-based content tree, line items, images, and attachments.\nResets status to draft, clears dates, generates a new proposal number,\nand keeps the same client.","operationId":"duplicate_proposal_api_proposals__proposal_id__duplicate_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/convert-to-invoice":{"post":{"tags":["proposals"],"summary":"Convert Proposal To Invoice","description":"Convert an issued or approved proposal to an invoice","operationId":"convert_proposal_to_invoice_api_proposals__proposal_id__convert_to_invoice_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/generate-pdf":{"post":{"tags":["proposals"],"summary":"Generate Proposal Pdf","description":"Generate PDF for a proposal","operationId":"generate_proposal_pdf_api_proposals__proposal_id__generate_pdf_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/content":{"put":{"tags":["proposals"],"summary":"Update Proposal Content","description":"Update a proposal's block-based `proposal_content` JSONB.\n\n- Validates the tree shape and cardinality invariants.\n- Optimistic concurrency via `expected_updated_at` → 409 on mismatch.\n- Writes a snapshot to `proposal_content_revisions` for the safety net.","operationId":"update_proposal_content_api_proposals__proposal_id__content_put","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalContentUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/mark-accepted":{"post":{"tags":["proposals"],"summary":"Mark Proposal Accepted","description":"Admin-side manual accept for proposals that don't use an acceptance block.\nSets approved_by_name, approved_by_email, approved_date, and flips status\nto 'approved'.","operationId":"mark_proposal_accepted_api_proposals__proposal_id__mark_accepted_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkAcceptedPayload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/void":{"post":{"tags":["proposals"],"summary":"Void Proposal","description":"Void a proposal (owner only)","operationId":"void_proposal_api_proposals__proposal_id__void_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposals/{proposal_id}/send-test":{"post":{"tags":["proposals"],"summary":"Send Test Proposal","description":"Send test proposal to specified test email instead of client email","operationId":"send_test_proposal_api_proposals__proposal_id__send_test_post","parameters":[{"name":"proposal_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Proposal Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/proposal/{public_id}":{"get":{"tags":["proposals"],"summary":"Get Proposal By Token","description":"Get proposal by approval token (for public viewing)","operationId":"get_proposal_by_token_public_proposal__public_id__get","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/proposal/{public_id}/approve":{"post":{"tags":["proposals"],"summary":"Approve Proposal","description":"Approve a proposal via public link","operationId":"approve_proposal_public_proposal__public_id__approve_post","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Approval Data"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/proposal/{public_id}/view":{"post":{"tags":["proposals"],"summary":"Track Public Proposal View","description":"DEPRECATED: Use POST /public/track-view instead. Kept for backward compatibility.","operationId":"track_public_proposal_view_public_proposal__public_id__view_post","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/proposal/{public_id}/pdf":{"post":{"tags":["proposals"],"summary":"Generate Proposal Pdf Public","description":"Generate PDF for a proposal using public_id (no auth required)","operationId":"generate_proposal_pdf_public_public_proposal__public_id__pdf_post","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-templates":{"get":{"tags":["proposal-templates"],"summary":"List Templates","description":"Return global seeds plus the current org's templates. RLS policies already\nrestrict visibility, but the query is written explicitly for clarity.","operationId":"list_templates_api_proposal_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Response List Templates Api Proposal Templates Get"}}}}}},"post":{"tags":["proposal-templates"],"summary":"Create Template","description":"Create a new org-owned template. Validates the block tree shape first.","operationId":"create_template_api_proposal_templates_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalTemplateCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Create Template Api Proposal Templates Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-templates/{template_id}":{"put":{"tags":["proposal-templates"],"summary":"Update Template","description":"Update an org-owned template. Global seeds are rejected.","operationId":"update_template_api_proposal_templates__template_id__put","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProposalTemplateUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Template Api Proposal Templates  Template Id  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["proposal-templates"],"summary":"Delete Template","description":"Delete an org-owned template. Global seeds are rejected.","operationId":"delete_template_api_proposal_templates__template_id__delete","parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Template Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Template Api Proposal Templates  Template Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-media/upload":{"post":{"tags":["proposal-media"],"summary":"Upload Proposal Media","description":"Multipart image upload for the proposal media block's Upload tab.","operationId":"upload_proposal_media_api_proposal_media_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_proposal_media_api_proposal_media_upload_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-media/generate":{"post":{"tags":["proposal-media"],"summary":"Generate Proposal Media","description":"Generate an image with Imagen 4 and return its hosted URL. Decrements\nthe caller's AI credit account at the flat Imagen per-image price.","operationId":"generate_proposal_media_api_proposal_media_generate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImagenGenerateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-media/iterate":{"post":{"tags":["proposal-media"],"summary":"Iterate Proposal Media","description":"Iterate on an existing image (uploaded or AI-generated) by passing it\nto the Gemini image-edit model along with a text prompt describing\nthe desired changes. Returns a new image hosted in proposal-media,\nsame shape as `/generate` so the editor can use one append helper.","operationId":"iterate_proposal_media_api_proposal_media_iterate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImagenIterateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-text/suggest":{"post":{"tags":["proposal-text"],"summary":"Suggest Proposal Text","description":"Generate or refine a text block's body using Gemini Flash.","operationId":"suggest_proposal_text_api_proposal_text_suggest_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextSuggestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-text/batch-tag":{"post":{"tags":["proposal-text"],"summary":"Batch Tag Text Blocks","description":"Auto-tag text blocks using a fast model. Single call for all blocks.","operationId":"batch_tag_text_blocks_api_proposal_text_batch_tag_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BatchTagRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-agent/runs":{"post":{"tags":["proposal-agent"],"summary":"Create Proposal Run","description":"Start a new proposal draft run. Fires the agent in the background.","operationId":"create_proposal_run_api_proposal_agent_runs_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateProposalRunRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["proposal-agent"],"summary":"Get Run For Proposal","description":"Return the latest run for a proposal (or null).","operationId":"get_run_for_proposal_api_proposal_agent_runs_get","parameters":[{"name":"proposal_id","in":"query","required":true,"schema":{"type":"string","title":"Proposal Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-agent/runs/{job_id}":{"get":{"tags":["proposal-agent"],"summary":"Get Run By Id","description":"Fetch a specific run by job_id. Returns the full row including batch_metadata.","operationId":"get_run_by_id_api_proposal_agent_runs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-agent/runs/{job_id}/dismiss":{"post":{"tags":["proposal-agent"],"summary":"Dismiss Run","description":"Mark a run's completion card as dismissed by the user.\n\nSets `user_dismissed_at = now()` on the row. Idempotent — repeat calls\nkeep the earliest dismissal timestamp (if already set, we no-op).","operationId":"dismiss_run_api_proposal_agent_runs__job_id__dismiss_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/proposal-agent/runs/{job_id}/answer":{"post":{"tags":["proposal-agent"],"summary":"Answer Run Questions","description":"Provide answers to the run's pending questions. Unblocks the agent.","operationId":"answer_run_questions_api_proposal_agent_runs__job_id__answer_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerQuestionsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/extension/captures":{"post":{"tags":["extension"],"summary":"Create Capture","description":"Start a capture run. Returns 202 + capture_id; the extension polls.","operationId":"create_capture_api_extension_captures_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCaptureRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/extension/captures/{capture_id}":{"get":{"tags":["extension"],"summary":"Get Capture","description":"Poll a capture run. Maps job status to the extension contract.","operationId":"get_capture_api_extension_captures__capture_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"capture_id","in":"path","required":true,"schema":{"type":"string","title":"Capture Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/extension/captures/{capture_id}/answer":{"post":{"tags":["extension"],"summary":"Answer Capture","description":"Answer the pending question. Unblocks the agent (worker resumes).","operationId":"answer_capture_api_extension_captures__capture_id__answer_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"capture_id","in":"path","required":true,"schema":{"type":"string","title":"Capture Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnswerCaptureRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/extension/linkedin-import/status":{"get":{"tags":["extension"],"summary":"Linkedin Import Status","description":"Has this org already imported a LinkedIn network? Drives the extension's\nCTA (first-run \"Import my connections\" vs \"Sync new connections\"). Counts\ncontacts with source='linkedin_import' — the source BOTH the CSV import\n(every-react ImportLinkedInContactsModal) and this extension stamp — so a\nprior CSV import correctly suppresses the first-run CTA too.","operationId":"linkedin_import_status_api_extension_linkedin_import_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/extension/linkedin-import":{"post":{"tags":["extension"],"summary":"Import Linkedin Connections","description":"Bulk-import the signed-in user's LinkedIn connections as Every contacts.\n\nThe extension pulls the connections list from LinkedIn's Voyager API using\nthe active session and POSTs the structured rows here. We dedup by\nnormalized LinkedIn URL (via entity_links), insert new contacts\n(source='linkedin_import'), stamp linkedin_connected_at on matches, and\nauto-enrich the new ids in the background.","operationId":"import_linkedin_connections_api_extension_linkedin_import_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkedInImportRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/extension/captures/{capture_id}/cancel":{"post":{"tags":["extension"],"summary":"Cancel Capture","description":"Cancel a capture, whether or not the worker has already claimed it.\n\nThree outcomes, and the caller must handle all three:\n\n- `{cancelled: True, mode: \"stopped\"}` — the job had not started (or was\n  paused for input), so it is already terminal. Nothing ever ran.\n- `{cancelled: True, mode: \"requested\"}` — the worker owns the run, so we\n  stamp `cancel_requested_at` and the runner stops cooperatively at its\n  next checkpoint (before any contact is written).\n- `{cancelled: False, status: \"finished\"}` — too late, it already\n  completed. **The caller should resolve its row from GET, not hang.**\n\nThe worker claims within ~0.5s, so \"requested\" is the common path in\npractice; the guarded pre-claim flip below is the rare fast case.","operationId":"cancel_capture_api_extension_captures__capture_id__cancel_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"capture_id","in":"path","required":true,"schema":{"type":"string","title":"Capture Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/targeting":{"get":{"tags":["prospecting"],"summary":"Get Canonical Prospecting Targeting","description":"Return the org's durable standing prospecting audience.","operationId":"get_canonical_prospecting_targeting_api_prospecting_targeting_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["prospecting"],"summary":"Update Canonical Prospecting Targeting","description":"Update the durable standing audience with optional fingerprint CAS.","operationId":"update_canonical_prospecting_targeting_api_prospecting_targeting_patch","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCanonicalTargetingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/settings":{"get":{"tags":["prospecting"],"summary":"Get Prospecting Settings","description":"Get org-level prospecting pipeline settings.","operationId":"get_prospecting_settings_api_prospecting_settings_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["prospecting"],"summary":"Update Prospecting Settings","description":"Update org-level prospecting pipeline settings.","operationId":"update_prospecting_settings_api_prospecting_settings_patch","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProspectingSettingsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/commercial-tracking":{"post":{"tags":["prospecting"],"summary":"Track Commercial Entity Route","description":"Create or link a pipeline deal for an existing commercial record.","operationId":"track_commercial_entity_route_api_prospecting_commercial_tracking_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrackCommercialEntityRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/learnings":{"get":{"tags":["prospecting"],"summary":"Get Prospecting Learnings","description":"Return parsed Org-Specific Learnings from the prospecting-scoring skill.\n\nRead-only view of what the agent has internalized from accept/reject\nfeedback. Most-recent first.","operationId":"get_prospecting_learnings_api_prospecting_learnings_get","parameters":[{"name":"scope","in":"query","required":false,"schema":{"type":"string","default":"default","title":"Scope"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["prospecting"],"summary":"Delete Prospecting Learning Route","description":"Remove one learning bullet from the chosen prospecting skill.\n\nItems are addressed by SHA-1 hash of `date|source_event|note` (same\nhash computed on the client from the rendered row). The prospecting\nagent loads the trimmed skill content on its next run.","operationId":"delete_prospecting_learning_route_api_prospecting_learnings_delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteProspectingLearningRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/guidance":{"post":{"tags":["prospecting"],"summary":"Teach Prospecting Guidance Route","operationId":"teach_prospecting_guidance_route_api_prospecting_guidance_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeachProspectingGuidanceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/resolve-goal":{"post":{"tags":["prospecting"],"summary":"Resolve Prospecting Goal","description":"Preflight the canonical prospecting goal before enqueueing a run.","operationId":"resolve_prospecting_goal_api_prospecting_resolve_goal_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResolveGoalRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/goals/merge-suggestions":{"get":{"tags":["prospecting"],"summary":"List Prospecting Goal Merge Suggestions","description":"List unconfirmed auto-created goals that resemble existing goals.","operationId":"list_prospecting_goal_merge_suggestions_api_prospecting_goals_merge_suggestions_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/goals/{goal_id}/merge":{"post":{"tags":["prospecting"],"summary":"Merge Prospecting Goal","description":"Merge an unconfirmed auto-created prospecting goal into a target goal.","operationId":"merge_prospecting_goal_api_prospecting_goals__goal_id__merge_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeProspectingGoalRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/goals/{goal_id}/keep-separate":{"post":{"tags":["prospecting"],"summary":"Keep Prospecting Goal Separate","description":"Confirm an unconfirmed auto-created goal as a separate goal.","operationId":"keep_prospecting_goal_separate_api_prospecting_goals__goal_id__keep_separate_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/run":{"post":{"tags":["prospecting"],"summary":"Create Prospecting Run","description":"Start a manual prospecting scan. Auto-detects run mode.\n\nPhase 2: accepts structured intake (`selling_summary`, `selling_service_ids`,\n`targeting`, `free_text_direction`). Builds a `goal` dict that the runner\nthreads through to every saved deal. Legacy `focus_prompt` is still\naccepted for backwards compat.","operationId":"create_prospecting_run_api_prospecting_run_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRunRequest","default":{"selling_service_ids":[],"create_new_goal":false}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/runs/{job_id}":{"get":{"tags":["prospecting"],"summary":"Get Run Status","description":"Get the status of a prospecting run.","operationId":"get_run_status_api_prospecting_runs__job_id__get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/goals":{"get":{"tags":["prospecting"],"summary":"List Prospecting Goals","description":"List the org's selectable prospecting goals for the warm-leads target\nselector.\n\nExcludes placeholder rows (`_is_placeholder_goal`) and rows already\nflagged for merge (`suggested_merge_into_goal_id` set) — those stay\nhidden until a merge UI exists. The canonical durable default is read\nvia `get_canonical_goal_row` (NEVER `resolve_active_goal` — see\n`goal_resolver.py:1046-1064`), marked `is_default`, and always listed\nfirst; if filtering/fetch excluded it, it's prepended so the default is\nnever missing from the selector. Each entry also carries `leads_found`\nand `last_used_at` (per-goal `prospecting_deals` aggregates) so the\ndropdown can show usefulness/recency and demote dupe-minted goals; the\nremaining (non-default) entries are ordered by `last_used_at desc NULLS\nLAST`, tiebreaking `created_at desc`.","operationId":"list_prospecting_goals_api_prospecting_goals_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/goals/history":{"get":{"tags":["prospecting"],"summary":"List Prospecting Goal History","description":"List every prospecting target that actually produced a deal.\n\nThis is deliberately separate from ``GET /goals``. The reusable-goal\nselector excludes placeholders and unresolved merge candidates, while a\nhistorical pipeline filter must include those rows so every ``goal_id``\nalready present on a deal remains filterable.","operationId":"list_prospecting_goal_history_api_prospecting_goals_history_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/active-goal":{"get":{"tags":["prospecting"],"summary":"Get Active Prospecting Goal","description":"Return the org's currently-active prospecting goal so the AI Zone intake\ncan reflect the goal the next run will default to (instead of the generic\n'Everything/Everyone' placeholder).\n\nActive goal = the goal of the org's most recent run (latest non-null\ndeal.goal_id), falling back to the most recently created non-archived goal,\nelse null (fresh org → the UI shows the broad Everything/Everyone default).\nThe UI pre-fills the intake fields only for user-specified goals\n(source user_intake/manual); for a derived_default it shows the broad\ndefault plus a label, since the run re-derives when intake is empty.\nWhen `include_derived_default` is true, `derived_default` additionally\nlets the UI show what an empty-intake run will actually use instead of\nthe broad placeholder.","operationId":"get_active_prospecting_goal_api_prospecting_active_goal_get","parameters":[{"name":"include_derived_default","in":"query","required":false,"schema":{"type":"boolean","description":"When true, also include `derived_default`: the DNA-derived goal (selling/targeting) an empty-intake scheduled run would actually use, so the UI can show it instead of the broad Everything/Everyone placeholder.","default":false,"title":"Include Derived Default"},"description":"When true, also include `derived_default`: the DNA-derived goal (selling/targeting) an empty-intake scheduled run would actually use, so the UI can show it instead of the broad Everything/Everyone placeholder."},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/active-jobs":{"get":{"tags":["prospecting"],"summary":"List Active Prospecting Jobs","description":"Return prospecting jobs for this org that are still in flight.\n\nUsed by the AI Zone card to re-attach its progress poller after a page\nrefresh. The agent runs are backend-driven (asyncio.create_task) and\npersist regardless of whether any frontend is connected; without this\nendpoint the UI loses awareness of in-flight runs on reload.","operationId":"list_active_prospecting_jobs_api_prospecting_active_jobs_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/runs":{"get":{"tags":["prospecting"],"summary":"List Prospecting Runs","description":"Return recent prospecting runs (all statuses) for the Pipeline Settings\nhistory section. Pulls from `agent_background_jobs` so we get the agent's\n`result_summary` (set by `report_run_summary`) and the original\nfocus_prompt — the Managed Agents `/sessions` view doesn't have these.","operationId":"list_prospecting_runs_api_prospecting_runs_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals":{"get":{"tags":["prospecting"],"summary":"List Deals","description":"List prospecting deals for the org.","operationId":"list_deals_api_prospecting_deals_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},{"name":"stage","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by stage name","title":"Stage"},"description":"Filter by stage name"},{"name":"review_state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by review state","title":"Review State"},"description":"Filter by review state"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["prospecting"],"summary":"Create Manual Deal","description":"Manually add a contact to the prospecting pipeline.\n\nThin wrapper over `services.pipeline_intake.create_manual_deal_for_org`,\nwhich is also called by the chat-agent `add_deal` tool.","operationId":"create_manual_deal_api_prospecting_deals_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateManualDealRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/archived":{"get":{"tags":["prospecting"],"summary":"List Archived Deals","description":"List archived pipeline deals for the org.","operationId":"list_archived_deals_api_prospecting_deals_archived_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/pending":{"get":{"tags":["prospecting"],"summary":"List Pending Deals","description":"List deals pending user review (for AIZoneCard batch approval).\n\nReturns ALL deals in review_state='pending'. Qualification is gated ONCE, at\npromotion/recompute time (the recompute endpoint sets review_state by\ntotal_score vs the org min_score) — review_state IS the qualified set. We do\nNOT re-filter by score on read: doing so re-applied the configurable min_score\n(default 70) to deals promoted under different/earlier logic, hiding pending\ndeals scoring below 70 (real scores cluster in the 40s-60s) and emptying the\nlist for every org without a custom scoring config. (fix 2026-06-25)","operationId":"list_pending_deals_api_prospecting_deals_pending_get","parameters":[{"name":"light","in":"query","required":false,"schema":{"type":"boolean","description":"When true, return the light card payload (derived previews, heavy fields omitted) like GET /pipeline?light=true. Web opts in; mobile leaves it false for the full payload.","default":false,"title":"Light"},"description":"When true, return the light card payload (derived previews, heavy fields omitted) like GET /pipeline?light=true. Web opts in; mobile leaves it false for the full payload."},{"name":"preview","in":"query","required":false,"schema":{"type":"boolean","description":"When true, select only the compact fields needed for dashboard previews.","default":false,"title":"Preview"},"description":"When true, select only the compact fields needed for dashboard previews."},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":50,"minimum":1},{"type":"null"}],"description":"Optional cap for compact preview surfaces.","title":"Limit"},"description":"Optional cap for compact preview surfaces."},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}":{"get":{"tags":["prospecting"],"summary":"Get Deal Detail","description":"Detail for ONE deal. Two callers, two projections:\n\n  1. DEFAULT (heavy fields only) — DealDetailDialog on card open. The dialog\n     already has the light fields from the board list row and\n     `useDealDetailMerge` merges the detail fields on top (the live list\n     row wins on every overlap), so we don't re-send the light fields — the\n     common path stays lean. No annotate chain re-run.\n  2. `?full=true` (whole deal) — the deep-link fallback (PipelineKanbanView)\n     for an off-board deal: a `?deal=<id>` link to a dismissed / non-visible\n     deal NOT in the board's fetched set. There is no list row to merge onto,\n     so the dialog renders this response directly and needs the full deal.\n\nOrg/RLS-scoped exactly like the sibling routes; no review_state filter (a\ndismissed deal is returned). Registered AFTER the static /deals and\n/deals/pending GETs so `{deal_id}` never captures them.","operationId":"get_deal_detail_api_prospecting_deals__deal_id__get","parameters":[{"name":"deal_id","in":"path","required":true,"schema":{"type":"string","title":"Deal Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/recompute-scores":{"post":{"tags":["prospecting"],"summary":"Recompute Scores","description":"Recompute configurable prospecting scores for pending/triaged deals.","operationId":"recompute_scores_api_prospecting_recompute_scores_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/approve":{"post":{"tags":["prospecting"],"summary":"Approve Deal","description":"Approve a pending deal — moves it to the Found stage.","operationId":"approve_deal_api_prospecting_deals__deal_id__approve_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/dismiss":{"post":{"tags":["prospecting"],"summary":"Dismiss Deal","description":"Dismiss a deal — removes it from review.\n\nThe dialog's chip + note (in ``learning_feedback``) is the single source\nof \"why dismissed\": we derive a denormalized ``stage_change_reason`` for\nfast reads on the dismissed card and queue the structured payload as a\nskill-learning signal so the agent learns from the rejection.\n\nA dismissal also writes a GLOBAL ``prospecting_suppressions`` row, so the\nrejection is a durable signal about that PERSON rather than about one goal.\nBefore this, dismissing only set ``review_state``; the goal-scoped exclusion\nthen let the same contact resurface under any other goal — including one the\nuser created by refining their own targeting. Global scope is deliberate\n(founder, 2026-08-11): \"a rejected candidate should be high signal on that\ncontact for all scans\". The soft, supersedable half of that model is the\norg-skill learning, not this row.\n\nDeal state and global suppression are attempted by one transactional RPC.\nIf suppression cannot be recorded, the dismissal still commits and the RPC\nwrites a durable retry row. Deals without a linked contact are still\ndismissed; the RPC skips suppression because there is no contact to store.","operationId":"dismiss_deal_api_prospecting_deals__deal_id__dismiss_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissDealRequest","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/dismiss-feedback":{"post":{"tags":["prospecting"],"summary":"Submit Dismiss Feedback","description":"Attach late rejection feedback to an already-dismissed lead.","operationId":"submit_dismiss_feedback_api_prospecting_deals__deal_id__dismiss_feedback_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissDealRequest","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/archive":{"post":{"tags":["prospecting"],"summary":"Archive Deal","description":"Archive an approved deal while retaining its pipeline stage.","operationId":"archive_deal_api_prospecting_deals__deal_id__archive_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/rename":{"post":{"tags":["prospecting"],"summary":"Rename Deal","description":"Rename the display fields of one deal.\n\nMirrors the chat agent's `rename_pipeline_deal` tool so both surfaces write\nthe same two columns and nothing else.","operationId":"rename_deal_api_prospecting_deals__deal_id__rename_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RenameDealRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/set-target-value":{"post":{"tags":["prospecting"],"summary":"Set Deal Target Value Route","description":"Set or clear one deal's manual/forecast target_value.\n\nMirrors the chat agent's `set_deal_target_value` tool — both surfaces\nshare `services.deal_target_value_service.set_deal_target_value` so\nvalidation (finite, >= 0, capped) and the linked-entity refusal live in\nexactly one place.","operationId":"set_deal_target_value_route_api_prospecting_deals__deal_id__set_target_value_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetDealTargetValueRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/unarchive":{"post":{"tags":["prospecting"],"summary":"Unarchive Deal","description":"Restore an archived deal to its retained pipeline stage.","operationId":"unarchive_deal_api_prospecting_deals__deal_id__unarchive_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/promote-to-client":{"post":{"tags":["prospecting"],"summary":"Promote Deal To Client For User","description":"Resolve a client for a deal from an explicit user choice.","operationId":"promote_deal_to_client_for_user_api_prospecting_deals__deal_id__promote_to_client_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoteToClientRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/move":{"post":{"tags":["prospecting"],"summary":"Move Deal","description":"Move a deal to a different pipeline stage (manual drag-drop).","operationId":"move_deal_api_prospecting_deals__deal_id__move_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MoveDealRequest","default":{"stage_name":""}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/refine":{"post":{"tags":["prospecting"],"summary":"Refine Deal","description":"Refresh strategy + draft for a single deal using new context.\n\nThe user types into the dialog's \"Refine plan\" card; this enqueues a\n`pipeline_deal_replan` job carrying the user_context and a fresh\n`pipeline_run_token`. Older queued replans for this deal abort as\n`superseded` once they pick up. Does not queue a cross-deal learning\nsignal — this input is a per-deal refinement only.","operationId":"refine_deal_api_prospecting_deals__deal_id__refine_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefineDealRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/pipeline":{"get":{"tags":["prospecting"],"summary":"Get Pipeline State","description":"Get the full pipeline state for rendering the kanban view.","operationId":"get_pipeline_state_api_prospecting_pipeline_get","parameters":[{"name":"light","in":"query","required":false,"schema":{"type":"boolean","description":"When true, omit the heavy AI-plan fields (latest_strategy / latest_draft / evidence / goal) and return small derived previews instead, for faster first card-paint. The web kanban opts in; the full fields load lazily per deal via GET /deals/{id}. Other clients (mobile) leave this false and get the full payload unchanged.","default":false,"title":"Light"},"description":"When true, omit the heavy AI-plan fields (latest_strategy / latest_draft / evidence / goal) and return small derived previews instead, for faster first card-paint. The web kanban opts in; the full fields load lazily per deal via GET /deals/{id}. Other clients (mobile) leave this false and get the full payload unchanged."},{"name":"defer_annotations","in":"query","required":false,"schema":{"type":"boolean","description":"When true, skip the three post-fetch annotation passes (_annotate_client_contacts / _annotate_commercial_states / _annotate_latest_activities) — the ~2.5s cost that scales with deal count. Cards still receive deal_party identity in the initial light projection, but paint without client_contacts / commercial_state / latest_activity; the caller fetches those separately via POST /pipeline/annotations. stage_totals values are 0 in this mode (no commercial_state to sum) — the frontend computes $ totals client-side once annotations land. Default unchanged: any caller that doesn't opt in (incl. mobile) gets today's exact payload.","default":false,"title":"Defer Annotations"},"description":"When true, skip the three post-fetch annotation passes (_annotate_client_contacts / _annotate_commercial_states / _annotate_latest_activities) — the ~2.5s cost that scales with deal count. Cards still receive deal_party identity in the initial light projection, but paint without client_contacts / commercial_state / latest_activity; the caller fetches those separately via POST /pipeline/annotations. stage_totals values are 0 in this mode (no commercial_state to sum) — the frontend computes $ totals client-side once annotations land. Default unchanged: any caller that doesn't opt in (incl. mobile) gets today's exact payload."},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/pipeline/annotations":{"post":{"tags":["prospecting"],"summary":"Get Pipeline Annotations","description":"Batch-compute the deferred pipeline annotations for a chosen set of deals.\n\nThe counterpart to `GET /pipeline?defer_annotations=true`: that endpoint\nskips `_annotate_client_contacts` / `_annotate_commercial_states` /\n`_annotate_latest_activities` for a fast first paint; the web kanban calls\nthis afterward, in priority batches, to stream those fields in. Deal ids\noutside the caller's org are silently dropped rather than erroring — the\ncaller is just naming rows it already saw on its own board.","operationId":"get_pipeline_annotations_api_prospecting_pipeline_annotations_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineAnnotationsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/network-counts":{"get":{"tags":["prospecting"],"summary":"Get Dashboard Network Counts","description":"Return cheap network counts for dashboard import/source affordances.","operationId":"get_dashboard_network_counts_api_prospecting_network_counts_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/network-summary":{"get":{"tags":["prospecting"],"summary":"Get Network Summary","description":"Return the prospecting agent's contact pool composition.\n\nThe \"remaining_potential_count\" (the AI Zone's \"Available Contacts\") is\nGOAL-SCOPED: exclusions only count for the goal a run will actually use.\n- `goal_id`: scope exclusions to that goal at its current version (the pool\n  reflects what that goal has already triaged).\n- `fresh=true`: preview for a brand-NEW goal — it has excluded no one yet, so\n  the full eligible pool is available (the \"new goal resets the pool\" case).\n  Implemented via a sentinel goal_id that matches no existing deal.\n- neither: legacy goal-blind composition (back-compat for other callers).\n\n`bypass_cache=true` is orthogonal to the above: it skips the cached value\nfor whichever scope was resolved, recomputes, and repopulates the cache\nwith the fresh result (so other readers of that scope also benefit). Used\nright after a client-side contact import — those writes go straight to\nSupabase and never invalidate this process's cache, so without this the\ndialog can show stale pre-import numbers for up to 5 minutes.","operationId":"get_network_summary_api_prospecting_network_summary_get","parameters":[{"name":"goal_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal Id"}},{"name":"fresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Fresh"}},{"name":"bypass_cache","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Bypass Cache"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/draft-proposal":{"post":{"tags":["prospecting"],"summary":"Draft Proposal For Deal","description":"Create a proposal from a deal and launch the proposal agent.","operationId":"draft_proposal_for_deal_api_prospecting_deals__deal_id__draft_proposal_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/draft":{"patch":{"tags":["prospecting"],"summary":"Save Outreach Draft For Deal","description":"Save subject/body only, without changing the canonical sales plan.\n\nThe first operator edit snapshots the generated copy inside the draft\nenvelope. Send-time comms learning can therefore still compare the\ngenerated draft with the final sent copy after one or more autosaves.","operationId":"save_outreach_draft_for_deal_api_prospecting_deals__deal_id__draft_patch","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveOutreachDraftRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/send-outreach":{"post":{"tags":["prospecting"],"summary":"Send Outreach For Deal","description":"Send the drafted outreach email for a deal.","operationId":"send_outreach_for_deal_api_prospecting_deals__deal_id__send_outreach_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/SendOutreachRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/links":{"post":{"tags":["prospecting"],"summary":"Create Deal Link","description":"Attach a proposal / invoice / booking to a deal.\n\nPromotes a fallback-matched ref to an explicit entity_links row, or\nswaps in a different target. The kanban resolver picks the most-recent\nlinked entity, so creating a new link with the user's chosen target\nautomatically wins over older links of the same type. Removing stale\nlinks is a separate DELETE endpoint.\n\nDelegates to `services.deal_link_service.link_deal_item` — the same\nuse case the chat agent's `link_deal_item` tool calls, so org-scoping,\nidempotency, the archived-deal refusal, and `deal.item_linked`\nemission live in exactly one place.","operationId":"create_deal_link_api_prospecting_deals__deal_id__links_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDealLinkRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/deals/{deal_id}/links/{link_id}":{"delete":{"tags":["prospecting"],"summary":"Delete Deal Link","description":"Remove an entity_links row from a deal.\n\nNo-op if the row is missing or belongs to a different org — returns\n200 either way so the UI can fire-and-forget without retry logic.","operationId":"delete_deal_link_api_prospecting_deals__deal_id__links__link_id__delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/prospecting/sessions":{"get":{"tags":["prospecting"],"summary":"List Sessions","description":"List recent prospecting agent sessions for debugging.","operationId":"list_sessions_api_prospecting_sessions_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deal-sync":{"post":{"tags":["pipeline"],"summary":"Create Deal Sync Run","description":"Start a fast-cycle deal sync for the org.\n\nEnqueues a `pipeline_deal_sync` background job. The dispatcher in\n`services/job_processor.py` routes it to the deterministic Python\nsweep (`run_deal_sync_for_org`) — no Managed Agent invocation.\n\nThe hourly scheduled routine calls the same underlying sweep directly;\nthis endpoint is available for manual triggering / ops. ``force=true``\nbypasses the normal sparse email cadence and stale-check window for a\nuser-requested catch-up; the per-run safety cap and per-deal idempotency\nstill apply.","operationId":"create_deal_sync_run_api_pipeline_deal_sync_post","parameters":[{"name":"force","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Force"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/agent-review":{"post":{"tags":["pipeline"],"summary":"Create Agent Review Run","description":"Trigger a \"Review Pipeline\" run as a DETERMINISTIC fan-out of per-deal replans.\n\nThe old behavior was one survey-then-act `pipeline_agent_review` SDK session\nthat called `list_deals_needing_attention` itself and acted on up to 10\ndeals. With the deal_agent collapsed to async replan/initial runs, there is\nno `agent_review` run-mode anymore. Instead we do the deal selection\nserver-side here — reusing the same warmest-first\n`list_deals_needing_attention` query the tool used — and enqueue one ordinary\n`pipeline_deal_replan` job per selected deal (same token-rotation +\nsupersede semantics as the per-deal Replan button). This removes the\nmulti-deal agent loop while preserving \"review the warm deals and refresh\ntheir plans\" as the user-visible outcome.","operationId":"create_agent_review_run_api_pipeline_agent_review_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/replan":{"post":{"tags":["pipeline"],"summary":"Replan Deal Route","description":"Enqueue a per-deal replan job for the pipeline agent.\n\nGenerates a fresh `pipeline_run_token`, writes it to the deal row, and\nenqueues a `pipeline_deal_replan` job carrying the token. Older queued\njobs for the same deal abort as `superseded` when they pick up because\ntheir stored token no longer matches the row's current token.","operationId":"replan_deal_route_api_pipeline_deals__deal_id__replan_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplanDealRequest","default":{}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/log-message":{"post":{"tags":["pipeline"],"summary":"Log Deal Message Route","description":"Log a completed activity as a message → async replan that records + replans.\n\nAsync sibling of the synchronous deal-agent chat. The operator logs what\nthey did (e.g. after a call); the shared `enqueue_log_activity_replan`\nhelper stamps a fresh `pipeline_run_token`, supersedes any pending replans\nfor this deal (newest wins), persists the note as an operator chat message\nso it renders immediately, then enqueues a `pipeline_deal_replan` carrying\nthe logged activity as `user_context` so the agent records it on the\ntimeline, marks the completed step done, and surgically refreshes the plan.\nThe same helper backs the Every-agent `log_deal_activity` tool.","operationId":"log_deal_message_route_api_pipeline_deals__deal_id__log_message_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogMessageRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/interactions":{"post":{"tags":["pipeline"],"summary":"Log Deal Interaction Route","description":"Log an off-platform activity note onto this deal's timeline.","operationId":"log_deal_interaction_route_api_pipeline_deals__deal_id__interactions_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogDealInteractionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/interactions/{event_id}":{"delete":{"tags":["pipeline"],"summary":"Delete Deal Interaction Route","description":"Delete a user-logged activity note from this deal's timeline.","operationId":"delete_deal_interaction_route_api_pipeline_deals__deal_id__interactions__event_id__delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/activity-context":{"get":{"tags":["pipeline"],"summary":"Get Deal Activity Context Route","description":"Explain Google activity coverage for the deal timeline.\n\nThe timeline RPC stays focused on events. This endpoint supplies the\nuser-facing account context needed to avoid misleading \"No activity yet\"\nstates and to show when multiple teammate mailboxes observed one logical\nGmail/Calendar event.","operationId":"get_deal_activity_context_route_api_pipeline_deals__deal_id__activity_context_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/owner":{"patch":{"tags":["pipeline"],"summary":"Change Deal Owner Route","description":"Change the persisted deal owner and replan for that owner's context.","operationId":"change_deal_owner_route_api_pipeline_deals__deal_id__owner_patch","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeDealOwnerRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/by-contact/{contact_id}":{"get":{"tags":["pipeline"],"summary":"List Deals By Contact","description":"List all deal cycles (active + historical) for a contact, newest first.\n\nUsed by the re-engagement panel (Phase 2 frontend) to show prior\nwon/lost cycles with `cycle_number` and outcome. Phase 1 returns the\nsame shape; Phase 2 UI consumes it.","operationId":"list_deals_by_contact_api_pipeline_deals_by_contact__contact_id__get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/by-contact/{contact_id}/make-new-plan":{"post":{"tags":["pipeline"],"summary":"Make New Plan For Contact","description":"Start a new deal cycle for a known contact.\n\nInserts a fresh `prospecting_deals` row (cycle_number = max(prior) + 1)\npointing at the contact, stamped with the user-supplied goal, then\nenqueues a pipeline_deal_replan job seeded with `mode_hint='initial_plan'`.\n\nFirst-cycle behavior: if no prior cycles exist, cycle_number=1 and\nprior_cycle_deal_id=None. The endpoint is idempotent at the cycle level\nvia UNIQUE(org_id, dedupe_key, cycle_number).","operationId":"make_new_plan_for_contact_api_pipeline_deals_by_contact__contact_id__make_new_plan_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MakeNewPlanRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/goal":{"post":{"tags":["pipeline"],"summary":"Update Deal Goal","description":"Update a deal's goal anchor and trigger a goal_changed replan.\n\nPhase 2: the goal jsonb is the success measure the pipeline agent reads\non every replan. Editing it forces a fresh strategy + draft pass.","operationId":"update_deal_goal_api_pipeline_deals__deal_id__goal_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealGoalRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/criteria":{"post":{"tags":["pipeline"],"summary":"Update Deal Criteria","description":"Update a deal's per-stage success-criteria overrides and trigger a\ncriteria_changed replan.\n\nMirrors `/goal`: normalizes the sparse override patch, stamps it on the deal\n(NULL when empty) while rotating `pipeline_run_token`, enqueues exactly ONE\n`pipeline_deal_replan`, and fires a best-effort `criteria_changed` timeline\nevent. The replan resolves the deal's current stage via the join (no\n`new_stage_name`).","operationId":"update_deal_criteria_api_pipeline_deals__deal_id__criteria_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealCriteriaRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/note":{"post":{"tags":["pipeline"],"summary":"Update Deal Note","description":"Update the operator-authored note attached to a deal.","operationId":"update_deal_note_api_pipeline_deals__deal_id__note_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDealNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/pipeline/deals/{deal_id}/messages":{"get":{"tags":["pipeline"],"summary":"List Deal Messages","description":"List durable operator↔agent messages for a deal, oldest first.\n\nUsed by deal-history reply notices and agent replan context. Org/deal\nscoped via RLS + explicit filters. Pagination via ``before`` (created_at\nISO timestamp).","operationId":"list_deal_messages_api_pipeline_deals__deal_id__messages_get","parameters":[{"name":"deal_id","in":"path","required":true,"schema":{"type":"string","title":"Deal Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Before"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/meta-fields/definitions":{"get":{"tags":["meta-fields"],"summary":"List Meta Field Definitions","operationId":"list_meta_field_definitions_api_meta_fields_definitions_get","parameters":[{"name":"entity_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Type"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["meta-fields"],"summary":"Create Meta Field Definition","operationId":"create_meta_field_definition_api_meta_fields_definitions_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__meta_field_routes__CreateDefinitionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/meta-fields/definitions/{definition_id}":{"patch":{"tags":["meta-fields"],"summary":"Patch Meta Field Definition","operationId":"patch_meta_field_definition_api_meta_fields_definitions__definition_id__patch","parameters":[{"name":"definition_id","in":"path","required":true,"schema":{"type":"string","title":"Definition Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDefinitionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/meta-fields/values/{entity_type}/{entity_id}":{"get":{"tags":["meta-fields"],"summary":"Get Meta Field Values","operationId":"get_meta_field_values_api_meta_fields_values__entity_type___entity_id__get","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["meta-fields"],"summary":"Put Meta Field Values","operationId":"put_meta_field_values_api_meta_fields_values__entity_type___entity_id__put","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetValuesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/meta-fields/values/{entity_type}/{entity_id}/{key}":{"delete":{"tags":["meta-fields"],"summary":"Delete Meta Field Value","operationId":"delete_meta_field_value_api_meta_fields_values__entity_type___entity_id___key__delete","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}},{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/meta-fields/find/{entity_type}":{"get":{"tags":["meta-fields"],"summary":"Find Entities By Meta Field","operationId":"find_entities_by_meta_field_api_meta_fields_find__entity_type__get","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"type":"string","title":"Entity Type"}},{"name":"key","in":"query","required":true,"schema":{"type":"string","minLength":1,"maxLength":64,"title":"Key"}},{"name":"op","in":"query","required":false,"schema":{"enum":["eq","neq","gt","gte","lt","lte","is_set","is_not_set","contains","contains_any"],"type":"string","description":"Typed comparison operator. contains matches one value in a list field; contains_any matches any repeated values parameter.","default":"eq","title":"Op"},"description":"Typed comparison operator. contains matches one value in a list field; contains_any matches any repeated values parameter."},{"name":"value","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"}},{"name":"values","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Repeated values for contains_any, for example values=vip&values=enterprise.","title":"Values"},"description":"Repeated values for contains_any, for example values=vip&values=enterprise."},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/geo/country":{"get":{"tags":["geo-public"],"summary":"Get Visitor Country","operationId":"get_visitor_country_public_geo_country_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GeoCountryResponse"}}}}}}},"/public/contact/sales":{"post":{"tags":["contact-public"],"summary":"Submit Contact Sales","description":"Email a homepage contact-form submission to hello@every.ai.\n\nAlways answers 200 on an accepted submission, including honeypot hits —\na public form must not reveal detection to the caller. Only a genuine\nsend failure returns an error, so the frontend can show a generic\n\"something went wrong\" state.","operationId":"submit_contact_sales_public_contact_sales_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSalesRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactSalesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contacts/filter-import-emails":{"post":{"tags":["contacts"],"summary":"Filter Import Emails","description":"Evaluate browser-owned import emails with the shared backend policy.","operationId":"filter_import_emails_api_contacts_filter_import_emails_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportEmailFilterRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contacts/{contact_id}/google-context-hydration":{"get":{"tags":["contacts"],"summary":"Get Contact Google Context Hydration Status","description":"Status of the 30-day Gmail/Calendar hydration ledger for one contact.\n\n`active` is true while any ledger row for this contact is still\npending/processing. The ledger table\n(`contact_recent_google_context_requests`) is service-role-only — no RLS\npolicy exposes it to the client — so this read goes through the backend\ninstead of the direct-Supabase path most contact reads use.","operationId":"get_contact_google_context_hydration_status_api_contacts__contact_id__google_context_hydration_get","parameters":[{"name":"contact_id","in":"path","required":true,"schema":{"type":"string","title":"Contact Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contacts/known-by":{"post":{"tags":["contacts"],"summary":"Get Contacts Known By","description":"Batch known-by facts for a set of contacts: which org members know each\ncontact, with source + first/last-touch timestamps. Facts only — no\ncomputed warmth score (explicit product decision, see the plan).\n\norg_id-scoped like every other read here; a contact_id outside the\ncaller's org simply yields no rows (contact_known_by carries its own\norg_id column, so no separate ownership check is needed).","operationId":"get_contacts_known_by_api_contacts_known_by_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnownByRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/contacts/network-overlap":{"get":{"tags":["contacts"],"summary":"Get Contacts Network Overlap","description":"Live-computed team overlap over the known-by graph: per-member\ncontact/company counts + pairwise shared-contact overlap. No cached job\n(mirrors services/network_rollup.py's live-full-scan posture); the\nfrontend gates display to multi-member orgs, so a solo org just gets\nempty arrays back.","operationId":"get_contacts_network_overlap_api_contacts_network_overlap_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/providers":{"get":{"tags":["accounting"],"summary":"List Accounting Providers","operationId":"list_accounting_providers_api_accounting_providers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/accounting/connections":{"get":{"tags":["accounting"],"summary":"List Connections","operationId":"list_connections_api_accounting_connections_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/accounting/oauth/start":{"post":{"tags":["accounting"],"summary":"Start Oauth","operationId":"start_oauth_api_accounting_oauth_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__accounting_routes__OAuthStartRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/oauth/{provider}/callback":{"get":{"tags":["accounting"],"summary":"Oauth Callback","operationId":"oauth_callback_api_accounting_oauth__provider__callback_get","parameters":[{"name":"provider","in":"path","required":true,"schema":{"$ref":"#/components/schemas/AccountingProvider"}},{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"realmId","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Realmid"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},{"name":"error_description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Description"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}/catalog":{"get":{"tags":["accounting"],"summary":"Connection Catalog","operationId":"connection_catalog_api_accounting_connections__connection_id__catalog_get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}},{"name":"resource","in":"query","required":true,"schema":{"enum":["accounts","tax_rates","items","tracking"],"type":"string","title":"Resource"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}":{"get":{"tags":["accounting"],"summary":"Connection Detail","operationId":"connection_detail_api_accounting_connections__connection_id__get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["accounting"],"summary":"Disconnect Connection","operationId":"disconnect_connection_api_accounting_connections__connection_id__delete","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}/mappings":{"put":{"tags":["accounting"],"summary":"Upsert Mapping","operationId":"upsert_mapping_api_accounting_connections__connection_id__mappings_put","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MappingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}/settings":{"patch":{"tags":["accounting"],"summary":"Update Connection Settings","operationId":"update_connection_settings_api_accounting_connections__connection_id__settings_patch","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectionSettingsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}/entities/{entity_type}/{entity_id}/status":{"get":{"tags":["accounting"],"summary":"Entity Sync Status","operationId":"entity_sync_status_api_accounting_connections__connection_id__entities__entity_type___entity_id__status_get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}},{"name":"entity_type","in":"path","required":true,"schema":{"enum":["client","invoice","payment","expense"],"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}/default":{"post":{"tags":["accounting"],"summary":"Set Default Connection","operationId":"set_default_connection_api_accounting_connections__connection_id__default_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}/sync":{"post":{"tags":["accounting"],"summary":"Queue Manual Sync","operationId":"queue_manual_sync_api_accounting_connections__connection_id__sync_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualSyncRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/connections/{connection_id}/sync-all":{"post":{"tags":["accounting"],"summary":"Queue Manual Full Sync","operationId":"queue_manual_full_sync_api_accounting_connections__connection_id__sync_all_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/accounting/webhooks/xero":{"post":{"tags":["accounting-webhooks"],"summary":"Xero Webhook","operationId":"xero_webhook_api_accounting_webhooks_xero_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/accounting/webhooks/quickbooks":{"post":{"tags":["accounting-webhooks"],"summary":"Quickbooks Webhook","operationId":"quickbooks_webhook_api_accounting_webhooks_quickbooks_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/client-verification/request":{"post":{"tags":["client-verification"],"summary":"Request Client Verification","description":"Request email verification for a client.","operationId":"request_client_verification_client_verification_request_post","parameters":[{"name":"entity_type","in":"query","required":true,"schema":{"enum":["invoice","proposal"],"type":"string","title":"Entity Type"}},{"name":"public_id","in":"query","required":true,"schema":{"type":"string","title":"Public Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RequestVerificationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/client-verification/verify/{token}":{"get":{"tags":["client-verification"],"summary":"Verify Client Token","description":"Verify a client email token.","operationId":"verify_client_token_client_verification_verify__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/entity-avatars/{entity_type}/{entity_id}":{"post":{"tags":["entity-avatars"],"summary":"Upload Entity Avatar","operationId":"upload_entity_avatar_api_entity_avatars__entity_type___entity_id__post","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"enum":["contact","client"],"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_entity_avatar_api_entity_avatars__entity_type___entity_id__post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityAvatarResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["entity-avatars"],"summary":"Delete Entity Avatar","operationId":"delete_entity_avatar_api_entity_avatars__entity_type___entity_id__delete","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"enum":["contact","client"],"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityAvatarResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/entity-avatars/{entity_type}/{entity_id}/resolve":{"post":{"tags":["entity-avatars"],"summary":"Resolve Entity Avatar From Known Links","description":"Queue fill-empty discovery from the entity's persisted URL signals.","operationId":"resolve_entity_avatar_from_known_links_api_entity_avatars__entity_type___entity_id__resolve_post","parameters":[{"name":"entity_type","in":"path","required":true,"schema":{"enum":["contact","client"],"type":"string","title":"Entity Type"}},{"name":"entity_id","in":"path","required":true,"schema":{"type":"string","title":"Entity Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntityAvatarResolveResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/subdomain-slug":{"get":{"tags":["organization"],"summary":"Get Subdomain Slug","description":"Get the current subdomain slug for the org.","operationId":"get_subdomain_slug_api_organization_subdomain_slug_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"put":{"tags":["organization"],"summary":"Update Subdomain Slug","description":"Set or update the org's subdomain slug.","operationId":"update_subdomain_slug_api_organization_subdomain_slug_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSubdomainSlugRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["organization"],"summary":"Delete Subdomain Slug","description":"Remove the org's subdomain slug.","operationId":"delete_subdomain_slug_api_organization_subdomain_slug_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/organization/subdomain-slug/check":{"get":{"tags":["organization"],"summary":"Check Subdomain Slug","description":"Check if a subdomain slug is available.","operationId":"check_subdomain_slug_api_organization_subdomain_slug_check_get","parameters":[{"name":"slug","in":"query","required":true,"schema":{"type":"string","minLength":3,"maxLength":63,"title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/rules":{"get":{"tags":["organization"],"summary":"List Rules","description":"List active Team rules plus the acting user's Private rules.","operationId":"list_rules_api_organization_rules_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["organization"],"summary":"Create Rule","description":"Create a manual rule through the same transactional core as chat.","operationId":"create_rule_api_organization_rules_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateRuleRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/rules/{rule_id}":{"patch":{"tags":["organization"],"summary":"Update Rule","description":"Supersede a rule while preserving immutable rule history.","operationId":"update_rule_api_organization_rules__rule_id__patch","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","title":"Rule Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRuleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["organization"],"summary":"Delete Rule","description":"Revoke a Private rule or apply Team-rule authority/opt-out semantics.","operationId":"delete_rule_api_organization_rules__rule_id__delete","parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","title":"Rule Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/validate-prompt":{"post":{"tags":["organization"],"summary":"Validate Prompt","description":"Validate a prompt for security issues without saving it.\nUseful for real-time validation in the UI.","operationId":"validate_prompt_api_organization_validate_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidatePromptRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidatePromptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/update-prompt":{"post":{"tags":["organization"],"summary":"Update Org Prompt","description":"Update the organization's business context after security validation.\n\nPost-Phase-2: this endpoint no longer writes the legacy `orgs.org_prompt`\ncolumn. The submitted text is saved as `business_context.identity_summary`\nvia the structured per-field RPC (and the field is owner-locked so BI will\nnot overwrite it). Callers that need richer structure should use\n`/api/organization/business-context/field` directly.","operationId":"update_org_prompt_api_organization_update_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgPromptRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateOrgPromptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/prompt":{"get":{"tags":["organization"],"summary":"Get Org Prompt","description":"Get the current organization prompt.\n\nPost-Phase-2: returns the rendered `business_context` block (full structured\ncontext) instead of the legacy `orgs.org_prompt` column.","operationId":"get_org_prompt_api_organization_prompt_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"delete":{"tags":["organization"],"summary":"Delete Org Prompt","description":"Delete/clear the organization's custom prompt.\n\nPost-Phase-2: clears `business_context.identity_summary` (and removes its\nfield lock so BI can repopulate it on the next run). The legacy\n`orgs.org_prompt` column is not touched.","operationId":"delete_org_prompt_api_organization_prompt_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/organization/business-dna":{"get":{"tags":["organization"],"summary":"Get Business Dna Route","description":"Return the org's structured business_dna row (or null if not yet generated).","operationId":"get_business_dna_route_api_organization_business_dna_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/organization/business-dna/field":{"post":{"tags":["organization"],"summary":"Update Business Dna Field Route","description":"Owner-edit a single structured field; sets field_locks so BI won't clobber it.","operationId":"update_business_dna_field_route_api_organization_business_dna_field_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBusinessContextFieldRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/business-context":{"get":{"tags":["organization"],"summary":"Get Business Context Route","description":"Deprecated alias for /business-dna.","operationId":"get_business_context_route_api_organization_business_context_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/organization/business-context/field":{"post":{"tags":["organization"],"summary":"Update Business Context Field Route","description":"Deprecated alias for /business-dna/field.","operationId":"update_business_context_field_route_api_organization_business_context_field_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBusinessContextFieldRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/onboarding/bootstrap":{"post":{"tags":["organization"],"summary":"Bootstrap Onboarding","description":"Bootstrap a new organization during onboarding.\n\nThis endpoint sets up the structural defaults a new org needs:\n- Default prospecting pipeline stages + settings\n- Default org skill templates\n- Subdomain slug + (unpublished) booking page\n- Daily Brief scheduled task\n- Optional Google Contacts import only when enabled in code\n- Welcome email\n\nNo sample client/service/skill is seeded — the welcome agent creates\nvertical-appropriate examples on demand.\n\nThe endpoint is idempotent and safe to call multiple times.","operationId":"bootstrap_onboarding_api_organization_onboarding_bootstrap_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/OnboardingBootstrapRequest"},{"type":"null"}],"title":"Request"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingBootstrapResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/onboarding/seed-welcome":{"post":{"tags":["organization"],"summary":"Seed Onboarding Welcome","description":"Onboarding chat removed 2026-07-06.\n\nThis shim exists only so stale mobile OTA bundles calling it degrade to a\nno-op; delete after OTA saturation.","operationId":"seed_onboarding_welcome_api_organization_onboarding_seed_welcome_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedWelcomeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedWelcomeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/timezone":{"get":{"tags":["organization"],"summary":"Get Timezone","description":"Get the organization's current timezone.","operationId":"get_timezone_api_organization_timezone_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Timezone Api Organization Timezone Get"}}}}}},"post":{"tags":["organization"],"summary":"Update Timezone","description":"Update the organization's timezone.\n\nAccepts IANA timezone names like 'America/New_York', 'Europe/London', etc.","operationId":"update_timezone_api_organization_timezone_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTimezoneRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Update Timezone Api Organization Timezone Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/sync-clerk-name":{"post":{"tags":["organization"],"summary":"Sync Clerk Name","description":"One-way sync of the organization's current Supabase `orgs.name` to Clerk's\norganization name. No request body — reads the org's own name.","operationId":"sync_clerk_name_api_organization_sync_clerk_name_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Sync Clerk Name Api Organization Sync Clerk Name Post"}}}}}}},"/api/organization/sync-subscription":{"post":{"tags":["organization"],"summary":"Sync Subscription","description":"Sync subscription status from Clerk for the current organization.\n\nThis endpoint is called after org creation to immediately sync subscription status\nwithout waiting for the nightly job.\n\nReturns:\n    Dictionary with sync result","operationId":"sync_subscription_api_organization_sync_subscription_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Sync Subscription Api Organization Sync Subscription Post"}}}}}}},"/api/check-user-organizations":{"get":{"tags":["organization"],"summary":"Check User Organizations","description":"Check if the current user has any organization memberships.\n\nThis endpoint uses the Clerk backend API to get authoritative data\nabout the user's organization memberships, bypassing frontend caching issues.\n\nReturns:\n    Dict with hasOrganizations (bool) and organizationCount (int)","operationId":"check_user_organizations_api_check_user_organizations_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/organization/api-keys":{"get":{"tags":["organization","api-keys"],"summary":"List Org Api Keys","operationId":"list_org_api_keys_api_organization_api_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ApiKeyPublic"},"type":"array","title":"Response List Org Api Keys Api Organization Api Keys Get"}}}}}},"post":{"tags":["organization","api-keys"],"summary":"Create Org Api Key","operationId":"create_org_api_key_api_organization_api_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiKeyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/organization/api-keys/{key_id}/revoke":{"post":{"tags":["organization","api-keys"],"summary":"Revoke Org Api Key","operationId":"revoke_org_api_key_api_organization_api_keys__key_id__revoke_post","parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/external/v1/invoices":{"get":{"tags":["external"],"summary":"List Invoices","operationId":"list_invoices","security":[{"HTTPBearer":[]}],"parameters":[{"name":"paymentStatus","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by payment status: unpaid|paid|overdue|partial","title":"Paymentstatus"},"description":"Filter by payment status: unpaid|paid|overdue|partial"},{"name":"invoiceStatus","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by invoice status: draft|estimate|issued|void","title":"Invoicestatus"},"description":"Filter by invoice status: draft|estimate|issued|void"},{"name":"clientId","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Clientid"}},{"name":"updatedSince","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO timestamp; return invoices updated_at >= this","title":"Updatedsince"},"description":"ISO timestamp; return invoices updated_at >= this"},{"name":"issueDateFrom","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuedatefrom"}},{"name":"issueDateTo","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuedateto"}},{"name":"include","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Comma-separated includes: client,line_items,payments","title":"Include"},"description":"Comma-separated includes: client,line_items,payments"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-background-jobs/{job_id}":{"get":{"tags":["background-jobs"],"summary":"Get Job Status","description":"Get the status of a background job.","operationId":"get_job_status_api_agent_background_jobs__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-background-jobs/{job_id}/undo":{"post":{"tags":["background-jobs"],"summary":"Undo Codex Import","description":"Undo a completed Codex import job.","operationId":"undo_codex_import_api_agent_background_jobs__job_id__undo_post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/codex-schema/match":{"post":{"tags":["codex-schema"],"summary":"Match Schema","description":"Return previously successful Codex imports whose schema matches the uploaded CSV.","operationId":"match_schema_api_codex_schema_match_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaMatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaMatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/codex-schema/all-saved-scripts":{"get":{"tags":["codex-schema"],"summary":"Get All Saved Scripts","description":"Return all completed import scripts for the organization (saved and unsaved).","operationId":"get_all_saved_scripts_api_codex_schema_all_saved_scripts_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaMatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/codex-schema/agent-evaluate":{"post":{"tags":["codex-schema"],"summary":"Evaluate Schema Reuse","description":"Use the schema safety agent to assess whether a prior script fits the new CSV.","operationId":"evaluate_schema_reuse_api_codex_schema_agent_evaluate_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGuardRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchemaGuardResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/codex-schema/toggle-save/{job_id}":{"post":{"tags":["codex-schema"],"summary":"Toggle Save Script","description":"Toggle the saved/starred state of an import script by setting or clearing its nickname.","operationId":"toggle_save_script_api_codex_schema_toggle_save__job_id__post","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","description":"The ID of the import job to save/unsave","title":"Job Id"},"description":"The ID of the import job to save/unsave"},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToggleSaveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Toggle Save Script Api Codex Schema Toggle Save  Job Id  Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/codex-schema/preview-upload":{"post":{"tags":["codex-schema"],"summary":"Preview Upload","description":"Parse an uploaded spreadsheet server-side and return headers, sample rows, and schema signature.","operationId":"preview_upload_api_codex_schema_preview_upload_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewUploadRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/codex-schema/run-saved-script":{"post":{"tags":["codex-schema"],"summary":"Run Saved Script","description":"Execute a saved import script synchronously against a new spreadsheet.","operationId":"run_saved_script_api_codex_schema_run_saved_script_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSavedScriptRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunSavedScriptResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/summary-metrics":{"get":{"summary":"Summary Metrics","operationId":"summary_metrics_api_summary_metrics_get","parameters":[{"name":"entities","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Optional comma-separated list of summary entity keys (e.g. 'invoices,clients').","title":"Entities"},"description":"Optional comma-separated list of summary entity keys (e.g. 'invoices,clients')."},{"name":"org_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},{"name":"user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/daily-brief":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Daily Brief Status","description":"Get the status of the current user's Daily Brief routine.\n\nDaily Brief is default-on per user. This read path also backfills the\ndefinition for invited/existing org members who did not create the org.","operationId":"get_daily_brief_status_api_agent_scheduled_tasks_daily_brief_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["agent-scheduled-tasks"],"summary":"Enable Daily Brief","description":"Enable the current user's Daily Brief routine.","operationId":"enable_daily_brief_api_agent_scheduled_tasks_daily_brief_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnableDailyBriefRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["agent-scheduled-tasks"],"summary":"Disable Daily Brief","description":"Disable the current user's Daily Brief routine.","operationId":"disable_daily_brief_api_agent_scheduled_tasks_daily_brief_delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/prospecting-slow-scan":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Prospecting Scheduled Scan Status","description":"Get and backfill the shared Prospecting Scheduled Scan routine.","operationId":"get_prospecting_scheduled_scan_status_api_agent_scheduled_tasks_prospecting_slow_scan_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/prospecting-scheduled-scan":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Prospecting Scheduled Scan Status","description":"Get and backfill the shared Prospecting Scheduled Scan routine.","operationId":"get_prospecting_scheduled_scan_status_api_agent_scheduled_tasks_prospecting_scheduled_scan_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/pipeline-deal-sync":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Pipeline Deal Sync Status","description":"Get and backfill the shared Pipeline Deal Sync routine.","operationId":"get_pipeline_deal_sync_status_api_agent_scheduled_tasks_pipeline_deal_sync_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/pipeline-context-heartbeat":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Pipeline Context Heartbeat Status","description":"Get and backfill the shared nightly Pipeline Heartbeat routine.","operationId":"get_pipeline_context_heartbeat_status_api_agent_scheduled_tasks_pipeline_context_heartbeat_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/{definition_id}/run-now":{"post":{"tags":["agent-scheduled-tasks"],"summary":"Run Scheduled Task Now","description":"Trigger an immediate run for the specified scheduled task definition.","operationId":"run_scheduled_task_now_api_agent_scheduled_tasks__definition_id__run_now_post","parameters":[{"name":"definition_id","in":"path","required":true,"schema":{"type":"string","title":"Definition Id"}},{"name":"allow_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Allow Inactive"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks":{"get":{"tags":["agent-scheduled-tasks"],"summary":"List Definitions","description":"List all scheduled task definitions for the organization.\n\nReturns all definitions with their current status and latest run information.","operationId":"list_definitions_api_agent_scheduled_tasks_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["agent-scheduled-tasks"],"summary":"Create Definition","description":"Create a new scheduled task definition.\n\nThis is a generic endpoint for creating any type of scheduled task.","operationId":"create_definition_api_agent_scheduled_tasks_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__agent_scheduled_tasks__CreateDefinitionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/{task_id}":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Definition","description":"Get details of a specific scheduled task definition.","operationId":"get_definition_api_agent_scheduled_tasks__task_id__get","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["agent-scheduled-tasks"],"summary":"Delete Definition","description":"Cancel a scheduled task definition while preserving its history.","operationId":"delete_definition_api_agent_scheduled_tasks__task_id__delete","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/{task_id}/prompt-template":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Prompt Template","description":"Get the prompt template for a scheduled task.\n\nFor built-in tasks such as daily_brief, returns the system prompt template\nwith the task's config values interpolated.\n\nFor custom_prompt tasks, returns the user's custom prompt.","operationId":"get_prompt_template_api_agent_scheduled_tasks__task_id__prompt_template_get","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/{task_id}/runs":{"get":{"tags":["agent-scheduled-tasks"],"summary":"Get Run History","description":"Get run history for a scheduled task definition.\n\nReturns paginated list of runs with their status, summary, and undo information.","operationId":"get_run_history_api_agent_scheduled_tasks__task_id__runs_get","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/{task_id}/runs/{run_id}/undo":{"post":{"tags":["agent-scheduled-tasks"],"summary":"Undo Run","description":"Undo a specific scheduled task run.\n\nThis will reverse all changes made during the run using the stored undo snapshot.","operationId":"undo_run_api_agent_scheduled_tasks__task_id__runs__run_id__undo_post","parameters":[{"name":"task_id","in":"path","required":true,"schema":{"type":"string","title":"Task Id"}},{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/custom-prompt":{"post":{"tags":["agent-scheduled-tasks"],"summary":"Create Custom Prompt Task","description":"Create a new custom prompt scheduled task.\n\nThis creates a scheduled task definition with routine_type='custom_prompt'\nand stores the user's custom prompt in the agent_scheduled_task_prompts table.","operationId":"create_custom_prompt_task_api_agent_scheduled_tasks_custom_prompt_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomPromptTaskRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/agent-scheduled-tasks/{definition_id}":{"patch":{"tags":["agent-scheduled-tasks"],"summary":"Update Scheduled Task","description":"Update a scheduled task definition's metadata.\n\nThis allows updating display_name, schedule_config, timezone, and email_results.\nIf schedule_config is changed, the next run will be rescheduled.","operationId":"update_scheduled_task_api_agent_scheduled_tasks__definition_id__patch","parameters":[{"name":"definition_id","in":"path","required":true,"schema":{"type":"string","title":"Definition Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__agent_scheduled_tasks__UpdateScheduledTaskRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/events/publish":{"post":{"summary":"Publish Event","description":"Generic event publishing endpoint for all entity types.\n\nCreates an event with source='user' to track user-driven actions.\nPublishes via the centralized EventPublisher.","operationId":"publish_event_events_publish_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EventPublishRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/events/publish/bulk":{"post":{"summary":"Publish Events Bulk","description":"Bulk event publishing endpoint for batching multiple events.\n\nThis endpoint allows publishing multiple events in a single request,\nreducing network round-trips and improving performance for operations\nthat generate multiple events.","operationId":"publish_events_bulk_events_publish_bulk_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkEventPublishRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/events/publish":{"post":{"summary":"Publish Spine Event","description":"Publish ONE event onto the unified-events spine.\n\nServer-stamped: org_id from the auth context, actor=('user', user_id) ALWAYS,\nsource='user'. Client-supplied actor fields are ignored by construction (this\nendpoint never reads one). Rejects the app.page.* clickstream namespace, caps\npayload size (~8KB) and links length (≤5), then calls emit_event.","operationId":"publish_spine_event_api_events_publish_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpinePublishRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/events/publish/bulk":{"post":{"summary":"Publish Spine Events Bulk","description":"Publish MANY events onto the unified-events spine in one request.\n\nBuilt for the contact-import modals, whose runs used to send one\nPOST /api/events/publish per event (a 2k-contact LinkedIn import = ~2k\nround trips ≈ minutes of post-import stall). Same trust boundary as the\nsingle endpoint: org from auth, actor=('user', user_id), source='user',\nclient actor fields ignored. Same per-event caps (namespace allowlist,\n~8KB payload, ≤5 links) — the whole request 4xxs if ANY event violates\nthem (the importers only send well-formed rows; fail loud, not partial).\nEvents land via chunked INSERTs (emit_events_bulk), not per-row emits.","operationId":"publish_spine_events_bulk_api_events_publish_bulk_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SpineBulkPublishRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/plans":{"get":{"summary":"Get Billing Plans","description":"Fetch all billing plans from Clerk's Backend API.\n\nThis endpoint is public and does not require authentication,\nmaking it suitable for displaying pricing on public landing pages.\n\nReturns:\n    List of billing plan dictionaries\n\nRaises:\n    HTTPException: If plans cannot be fetched","operationId":"get_billing_plans_api_billing_plans_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Response Get Billing Plans Api Billing Plans Get"}}}}}}},"/api/billing/pricing-catalog":{"get":{"summary":"Get Pricing Catalog","description":"Return Clerk commercial truth composed with Every's reviewed story.","operationId":"get_pricing_catalog_api_billing_pricing_catalog_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Response Get Pricing Catalog Api Billing Pricing Catalog Get"}}}}}}},"/api/enterprise-contact":{"post":{"summary":"Submit Enterprise Contact","description":"Persist an Enterprise \"contact us\" inquiry, then best-effort alert the founders.\n\nPublic — unauthenticated calls are accepted (the marketing site has no session).\nWhen a Supabase-JWT Bearer token IS present and verifies, org_id is attached from\nthe token — NEVER trusted from the request body (same hybrid-auth pattern as\nPOST /api/promo/enrichment/register).\n\nPersists FIRST; the lead row is the system of record. Founder notification is\nbest-effort and its failure must never fail this request — the lead is already\nsaved. Always answers 200 on an accepted submission, including honeypot hits, so\na public form never reveals detection to the caller; only a genuine persistence\nfailure returns an error.","operationId":"submit_enterprise_contact_api_enterprise_contact_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnterpriseContactRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnterpriseContactResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/org-subscription":{"get":{"summary":"Get Org Subscription","description":"Fetch the billing subscription for the authenticated user's organization.\n\nThis endpoint requires authentication and uses the org_id from the user's session.\nReturns subscription data including trial dates, status, plan details, and subscription items.\n\nArgs:\n    request: FastAPI request object\n    user_id: User ID (injected by @require_auth)\n    org_id: Organization ID (injected by @require_auth)\n\nReturns:\n    Dictionary containing:\n        - status: Subscription status (e.g., \"trialing\", \"active\", \"past_due\")\n        - trial_starts_at: ISO 8601 timestamp when trial started (if applicable)\n        - trial_ends_at: ISO 8601 timestamp when trial ends (if applicable)\n        - plan_id: ID of the billing plan\n        - plan_name: Name of the billing plan\n        - subscription_items: List of subscription item details\n        - server_time: Current server time in ISO 8601 format\n\nRaises:\n    HTTPException: If org_id is missing or subscription cannot be fetched","operationId":"get_org_subscription_api_billing_org_subscription_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Org Subscription Api Billing Org Subscription Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/entitlement":{"get":{"summary":"Get Billing Entitlement","description":"Fetch internal per-org entitlement state for billing/paywall decisions.\n\nThe optional ``plan_slug`` query param is sent by the frontend (derived from\nClerk's ``has({ plan })``).  When it differs from the stored plan_slug we\ntrigger an immediate Clerk sync so credit limits update without waiting for\nthe nightly job.","operationId":"get_billing_entitlement_api_billing_entitlement_get","parameters":[{"name":"plan_slug","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Slug"}},{"name":"fresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Fresh"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EntitlementResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/subscription-items/{subscription_item_id}/extend-free-trial":{"post":{"summary":"Extend Subscription Trial","description":"Extend the free trial for a subscription item.\n\nThis endpoint is intended for admin use only. It allows extending the trial period\nfor a specific subscription item to a new end date.\n\nArgs:\n    subscription_item_id: The ID of the subscription item to extend\n    body: Request body containing the new trial end date\n    request: FastAPI request object\n    user_id: User ID (injected by @require_auth)\n    org_id: Organization ID (injected by @require_auth)\n\nReturns:\n    Updated subscription item data\n\nRaises:\n    HTTPException: If the operation fails","operationId":"extend_subscription_trial_api_billing_subscription_items__subscription_item_id__extend_free_trial_post","parameters":[{"name":"subscription_item_id","in":"path","required":true,"schema":{"type":"string","title":"Subscription Item Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtendTrialRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Extend Subscription Trial Api Billing Subscription Items  Subscription Item Id  Extend Free Trial Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/usage-breakdown":{"get":{"summary":"Get Usage Breakdown","description":"Return AI credit usage event log for the last 90 days.","operationId":"get_usage_breakdown_api_billing_usage_breakdown_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Usage Breakdown Api Billing Usage Breakdown Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/credit-settings":{"get":{"summary":"Get Credit Settings","operationId":"get_credit_settings_api_billing_credit_settings_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Update Credit Settings","operationId":"update_credit_settings_api_billing_credit_settings_put","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditSettingsUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/credits/checkout-session":{"post":{"summary":"Create Credit Checkout Session","operationId":"create_credit_checkout_session_api_billing_credits_checkout_session_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditCheckoutRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Credit Checkout Session Api Billing Credits Checkout Session Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/credits/purchases":{"get":{"summary":"List Credit Purchases","operationId":"list_credit_purchases_api_billing_credits_purchases_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Limit"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Credit Purchases Api Billing Credits Purchases Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/credit-history":{"get":{"summary":"Get Credit History","operationId":"get_credit_history_api_billing_credit_history_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Credit History Api Billing Credit History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/credits/reconcile-session":{"post":{"summary":"Reconcile Credit Checkout Session","operationId":"reconcile_credit_checkout_session_api_billing_credits_reconcile_session_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reconcile Credit Checkout Session Api Billing Credits Reconcile Session Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/credits/webhook":{"post":{"summary":"Stripe Credit Webhook","operationId":"stripe_credit_webhook_api_billing_credits_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Stripe Credit Webhook Api Billing Credits Webhook Post"}}}}}}},"/exports/presets":{"get":{"tags":["Exports"],"summary":"List Presets","description":"List available export presets","operationId":"list_presets_exports_presets_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/presets/{preset_name}":{"get":{"tags":["Exports"],"summary":"Get Preset Config","description":"Get the full configuration for a preset","operationId":"get_preset_config_exports_presets__preset_name__get","parameters":[{"name":"preset_name","in":"path","required":true,"schema":{"type":"string","title":"Preset Name"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/preview":{"post":{"tags":["Exports"],"summary":"Preview Export","description":"Preview an export with sample rows and warnings.\nReturns first 10 rows as a preview.","operationId":"preview_export_exports_preview_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/run":{"post":{"tags":["Exports"],"summary":"Run Export","description":"Execute an export and return CSV data as a streaming response.","operationId":"run_export_exports_run_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/available-fields":{"get":{"tags":["Exports"],"summary":"Get Available Fields","description":"Get all available fields for custom export configuration.\nReturns fields organized by category with metadata for building the UI.","operationId":"get_available_fields_exports_available_fields_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/filter-options":{"get":{"tags":["Exports"],"summary":"Get Filter Options","description":"Get available filter options for the export UI.\nReturns lists of clients, currencies, and status options.","operationId":"get_filter_options_exports_filter_options_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/expense-fields":{"get":{"tags":["Exports"],"summary":"Get Expense Available Fields","description":"Get all available fields for expense export configuration.\nReturns fields organized by category with metadata for building the UI.","operationId":"get_expense_available_fields_exports_expense_fields_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/expense-filter-options":{"get":{"tags":["Exports"],"summary":"Get Expense Filter Options","description":"Get available filter options for expense exports.","operationId":"get_expense_filter_options_exports_expense_filter_options_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/expense-preview":{"post":{"tags":["Exports"],"summary":"Preview Expense Export","description":"Preview an expense export with sample rows.\nReturns first 10 rows as a preview.","operationId":"preview_expense_export_exports_expense_preview_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/expense-run":{"post":{"tags":["Exports"],"summary":"Run Expense Export","description":"Execute an expense export and return CSV data as a streaming response.","operationId":"run_expense_export_exports_expense_run_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/exports/expense-default-columns":{"get":{"tags":["Exports"],"summary":"Get Expense Default Columns","description":"Get the default column configuration for expense exports.","operationId":"get_expense_default_columns_exports_expense_default_columns_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/expense-categories":{"get":{"tags":["Expense Categories"],"summary":"List Expense Categories","operationId":"list_expense_categories_api_expense_categories_get","parameters":[{"name":"include_archived","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Include Archived"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["Expense Categories"],"summary":"Create Expense Category","operationId":"create_expense_category_api_expense_categories_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseCategoryCreateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/expense-categories/{key}":{"patch":{"tags":["Expense Categories"],"summary":"Patch Expense Category","operationId":"patch_expense_category_api_expense_categories__key__patch","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExpenseCategoryPatchRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/org-skills":{"get":{"tags":["org-skills"],"summary":"List Org Skills","description":"List all skills for the current organization.","operationId":"list_org_skills_api_org_skills_get","parameters":[{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/OrgSkillListItem"},"title":"Response List Org Skills Api Org Skills Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["org-skills"],"summary":"Create Org Skill","description":"Create a new organization skill. Skill name is normalized to slug format.","operationId":"create_org_skill_api_org_skills_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgSkillCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgSkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/org-skills/templates":{"get":{"tags":["org-skills"],"summary":"Get Skill Templates","description":"Get available skill templates as starting points.","operationId":"get_skill_templates_api_org_skills_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SkillTemplate"},"type":"array","title":"Response Get Skill Templates Api Org Skills Templates Get"}}}}}}},"/api/org-skills/{skill_id}":{"get":{"tags":["org-skills"],"summary":"Get Org Skill","description":"Get a specific skill by ID.","operationId":"get_org_skill_api_org_skills__skill_id__get","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","title":"Skill Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgSkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["org-skills"],"summary":"Update Org Skill","description":"Update an existing skill. Only provided fields will be updated.","operationId":"update_org_skill_api_org_skills__skill_id__patch","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","title":"Skill Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgSkillUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgSkillResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["org-skills"],"summary":"Delete Org Skill","description":"Delete a skill. Soft delete by default, hard_delete=true to permanently remove.","operationId":"delete_org_skill_api_org_skills__skill_id__delete","parameters":[{"name":"skill_id","in":"path","required":true,"schema":{"type":"string","title":"Skill Id"}},{"name":"hard_delete","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Hard Delete"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/org-skills/start-creation":{"post":{"tags":["org-skills"],"summary":"Start Skill Creation","description":"Start a conversational skill creation flow.\nCreates a new thread and returns the thread_id along with the system message\nthat should be sent to trigger the skill builder assistant.","operationId":"start_skill_creation_api_org_skills_start_creation_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartCreationResponse"}}}}}}},"/api/org-skills/start-iteration":{"post":{"tags":["org-skills"],"summary":"Start Skill Iteration","description":"Start a conversational skill iteration/tweaking flow.\nCreates a new thread and returns the thread_id along with a system message\nthat includes the existing skill content for refinement.","operationId":"start_skill_iteration_api_org_skills_start_iteration_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartIterationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartCreationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/onboarding/send-intro-email":{"post":{"summary":"Send Intro Email","description":"Send onboarding introduction email to new users.\n\nBackward-compatible arm/reconcile endpoint for the coordinated signup\njourney. It no longer bypasses Business DNA with an immediate email.","operationId":"send_intro_email_api_onboarding_send_intro_email_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Send Intro Email Api Onboarding Send Intro Email Post"}}}}}}},"/api/mcp-integrations/providers":{"get":{"tags":["mcp-integrations"],"summary":"List Providers","description":"List all available MCP integration providers.\n\nReturns:\n    List of provider configurations (Xero, HubSpot, etc.)","operationId":"list_providers_api_mcp_integrations_providers_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/mcp-integrations/status":{"get":{"tags":["mcp-integrations"],"summary":"Get Integration Status","description":"Get organization's MCP integration status.\n\nReturns:\n    List of connected integrations with connection details","operationId":"get_integration_status_api_mcp_integrations_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/mcp-integrations/manifest":{"get":{"tags":["mcp-integrations"],"summary":"Get Connection Manifest","description":"The org's live external connections, for the chat composer's picker.\n\nDistinct from `/status`, which reports every integration row and its health so\nthe Connections page can offer reconnects. This returns only what actually\nRESOLVED for this turn's execution scope, because the composer's job is to\noffer connections the agent can genuinely act on right now -- a picker that\nlists a gated or auth-failed provider invites the user to point the agent at\ntools it does not hold, and the agent then looks like it ignored them.\n\nGoogle and Slack are absent by design (native requester-scoped tooling, and a\nsurface with no agent tools respectively); the client composes those in.","operationId":"get_connection_manifest_api_mcp_integrations_manifest_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/mcp-integrations/hubspot/import":{"post":{"tags":["mcp-integrations"],"summary":"Start Hubspot Import","description":"Enqueue one HubSpot companies/contacts import, reusing an active run if present.","operationId":"start_hubspot_import_api_mcp_integrations_hubspot_import_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/mcp-integrations/hubspot/import/preview":{"get":{"tags":["mcp-integrations"],"summary":"Preview Hubspot Import","description":"Best-effort counts of importable HubSpot contacts and companies.\n\nDeclared BEFORE the `/{job_id}` route so \"preview\" is never captured as a job id.","operationId":"preview_hubspot_import_api_mcp_integrations_hubspot_import_preview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/mcp-integrations/hubspot/import/{job_id}":{"get":{"tags":["mcp-integrations"],"summary":"Get Hubspot Import Status","description":"Return an org-owned import status with progress and terminal counts.","operationId":"get_hubspot_import_status_api_mcp_integrations_hubspot_import__job_id__get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp-integrations/{provider_key}/auth/url":{"post":{"tags":["mcp-integrations"],"summary":"Get Auth Url","description":"Generate OAuth authorization URL for a specific provider.","operationId":"get_auth_url_api_mcp_integrations__provider_key__auth_url_post","parameters":[{"name":"provider_key","in":"path","required":true,"schema":{"type":"string","title":"Provider Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp-integrations/{provider_key}/connect":{"post":{"tags":["mcp-integrations"],"summary":"Connect Api Key Provider","description":"Connect a non-OAuth provider that authenticates with a static API key.","operationId":"connect_api_key_provider_api_mcp_integrations__provider_key__connect_post","parameters":[{"name":"provider_key","in":"path","required":true,"schema":{"type":"string","title":"Provider Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp-integrations/callback":{"get":{"tags":["mcp-integrations"],"summary":"Oauth Callback","description":"Handle OAuth callback from external providers.","operationId":"oauth_callback_api_mcp_integrations_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},{"name":"error_description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Description"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp-integrations/{provider_key}/disconnect":{"post":{"tags":["mcp-integrations"],"summary":"Disconnect Integration","description":"Disconnect ONE MCP connection and remove its stored credentials.\n\nDeliberately does not check `is_provider_enabled_for_org`/the org's\nrollout flag: revoking an existing grant must never be trapped behind a\nflag that got turned off or removed after connecting -- so the ungated\nprovider lookup is used purely to read the ownership axis.\n\nAuthorization:\n- org-shared provider: org admin, as before. `target_user_id` is\n  meaningless there and is rejected rather than silently ignored.\n- user-scoped provider: a member disconnects their own connection with no\n  admin gate; disconnecting ANOTHER member's connection (offboarding) is\n  an explicit admin action that must name `target_user_id`.","operationId":"disconnect_integration_api_mcp_integrations__provider_key__disconnect_post","parameters":[{"name":"provider_key","in":"path","required":true,"schema":{"type":"string","title":"Provider Key"}},{"name":"target_user_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisconnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp-integrations/{provider_key}/refresh":{"post":{"tags":["mcp-integrations"],"summary":"Refresh Token","description":"Manually refresh OAuth token for a provider (for testing; normally auto-refreshed).","operationId":"refresh_token_api_mcp_integrations__provider_key__refresh_post","parameters":[{"name":"provider_key","in":"path","required":true,"schema":{"type":"string","title":"Provider Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp-integrations/{provider_key}/validate":{"post":{"tags":["mcp-integrations"],"summary":"Validate Integration","description":"Validate the provider; Kondo also performs a minimal browser-bridge read.","operationId":"validate_integration_api_mcp_integrations__provider_key__validate_post","parameters":[{"name":"provider_key","in":"path","required":true,"schema":{"type":"string","title":"Provider Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationHealthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/mcp-integrations/{provider_key}/debug-auth-url":{"get":{"tags":["mcp-integrations"],"summary":"Debug Auth Url","description":"Debug endpoint to show OAuth configuration and URL for troubleshooting.","operationId":"debug_auth_url_api_mcp_integrations__provider_key__debug_auth_url_get","parameters":[{"name":"provider_key","in":"path","required":true,"schema":{"type":"string","title":"Provider Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/slack/events":{"post":{"tags":["slack"],"summary":"Slack Events","description":"Slack Events API request URL.\n\nOrdering is deliberate and must not be reordered:\n  1. Verify X-Slack-Signature (and reject a stale timestamp) against the\n     RAW body, before any JSON parsing.\n  2. Handle url_verification (Slack's one-time endpoint handshake).\n  3. For a DM, app_mention, or assistant_thread_started event, resolve\n     team_id -> the org that installed this workspace (a READ --\n     required because `agent_background_jobs.org_id`\n     is a NOT NULL FK, so there is no way to enqueue anything without it;\n     a read has no \"succeeded but orphaned\" failure mode, unlike a write,\n     so it is safe to keep ahead of the ACK). Everything else that is a\n     genuine judgement call -- the slack_agent_app gate, Slack\n     identity-link resolution -- stays in the worker\n     (services/job_processor.py:_process_slack_agent_turn_job /\n     _process_slack_assistant_thread_started_job), never here.\n  4. Acknowledge with 200 after exactly ONE pre-ACK WRITE: an idempotent\n     job insert (`AgentBackgroundJobService.create_background_job_idempotent`,\n     dedupe_key=event_id) that carries the event-dedup uniqueness itself.\n     A duplicate Slack delivery's insert simply conflicts and returns the\n     existing job row -- no separate dedup write exists that a later\n     failure could orphan (see the migration's design-note comment for\n     the prior two-write design this replaced and why it lost events).\n     If the insert raises, we do NOT ACK (500) -- nothing was durably\n     written, so Slack's retry is the correct, safe recovery path.","operationId":"slack_events_api_slack_events_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/slack/install/start":{"get":{"tags":["slack"],"summary":"Slack Install Start","operationId":"slack_install_start_api_slack_install_start_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/slack/install/auth-url":{"post":{"tags":["slack"],"summary":"Slack Install Auth Url","description":"JSON variant of /install/start, mirroring\nroutes/mcp_integrations.py's `POST /{provider_key}/auth/url` pattern.\n\nGET /install/start is an authenticated redirect --\nDepends(get_current_user_and_org) reads ONLY the Authorization header\n(no cookie or query-token fallback anywhere in auth.py), so a plain\ntop-level browser navigation to it cannot carry that header and would\n401 before ever reaching Slack. This route lets the frontend attach the\nbearer token via a normal authenticated fetch, then navigate with\n`window.location.href` to the returned THIRD-PARTY url -- which needs no\nbearer token, same as the MCP OAuth connect flow. /install/start is left\nworking unchanged for any caller that can supply the header directly\n(e.g. a signed script or a future first-party client).","operationId":"slack_install_auth_url_api_slack_install_auth_url_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/slack/install/callback":{"get":{"tags":["slack"],"summary":"Slack Install Callback","operationId":"slack_install_callback_api_slack_install_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/slack/install/status":{"get":{"tags":["slack"],"summary":"Slack Install Status","operationId":"slack_install_status_api_slack_install_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/slack/install/uninstall":{"post":{"tags":["slack"],"summary":"Slack Install Uninstall","operationId":"slack_install_uninstall_api_slack_install_uninstall_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/slack/identity-link/start":{"get":{"tags":["slack"],"summary":"Slack Identity Link Start","description":"Public entry point for the link the bot posts in the DM.\n\nUnauthenticated by design (Slack never sends Clerk credentials) --\nvalidates the token WITHOUT consuming it, then hands off to the\nfrontend, which authenticates the user via Clerk and completes the bind\nby calling POST /identity-link/callback. (The Connections-page UI this\nredirects to is Phase 5 of the plan and does not exist yet in Tranche 1\n-- this route's contract is stable regardless of when that UI lands.)","operationId":"slack_identity_link_start_api_slack_identity_link_start_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/slack/identity-link/callback":{"post":{"tags":["slack"],"summary":"Slack Identity Link Callback","description":"Clerk-authenticated completion of the identity-link flow.\n\nValidates the gate + org membership FIRST using a non-destructive peek,\nand consumes the single-use token (DELETE ... RETURNING) only as the\nLAST step, once every check has passed. A wrong-org signin (the caller\nis authenticated, but into a DIFFERENT Every org than the one that\ninstalled this Slack workspace) must not burn the token -- the correct\nuser still needs to be able to use it. Consuming first would let one\nfailed/wrong-org attempt permanently strand the real user with an\n\"expired\" link.","operationId":"slack_identity_link_callback_api_slack_identity_link_callback_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IdentityLinkCallbackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections":{"get":{"tags":["custom-mcp-connections"],"summary":"List Custom Mcp Connections","operationId":"list_custom_mcp_connections_api_custom_mcp_connections_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomMCPConnectionListResponse"}}}}}},"post":{"tags":["custom-mcp-connections"],"summary":"Create Custom Mcp Connection","operationId":"create_custom_mcp_connection_api_custom_mcp_connections_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCustomMCPRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomMCPConnectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections/{connection_id}":{"patch":{"tags":["custom-mcp-connections"],"summary":"Update Custom Mcp Connection","operationId":"update_custom_mcp_connection_api_custom_mcp_connections__connection_id__patch","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomMCPRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomMCPConnectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["custom-mcp-connections"],"summary":"Delete Custom Mcp Connection","operationId":"delete_custom_mcp_connection_api_custom_mcp_connections__connection_id__delete","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections/{connection_id}/test":{"post":{"tags":["custom-mcp-connections"],"summary":"Test Custom Mcp Connection","operationId":"test_custom_mcp_connection_api_custom_mcp_connections__connection_id__test_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomMCPConnectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections/{connection_id}/approve":{"post":{"tags":["custom-mcp-connections"],"summary":"Approve Custom Mcp Catalog","operationId":"approve_custom_mcp_catalog_api_custom_mcp_connections__connection_id__approve_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomMCPConnectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections/{connection_id}/disable":{"post":{"tags":["custom-mcp-connections"],"summary":"Disable Custom Mcp Connection","operationId":"disable_custom_mcp_connection_api_custom_mcp_connections__connection_id__disable_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomMCPConnectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections/{connection_id}/oauth/start":{"post":{"tags":["custom-mcp-connections"],"summary":"Start Custom Mcp Oauth","operationId":"start_custom_mcp_oauth_api_custom_mcp_connections__connection_id__oauth_start_post","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__custom_mcp_connections__OAuthStartRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStartResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections/{connection_id}/oauth/metadata":{"get":{"tags":["custom-mcp-connections"],"summary":"Get Custom Mcp Oauth Metadata","operationId":"get_custom_mcp_oauth_metadata_api_custom_mcp_connections__connection_id__oauth_metadata_get","parameters":[{"name":"connection_id","in":"path","required":true,"schema":{"type":"string","title":"Connection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthMetadataResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/custom-mcp-connections/oauth/client-metadata":{"get":{"tags":["custom-mcp-connections"],"summary":"Custom Mcp Client Metadata","operationId":"custom_mcp_client_metadata_api_custom_mcp_connections_oauth_client_metadata_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/custom-mcp-connections/oauth/callback":{"get":{"tags":["custom-mcp-connections"],"summary":"Custom Mcp Oauth Callback","operationId":"custom_mcp_oauth_callback_api_custom_mcp_connections_oauth_callback_get","parameters":[{"name":"state","in":"query","required":true,"schema":{"type":"string","minLength":16,"maxLength":512,"title":"State"}},{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":4096},{"type":"null"}],"title":"Code"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/invoice/{identifier}":{"get":{"tags":["internal"],"summary":"Get Invoice","description":"Get a single invoice by invoice number or UUID.","operationId":"get_invoice_api_internal_invoice__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/invoices":{"get":{"tags":["internal"],"summary":"List Invoices","description":"List invoices with optional filters.","operationId":"list_invoices_api_internal_invoices_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by client UUID","title":"Client Id"},"description":"Filter by client UUID"},{"name":"invoice_status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by invoice status: draft, estimate, issued, void","title":"Invoice Status"},"description":"Filter by invoice status: draft, estimate, issued, void"},{"name":"payment_status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by payment status: unpaid, paid, overdue, partial","title":"Payment Status"},"description":"Filter by payment status: unpaid, paid, overdue, partial"},{"name":"is_archived","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by archived status","default":false,"title":"Is Archived"},"description":"Filter by archived status"},{"name":"order_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column to sort by (e.g., issue_date, due_date, created_at, invoice_number)","default":"issue_date","title":"Order By"},"description":"Column to sort by (e.g., issue_date, due_date, created_at, invoice_number)"},{"name":"order_desc","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Sort in descending order (most recent first)","default":true,"title":"Order Desc"},"description":"Sort in descending order (most recent first)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of invoices to return","default":20,"title":"Limit"},"description":"Maximum number of invoices to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of invoices to skip","default":0,"title":"Offset"},"description":"Number of invoices to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/clients":{"get":{"tags":["internal"],"summary":"List Clients","description":"List clients with optional filters.","operationId":"list_clients_api_internal_clients_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partial match on client name","title":"Name"},"description":"Partial match on client name"},{"name":"is_archived","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by archived status","default":false,"title":"Is Archived"},"description":"Filter by archived status"},{"name":"order_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column to sort by (e.g., name, created_at, updated_at)","default":"name","title":"Order By"},"description":"Column to sort by (e.g., name, created_at, updated_at)"},{"name":"order_desc","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Sort in descending order","default":false,"title":"Order Desc"},"description":"Sort in descending order"},{"name":"include_contacts","in":"query","required":false,"schema":{"type":"boolean","description":"Include client contacts in response","default":false,"title":"Include Contacts"},"description":"Include client contacts in response"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of clients to return","default":20,"title":"Limit"},"description":"Maximum number of clients to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of clients to skip","default":0,"title":"Offset"},"description":"Number of clients to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/client/{identifier}":{"get":{"tags":["internal"],"summary":"Get Client","description":"Get a single client by UUID or exact name.","operationId":"get_client_api_internal_client__identifier__get","parameters":[{"name":"identifier","in":"path","required":true,"schema":{"type":"string","title":"Identifier"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/payments":{"get":{"tags":["internal"],"summary":"List Payments","description":"List payments with optional filters.","operationId":"list_payments_api_internal_payments_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"invoice_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by invoice UUID","title":"Invoice Id"},"description":"Filter by invoice UUID"},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by client UUID","title":"Client Id"},"description":"Filter by client UUID"},{"name":"payment_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by payment type: stripe, cash, cheque, credit_card, bank_transfer, other","title":"Payment Type"},"description":"Filter by payment type: stripe, cash, cheque, credit_card, bank_transfer, other"},{"name":"invoice_number","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by invoice number","title":"Invoice Number"},"description":"Filter by invoice number"},{"name":"order_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column to sort by (e.g., payment_date, amount, created_at)","default":"payment_date","title":"Order By"},"description":"Column to sort by (e.g., payment_date, amount, created_at)"},{"name":"order_desc","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Sort in descending order (most recent first)","default":true,"title":"Order Desc"},"description":"Sort in descending order (most recent first)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of payments to return","default":20,"title":"Limit"},"description":"Maximum number of payments to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of payments to skip","default":0,"title":"Offset"},"description":"Number of payments to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/expenses":{"get":{"tags":["internal"],"summary":"List Expenses","description":"List expenses with optional filters.","operationId":"list_expenses_api_internal_expenses_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"merchant_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partial match on merchant name","title":"Merchant Name"},"description":"Partial match on merchant name"},{"name":"description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Partial match on description","title":"Description"},"description":"Partial match on description"},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by client UUID","title":"Client Id"},"description":"Filter by client UUID"},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by expense category","title":"Category"},"description":"Filter by expense category"},{"name":"invoice_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by invoice UUID","title":"Invoice Id"},"description":"Filter by invoice UUID"},{"name":"is_archived","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by archived status","default":false,"title":"Is Archived"},"description":"Filter by archived status"},{"name":"order_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column to sort by (e.g., expense_date, amount, created_at, merchant_name)","default":"expense_date","title":"Order By"},"description":"Column to sort by (e.g., expense_date, amount, created_at, merchant_name)"},{"name":"order_desc","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Sort in descending order (most recent first)","default":true,"title":"Order Desc"},"description":"Sort in descending order (most recent first)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of expenses to return","default":20,"title":"Limit"},"description":"Maximum number of expenses to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of expenses to skip","default":0,"title":"Offset"},"description":"Number of expenses to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/proposals":{"get":{"tags":["internal"],"summary":"List Proposals","description":"List proposals with optional filters.","operationId":"list_proposals_api_internal_proposals_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by status: draft, issued, approved, void","title":"Status"},"description":"Filter by status: draft, issued, approved, void"},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by client UUID","title":"Client Id"},"description":"Filter by client UUID"},{"name":"proposal_number","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by proposal number","title":"Proposal Number"},"description":"Filter by proposal number"},{"name":"invoice_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by linked invoice UUID","title":"Invoice Id"},"description":"Filter by linked invoice UUID"},{"name":"order_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Column to sort by (e.g., created_at, updated_at, proposal_number)","default":"created_at","title":"Order By"},"description":"Column to sort by (e.g., created_at, updated_at, proposal_number)"},{"name":"order_desc","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Sort in descending order (most recent first)","default":true,"title":"Order Desc"},"description":"Sort in descending order (most recent first)"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of proposals to return","default":20,"title":"Limit"},"description":"Maximum number of proposals to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of proposals to skip","default":0,"title":"Offset"},"description":"Number of proposals to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/services":{"get":{"tags":["internal"],"summary":"List Services","description":"List services/offerings for the org.","operationId":"list_services_api_internal_services_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}},{"name":"is_archived","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"Filter by archived status","default":false,"title":"Is Archived"},"description":"Filter by archived status"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of services to return","default":25,"title":"Limit"},"description":"Maximum number of services to return"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of services to skip","default":0,"title":"Offset"},"description":"Number of services to skip"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/business-settings":{"get":{"tags":["internal"],"summary":"Get Business Settings","description":"Get business settings payload.","operationId":"get_business_settings_api_internal_business_settings_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/internal/mcp-tool-registry":{"get":{"tags":["mcp-registry"],"summary":"Get Mcp Tool Registry","description":"Export tool definitions for MCP server registration.\n\nReturns tools that should be exposed to external MCP clients (ChatGPT, Claude Code).\nThe MCP server fetches this on startup and registers tools dynamically.","operationId":"get_mcp_tool_registry_api_internal_mcp_tool_registry_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/transcribe-audio":{"post":{"summary":"Transcribe Audio","description":"Transcribe audio file using OpenAI gpt-transcribe.","operationId":"transcribe_audio_api_transcribe_audio_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_transcribe_audio_api_transcribe_audio_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/realtime-transcription-token":{"post":{"summary":"Realtime Transcription Token","description":"Mint a short-lived OpenAI Realtime client secret scoped to a transcription\nsession, so the browser can open a WebRTC/WebSocket connection directly to\nOpenAI without ever seeing our server-side API key.","operationId":"realtime_transcription_token_api_realtime_transcription_token_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/health/automations":{"get":{"summary":"Get Recurring Invoice Health","description":"Return JSON health data for all recurring invoice systems.","operationId":"get_recurring_invoice_health_api_health_automations_get","parameters":[{"name":"x-health-check-key","in":"header","required":false,"schema":{"type":"string","title":"X-Health-Check-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/health/automations/report":{"post":{"summary":"Send Recurring Invoice Health Report","description":"Run health check, send email report, and return results.","operationId":"send_recurring_invoice_health_report_api_health_automations_report_post","parameters":[{"name":"x-health-check-key","in":"header","required":false,"schema":{"type":"string","title":"X-Health-Check-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/health/local-enrichment-digest":{"post":{"summary":"Run Local Enrichment Digest Health","description":"Dry-run or explicitly send the local-enrichment founder digest.","operationId":"run_local_enrichment_digest_health_api_health_local_enrichment_digest_post","parameters":[{"name":"x-health-check-key","in":"header","required":false,"schema":{"type":"string","title":"X-Health-Check-Key"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/LocalEnrichmentDigestRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/linkedin/process-messages":{"post":{"tags":["linkedin"],"summary":"Process Messages","operationId":"process_messages_api_linkedin_process_messages_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_process_messages_api_linkedin_process_messages_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProcessMessagesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/linkedin/process-messages/{job_id}/status":{"get":{"tags":["linkedin"],"summary":"Get Message Job Status","description":"Lightweight read-only status check. Processing is handled by the background job processor.","operationId":"get_message_job_status_api_linkedin_process_messages__job_id__status_get","parameters":[{"name":"job_id","in":"path","required":true,"schema":{"type":"string","title":"Job Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JobStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/user/attribution":{"post":{"summary":"Save Attribution","description":"Store UTM attribution data for the authenticated user.\n\nPriority-aware first-touch (upsert_user_attribution SQL function): a\n'frontend' write upgrades fallback rows ('clerk_webhook',\n'frontend_fallback') but never overwrites an equal-priority source\n('frontend', 'mcp_oauth') — and vice versa.","operationId":"save_attribution_api_user_attribution_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/user/professional-context/enrich":{"post":{"summary":"Enrich User Professional Context","description":"Infer and save the authenticated user's professional context.","operationId":"enrich_user_professional_context_api_user_professional_context_enrich_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/account/deletion":{"post":{"summary":"Delete My Account","description":"Delete the caller's own account within this organization (immediate).\n\nTheir personal data goes; the organization's business records stay, with their\nattribution reassigned. See purge_org_user().","operationId":"delete_my_account_api_account_deletion_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/org/members/{subject_user_id}":{"delete":{"summary":"Remove Org Member","description":"Admin offboards a member (e.g. an employee leaving).","operationId":"remove_org_member_api_org_members__subject_user_id__delete","parameters":[{"name":"subject_user_id","in":"path","required":true,"schema":{"type":"string","title":"Subject User Id"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/org/deletion":{"get":{"summary":"Get Org Deletion","description":"Any member may see a pending deletion — it destroys their workspace too.\n\nPowers the in-app countdown banner.","operationId":"get_org_deletion_api_org_deletion_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Schedule Org Deletion","description":"Schedule the whole workspace for deletion in 24 hours (admin only).","operationId":"schedule_org_deletion_api_org_deletion_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Cancel Org Deletion","description":"Call off a scheduled deletion and restore the frozen levers (admin only).","operationId":"cancel_org_deletion_api_org_deletion_delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/device-tokens":{"post":{"summary":"Register Device Token","description":"Register or re-activate an Expo push token for the authenticated user.\nCalled on app launch after auth is ready.","operationId":"register_device_token_api_device_tokens_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Deactivate Device Token","description":"Deactivate an Expo push token. Called on user logout.","operationId":"deactivate_device_token_api_device_tokens_delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/share-tokens":{"post":{"summary":"Mint Share Token","operationId":"mint_share_token_api_share_tokens_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Revoke Share Token","operationId":"revoke_share_token_api_share_tokens_delete","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareTokenRevokeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/share-capture":{"post":{"summary":"Share Capture","operationId":"share_capture_api_share_capture_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_share_capture_api_share_capture_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareCaptureResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/uploads/grant":{"post":{"tags":["uploads"],"summary":"Create Upload Grant","operationId":"create_upload_grant_api_uploads_grant_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateUploadGrant"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/uploads/finalize":{"post":{"tags":["uploads"],"summary":"Finalize Upload","operationId":"finalize_upload_api_uploads_finalize_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FinalizeUpload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/og/invoice/{public_id}":{"get":{"tags":["og-metadata"],"summary":"Og Invoice","description":"OG metadata page for public invoices.","operationId":"og_invoice_og_invoice__public_id__get","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/og/proposal/{public_id}":{"get":{"tags":["og-metadata"],"summary":"Og Proposal","description":"OG metadata page for public proposals.","operationId":"og_proposal_og_proposal__public_id__get","parameters":[{"name":"public_id","in":"path","required":true,"schema":{"type":"string","title":"Public Id"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/info":{"get":{"tags":["client-portal"],"summary":"Get Org Info","description":"Return basic org info (name, logo) for the portal login page. No auth required.","operationId":"get_org_info_public_portal__slug__info_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/inquiry":{"post":{"tags":["client-portal"],"summary":"Submit Inquiry","description":"Record an inquiry from someone who is not a client yet.\n\nAlways answers 200 with the same shape, whether or not anything was written.\nA public form must not report on the org behind it — \"no such org\" or \"we\nfailed to create your deal\" tells a stranger about internal state, and the\nvisitor can do nothing with either. Failures are logged, not surfaced.","operationId":"submit_inquiry_public_portal__slug__inquiry_post","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InquiryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InquiryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/inquiry/profile":{"post":{"tags":["client-portal"],"summary":"Submit Inquiry Profile","description":"Optional extra details, offered after the inquiry is already recorded.\n\nAuthorised by the short-lived token the inquiry returned — never by a bare\ncontact id, which anyone could guess at.","operationId":"submit_inquiry_profile_public_portal__slug__inquiry_profile_post","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InquiryProfileRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/resolve-slug/{slug}":{"get":{"tags":["client-portal"],"summary":"Resolve Slug Redirect","description":"Check if a slug is an old/stale slug and return the current one for redirect.","operationId":"resolve_slug_redirect_public_portal_resolve_slug__slug__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/auth/request":{"post":{"tags":["client-portal"],"summary":"Request Magic Link","description":"Request a magic-link login email for the client portal.","operationId":"request_magic_link_public_portal__slug__auth_request_post","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MagicLinkRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MagicLinkResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/auth/verify/{token}":{"get":{"tags":["client-portal"],"summary":"Verify Magic Link","description":"Verify a magic-link token and return an active session.","operationId":"verify_magic_link_public_portal__slug__auth_verify__token__get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/auth/logout":{"post":{"tags":["client-portal"],"summary":"Logout","description":"Revoke the current portal session.","operationId":"logout_public_portal__slug__auth_logout_post","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/auth/me":{"get":{"tags":["client-portal"],"summary":"Get Me","description":"Return the current session's contact and org info.","operationId":"get_me_public_portal__slug__auth_me_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/clients":{"get":{"tags":["client-portal"],"summary":"List Clients","description":"List clients that the authenticated portal contact has access to.","operationId":"list_clients_public_portal__slug__clients_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/invoices":{"get":{"tags":["client-portal"],"summary":"List Invoices","description":"List invoices visible to the authenticated portal contact.","operationId":"list_invoices_public_portal__slug__invoices_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/portal/{slug}/proposals":{"get":{"tags":["client-portal"],"summary":"List Proposals","description":"List proposals visible to the authenticated portal contact.","operationId":"list_proposals_public_portal__slug__proposals_get","parameters":[{"name":"slug","in":"path","required":true,"schema":{"type":"string","title":"Slug"}},{"name":"client_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/portal/impersonate":{"post":{"tags":["client-portal-auth"],"summary":"Impersonate Client","description":"Create a pre-verified portal session so a business owner can preview\nthe client portal as a specific contact.  Requires Clerk JWT auth.","operationId":"impersonate_client_api_portal_impersonate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/broadcast/create-audience":{"post":{"summary":"Create Audience Endpoint","description":"Create a new Resend audience. Returns the audience_id to set in env.","operationId":"create_audience_endpoint_admin_broadcast_create_audience_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAudienceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/broadcast/sync-audience":{"post":{"summary":"Sync Audience Endpoint","description":"Sync all Supabase users into the Resend audience.","operationId":"sync_audience_endpoint_admin_broadcast_sync_audience_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/broadcast/send":{"post":{"summary":"Send Broadcast Endpoint","description":"Send a plain-text broadcast email.\n\naudience_id is required: pass \"test\", \"prod\", or a raw UUID.","operationId":"send_broadcast_endpoint_admin_broadcast_send_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendBroadcastRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/broadcast/contacts":{"get":{"summary":"List Contacts Endpoint","description":"List contacts. Pass ?test=true for test audience.","operationId":"list_contacts_endpoint_admin_broadcast_contacts_get","parameters":[{"name":"test","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Test"}},{"name":"user_id","in":"query","required":false,"schema":{"type":"string","title":"User Id"}},{"name":"org_id","in":"query","required":false,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/public/track-view":{"post":{"tags":["page-views"],"summary":"Track Page View","description":"Track a page view for any public-facing page.\n\n- Invoice/proposal owner and preview views are ignored.\n- Other public surfaces continue recording all viewer classifications.\n- Client views on invoices/proposals also publish to the events table.\n- Fire-and-forget: always returns success to the caller.","operationId":"track_page_view_public_track_view_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageViewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/claim/{token}":{"get":{"tags":["credit-claims"],"summary":"Claim Credits","description":"Public endpoint: verify a credit claim token, grant credits, redirect to app.\n\nFor upgrade_bonus claims (requires_paid_plan=true):\n- If org is on a paid plan → grant credits\n- If not → redirect to billing page so they can upgrade first","operationId":"claim_credits_claim__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/promo/enrichment/register":{"post":{"tags":["promo"],"summary":"Register Enrichment Promo","operationId":"register_enrichment_promo_api_promo_enrichment_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrichmentRegisterBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Register Enrichment Promo Api Promo Enrichment Register Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/promo/enrichment/status":{"get":{"tags":["promo"],"summary":"Enrichment Promo Status","operationId":"enrichment_promo_status_api_promo_enrichment_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Enrichment Promo Status Api Promo Enrichment Status Get"}}}}}}},"/api/referrals/lookup":{"get":{"tags":["referrals"],"summary":"Lookup","description":"Public: resolve a referral code → minimal referrer name for landing-page\npersonalization. No auth (anyone with the link can see the referrer's name).\nReturns 404 if the code doesn't exist; otherwise referrer_name + grant size.","operationId":"lookup_api_referrals_lookup_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Lookup Api Referrals Lookup Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/referrals/me":{"get":{"tags":["referrals"],"summary":"Get My Referral","operationId":"get_my_referral_api_referrals_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get My Referral Api Referrals Me Get"}}}}}}},"/api/referrals/me/code":{"post":{"tags":["referrals"],"summary":"Ensure My Code","description":"Ensure the org has a referral code; returns the code + link.","operationId":"ensure_my_code_api_referrals_me_code_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Ensure My Code Api Referrals Me Code Post"}}}}}}},"/api/referrals/me/earnings":{"get":{"tags":["referrals"],"summary":"Get My Earnings","description":"Cash rev-share state for the Refer & Earn card: balance, per-referral earnings\nagainst the $300 cap, and payout history.","operationId":"get_my_earnings_api_referrals_me_earnings_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get My Earnings Api Referrals Me Earnings Get"}}}}}}},"/api/referrals/me/payout-info":{"post":{"tags":["referrals"],"summary":"Set My Payout Info","description":"Save (or clear) the PayPal address we send referral payouts to.","operationId":"set_my_payout_info_api_referrals_me_payout_info_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutInfoRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Set My Payout Info Api Referrals Me Payout Info Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/referrals/me/invites":{"get":{"tags":["referrals"],"summary":"List My Invites","operationId":"list_my_invites_api_referrals_me_invites_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List My Invites Api Referrals Me Invites Get"}}}}}}},"/api/referrals/me/invite":{"post":{"tags":["referrals"],"summary":"Send My Invite","operationId":"send_my_invite_api_referrals_me_invite_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Send My Invite Api Referrals Me Invite Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/referrals/redeem":{"post":{"tags":["referrals"],"summary":"Redeem","description":"Called by the frontend after createOrgRecordInSupabase resolves. Never raises on business-rule failures.","operationId":"redeem_api_referrals_redeem_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Redeem Api Referrals Redeem Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/email/unsubscribe":{"get":{"tags":["email-unsubscribe"],"summary":"Unsubscribe From Marketing","description":"Unsubscribe from marketing/drip emails via signed link.\n\nSuppression is by EMAIL address (covers all of this person's current and\nfuture orgs), with the org-level flag kept for backwards compatibility.","operationId":"unsubscribe_from_marketing_api_email_unsubscribe_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}},{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/status":{"get":{"tags":["social"],"summary":"Social Status","description":"Always 200 — never gate this endpoint itself. The frontend reads\n`gated` to decide whether to show the feature at all, so a 403 here would\nread as a broken app rather than \"not available yet\".","operationId":"social_status_api_social_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Social Status Api Social Status Get"}}}}}}},"/api/social/{network}/connect":{"post":{"tags":["social"],"summary":"Social Connect","operationId":"social_connect_api_social__network__connect_post","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Connect Api Social  Network  Connect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/{network}/connect/status":{"get":{"tags":["social"],"summary":"Social Connect Status","operationId":"social_connect_status_api_social__network__connect_status_get","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}},{"name":"ref","in":"query","required":true,"schema":{"type":"string","title":"Ref"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Connect Status Api Social  Network  Connect Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/{network}/verify":{"post":{"tags":["social"],"summary":"Social Verify","description":"Phase 2 \"test connection\": actively re-checks whether the persisted\nsession still authenticates (services/social/social_pull.py::verify_session),\nrather than trusting the last-known `status` column the way `/status`\ndoes. On failure, flips the row to 'stale' via `mark_stale` immediately —\nsame signal the auto-reconnect-detection paths (scheduled sync/heartbeat\nauth failures) write — so the frontend can render \"Reconnect needed\"\nright away instead of waiting for the next background pass.","operationId":"social_verify_api_social__network__verify_post","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Verify Api Social  Network  Verify Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/{network}/disconnect":{"post":{"tags":["social"],"summary":"Social Disconnect","operationId":"social_disconnect_api_social__network__disconnect_post","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Disconnect Api Social  Network  Disconnect Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/{network}/sync-contacts":{"post":{"tags":["social"],"summary":"Social Sync Contacts","operationId":"social_sync_contacts_api_social__network__sync_contacts_post","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Sync Contacts Api Social  Network  Sync Contacts Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/{network}/sync-messages":{"post":{"tags":["social"],"summary":"Social Sync Messages","operationId":"social_sync_messages_api_social__network__sync_messages_post","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Sync Messages Api Social  Network  Sync Messages Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/{network}/schedule":{"put":{"tags":["social"],"summary":"Social Set Schedule","description":"Set the deterministic auto-sync schedule for a connected network. Stores the\ncadence and computes the first `next_sync_at`; the scheduler sweep\n(run_social_sync_sweep_job) enqueues the existing contacts + messages sync jobs\nwhen a row comes due. Returns the updated schedule (same field shape /status\nexposes).","operationId":"social_set_schedule_api_social__network__schedule_put","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/routes__social_routes__ScheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Set Schedule Api Social  Network  Schedule Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/social/{network}/reply":{"post":{"tags":["social"],"summary":"Social Reply","description":"Phase 5 outbound reply — drives a real DM send via the persisted\nsession (services/social/social_send.py). Strictly gated: only ever\ninvoked explicitly by an allowed caller.","operationId":"social_reply_api_social__network__reply_post","parameters":[{"name":"network","in":"path","required":true,"schema":{"type":"string","title":"Network"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Social Reply Api Social  Network  Reply Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AccountLinkRequest":{"properties":{"account":{"type":"string","title":"Account"}},"type":"object","required":["account"],"title":"AccountLinkRequest"},"AccountLinkResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"AccountLinkResponse"},"AccountRequest":{"properties":{},"type":"object","title":"AccountRequest"},"AccountResponse":{"properties":{"account":{"type":"string","title":"Account"}},"type":"object","required":["account"],"title":"AccountResponse"},"AccountStatusResponse":{"properties":{"account_id":{"type":"string","title":"Account Id"},"details_submitted":{"type":"boolean","title":"Details Submitted"},"charges_enabled":{"type":"boolean","title":"Charges Enabled"},"payouts_enabled":{"type":"boolean","title":"Payouts Enabled"},"is_complete":{"type":"boolean","title":"Is Complete"},"requirements":{"additionalProperties":true,"type":"object","title":"Requirements","default":{}}},"type":"object","required":["account_id","details_submitted","charges_enabled","payouts_enabled","is_complete"],"title":"AccountStatusResponse"},"AccountingProvider":{"type":"string","enum":["xero","quickbooks_online"],"title":"AccountingProvider"},"AgentChatMessageRequest":{"properties":{"thread_id":{"type":"string","title":"Thread Id"},"message":{"type":"string","title":"Message"},"is_system_event":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is System Event","default":false},"file_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Path"},"custom_agent_endpoint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Agent Endpoint"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["thread_id","message"],"title":"AgentChatMessageRequest"},"AnswerCaptureRequest":{"properties":{"answer":{"$ref":"#/components/schemas/CaptureAnswer"}},"type":"object","required":["answer"],"title":"AnswerCaptureRequest"},"AnswerQuestionsRequest":{"properties":{"answers":{"additionalProperties":{"additionalProperties":true,"type":"object"},"type":"object","title":"Answers","description":"Map of question_id -> {option_id, custom?}."}},"type":"object","required":["answers"],"title":"AnswerQuestionsRequest"},"ApiKeyConnectRequest":{"properties":{"api_key":{"type":"string","title":"Api Key"}},"type":"object","required":["api_key"],"title":"ApiKeyConnectRequest"},"ApiKeyPublic":{"properties":{"id":{"type":"string","title":"Id"},"org_id":{"type":"string","title":"Org Id"},"name":{"type":"string","title":"Name"},"key_prefix":{"type":"string","title":"Key Prefix"},"revoked":{"type":"boolean","title":"Revoked"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["id","org_id","name","key_prefix","revoked","scopes"],"title":"ApiKeyPublic"},"AsyncChatMessageRequest":{"properties":{"thread_id":{"type":"string","title":"Thread Id"},"message":{"type":"string","title":"Message"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","default":{}}},"type":"object","required":["thread_id","message"],"title":"AsyncChatMessageRequest","description":"Request body for POST /agent-chat-message-async."},"AsyncChatMessageResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"}},"type":"object","required":["job_id"],"title":"AsyncChatMessageResponse"},"AuthUrlResponse":{"properties":{"auth_url":{"type":"string","title":"Auth Url"}},"type":"object","required":["auth_url"],"title":"AuthUrlResponse"},"AvatarVariants":{"properties":{"small_url":{"type":"string","title":"Small Url"},"full_url":{"type":"string","title":"Full Url"}},"type":"object","required":["small_url","full_url"],"title":"AvatarVariants"},"BatchTagRequest":{"properties":{"blocks":{"items":{"$ref":"#/components/schemas/TextBlockForTagging"},"type":"array","title":"Blocks"}},"type":"object","required":["blocks"],"title":"BatchTagRequest"},"Body_analyze_receipt_api_analyze_receipt_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_analyze_receipt_api_analyze_receipt_post"},"Body_create_invoice_event_invoices__invoice_id__events_post":{"properties":{"event_type":{"type":"string","title":"Event Type","description":"The type of event to create"},"event_message":{"type":"string","title":"Event Message","description":"The event message"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","description":"Optional event metadata","default":{}}},"type":"object","required":["event_type","event_message"],"title":"Body_create_invoice_event_invoices__invoice_id__events_post"},"Body_process_messages_api_linkedin_process_messages_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_process_messages_api_linkedin_process_messages_post"},"Body_share_capture_api_share_capture_post":{"properties":{"files[]":{"anyOf":[{"items":{"type":"string","contentMediaType":"application/octet-stream"},"type":"array"},{"type":"null"}],"title":"Files[]"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"shared_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shared Text"},"shared_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Shared Url"}},"type":"object","title":"Body_share_capture_api_share_capture_post"},"Body_transcribe_audio_api_transcribe_audio_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_transcribe_audio_api_transcribe_audio_post"},"Body_upload_entity_avatar_api_entity_avatars__entity_type___entity_id__post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_entity_avatar_api_entity_avatars__entity_type___entity_id__post"},"Body_upload_proposal_media_api_proposal_media_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_proposal_media_api_proposal_media_upload_post"},"BulkEnrichRequest":{"properties":{"entity_type":{"type":"string","enum":["contact","client"],"title":"Entity Type"},"entity_ids":{"items":{"type":"string"},"type":"array","maxItems":200,"minItems":1,"title":"Entity Ids"}},"type":"object","required":["entity_type","entity_ids"],"title":"BulkEnrichRequest"},"BulkEnrichResponse":{"properties":{"mode":{"type":"string","title":"Mode"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["mode"],"title":"BulkEnrichResponse"},"BulkEventPublishRequest":{"properties":{"events":{"items":{"$ref":"#/components/schemas/EventPublishRequest"},"type":"array","title":"Events","description":"List of events to publish"}},"type":"object","required":["events"],"title":"BulkEventPublishRequest","description":"Request model for bulk event publishing"},"BusinessIntelligenceJobResponse":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"The background job ID for tracking report generation"},"status":{"type":"string","title":"Status","description":"Initial job status","default":"pending"}},"type":"object","required":["job_id"],"title":"BusinessIntelligenceJobResponse","description":"Response when creating a background job for business intelligence report"},"BusinessIntelligenceRequest":{"properties":{"lookback_days":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days","description":"Number of days to analyze (typically 90 for the last quarter).","default":90},"update_org_prompt_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Update Org Prompt Mode","description":"How to update org_prompt after completion: 'append' (add to existing), 'replace' (full replace), or None (don't update)"},"vertical":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vertical","description":"Optional vertical override (e.g., 'creators') for admin/testing. When omitted, the org's `vertical` column is used. None means generic prompt."}},"type":"object","title":"BusinessIntelligenceRequest"},"CalendarEventCreate":{"properties":{"summary":{"type":"string","title":"Summary"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"start_time":{"type":"string","title":"Start Time"},"end_time":{"type":"string","title":"End Time"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"attendees":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Attendees","default":[]},"calendar_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Id","default":"primary"},"recurrence_rule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence Rule","description":"Raw RRULE string (with or without RRULE: prefix)"},"recurrence":{"anyOf":[{"$ref":"#/components/schemas/CalendarRecurrenceConfig"},{"type":"null"}],"description":"Structured recurrence definition; alternative to recurrence_rule"}},"type":"object","required":["summary","start_time","end_time"],"title":"CalendarEventCreate"},"CalendarEventUpdate":{"properties":{"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Time"},"end_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Time"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"attendees":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Attendees"},"recurrence_rule":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence Rule","description":"Raw RRULE string (with or without RRULE: prefix)"},"recurrence":{"anyOf":[{"$ref":"#/components/schemas/CalendarRecurrenceConfig"},{"type":"null"}],"description":"Structured recurrence definition; alternative to recurrence_rule"},"clear_recurrence":{"type":"boolean","title":"Clear Recurrence","description":"Set to true to remove existing recurrence data","default":false}},"type":"object","title":"CalendarEventUpdate"},"CalendarRecurrenceConfig":{"properties":{"frequency":{"type":"string","title":"Frequency","description":"daily, weekly, monthly, or yearly"},"interval":{"anyOf":[{"type":"integer","maximum":365.0,"minimum":1.0},{"type":"null"}],"title":"Interval","default":1},"count":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Count"},"until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Until","description":"ISO 8601 date or datetime when recurrence should stop"},"weekdays":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Weekdays","description":"List of weekdays (e.g., ['MO','WE'] or ['monday','wednesday'])"},"month_days":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Month Days","description":"List of month day numbers (1-31 or -31 to -1 for reverse indexing)"}},"type":"object","required":["frequency"],"title":"CalendarRecurrenceConfig"},"CancelRunRequest":{"properties":{"thread_id":{"type":"string","title":"Thread Id"},"turn_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Turn Id"}},"type":"object","required":["thread_id"],"title":"CancelRunRequest"},"CaptureAnswer":{"properties":{"option_ids":{"items":{"type":"string"},"type":"array","title":"Option Ids"},"custom":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Custom"}},"type":"object","title":"CaptureAnswer"},"ChangeDealOwnerRequest":{"properties":{"owner_user_id":{"type":"string","maxLength":128,"minLength":1,"title":"Owner User Id"}},"type":"object","required":["owner_user_id"],"title":"ChangeDealOwnerRequest","description":"Body for /deals/{deal_id}/owner.\n\nOwnership controls the personal Gmail/Calendar context used for future\ndeal-agent work and owner-only outreach sending."},"ConnectRequest":{"properties":{"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"},"redirect":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Redirect"},"reauth_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reauth Account Id"}},"type":"object","title":"ConnectRequest"},"ConnectionSettingsRequest":{"properties":{"auto_sync_clients":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Sync Clients"},"auto_sync_invoices":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Sync Invoices"},"auto_sync_payments":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Sync Payments"},"auto_sync_expenses":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Sync Expenses"},"send_provider_invoice":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Send Provider Invoice"}},"additionalProperties":false,"type":"object","title":"ConnectionSettingsRequest"},"ContactEnrichmentRequest":{"properties":{"contact_id":{"type":"string","title":"Contact Id","description":"The ID of the contact to enrich"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name","description":"Client name (for context)"},"mode":{"type":"string","enum":["full","fill_empty"],"title":"Mode","description":"Enrichment mode","default":"fill_empty"}},"type":"object","required":["contact_id"],"title":"ContactEnrichmentRequest","description":"Request model for single contact enrichment (requires saved contact)."},"ContactEnrichmentResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"contact_id":{"type":"string","title":"Contact Id"},"was_enriched":{"type":"boolean","title":"Was Enriched"},"fields_updated":{"items":{"type":"string"},"type":"array","title":"Fields Updated","default":[]},"links_added":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Links Added","default":[]},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"enrichment_summary":{"additionalProperties":true,"type":"object","title":"Enrichment Summary"}},"type":"object","required":["success","contact_id","was_enriched"],"title":"ContactEnrichmentResponse","description":"Response model for single contact enrichment."},"ContactInput":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id","description":"Contact ID (if existing contact)"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Contact's full name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"Contact's email address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone","description":"Contact's phone number"},"job_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Title","description":"Contact's job title/role"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company","description":"Contact's company/organization"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location","description":"Contact's city/state/country"},"seniority":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Seniority","description":"Seniority level (C-suite, VP, Director, Manager, IC)"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry","description":"Industry/vertical they work in"},"headline":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headline","description":"Professional headline or tagline"},"invoice_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Role","description":"Role for invoices: 'to', 'cc', or null"},"proposal_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Proposal Role","description":"Role for proposals: 'to', 'cc', or null"},"links":{"anyOf":[{"items":{"$ref":"#/components/schemas/ExistingLinkInput"},"type":"array"},{"type":"null"}],"title":"Links","description":"Contact's existing links"},"internal_notes_for_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Internal Notes For Agent","description":"Internal notes about this contact"}},"type":"object","title":"ContactInput","description":"Input model for a contact to be enriched."},"ContactPreviewEnrichmentRequest":{"properties":{"email":{"type":"string","title":"Email","description":"Contact's email address (required)"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Contact's name"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone","description":"Contact's phone number"},"job_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Title","description":"Contact's job title"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name","description":"Company name for context"}},"type":"object","required":["email"],"title":"ContactPreviewEnrichmentRequest","description":"Request model for contact enrichment preview (no database save)."},"ContactPreviewEnrichmentResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"job_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Title"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"seniority":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Seniority"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"headline":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headline"},"links":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Links","default":[]},"enriched_fields":{"items":{"type":"string"},"type":"array","title":"Enriched Fields","default":[]},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["success"],"title":"ContactPreviewEnrichmentResponse","description":"Response model for contact enrichment preview."},"ContactSalesRequest":{"properties":{"company":{"type":"string","maxLength":200,"minLength":1,"title":"Company"},"email":{"type":"string","maxLength":320,"format":"email","title":"Email"},"notes":{"type":"string","maxLength":5000,"title":"Notes","default":""},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"}},"type":"object","required":["company","email"],"title":"ContactSalesRequest"},"ContactSalesResponse":{"properties":{"ok":{"type":"boolean","title":"Ok","default":true}},"type":"object","title":"ContactSalesResponse"},"ContextualPreviewRequest":{"properties":{"kind":{"type":"string","title":"Kind","description":"One of: invoice_send, invoice_test, invoice_payment_reminder, proposal_send, proposal_test, payment_confirmation"},"entity_id":{"type":"string","title":"Entity Id","description":"Invoice / proposal / payment ID"},"custom_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Message"},"test_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Test Email"}},"type":"object","required":["kind","entity_id"],"title":"ContextualPreviewRequest"},"ContextualPreviewResponse":{"properties":{"kind":{"type":"string","title":"Kind"},"template_name":{"type":"string","title":"Template Name"},"subject":{"type":"string","title":"Subject"},"to":{"items":{"type":"string"},"type":"array","title":"To"},"cc":{"items":{"type":"string"},"type":"array","title":"Cc"},"from_label":{"type":"string","title":"From Label"},"reply_to":{"type":"string","title":"Reply To"},"html":{"type":"string","title":"Html"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"}},"type":"object","required":["kind","template_name","subject","to","cc","from_label","reply_to","html","warnings"],"title":"ContextualPreviewResponse"},"CreateApiKeyRequest":{"properties":{"name":{"type":"string","maxLength":128,"minLength":1,"title":"Name"},"scopes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Scopes"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["name"],"title":"CreateApiKeyRequest"},"CreateApiKeyResponse":{"properties":{"token":{"type":"string","title":"Token"},"key":{"$ref":"#/components/schemas/ApiKeyPublic"}},"type":"object","required":["token","key"],"title":"CreateApiKeyResponse"},"CreateAudienceRequest":{"properties":{"name":{"type":"string","title":"Name","default":"Product Updates"}},"type":"object","title":"CreateAudienceRequest"},"CreateCaptureRequest":{"properties":{"page_url":{"type":"string","maxLength":2048,"minLength":1,"title":"Page Url"},"page_title":{"type":"string","maxLength":512,"title":"Page Title","default":""},"page_text":{"type":"string","minLength":1,"title":"Page Text"}},"type":"object","required":["page_url","page_text"],"title":"CreateCaptureRequest"},"CreateCustomMCPRequest":{"properties":{"display_name":{"type":"string","maxLength":80,"minLength":1,"title":"Display Name"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"auth_kind":{"type":"string","enum":["auto","none","static_headers","oauth"],"title":"Auth Kind","default":"auto"}},"type":"object","required":["display_name","config"],"title":"CreateCustomMCPRequest"},"CreateCustomPromptTaskRequest":{"properties":{"display_name":{"type":"string","title":"Display Name"},"schedule_type":{"type":"string","title":"Schedule Type"},"schedule_config":{"additionalProperties":true,"type":"object","title":"Schedule Config"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"prompt":{"type":"string","title":"Prompt"},"context_entities":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Context Entities"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"email_results":{"type":"boolean","title":"Email Results","default":false}},"type":"object","required":["display_name","schedule_type","schedule_config","prompt"],"title":"CreateCustomPromptTaskRequest","description":"Request body for creating a custom prompt task."},"CreateDealLinkRequest":{"properties":{"link_type":{"type":"string","title":"Link Type","description":"proposal | invoice | booking"},"target_id":{"type":"string","title":"Target Id","description":"Target entity id (proposal/invoice/booking row)."},"title":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Title"}},"type":"object","required":["link_type","target_id"],"title":"CreateDealLinkRequest","description":"Attach a proposal / invoice / booking to a deal via entity_links.\n\nUsed by the Linked section in DealDetailDialog to let operators\nconfirm a fallback-matched ref or replace it with a different doc.\n`link_type` corresponds to the `entity_links.link_type` enum;\n`target_id` is the row id in proposals / invoices / bookings."},"CreateManualDealRequest":{"properties":{"contact_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Id"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"target_name":{"type":"string","maxLength":200,"title":"Target Name","description":"Display name for the target"},"target_email":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}],"title":"Target Email"},"target_company_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Target Company Name"},"target_role":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Target Role"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes","description":"Optional user context to seed the plan"},"goal_summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Goal Summary"},"goal_service_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Goal Service Ids"},"goal_targeting":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Goal Targeting"},"stage":{"anyOf":[{"type":"string","pattern":"^(found|lead|opportunity|won|lost)$"},{"type":"null"}],"title":"Stage","description":"Starting stage — 'lead' (default), 'opportunity', 'won', or 'lost'.","default":"lead"}},"type":"object","required":["target_name"],"title":"CreateManualDealRequest"},"CreateProposalRunRequest":{"properties":{"proposal_id":{"type":"string","title":"Proposal Id"},"user_prompt":{"type":"string","maxLength":2000,"minLength":1,"title":"User Prompt"}},"type":"object","required":["proposal_id","user_prompt"],"title":"CreateProposalRunRequest"},"CreateRuleRequest":{"properties":{"rule_text":{"type":"string","maxLength":600,"minLength":1,"title":"Rule Text"},"scope":{"type":"string","pattern":"^(team|private)$","title":"Scope"},"context_entities":{"items":{"$ref":"#/components/schemas/RuleContextEntityRequest"},"type":"array","title":"Context Entities"}},"type":"object","required":["rule_text","scope"],"title":"CreateRuleRequest"},"CreateRunRequest":{"properties":{"selling_summary":{"anyOf":[{"type":"string","maxLength":2000,"minLength":1},{"type":"null"}],"title":"Selling Summary","description":"What the user is trying to sell. REQUIRED for new callers."},"selling_service_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Selling Service Ids","description":"Service IDs to anchor outreach on. Surfaces titles in the prompt."},"targeting":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Targeting","description":"Who the user wants to target — ICP signals, segment, etc."},"targeting_mode":{"anyOf":[{"type":"string","enum":["unconfigured","everyone","criteria"]},{"type":"null"}],"title":"Targeting Mode","description":"How the audience was chosen. Omit to infer: targeting text -> 'criteria', empty -> 'unconfigured'. Pass 'everyone' ONLY when the user explicitly chose their whole network — empty targeting is never silently promoted to 'everyone'."},"free_text_direction":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Free Text Direction","description":"Free-form user direction (legacy `focus_prompt` slot)."},"candidate_limit":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Candidate Limit","description":"Max number of candidate contacts to scan per page (default 100)."},"max_leads":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Max Leads","description":"Optional cap on qualified leads to persist this run. Defaults to candidate_limit."},"target_leads":{"anyOf":[{"type":"integer","maximum":1000.0,"minimum":1.0},{"type":"null"}],"title":"Target Leads","description":"Target number of new pending leads for lead-target GLM runs."},"focus_prompt":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Focus Prompt","description":"DEPRECATED — use free_text_direction. Kept for legacy clients."},"goal_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal Id","description":"Confirmed prospecting goal id selected by preflight."},"create_new_goal":{"type":"boolean","title":"Create New Goal","description":"Create a confirmed new goal from this intake before enqueue.","default":false}},"type":"object","title":"CreateRunRequest","description":"Structured prospecting intake (Phase 2 of split-prospecting-pipeline-agents).\n\nPhase 2 introduces goal anchoring: every saved deal carries a `goal` jsonb\ncolumn derived from `selling_summary` + `selling_service_ids` + `targeting`.\nThe pipeline agent uses this as its success measure on every replan.\n\nBackwards-compat: callers that still pass `focus_prompt` get its value\nforwarded to `free_text_direction`. New callers should pass the four\nstructured fields directly."},"CreateScheduledTaskRequest":{"properties":{"task_type":{"type":"string","title":"Task Type","description":"Type of task (send_invoice, send_expense, etc.)"},"resource_type":{"type":"string","title":"Resource Type","description":"Type of resource (invoice, expense, etc.)"},"resource_id":{"type":"string","title":"Resource Id","description":"ID of the resource to schedule"},"scheduled_at":{"type":"string","format":"date-time","title":"Scheduled At","description":"When to execute the task (ISO format)"},"task_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Task Config","description":"Optional task configuration"},"max_attempts":{"type":"integer","title":"Max Attempts","description":"Maximum retry attempts","default":3}},"type":"object","required":["task_type","resource_type","resource_id","scheduled_at"],"title":"CreateScheduledTaskRequest","description":"Request model for creating a scheduled task."},"CreateThreadRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","default":"New Chat"},"primary_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Agent","default":"orchestrator_agent"},"step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Step"},"active_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Active Agent"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","title":"CreateThreadRequest","description":"Request model for creating a new thread."},"CreateUploadGrant":{"properties":{"purpose":{"$ref":"#/components/schemas/UploadPurpose"},"original_filename":{"type":"string","maxLength":255,"minLength":1,"title":"Original Filename"},"declared_content_type":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Declared Content Type"},"size_bytes":{"type":"integer","exclusiveMinimum":0.0,"title":"Size Bytes"}},"type":"object","required":["purpose","original_filename","size_bytes"],"title":"CreateUploadGrant"},"CreditCheckoutRequest":{"properties":{"amount_usd":{"type":"number","exclusiveMinimum":0.0,"title":"Amount Usd"}},"type":"object","required":["amount_usd"],"title":"CreditCheckoutRequest"},"CreditSettingsResponse":{"properties":{"org_id":{"type":"string","title":"Org Id"},"auto_recharge_enabled":{"type":"boolean","title":"Auto Recharge Enabled"},"auto_recharge_threshold_usd":{"type":"number","title":"Auto Recharge Threshold Usd"},"auto_recharge_amount_usd":{"type":"number","title":"Auto Recharge Amount Usd"},"auto_recharge_threshold_credits":{"type":"integer","title":"Auto Recharge Threshold Credits","default":0},"auto_recharge_amount_credits":{"type":"integer","title":"Auto Recharge Amount Credits","default":0},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id"},"default_payment_method_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Payment Method Id"}},"type":"object","required":["org_id","auto_recharge_enabled","auto_recharge_threshold_usd","auto_recharge_amount_usd"],"title":"CreditSettingsResponse"},"CreditSettingsUpdateRequest":{"properties":{"auto_recharge_enabled":{"type":"boolean","title":"Auto Recharge Enabled"},"auto_recharge_threshold_usd":{"type":"number","minimum":0.0,"title":"Auto Recharge Threshold Usd"},"auto_recharge_amount_usd":{"type":"number","exclusiveMinimum":0.0,"title":"Auto Recharge Amount Usd"},"default_payment_method_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Payment Method Id"}},"type":"object","required":["auto_recharge_enabled","auto_recharge_threshold_usd","auto_recharge_amount_usd"],"title":"CreditSettingsUpdateRequest"},"CustomMCPConnectionListResponse":{"properties":{"connections":{"items":{"$ref":"#/components/schemas/CustomMCPConnectionResponse"},"type":"array","title":"Connections"},"can_manage":{"type":"boolean","title":"Can Manage"},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["connections","can_manage"],"title":"CustomMCPConnectionListResponse"},"CustomMCPConnectionResponse":{"properties":{"id":{"type":"string","title":"Id"},"runtime_key":{"type":"string","title":"Runtime Key"},"display_name":{"type":"string","title":"Display Name"},"endpoint_url":{"type":"string","title":"Endpoint Url"},"auth_kind":{"type":"string","enum":["none","static_headers","oauth"],"title":"Auth Kind"},"connection_status":{"type":"string","title":"Connection Status"},"config_revision":{"type":"integer","title":"Config Revision"},"tool_catalog":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Tool Catalog"},"server_info":{"additionalProperties":true,"type":"object","title":"Server Info"},"last_tested_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Tested At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"},"is_active":{"type":"boolean","title":"Is Active"},"approval_required":{"type":"boolean","title":"Approval Required"},"catalog_changed":{"type":"boolean","title":"Catalog Changed"},"has_approved_catalog":{"type":"boolean","title":"Has Approved Catalog"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","runtime_key","display_name","endpoint_url","auth_kind","connection_status","config_revision","tool_catalog","server_info","is_active","approval_required","catalog_changed","has_approved_catalog"],"title":"CustomMCPConnectionResponse"},"DefaultRoleRequest":{"properties":{"role":{"type":"string","title":"Role"},"calendar_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Id"},"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},"type":"object","required":["role"],"title":"DefaultRoleRequest"},"DeleteProspectingLearningRequest":{"properties":{"skill_name":{"type":"string","title":"Skill Name","default":"prospecting-scoring"},"item_hash":{"type":"string","title":"Item Hash"}},"type":"object","required":["item_hash"],"title":"DeleteProspectingLearningRequest"},"DisconnectResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"DisconnectResponse"},"DiscoveredContactResponse":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"type":"string","title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"job_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Title"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"seniority":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Seniority"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"headline":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headline"},"links":{"items":{"$ref":"#/components/schemas/EnrichedLinkResponse"},"type":"array","title":"Links"},"source":{"type":"string","title":"Source","description":"How this contact was discovered","default":"domain_discovery"},"confidence":{"type":"number","title":"Confidence","default":0.7}},"type":"object","required":["email"],"title":"DiscoveredContactResponse","description":"Response model for a newly discovered contact from domain search."},"DismissDealRequest":{"properties":{"learning_feedback":{"anyOf":[{"$ref":"#/components/schemas/ProspectingLearningFeedback"},{"type":"null"}]}},"type":"object","title":"DismissDealRequest"},"DriveFileForChatRequest":{"properties":{"files":{"items":{"$ref":"#/components/schemas/DriveFileSelection"},"type":"array","title":"Files"}},"type":"object","required":["files"],"title":"DriveFileForChatRequest"},"DriveFileSelection":{"properties":{"file_id":{"type":"string","title":"File Id"},"file_name":{"type":"string","title":"File Name"},"mime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mime Type"},"web_view_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Web View Link"},"icon_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon Url"},"size_bytes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Size Bytes"},"ai_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Summary"}},"type":"object","required":["file_id","file_name"],"title":"DriveFileSelection"},"DriveFileSelectionRequest":{"properties":{"files":{"items":{"$ref":"#/components/schemas/DriveFileSelection"},"type":"array","title":"Files"}},"type":"object","required":["files"],"title":"DriveFileSelectionRequest"},"EditableVoiceProfile":{"properties":{"client_facing":{"$ref":"#/components/schemas/EditableVoiceProfileAudience"},"internal_casual":{"$ref":"#/components/schemas/EditableVoiceProfileAudience"},"non_client_external":{"$ref":"#/components/schemas/EditableVoiceProfileAudience"}},"type":"object","required":["client_facing","internal_casual","non_client_external"],"title":"EditableVoiceProfile","description":"Audience-aware voice profile designed for agent use and direct user editing."},"EditableVoiceProfileAudience":{"properties":{"description":{"type":"string","title":"Description","description":"Short description of how the business should sound with this audience.","default":""},"tags":{"items":{"$ref":"#/components/schemas/VoiceProfileTag"},"type":"array","title":"Tags","description":"Optional preset tags the user wants the agent to lean on."},"examples":{"items":{"type":"string"},"type":"array","title":"Examples","description":"Optional synthetic examples that demonstrate the desired tone without quoting real messages."}},"type":"object","title":"EditableVoiceProfileAudience","description":"Slim, user-editable audience guidance stored on the org record."},"EnableDailyBriefRequest":{"properties":{"run_at_local":{"type":"string","title":"Run At Local"},"lookback_hours":{"type":"integer","title":"Lookback Hours","default":24},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"email_results":{"type":"boolean","title":"Email Results","default":false}},"type":"object","required":["run_at_local"],"title":"EnableDailyBriefRequest","description":"Request body for enabling Daily Brief."},"EnabledRequest":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},"type":"object","required":["enabled"],"title":"EnabledRequest"},"EnhancedEnrichmentRequest":{"properties":{"client_id":{"type":"string","title":"Client Id","description":"Client ID to enrich (or 'new' for new clients)"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name","description":"Client name (optional)"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email","description":"Primary contact email (deprecated - use contacts array)"},"contacts":{"anyOf":[{"items":{"$ref":"#/components/schemas/ContactInput"},"type":"array"},{"type":"null"}],"title":"Contacts","description":"All contacts for this client with their full data"},"existing_links":{"anyOf":[{"items":{"$ref":"#/components/schemas/ExistingLinkInput"},"type":"array"},{"type":"null"}],"title":"Existing Links","description":"Client-level links already added"},"client_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Address","description":"Client's current address"},"client_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Notes","description":"Client's internal notes"},"mode":{"type":"string","enum":["full","fill_empty"],"title":"Mode","description":"'full' overwrites all fields, 'fill_empty' only fills empty fields","default":"fill_empty"},"source":{"type":"string","enum":["frontend","agent","clientform"],"title":"Source","description":"'clientform' = preview only (no auto-save), others = auto-save","default":"frontend"}},"type":"object","required":["client_id"],"title":"EnhancedEnrichmentRequest","description":"Request model for enhanced client enrichment."},"EnhancedEnrichmentResponse":{"properties":{"client_updated":{"type":"boolean","title":"Client Updated"},"client_data":{"additionalProperties":true,"type":"object","title":"Client Data"},"contacts_enriched":{"items":{"$ref":"#/components/schemas/EnrichedContactResponse"},"type":"array","title":"Contacts Enriched","description":"All contacts with enriched data"},"discovered_contacts":{"items":{"$ref":"#/components/schemas/DiscoveredContactResponse"},"type":"array","title":"Discovered Contacts","description":"New contacts discovered from email domain search. For clientform: add these to the form. For frontend/agent: already saved to DB."},"contacts_created":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Contacts Created"},"contacts_data":{"items":{"$ref":"#/components/schemas/EnrichedContactResponse"},"type":"array","title":"Contacts Data"},"entity_links":{"items":{"$ref":"#/components/schemas/EnrichedLinkResponse"},"type":"array","title":"Entity Links"},"is_individual":{"type":"boolean","title":"Is Individual","description":"True if this is an individual, not a business","default":false},"enrichment_summary":{"additionalProperties":true,"type":"object","title":"Enrichment Summary"}},"type":"object","required":["client_updated"],"title":"EnhancedEnrichmentResponse","description":"Response model for enhanced enrichment."},"EnrichedContactResponse":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"name":{"type":"string","title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"job_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Title"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"seniority":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Seniority"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"headline":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Headline"},"internal_notes_for_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Internal Notes For Agent"},"source":{"type":"string","title":"Source"},"confidence":{"type":"number","title":"Confidence"},"links":{"items":{"$ref":"#/components/schemas/EnrichedLinkResponse"},"type":"array","title":"Links"},"was_enriched":{"type":"boolean","title":"Was Enriched","description":"True if this contact had data enriched","default":false},"enriched_fields":{"items":{"type":"string"},"type":"array","title":"Enriched Fields","description":"Fields that were enriched"}},"type":"object","required":["name","source","confidence"],"title":"EnrichedContactResponse","description":"Response model for an enriched contact."},"EnrichedLinkResponse":{"properties":{"link_type":{"type":"string","title":"Link Type"},"url":{"type":"string","title":"Url"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"}},"type":"object","required":["link_type","url"],"title":"EnrichedLinkResponse","description":"Response model for an enriched link."},"EnrichmentRegisterBody":{"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"}},"type":"object","title":"EnrichmentRegisterBody"},"EnterpriseContactRequest":{"properties":{"email":{"type":"string","maxLength":320,"format":"email","title":"Email"},"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"company":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Company"},"message":{"anyOf":[{"type":"string","maxLength":5000},{"type":"null"}],"title":"Message"},"source":{"type":"string","enum":["site","app"],"title":"Source","default":"site"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"}},"type":"object","required":["email"],"title":"EnterpriseContactRequest","description":"POST /api/enterprise-contact body.\n\nThe whole Enterprise \"plan\" for now is this contact form (Solo/Team/Enterprise\nrename, 2026-08-08 plan) — no Clerk plan object, no checkout. Two mount points\nshare this one endpoint: the marketing site pricing page (unauthenticated,\nsource='site') and the in-app plan-picker card (authenticated, source='app')."},"EnterpriseContactResponse":{"properties":{"ok":{"type":"boolean","title":"Ok","default":true}},"type":"object","title":"EnterpriseContactResponse"},"EntitlementResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"org_id":{"type":"string","title":"Org Id"},"subscription_status":{"type":"string","title":"Subscription Status"},"is_paid_org":{"type":"boolean","title":"Is Paid Org"},"is_paying_org":{"type":"boolean","title":"Is Paying Org"},"low_balance_threshold_usd":{"type":"number","title":"Low Balance Threshold Usd","default":0},"auto_recharge_enabled":{"type":"boolean","title":"Auto Recharge Enabled","default":false},"auto_recharge_amount_usd":{"type":"number","title":"Auto Recharge Amount Usd","default":0},"monthly_credit_limit":{"type":"integer","title":"Monthly Credit Limit"},"monthly_credits_used":{"type":"integer","title":"Monthly Credits Used"},"monthly_credits_remaining":{"type":"integer","title":"Monthly Credits Remaining"},"monthly_credits_exhausted":{"type":"boolean","title":"Monthly Credits Exhausted"},"monthly_period_start":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Monthly Period Start"},"monthly_period_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Monthly Period End"},"monthly_exhausted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Monthly Exhausted At"},"extra_credit_balance":{"type":"integer","title":"Extra Credit Balance","default":0},"total_available_credits":{"type":"integer","title":"Total Available Credits","default":0},"ai_usage_allowed":{"type":"boolean","title":"Ai Usage Allowed","default":true},"minimum_required_credits":{"type":"integer","title":"Minimum Required Credits","default":100},"free_trial_credits":{"type":"integer","title":"Free Trial Credits","default":10000000},"requires_billing_paywall":{"type":"boolean","title":"Requires Billing Paywall"},"paywall_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paywall Reason"},"credits_reset_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Credits Reset At"},"billing_path":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Path"},"has_payment_method":{"type":"boolean","title":"Has Payment Method","default":false},"plan_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Slug"},"plan_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan Name"},"server_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Server Time"},"is_trialing":{"type":"boolean","title":"Is Trialing","default":false},"trial_started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trial Started At"},"trial_ends_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trial Ends At"},"trial_forfeited":{"type":"boolean","title":"Trial Forfeited","default":false},"has_ever_paid":{"type":"boolean","title":"Has Ever Paid","default":false},"member_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Member Count"}},"type":"object","required":["user_id","org_id","subscription_status","is_paid_org","is_paying_org","monthly_credit_limit","monthly_credits_used","monthly_credits_remaining","monthly_credits_exhausted","requires_billing_paywall"],"title":"EntitlementResponse","description":"Internal billing entitlement payload for frontend gating."},"EntityAvatarResolveResponse":{"properties":{"scheduled":{"type":"boolean","title":"Scheduled"}},"type":"object","required":["scheduled"],"title":"EntityAvatarResolveResponse"},"EntityAvatarResponse":{"properties":{"entity_type":{"type":"string","enum":["contact","client"],"title":"Entity Type"},"entity_id":{"type":"string","title":"Entity Id"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"},"avatar_source":{"type":"string","title":"Avatar Source"},"avatar_updated_at":{"type":"string","title":"Avatar Updated At"},"variants":{"anyOf":[{"$ref":"#/components/schemas/AvatarVariants"},{"type":"null"}]}},"type":"object","required":["entity_type","entity_id","avatar_url","avatar_source","avatar_updated_at"],"title":"EntityAvatarResponse"},"EventLink":{"properties":{"role":{"type":"string","title":"Role","description":"Link role: contact|client|deal|thread|related","default":"related"},"type":{"type":"string","title":"Type","description":"Related entity type"},"id":{"type":"string","title":"Id","description":"Related entity id"}},"type":"object","required":["type","id"],"title":"EventLink","description":"A related-entity link (written directly by the SDK, service role)."},"EventPublishRequest":{"properties":{"entity_type":{"type":"string","title":"Entity Type","description":"The type of entity (e.g., 'client', 'payment', 'expense')"},"entity_id":{"type":"string","title":"Entity Id","description":"The ID of the entity"},"event_type":{"type":"string","title":"Event Type","description":"The type of event to create"},"event_message":{"type":"string","title":"Event Message","description":"The event message"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata","description":"Optional event metadata (can include turn_id if needed)"},"invoice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Id","description":"Optional invoice ID to link this event to an invoice"},"change_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Change Type","description":"Type of change (create, update, delete)"},"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thread Id","description":"Thread ID for agent chat context"}},"type":"object","required":["entity_type","entity_id","event_type","event_message"],"title":"EventPublishRequest","description":"Request model for single event publishing"},"EventSubject":{"properties":{"type":{"type":"string","title":"Type","description":"Subject entity type, e.g. 'contact', 'deal', 'client'"},"id":{"type":"string","title":"Id","description":"Subject entity id"}},"type":"object","required":["type","id"],"title":"EventSubject","description":"The ONE subject of the event (fills legacy entity_type/entity_id; the DB\nfanout trigger emits the subject link)."},"ExistingLinkInput":{"properties":{"link_type":{"type":"string","title":"Link Type"},"url":{"type":"string","title":"Url"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"}},"type":"object","required":["link_type","url"],"title":"ExistingLinkInput","description":"Input model for existing links passed from the frontend."},"ExpenseCategoryCreateRequest":{"properties":{"label":{"type":"string","maxLength":120,"minLength":1,"title":"Label"},"key":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Key"},"gl_code":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Gl Code"},"sort":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sort"},"is_archived":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Archived","default":false}},"type":"object","required":["label"],"title":"ExpenseCategoryCreateRequest"},"ExpenseCategoryPatchRequest":{"properties":{"label":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Label"},"gl_code":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Gl Code"},"sort":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sort"},"is_archived":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Archived"}},"type":"object","title":"ExpenseCategoryPatchRequest"},"ExtendTrialRequest":{"properties":{"extend_to":{"type":"string","title":"Extend To"}},"type":"object","required":["extend_to"],"title":"ExtendTrialRequest","description":"Request body for extending a free trial."},"FinalizeUpload":{"properties":{"grant_id":{"type":"string","format":"uuid","title":"Grant Id"}},"type":"object","required":["grant_id"],"title":"FinalizeUpload"},"GeoCountryResponse":{"properties":{"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"allowed":{"type":"boolean","title":"Allowed","default":true}},"type":"object","title":"GeoCountryResponse"},"GoogleWorkspaceImportRequest":{"properties":{"lookback_days_calendar":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days Calendar","description":"Days of Google Calendar history to scan for meeting attendees.","default":90},"lookback_days_inbox_client":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days Inbox Client","description":"Days of Gmail history to scan for paid-client signals (invoices, payments, contracts).","default":540},"lookback_days_inbox_lead":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days Inbox Lead","description":"Days of Gmail history to scan for active-lead signals (proposals, intros, outreach).","default":180},"max_records":{"type":"integer","exclusiveMinimum":0.0,"title":"Max Records","description":"Maximum records to create in a single import run. Hard cap to bound cost and noise.","default":100}},"type":"object","title":"GoogleWorkspaceImportRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IdentityLinkCallbackRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"IdentityLinkCallbackRequest"},"ImagenGenerateRequest":{"properties":{"prompt":{"type":"string","title":"Prompt"},"aspect_ratio":{"type":"string","title":"Aspect Ratio","default":"1:1"},"model":{"type":"string","title":"Model"},"person_generation":{"type":"string","title":"Person Generation","default":"allow_adult"}},"type":"object","required":["prompt"],"title":"ImagenGenerateRequest"},"ImagenIterateRequest":{"properties":{"source_url":{"type":"string","title":"Source Url"},"prompt":{"type":"string","title":"Prompt"},"model":{"type":"string","title":"Model"}},"type":"object","required":["source_url","prompt"],"title":"ImagenIterateRequest"},"ImpersonateRequest":{"properties":{"slug":{"type":"string","title":"Slug"},"contact_id":{"type":"string","title":"Contact Id"}},"type":"object","required":["slug","contact_id"],"title":"ImpersonateRequest"},"ImpersonateResponse":{"properties":{"session_token":{"type":"string","title":"Session Token"},"slug":{"type":"string","title":"Slug"}},"type":"object","required":["session_token","slug"],"title":"ImpersonateResponse"},"ImportEmailFilterRequest":{"properties":{"emails":{"items":{"type":"string"},"type":"array","maxItems":2000,"title":"Emails"}},"type":"object","required":["emails"],"title":"ImportEmailFilterRequest"},"ImportFinalizeRequest":{"properties":{"import_batch_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Import Batch Id"},"source":{"type":"string","maxLength":64,"minLength":1,"title":"Source"},"contact_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":20000,"title":"Contact Ids"},"matched_contact_ids":{"items":{"type":"string","format":"uuid"},"type":"array","maxItems":20000,"title":"Matched Contact Ids"}},"type":"object","required":["source"],"title":"ImportFinalizeRequest"},"ImportFinalizeResponse":{"properties":{"receipt_id":{"type":"string","title":"Receipt Id"},"status":{"type":"string","title":"Status"},"job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Id"},"created":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Created"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"requested_count":{"type":"integer","title":"Requested Count"},"granted_count":{"type":"integer","title":"Granted Count"}},"type":"object","required":["receipt_id","status","requested_count","granted_count"],"title":"ImportFinalizeResponse"},"InquiryProfileRequest":{"properties":{"token":{"type":"string","title":"Token"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"job_title":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Title"}},"type":"object","required":["token"],"title":"InquiryProfileRequest"},"InquiryRequest":{"properties":{"name":{"type":"string","title":"Name"},"email":{"type":"string","format":"email","title":"Email"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"},"fax":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fax"}},"type":"object","required":["name","email"],"title":"InquiryRequest"},"InquiryResponse":{"properties":{"profile_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile Token"}},"type":"object","title":"InquiryResponse"},"IntegrationHealthResponse":{"properties":{"healthy":{"type":"boolean","title":"Healthy"},"authorized":{"type":"boolean","title":"Authorized"},"bridge_online":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Bridge Online"},"effective_health":{"type":"string","title":"Effective Health"},"checked_at":{"type":"string","title":"Checked At"},"tool_count":{"type":"integer","title":"Tool Count"},"schema_fingerprint":{"type":"string","title":"Schema Fingerprint"}},"type":"object","required":["healthy","authorized","effective_health","checked_at","tool_count","schema_fingerprint"],"title":"IntegrationHealthResponse"},"InviteRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"InviteRequest"},"JobStatusResponse":{"properties":{"status":{"type":"string","title":"Status"},"matched_count":{"type":"integer","title":"Matched Count"},"processed_count":{"type":"integer","title":"Processed Count"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["status","matched_count","processed_count"],"title":"JobStatusResponse"},"KnownByRequest":{"properties":{"contact_ids":{"items":{"type":"string"},"type":"array","maxItems":500,"minItems":1,"title":"Contact Ids"}},"type":"object","required":["contact_ids"],"title":"KnownByRequest"},"LegacyCompanyEnrichmentRequest":{"properties":{"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"contact":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","title":"LegacyCompanyEnrichmentRequest","description":"Legacy request model - use EnhancedEnrichmentRequest instead."},"LinkedInConnectionIn":{"properties":{"name":{"type":"string","maxLength":300,"minLength":1,"title":"Name"},"headline":{"anyOf":[{"type":"string","maxLength":600},{"type":"null"}],"title":"Headline"},"title":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Title"},"company":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Company"},"location":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Location"},"linkedin_url":{"type":"string","maxLength":2048,"minLength":1,"title":"Linkedin Url"},"connected_at":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Connected At"},"photo_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Photo Url"}},"type":"object","required":["name","linkedin_url"],"title":"LinkedInConnectionIn"},"LinkedInImportRequest":{"properties":{"profile":{"$ref":"#/components/schemas/LinkedInProfileIn"},"connections":{"items":{"$ref":"#/components/schemas/LinkedInConnectionIn"},"type":"array","title":"Connections"}},"type":"object","required":["profile","connections"],"title":"LinkedInImportRequest"},"LinkedInProfileIn":{"properties":{"member_urn":{"type":"string","maxLength":300,"title":"Member Urn","default":""},"public_id":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Public Id"},"name":{"anyOf":[{"type":"string","maxLength":300},{"type":"null"}],"title":"Name"},"headline":{"anyOf":[{"type":"string","maxLength":600},{"type":"null"}],"title":"Headline"}},"type":"object","title":"LinkedInProfileIn"},"LocalEnrichmentDigestRequest":{"properties":{"send":{"type":"boolean","title":"Send","default":false}},"type":"object","title":"LocalEnrichmentDigestRequest"},"LogDealInteractionRequest":{"properties":{"channel":{"type":"string","enum":["meeting","phone_call","sms","linkedin","whatsapp","other"],"title":"Channel","default":"meeting"},"details":{"type":"string","maxLength":12000,"minLength":1,"title":"Details"},"completed_plan_action_id":{"anyOf":[{"type":"string","maxLength":80,"minLength":1},{"type":"null"}],"title":"Completed Plan Action Id"}},"type":"object","required":["details"],"title":"LogDealInteractionRequest","description":"Body for /deals/{deal_id}/interactions.\n\nThe UI collects one natural-language note and lets the backend derive the\nconcise timeline summary stored as the event message. When invoked from a\nsales-plan row, ``completed_plan_action_id`` explicitly marks that row done."},"LogMessageAttachment":{"properties":{"storage_name":{"type":"string","maxLength":500,"minLength":1,"title":"Storage Name"},"original_name":{"type":"string","maxLength":255,"minLength":1,"title":"Original Name"},"file_size":{"type":"integer","maximum":20971520.0,"exclusiveMinimum":0.0,"title":"File Size"}},"type":"object","required":["storage_name","original_name","file_size"],"title":"LogMessageAttachment","description":"One file already uploaded to the `agent-uploads` bucket via the same\nsigned-upload flow the chat input uses (20MB cap, same supported types).\n`storage_name` is the bucket object path the backend downloads from;\n`original_name`/`file_size` are display-only metadata from the upload."},"LogMessageRequest":{"properties":{"text":{"type":"string","maxLength":12000,"minLength":1,"title":"Text"},"completed_plan_action_id":{"anyOf":[{"type":"string","maxLength":80,"minLength":1},{"type":"null"}],"title":"Completed Plan Action Id"},"attachments":{"anyOf":[{"items":{"$ref":"#/components/schemas/LogMessageAttachment"},"type":"array","maxItems":10},{"type":"null"}],"title":"Attachments"}},"type":"object","required":["text"],"title":"LogMessageRequest","description":"Body for /deals/{deal_id}/log-message.\n\nThe operator logs a completed off-platform activity as free text (e.g.\n\"Called Avery, she wants pricing by Friday\"). The backend enqueues an async\nreplan that records the activity on the timeline, optionally marks the named\nplan step done, and surgically refreshes the remaining plan. When triggered\nfrom a sales-plan row, `completed_plan_action_id` is that row's step id.\n\n`attachments` carries files/screenshots dropped or pasted into the composer\n(omitted/empty when none) — capped at 10, matching the chat composer's\nMAX_FILES. The replan agent reads each one via `read_deal_attachment`."},"MagicLinkRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"MagicLinkRequest"},"MagicLinkResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"MagicLinkResponse"},"MakeNewPlanRequest":{"properties":{"goal_summary":{"type":"string","maxLength":2000,"minLength":1,"title":"Goal Summary"},"goal_service_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Goal Service Ids"},"goal_targeting":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Goal Targeting"}},"type":"object","required":["goal_summary"],"title":"MakeNewPlanRequest","description":"Body for /deals/by-contact/{contact_id}/make-new-plan.\n\nStarts a new deal cycle for a contact who has prior won/lost cycles\n(or for a brand-new manual add when no prior cycle exists)."},"ManualSyncRequest":{"properties":{"entity_type":{"type":"string","enum":["client","invoice","payment","expense"],"title":"Entity Type"},"entity_id":{"type":"string","title":"Entity Id"}},"additionalProperties":false,"type":"object","required":["entity_type","entity_id"],"title":"ManualSyncRequest"},"MappingRequest":{"properties":{"mapping_type":{"$ref":"#/components/schemas/MappingType"},"local_key":{"type":"string","title":"Local Key","default":"__default__"},"external_id":{"type":"string","title":"External Id"},"external_name":{"type":"string","title":"External Name"},"external_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Code"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"additionalProperties":false,"type":"object","required":["mapping_type","external_id","external_name"],"title":"MappingRequest"},"MappingType":{"type":"string","enum":["revenue_account","expense_account","expense_payment_account","expense_tax_rate","payment_account","tax_rate","item","tracking_category","tracking_option"],"title":"MappingType"},"MarkAcceptedPayload":{"properties":{"name":{"type":"string","title":"Name"},"email":{"type":"string","title":"Email"}},"type":"object","required":["name","email"],"title":"MarkAcceptedPayload"},"MergeProspectingGoalRequest":{"properties":{"target_goal_id":{"type":"string","minLength":1,"title":"Target Goal Id"}},"type":"object","required":["target_goal_id"],"title":"MergeProspectingGoalRequest"},"MoveDealRequest":{"properties":{"stage_name":{"type":"string","title":"Stage Name","description":"Target stage name (e.g., 'found'/'lead', 'opportunity')"},"learning_feedback":{"anyOf":[{"$ref":"#/components/schemas/ProspectingLearningFeedback"},{"type":"null"}]}},"type":"object","required":["stage_name"],"title":"MoveDealRequest"},"OAuthMetadataResponse":{"properties":{"issuer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issuer"},"scopes_supported":{"items":{"type":"string"},"type":"array","title":"Scopes Supported"}},"type":"object","required":["scopes_supported"],"title":"OAuthMetadataResponse"},"OAuthStartResponse":{"properties":{"auth_url":{"type":"string","title":"Auth Url"}},"type":"object","required":["auth_url"],"title":"OAuthStartResponse"},"OnboardingBootstrapJobsRequest":{"properties":{"lookback_days_calendar":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days Calendar","description":"Days of Google Calendar history to scan for meeting attendees.","default":90},"lookback_days_inbox_client":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days Inbox Client","description":"Days of Gmail history to scan for paid-client signals (invoices, payments, contracts).","default":540},"lookback_days_inbox_lead":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days Inbox Lead","description":"Days of Gmail history to scan for active-lead signals (proposals, intros, outreach).","default":180},"max_records":{"type":"integer","exclusiveMinimum":0.0,"title":"Max Records","description":"Maximum records to create in a single import run. Hard cap to bound cost and noise.","default":100},"phase":{"anyOf":[{"type":"string","enum":["early","final"]},{"type":"null"}],"title":"Phase","description":"Optional onboarding phase. Omit for the legacy all-jobs behavior; 'early' starts BI + voice while waiting for survey answers; 'final' starts the import after the survey is saved."}},"type":"object","title":"OnboardingBootstrapJobsRequest"},"OnboardingBootstrapRequest":{"properties":{"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone","description":"IANA timezone from browser (e.g., 'America/New_York'). Obtained via Intl.DateTimeFormat().resolvedOptions().timeZone"},"daily_brief":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Daily Brief","description":"Optional Daily Brief defaults to apply during bootstrap"}},"type":"object","title":"OnboardingBootstrapRequest","description":"Request model for onboarding bootstrap"},"OnboardingBootstrapResponse":{"properties":{"already_seeded":{"type":"boolean","title":"Already Seeded"},"subdomain_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subdomain Slug"},"subdomain_created":{"type":"boolean","title":"Subdomain Created","default":false},"welcome_sent":{"type":"boolean","title":"Welcome Sent","default":false},"marked_complete":{"type":"boolean","title":"Marked Complete","default":false},"user_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Email"},"timezone_set":{"type":"boolean","title":"Timezone Set","default":false}},"type":"object","required":["already_seeded"],"title":"OnboardingBootstrapResponse","description":"Response model for onboarding bootstrap"},"OrgSkillCreate":{"properties":{"skill_name":{"type":"string","maxLength":50,"minLength":1,"title":"Skill Name"},"display_name":{"type":"string","maxLength":100,"minLength":1,"title":"Display Name"},"when_to_use":{"type":"string","maxLength":500,"minLength":1,"title":"When To Use"},"content":{"type":"string","maxLength":50000,"minLength":1,"title":"Content"},"context_entities":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Context Entities"}},"type":"object","required":["skill_name","display_name","when_to_use","content"],"title":"OrgSkillCreate"},"OrgSkillListItem":{"properties":{"id":{"type":"string","title":"Id"},"skill_name":{"type":"string","title":"Skill Name"},"display_name":{"type":"string","title":"Display Name"},"when_to_use":{"type":"string","title":"When To Use"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","skill_name","display_name","when_to_use","is_active","created_at","updated_at"],"title":"OrgSkillListItem"},"OrgSkillResponse":{"properties":{"id":{"type":"string","title":"Id"},"org_id":{"type":"string","title":"Org Id"},"skill_name":{"type":"string","title":"Skill Name"},"display_name":{"type":"string","title":"Display Name"},"when_to_use":{"type":"string","title":"When To Use"},"content":{"type":"string","title":"Content"},"context_entities":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Context Entities"},"is_active":{"type":"boolean","title":"Is Active"},"created_by":{"type":"string","title":"Created By"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","org_id","skill_name","display_name","when_to_use","content","is_active","created_by","created_at","updated_at"],"title":"OrgSkillResponse"},"OrgSkillUpdate":{"properties":{"display_name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Display Name"},"when_to_use":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"null"}],"title":"When To Use"},"content":{"anyOf":[{"type":"string","maxLength":50000,"minLength":1},{"type":"null"}],"title":"Content"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"context_entities":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Context Entities"}},"type":"object","title":"OrgSkillUpdate"},"PageViewRequest":{"properties":{"entity_type":{"type":"string","enum":["invoice","proposal","booking_page","client_portal"],"title":"Entity Type"},"entity_id":{"type":"string","title":"Entity Id"},"page":{"type":"string","title":"Page","default":"view"},"viewer_type":{"type":"string","enum":["client","owner","preview"],"title":"Viewer Type"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["entity_type","entity_id","viewer_type"],"title":"PageViewRequest"},"PayoutInfoRequest":{"properties":{"paypal_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paypal Email"}},"type":"object","title":"PayoutInfoRequest"},"PermissionResponseRequest":{"properties":{"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thread Id"},"request_id":{"type":"string","title":"Request Id"},"approved":{"type":"boolean","title":"Approved"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["request_id","approved"],"title":"PermissionResponseRequest","description":"Request body for responding to a permission request.\n\n`thread_id` is optional because not every permission request comes from a\nchat thread. MCP-origin requests (ChatGPT, the Claude connector, Cursor, the\nEvery CLI) have no thread -- they are bound to a user and an org instead.\nWhile this field was required, an MCP row could not even be SUBMITTED here:\nthe schema rejected `null` with a 422 before any authorization ran, which is\nwhy the destructive-write gate had to ship with enforcement off."},"PhasedOnboardingBootstrapJobsResponse":{"properties":{"bi_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bi Job Id","description":"business_intelligence_report job ID, if enqueued"},"voice_profile_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Profile Job Id","description":"voice_profile_refresh job ID, if enqueued"},"import_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Import Job Id","description":"add_clients_and_deals_from_google_workspace job ID, if enqueued (waits on bi_job_id)"},"phase":{"anyOf":[{"type":"string","enum":["early","final"]},{"type":"null"}],"title":"Phase","description":"Echoes the requested phase when provided."},"import_depends_on_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Import Depends On Job Id","description":"BI job ID used as the dependency for the import job, when applicable."},"bi_await_survey":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Bi Await Survey","description":"Current await_survey gate value written to the BI job_input_data, when applicable."},"fallback_to_default":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Fallback To Default","description":"True when phase='final' fell back to legacy all-jobs enqueue because no BI job existed."}},"type":"object","title":"PhasedOnboardingBootstrapJobsResponse"},"PipelineAnnotationsRequest":{"properties":{"deal_ids":{"items":{"type":"string"},"type":"array","maxItems":500,"minItems":1,"title":"Deal Ids"}},"type":"object","required":["deal_ids"],"title":"PipelineAnnotationsRequest"},"PreviewUploadRequest":{"properties":{"storage_name":{"type":"string","title":"Storage Name","description":"Storage path of the uploaded file in agent-uploads bucket."},"original_filename":{"type":"string","title":"Original Filename","description":"Original filename for type detection."},"sheet_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet Name","description":"Sheet to preview when workbook has multiple sheets."}},"type":"object","required":["storage_name","original_filename"],"title":"PreviewUploadRequest"},"PreviewUploadResponse":{"properties":{"file_type":{"type":"string","title":"File Type"},"available_sheets":{"anyOf":[{"items":{"$ref":"#/components/schemas/SheetInfo"},"type":"array"},{"type":"null"}],"title":"Available Sheets"},"selected_sheet":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Selected Sheet"},"headers":{"items":{"type":"string"},"type":"array","title":"Headers"},"sample_rows":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sample Rows"},"total_rows":{"type":"integer","title":"Total Rows"},"schema_signature":{"type":"string","title":"Schema Signature"},"schema_version":{"type":"integer","title":"Schema Version"}},"type":"object","required":["file_type","headers","sample_rows","total_rows","schema_signature","schema_version"],"title":"PreviewUploadResponse"},"ProcessMessagesResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"matched_contacts":{"type":"integer","title":"Matched Contacts"},"unmatched":{"type":"integer","title":"Unmatched"},"total_conversations":{"type":"integer","title":"Total Conversations"}},"type":"object","required":["job_id","matched_contacts","unmatched","total_conversations"],"title":"ProcessMessagesResponse"},"PromoteToClientRequest":{"properties":{"mode":{"type":"string","enum":["link_existing","create_new"],"title":"Mode"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"}},"type":"object","required":["mode"],"title":"PromoteToClientRequest"},"ProposalContentUpdate":{"properties":{"content":{"additionalProperties":true,"type":"object","title":"Content"},"expected_updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected Updated At"}},"type":"object","required":["content"],"title":"ProposalContentUpdate"},"ProposalTemplateCreate":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"template_content":{"additionalProperties":true,"type":"object","title":"Template Content"},"source_proposal_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Source Proposal Id"}},"type":"object","required":["name","template_content"],"title":"ProposalTemplateCreate"},"ProposalTemplateUpdate":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"template_content":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Template Content"}},"type":"object","title":"ProposalTemplateUpdate"},"ProspectingLearningFeedback":{"properties":{"reason":{"anyOf":[{"type":"string","maxLength":160},{"type":"null"}],"title":"Reason"},"note":{"anyOf":[{"type":"string","maxLength":1200},{"type":"null"}],"title":"Note"}},"type":"object","title":"ProspectingLearningFeedback"},"RedeemRequest":{"properties":{"code":{"type":"string","title":"Code"},"invite_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invite Token"}},"type":"object","required":["code"],"title":"RedeemRequest"},"RefineDealRequest":{"properties":{"user_context":{"type":"string","maxLength":2000,"minLength":1,"title":"User Context"}},"type":"object","required":["user_context"],"title":"RefineDealRequest","description":"Manual user-supplied context that should refresh this deal's\nstrategy + draft. Does not queue a cross-deal skill-learning signal."},"RenameDealRequest":{"properties":{"target_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Target Name"},"target_company_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Target Company Name"}},"type":"object","title":"RenameDealRequest","description":"Display-only rename. Deliberately carries NO contact/client field.\n\n`target_name` / `target_company_name` are a display snapshot on the deal\nrow, not a join to the linked contact — so this changes the board label and\nnothing else. Re-pointing a deal at a different person is NOT exposed here:\n`dedupe_key` is `manual:<contact_id>` and the suppression/identity checks\nrun against that contact at creation, so swapping it without recomputing\nboth could mint a second live deal for one human. That repair is archive +\nre-add, which recomputes everything."},"ReplanDealRequest":{"properties":{"user_note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"User Note"},"user_context":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"User Context"}},"type":"object","title":"ReplanDealRequest","description":"Optional context for a manual replan trigger.\n\nBoth fields are optional — the runner falls back to the existing deal\nstate if neither is provided. `user_note` corresponds to the dialog's\n\"Refine plan\" free-text card; `user_context` is additional weighted\ncontext used to influence the next strategy/draft."},"ReplyRequest":{"properties":{"profile_url":{"type":"string","title":"Profile Url"},"text":{"type":"string","title":"Text"}},"type":"object","required":["profile_url","text"],"title":"ReplyRequest"},"RequestVerificationRequest":{"properties":{"email":{"type":"string","title":"Email"},"name":{"type":"string","title":"Name"}},"type":"object","required":["email","name"],"title":"RequestVerificationRequest"},"ResolveGoalRequest":{"properties":{"selling_summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Selling Summary"},"targeting":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Targeting"},"targeting_mode":{"anyOf":[{"type":"string","enum":["unconfigured","everyone","criteria"]},{"type":"null"}],"title":"Targeting Mode"},"service_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Service Ids"}},"type":"object","title":"ResolveGoalRequest"},"RuleContextEntityRequest":{"properties":{"type":{"type":"string","maxLength":64,"minLength":1,"title":"Type"},"id":{"type":"string","maxLength":255,"minLength":1,"title":"Id"},"display":{"type":"string","maxLength":255,"minLength":1,"title":"Display"}},"type":"object","required":["type","id","display"],"title":"RuleContextEntityRequest"},"RunSavedScriptRequest":{"properties":{"prior_job_id":{"type":"string","title":"Prior Job Id","description":"Job ID of the saved script to reuse."},"storage_name":{"type":"string","title":"Storage Name","description":"Storage path of the new file to import."},"schema_signature":{"type":"string","title":"Schema Signature","description":"Schema signature of the new file."},"schema_version":{"type":"integer","title":"Schema Version","default":2},"sheet_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet Name","description":"Sheet name for XLSX/XLS files."}},"type":"object","required":["prior_job_id","storage_name","schema_signature"],"title":"RunSavedScriptRequest"},"RunSavedScriptResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"status":{"type":"string","title":"Status"},"result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result"}},"type":"object","required":["job_id","status"],"title":"RunSavedScriptResponse"},"SaveOutreachDraftRequest":{"properties":{"subject":{"type":"string","maxLength":500,"title":"Subject","default":""},"body":{"type":"string","maxLength":20000,"title":"Body","default":""}},"type":"object","title":"SaveOutreachDraftRequest","description":"Operator-edited content for the deal's existing unsent draft."},"ScheduledTaskResponse":{"properties":{"id":{"type":"string","title":"Id"},"task_type":{"type":"string","title":"Task Type"},"resource_type":{"type":"string","title":"Resource Type"},"resource_id":{"type":"string","title":"Resource Id"},"scheduled_at":{"type":"string","format":"date-time","title":"Scheduled At"},"status":{"type":"string","title":"Status"},"attempts":{"type":"integer","title":"Attempts"},"max_attempts":{"type":"integer","title":"Max Attempts"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"last_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error"},"executed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Executed At"},"result_data":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Result Data"},"task_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Task Config"}},"type":"object","required":["id","task_type","resource_type","resource_id","scheduled_at","status","attempts","max_attempts","created_at","updated_at"],"title":"ScheduledTaskResponse","description":"Response model for scheduled tasks."},"SchemaGuardRequest":{"properties":{"job_id":{"type":"string","title":"Job Id","description":"Background job identifier for the reference script."},"headers":{"items":{"type":"string"},"type":"array","title":"Headers","description":"Headers detected on the new CSV upload."},"sample_rows":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Sample Rows","description":"Preview rows from the new CSV (limited to ~50 for context)."},"deterministic_warnings":{"items":{"type":"string"},"type":"array","title":"Deterministic Warnings","description":"Warnings already computed via deterministic fingerprint comparison."},"schema_signature":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Schema Signature","description":"Client-computed signature for the new CSV headers (used for validation)."},"schema_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Schema Version","description":"Fingerprint spec version used by the client when computing the signature.","default":2}},"type":"object","required":["job_id"],"title":"SchemaGuardRequest"},"SchemaGuardResponse":{"properties":{"verdict":{"type":"string","enum":["safe","safe_with_warnings","unsafe"],"title":"Verdict"},"summary":{"type":"string","title":"Summary"},"warnings":{"items":{"type":"string"},"type":"array","title":"Warnings"},"blocking_issues":{"items":{"type":"string"},"type":"array","title":"Blocking Issues"},"suggested_follow_up":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Suggested Follow Up"},"confidence":{"type":"number","title":"Confidence"}},"type":"object","required":["verdict","summary","warnings","blocking_issues","suggested_follow_up","confidence"],"title":"SchemaGuardResponse"},"SchemaMatchRequest":{"properties":{"signature":{"type":"string","title":"Signature","description":"SHA256 fingerprint of normalized headers."},"headers":{"items":{"type":"string"},"type":"array","title":"Headers","description":"Raw column headers from the CSV."},"sample_rows":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Sample Rows","description":"Optional preview rows from the CSV for compatibility checks."},"schema_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Schema Version","description":"Fingerprint specification version.","default":2},"limit":{"anyOf":[{"type":"integer","maximum":10.0,"minimum":1.0},{"type":"null"}],"title":"Limit","description":"Maximum number of matches to return.","default":5}},"type":"object","required":["signature"],"title":"SchemaMatchRequest"},"SchemaMatchResponse":{"properties":{"matches":{"items":{"$ref":"#/components/schemas/SchemaMatchResult"},"type":"array","title":"Matches"}},"type":"object","required":["matches"],"title":"SchemaMatchResponse"},"SchemaMatchResult":{"properties":{"job_id":{"type":"string","title":"Job Id"},"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thread Id"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"job_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Job Type"},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nickname"},"schema_signature":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Schema Signature"},"schema_version":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Schema Version"},"reused_from_job_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reused From Job Id"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"script_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Script Hash"},"compatibility":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Compatibility"}},"type":"object","required":["job_id","thread_id","completed_at","job_type","nickname","schema_signature","schema_version","reused_from_job_id","summary","script_hash","compatibility"],"title":"SchemaMatchResult"},"ScoreMergeCandidatesRequest":{"properties":{"limit":{"type":"integer","maximum":100.0,"minimum":1.0,"title":"Limit","default":40}},"type":"object","title":"ScoreMergeCandidatesRequest"},"ScoreMergeCandidatesResponse":{"properties":{"scored":{"items":{"$ref":"#/components/schemas/ScoredVerdict"},"type":"array","title":"Scored"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["scored","count"],"title":"ScoreMergeCandidatesResponse"},"ScoredVerdict":{"properties":{"candidate_id":{"type":"string","title":"Candidate Id"},"verdict":{"type":"string","title":"Verdict"},"confidence":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Confidence"},"rationale":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rationale"}},"type":"object","required":["candidate_id","verdict"],"title":"ScoredVerdict"},"SeedWelcomeRequest":{"properties":{"thread_id":{"type":"string","title":"Thread Id","description":"Client-created thread UUID to render the welcome into"}},"type":"object","required":["thread_id"],"title":"SeedWelcomeRequest","description":"Request model for seeding the hardcoded onboarding welcome."},"SeedWelcomeResponse":{"properties":{"welcome_message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Welcome Message Id"},"welcome_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Welcome Text"},"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thread Id"},"status":{"type":"string","title":"Status"},"offered_action_labels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Offered Action Labels"}},"type":"object","required":["status"],"title":"SeedWelcomeResponse","description":"Response model for the onboarding seed-welcome endpoint (FROZEN contract;\noffered_action_labels added 2026-07 as an optional, backward-compatible field)."},"SendBroadcastRequest":{"properties":{"audience_id":{"type":"string","title":"Audience Id"},"sender":{"type":"string","title":"Sender"},"subject":{"type":"string","title":"Subject"},"body":{"type":"string","title":"Body"},"reply_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reply To"}},"type":"object","required":["audience_id","sender","subject","body"],"title":"SendBroadcastRequest"},"SendOutreachRequest":{"properties":{"subject":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Subject"},"body":{"anyOf":[{"type":"string","maxLength":20000,"minLength":1},{"type":"null"}],"title":"Body"},"to_email":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}],"title":"To Email"},"completed_plan_action_id":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Completed Plan Action Id"}},"type":"object","title":"SendOutreachRequest","description":"Optional operator-edited draft content to send instead of stored draft."},"SetDealTargetValueRequest":{"properties":{"target_value":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Target Value"}},"type":"object","required":["target_value"],"title":"SetDealTargetValueRequest","description":"Manual/forecast value, shown until a proposal/invoice link supersedes\nit (see `entity_resolution._compute_value` precedence). `null` (or `0`)\nclears any existing target; setting a non-null, non-zero value is\nrefused once a proposal or invoice is already linked to the deal.\n\n`target_value` is REQUIRED (though nullable) — deliberately no default.\nOmitting the field entirely from the request body is a 422, not a\nsilent clear; the caller must send `\"target_value\": null` to clear."},"SetValuesRequest":{"properties":{"values":{"additionalProperties":true,"type":"object","title":"Values"},"explicit_types":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Explicit Types"}},"type":"object","required":["values"],"title":"SetValuesRequest"},"ShareCaptureResponse":{"properties":{"thread_id":{"type":"string","title":"Thread Id"},"job_id":{"type":"string","title":"Job Id"}},"type":"object","required":["thread_id","job_id"],"title":"ShareCaptureResponse"},"ShareTokenResponse":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"ShareTokenResponse"},"ShareTokenRevokeResponse":{"properties":{"status":{"type":"string","title":"Status"}},"type":"object","required":["status"],"title":"ShareTokenRevokeResponse"},"SharingRequest":{"properties":{"shared_scope":{"type":"string","title":"Shared Scope"},"read_scope":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Read Scope"},"read_scope_label_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Read Scope Label Id"},"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},"type":"object","required":["shared_scope"],"title":"SharingRequest"},"SheetInfo":{"properties":{"name":{"type":"string","title":"Name"},"row_count":{"type":"integer","title":"Row Count"}},"type":"object","required":["name","row_count"],"title":"SheetInfo"},"SkillTemplate":{"properties":{"template_id":{"type":"string","title":"Template Id"},"name":{"type":"string","title":"Name"},"when_to_use":{"type":"string","title":"When To Use"},"content":{"type":"string","title":"Content"},"icon":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Icon"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"}},"type":"object","required":["template_id","name","when_to_use","content"],"title":"SkillTemplate"},"SpineBulkPublishRequest":{"properties":{"events":{"items":{"$ref":"#/components/schemas/SpinePublishRequest"},"type":"array","title":"Events","description":"Events to publish (≤500)"}},"type":"object","required":["events"],"title":"SpineBulkPublishRequest","description":"Request model for the bulk spine publish endpoint."},"SpinePublishRequest":{"properties":{"event_type":{"type":"string","title":"Event Type","description":"Namespaced canonical (e.g. 'contact.created') or legacy name"},"subject":{"$ref":"#/components/schemas/EventSubject","description":"The single subject entity"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message","description":"Human-readable event_message"},"payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Payload","description":"Stored in events.metadata (≤8KB)"},"occurred_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Occurred At","description":"Occurred time; defaults to now"},"links":{"anyOf":[{"items":{"$ref":"#/components/schemas/EventLink"},"type":"array"},{"type":"null"}],"title":"Links","description":"Related-entity links (≤5)"}},"type":"object","required":["event_type","subject"],"title":"SpinePublishRequest","description":"Request model for the unified-events spine publish endpoint."},"StageDefinitionSettings":{"properties":{"criteria":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Criteria"},"agent_can_move_to_stage":{"type":"boolean","title":"Agent Can Move To Stage","default":true}},"type":"object","title":"StageDefinitionSettings"},"StartCreationResponse":{"properties":{"thread_id":{"type":"string","title":"Thread Id"},"system_message":{"type":"string","title":"System Message"}},"type":"object","required":["thread_id","system_message"],"title":"StartCreationResponse"},"StartIterationRequest":{"properties":{"skill_id":{"type":"string","title":"Skill Id"}},"type":"object","required":["skill_id"],"title":"StartIterationRequest"},"StoredVoiceProfile":{"properties":{"updated_at":{"type":"string","title":"Updated At","description":"ISO timestamp when the voice profile was last refreshed."},"audiences":{"$ref":"#/components/schemas/EditableVoiceProfile"}},"type":"object","required":["updated_at","audiences"],"title":"StoredVoiceProfile","description":"Persisted minimal voice profile shape shown to users and loaded by writing flows."},"SummaryInsightRequest":{"properties":{"card_type":{"type":"string","title":"Card Type"},"value":{"type":"string","title":"Value"}},"type":"object","required":["card_type","value"],"title":"SummaryInsightRequest"},"TeachProspectingGuidanceRequest":{"properties":{"guidance":{"type":"string","maxLength":1200,"minLength":1,"title":"Guidance"}},"type":"object","required":["guidance"],"title":"TeachProspectingGuidanceRequest"},"TextBlockForTagging":{"properties":{"id":{"type":"string","title":"Id"},"heading":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heading"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"}},"type":"object","required":["id"],"title":"TextBlockForTagging"},"TextSuggestRequest":{"properties":{"proposal_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Proposal Id"},"heading":{"type":"string","title":"Heading"},"mode":{"type":"string","enum":["generate","refine"],"title":"Mode","default":"generate"},"current_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Body"},"refine_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Refine Prompt"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"inline_context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inline Context"}},"type":"object","required":["heading"],"title":"TextSuggestRequest"},"ToggleSaveRequest":{"properties":{"saved":{"type":"boolean","title":"Saved","description":"True to save (star), false to unsave (unstar)."},"nickname":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nickname","description":"Optional nickname when saving."}},"type":"object","required":["saved"],"title":"ToggleSaveRequest"},"TrackCommercialEntityRequest":{"properties":{"entity_type":{"type":"string","enum":["proposal","invoice","booking"],"title":"Entity Type"},"entity_id":{"type":"string","title":"Entity Id"},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"contact_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Id"},"metadata":{"additionalProperties":true,"type":"object","title":"Metadata"}},"type":"object","required":["entity_type","entity_id"],"title":"TrackCommercialEntityRequest"},"UpdateAccountRequest":{"properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","title":"UpdateAccountRequest"},"UpdateBusinessContextFieldRequest":{"properties":{"field":{"type":"string","title":"Field","description":"One of identity_summary, services_summary, target_client_summary, growth_motion, metrics_summary, internal_operations_summary"},"value":{"title":"Value","description":"str for text fields; object for growth_motion"},"set_lock":{"type":"boolean","title":"Set Lock","description":"Mark the field owner-locked so BI will not overwrite it","default":true}},"type":"object","required":["field","value"],"title":"UpdateBusinessContextFieldRequest","description":"Owner edit of a single structured business_context field."},"UpdateCanonicalTargetingRequest":{"properties":{"targeting":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Targeting"},"everyone":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Everyone"},"expected_fingerprint":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expected Fingerprint"}},"type":"object","title":"UpdateCanonicalTargetingRequest"},"UpdateCustomMCPRequest":{"properties":{"display_name":{"anyOf":[{"type":"string","maxLength":80,"minLength":1},{"type":"null"}],"title":"Display Name"},"config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Config"},"auth_kind":{"anyOf":[{"type":"string","enum":["none","static_headers","oauth"]},{"type":"null"}],"title":"Auth Kind"}},"type":"object","title":"UpdateCustomMCPRequest"},"UpdateDealCriteriaRequest":{"properties":{"stage_criteria_overrides":{"additionalProperties":true,"type":"object","title":"Stage Criteria Overrides"}},"type":"object","title":"UpdateDealCriteriaRequest","description":"Body for /deals/{deal_id}/criteria.\n\nPer-deal success-criteria overrides. REPLACE semantics: the caller sends the\nfull desired override set (sparse per-stage delta keyed by\nlead/opportunity/won/lost); blank/absent fields drop, an empty map clears\nall overrides (stored NULL). Normalization caps criteria length."},"UpdateDealGoalRequest":{"properties":{"summary":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Summary"},"service_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Service Ids"},"targeting":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Targeting"}},"type":"object","title":"UpdateDealGoalRequest","description":"Body for /deals/{deal_id}/goal.\n\nMutates the deal's `goal` jsonb in place and triggers a replan with\ntrigger='goal_changed' so the agent re-derives strategy + draft against\nthe new objective."},"UpdateDealNoteRequest":{"properties":{"note":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Note"}},"type":"object","title":"UpdateDealNoteRequest","description":"Body for /deals/{deal_id}/note.\n\nMutates `target_snapshot.user_notes`, which is user-entered context shown\nin the deal identity rail. Empty notes remove the key."},"UpdateDefinitionRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Description"},"validations":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Validations"},"filterable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Filterable"},"agent_readable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Agent Readable"},"agent_writable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Agent Writable"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"display_order":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Display Order"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"field_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Field Type"},"is_list":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is List"},"key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key"},"namespace":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Namespace"},"entity_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Entity Type"}},"type":"object","title":"UpdateDefinitionRequest"},"UpdateOrgPromptRequest":{"properties":{"org_prompt":{"type":"string","maxLength":5000,"minLength":1,"title":"Org Prompt","description":"Custom instructions for the organization"}},"type":"object","required":["org_prompt"],"title":"UpdateOrgPromptRequest","description":"Request model for updating organization prompt"},"UpdateOrgPromptResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"org_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Prompt"}},"type":"object","required":["success","message"],"title":"UpdateOrgPromptResponse","description":"Response model for org prompt update"},"UpdateProspectingSettingsRequest":{"properties":{"won_definition":{"anyOf":[{"$ref":"#/components/schemas/WonDefinitionSettings"},{"type":"null"}]},"stage_definitions":{"anyOf":[{"additionalProperties":{"$ref":"#/components/schemas/StageDefinitionSettings"},"type":"object"},{"type":"null"}],"title":"Stage Definitions"},"scoring":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Scoring"},"default_focus_prompt":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Default Focus Prompt"},"default_targeting":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Default Targeting"}},"type":"object","title":"UpdateProspectingSettingsRequest"},"UpdateRuleRequest":{"properties":{"rule_text":{"anyOf":[{"type":"string","maxLength":600,"minLength":1},{"type":"null"}],"title":"Rule Text"},"scope":{"anyOf":[{"type":"string","pattern":"^(team|private)$"},{"type":"null"}],"title":"Scope"},"context_entities":{"anyOf":[{"items":{"$ref":"#/components/schemas/RuleContextEntityRequest"},"type":"array"},{"type":"null"}],"title":"Context Entities"}},"type":"object","title":"UpdateRuleRequest"},"UpdateSubdomainSlugRequest":{"properties":{"slug":{"type":"string","maxLength":63,"minLength":3,"title":"Slug","description":"Subdomain slug (e.g. 'acme')"}},"type":"object","required":["slug"],"title":"UpdateSubdomainSlugRequest"},"UpdateTimezoneRequest":{"properties":{"timezone":{"type":"string","title":"Timezone","description":"IANA timezone name (e.g., 'America/New_York', 'Europe/London')"}},"type":"object","required":["timezone"],"title":"UpdateTimezoneRequest","description":"Request model for updating timezone"},"UploadPurpose":{"type":"string","enum":["chat_attachment","data_import","invoice_attachment","proposal_attachment","org_logo","org_context","expense_receipt","proposal_media","linkedin_messages","audio_transcription"],"title":"UploadPurpose"},"UserVoiceProfileStateResponse":{"properties":{"voice_profile":{"anyOf":[{"$ref":"#/components/schemas/StoredVoiceProfile"},{"type":"null"}]},"voice_profile_meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Voice Profile Meta"}},"type":"object","title":"UserVoiceProfileStateResponse"},"UserVoiceProfileUpdateRequest":{"properties":{"voice_profile":{"$ref":"#/components/schemas/StoredVoiceProfile"}},"additionalProperties":false,"type":"object","required":["voice_profile"],"title":"UserVoiceProfileUpdateRequest"},"ValidatePromptRequest":{"properties":{"prompt_text":{"type":"string","maxLength":5000,"minLength":1,"title":"Prompt Text","description":"Prompt text to validate"}},"type":"object","required":["prompt_text"],"title":"ValidatePromptRequest","description":"Request model for validating a prompt without saving"},"ValidatePromptResponse":{"properties":{"is_safe":{"type":"boolean","title":"Is Safe"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["is_safe","reason"],"title":"ValidatePromptResponse","description":"Response model for prompt validation"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VoiceProfileRefreshRequest":{"properties":{"lookback_days":{"type":"integer","exclusiveMinimum":0.0,"title":"Lookback Days","description":"Number of days to analyze for the latest voice and tone profile.","default":90}},"type":"object","title":"VoiceProfileRefreshRequest"},"VoiceProfileTag":{"type":"string","enum":["warm","friendly","direct","clear","concise","professional","polished","confident","calm","casual","empathetic","reassuring","consultative","formal","playful","upbeat","urgent"],"title":"VoiceProfileTag"},"WonDefinitionSettings":{"properties":{"type":{"type":"string","title":"Type","description":"Legacy compatibility field. agent_determined is canonical; former fixed-rule values are accepted and coerced."},"agent_criteria":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Agent Criteria"}},"type":"object","required":["type"],"title":"WonDefinitionSettings"},"routes__accounting_routes__OAuthStartRequest":{"properties":{"provider":{"$ref":"#/components/schemas/AccountingProvider"},"redirect_path":{"type":"string","title":"Redirect Path","default":"/settings/accounting"},"reauth_credential_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reauth Credential Id"}},"additionalProperties":false,"type":"object","required":["provider"],"title":"OAuthStartRequest"},"routes__agent_scheduled_tasks__CreateDefinitionRequest":{"properties":{"routine_type":{"type":"string","title":"Routine Type"},"display_name":{"type":"string","title":"Display Name"},"schedule_type":{"type":"string","title":"Schedule Type"},"schedule_config":{"additionalProperties":true,"type":"object","title":"Schedule Config"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"timezone":{"type":"string","title":"Timezone"},"thread_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thread Id"},"email_results":{"type":"boolean","title":"Email Results","default":false}},"type":"object","required":["routine_type","display_name","schedule_type","schedule_config","config","timezone"],"title":"CreateDefinitionRequest","description":"Request body for creating a scheduled task definition."},"routes__agent_scheduled_tasks__UpdateScheduledTaskRequest":{"properties":{"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"schedule_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Schedule Type"},"schedule_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Schedule Config"},"config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Config"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"email_results":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email Results"}},"type":"object","title":"UpdateScheduledTaskRequest","description":"Request body for updating a scheduled task definition."},"routes__custom_mcp_connections__OAuthStartRequest":{"properties":{"scopes":{"items":{"type":"string"},"type":"array","maxItems":20,"title":"Scopes"}},"type":"object","title":"OAuthStartRequest"},"routes__google_accounts__ScheduleRequest":{"properties":{"sync_schedule":{"type":"string","title":"Sync Schedule"},"axis":{"type":"string","title":"Axis","default":"new_deal"},"sync_daily_hour":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sync Daily Hour","default":6},"sync_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sync Timezone"},"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},"type":"object","required":["sync_schedule"],"title":"ScheduleRequest"},"routes__meta_field_routes__CreateDefinitionRequest":{"properties":{"entity_type":{"type":"string","title":"Entity Type"},"key":{"type":"string","maxLength":64,"minLength":1,"title":"Key"},"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"type":{"type":"string","title":"Type"},"is_list":{"type":"boolean","title":"Is List","default":false},"namespace":{"type":"string","maxLength":64,"minLength":1,"title":"Namespace","default":"custom"},"description":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Description"},"validations":{"additionalProperties":true,"type":"object","title":"Validations"},"default_value":{"title":"Default Value"},"filterable":{"type":"boolean","title":"Filterable","default":false},"agent_readable":{"type":"boolean","title":"Agent Readable","default":true},"agent_writable":{"type":"boolean","title":"Agent Writable","default":true}},"type":"object","required":["entity_type","key","name","type"],"title":"CreateDefinitionRequest"},"routes__scheduled_tasks__UpdateScheduledTaskRequest":{"properties":{"scheduled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Scheduled At","description":"New scheduled time"},"task_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Task Config","description":"Updated task configuration"}},"type":"object","title":"UpdateScheduledTaskRequest","description":"Request model for updating a scheduled task."},"routes__social_routes__ScheduleRequest":{"properties":{"sync_schedule":{"type":"string","title":"Sync Schedule"},"axis":{"type":"string","title":"Axis","default":"new_deal"},"sync_timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sync Timezone"},"sync_daily_hour":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sync Daily Hour"}},"type":"object","required":["sync_schedule"],"title":"ScheduleRequest"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}