{"openapi":"3.1.0","info":{"title":"opero.pro API","version":"0.1.0"},"paths":{"/v1/":{"get":{"tags":["health"],"summary":"Health Check","description":"Health check endpoint at /v1/","operationId":"health_check_v1__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/chat/completions":{"post":{"tags":["chat"],"summary":"Chat Completions","operationId":"chat_completions_v1_chat_completions_post","parameters":[{"name":"X-User-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatCompletionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/generate-title":{"post":{"tags":["chat"],"summary":"Generate Title","operationId":"generate_title_v1_generate_title_post","parameters":[{"name":"X-User-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TitleGenerationRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/conversations":{"get":{"tags":["conversations"],"summary":"Get Conversations","description":"Get user's conversations with pagination.\nReturns 5 conversations by default, expandable with scroll.\nConversations are sorted by the timestamp of their last message.","operationId":"get_conversations_v1_conversations_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":5,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"X-User-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/conversations/{conversation_id}/messages":{"get":{"tags":["conversations"],"summary":"Get Messages","description":"Get messages in a conversation.\nReturns 10 messages by default, expandable with scroll.","operationId":"get_messages_v1_conversations__conversation_id__messages_get","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":10,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"X-User-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/conversations/{conversation_id}/rewrite":{"post":{"tags":["conversations"],"summary":"Rewrite Message","description":"Truncate conversation from a given message and clear checkpointer state,\nso the user can re-send an edited message through the normal chat flow.","operationId":"rewrite_message_v1_conversations__conversation_id__rewrite_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"X-User-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RewriteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/messages/{message_id}/reactions":{"post":{"tags":["messages"],"summary":"Add Reaction","description":"Add or update a reaction to a message.\nSupports both JWT and API key authentication.","operationId":"add_reaction_v1_messages__message_id__reactions_post","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"name":"X-User-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReactionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["messages"],"summary":"Delete Reaction","description":"Remove user's reaction from a message.\nSupports both JWT and API key authentication.","operationId":"delete_reaction_v1_messages__message_id__reactions_delete","parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}},{"name":"X-User-Id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-User-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/generate-questions":{"post":{"tags":["questions"],"summary":"Generate Questions","description":"Generate relevant questions based on an organization's document titles.","operationId":"generate_questions_v1_generate_questions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionGenerationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuestionGenerationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/documents/{document_id}":{"delete":{"tags":["documents"],"summary":"Delete Document","description":"Delete a document from Supabase, vector store, and S3.","operationId":"delete_document_v1_documents__document_id__delete","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/documents/ic":{"post":{"tags":["documents"],"summary":"Convert Document To Ic","description":"Internal endpoint: convert a spreadsheet in S3 to IronCalc bytes.\n\nCalled only by the Next.js presign route, which has already authorized the\ncaller for this key. Requires a valid X-Webhook-Secret header. The result is\ncached as an .ic sibling next to the original, mirroring the .pdf sibling.","operationId":"convert_document_to_ic_v1_documents_ic_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IcConversionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/nango":{"post":{"tags":["webhooks","nango-webhooks"],"summary":"Handle Webhook","description":"Handle incoming webhooks from Nango.\n\nVerifies webhook signature and routes to appropriate handlers based on type.","operationId":"handle_webhook_v1_webhooks_nango_post","parameters":[{"name":"X-Nango-Hmac-Sha256","in":"header","required":false,"schema":{"type":"string","title":"X-Nango-Hmac-Sha256"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/s3/events":{"post":{"tags":["webhooks","s3-webhooks"],"summary":"Handle S3 Events","description":"Receive a batch of S3 object-change records from the event-router Lambda.","operationId":"handle_s3_events_v1_webhooks_s3_events_post","parameters":[{"name":"X-Webhook-Secret","in":"header","required":false,"schema":{"type":"string","title":"X-Webhook-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/S3EventBatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/hail":{"post":{"tags":["webhooks","hail-webhooks"],"summary":"Hail Webhook","operationId":"hail_webhook_v1_webhooks_hail_post","parameters":[{"name":"x-hail-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Hail-Signature"}},{"name":"x-hail-event","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Hail-Event"}},{"name":"x-hail-delivery","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Hail-Delivery"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/billing/metronome":{"post":{"tags":["webhooks","billing-webhooks"],"summary":"Metronome Webhook","operationId":"metronome_webhook_v1_webhooks_billing_metronome_post","parameters":[{"name":"Metronome-Webhook-Signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metronome-Webhook-Signature"}},{"name":"Date","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/billing/stripe":{"post":{"tags":["webhooks","billing-webhooks"],"summary":"Stripe Webhook","operationId":"stripe_webhook_v1_webhooks_billing_stripe_post","parameters":[{"name":"Stripe-Signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/webhooks/etl/step-failures":{"post":{"tags":["webhooks","etl-webhooks"],"summary":"Handle Step Failure","operationId":"handle_step_failure_v1_webhooks_etl_step_failures_post","parameters":[{"name":"X-Webhook-Secret","in":"header","required":false,"schema":{"type":"string","title":"X-Webhook-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StepFailureAlert"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Handle Step Failure V1 Webhooks Etl Step Failures Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/reports/output-capabilities":{"get":{"tags":["reports"],"summary":"Output Capabilities","description":"Allow frontend previews to detect an API predating observation output.","operationId":"output_capabilities_v1_reports_output_capabilities_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v1/reports/{call_id}/observation":{"get":{"tags":["reports"],"summary":"Get Observation","description":"Render stored observations with chat's canonical chart/table contract.","operationId":"get_observation_v1_reports__call_id__observation_get","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/reports/{call_id}/observation/pdf":{"post":{"tags":["reports"],"summary":"Export Observation Pdf","operationId":"export_observation_pdf_v1_reports__call_id__observation_pdf_post","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/reports/{call_id}/knowledge-base":{"post":{"tags":["reports"],"summary":"Add To Knowledge Base","operationId":"add_to_knowledge_base_v1_reports__call_id__knowledge_base_post","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["reports"],"summary":"Remove From Knowledge Base","operationId":"remove_from_knowledge_base_v1_reports__call_id__knowledge_base_delete","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/reports/{call_id}/content":{"get":{"tags":["reports"],"summary":"Get Editable Content","operationId":"get_editable_content_v1_reports__call_id__content_get","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}},{"name":"probe","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Probe"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["reports"],"summary":"Save Editable Content","operationId":"save_editable_content_v1_reports__call_id__content_patch","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveContent"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/reports/{call_id}/content/sync":{"post":{"tags":["reports"],"summary":"Sync Edited Report","operationId":"sync_edited_report_v1_reports__call_id__content_sync_post","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/drafts/{conversation_id}/submit":{"post":{"tags":["reports"],"summary":"Submit Draft","operationId":"submit_draft_v1_drafts__conversation_id__submit_post","parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/reports/{call_id}/process":{"post":{"tags":["reports"],"summary":"Process Report","operationId":"process_report_v1_reports__call_id__process_post","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/email-domains":{"post":{"tags":["email-domains"],"summary":"Create Domain","operationId":"create_domain_v1_email_domains_post","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateDomainBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["email-domains"],"summary":"List Domains","operationId":"list_domains_v1_email_domains_get","parameters":[{"name":"orgId","in":"query","required":true,"schema":{"type":"string","title":"Orgid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/email-domains/{domain_id}":{"get":{"tags":["email-domains"],"summary":"Refresh Domain","operationId":"refresh_domain_v1_email_domains__domain_id__get","parameters":[{"name":"domain_id","in":"path","required":true,"schema":{"type":"string","title":"Domain Id"}},{"name":"orgId","in":"query","required":true,"schema":{"type":"string","title":"Orgid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["email-domains"],"summary":"Delete Domain","operationId":"delete_domain_v1_email_domains__domain_id__delete","parameters":[{"name":"domain_id","in":"path","required":true,"schema":{"type":"string","title":"Domain Id"}},{"name":"orgId","in":"query","required":true,"schema":{"type":"string","title":"Orgid"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/emails/reconcile":{"post":{"tags":["emails"],"summary":"Trigger Reconcile","operationId":"trigger_reconcile_v1_emails_reconcile_post","parameters":[{"name":"x-webhook-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Webhook-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/emails/{email_id}/attachments/urls":{"get":{"tags":["emails"],"summary":"Get Attachment Urls","description":"Presigned URLs for every attachment that has one — one request instead\nof N, for message-body.tsx resolving several inline cid: images at once.\n\nMust stay declared before ``/{email_id}/attachments/{index}`` below:\nStarlette matches routes by path shape first and type-checks path params\n(``index: int``) only after a route already matched, so with the other\norder this path 404s into a 422 on \"urls\" instead of ever reaching here.","operationId":"get_attachment_urls_v1_emails__email_id__attachments_urls_get","parameters":[{"name":"email_id","in":"path","required":true,"schema":{"type":"string","title":"Email Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/emails/{email_id}/attachments/{index}":{"get":{"tags":["emails"],"summary":"Get Attachment Url","operationId":"get_attachment_url_v1_emails__email_id__attachments__index__get","parameters":[{"name":"email_id","in":"path","required":true,"schema":{"type":"string","title":"Email Id"}},{"name":"index","in":"path","required":true,"schema":{"type":"integer","title":"Index"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/emails/threads/{thread_id}/reply-context":{"get":{"tags":["emails"],"summary":"Get Reply Context","operationId":"get_reply_context_v1_emails_threads__thread_id__reply_context_get","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/emails/threads/{thread_id}/reply":{"post":{"tags":["emails"],"summary":"Send Reply","operationId":"send_reply_v1_emails_threads__thread_id__reply_post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/emails/threads/{thread_id}/knowledge-base":{"post":{"tags":["emails"],"summary":"Add Thread To Knowledge Base","operationId":"add_thread_to_knowledge_base_v1_emails_threads__thread_id__knowledge_base_post","parameters":[{"name":"thread_id","in":"path","required":true,"schema":{"type":"string","title":"Thread Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/emails/drafts/{draft_id}":{"delete":{"tags":["emails"],"summary":"Discard Draft","operationId":"discard_draft_v1_emails_drafts__draft_id__delete","parameters":[{"name":"draft_id","in":"path","required":true,"schema":{"type":"string","title":"Draft Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/{workflow_id}/run":{"post":{"tags":["workflows"],"summary":"Run Workflow","operationId":"run_workflow_v1_workflows__workflow_id__run_post","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunWorkflowRequest","default":{"trigger_payload":{}}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/{workflow_id}/test-trigger-payload":{"get":{"tags":["workflows"],"summary":"Get Test Trigger Payload","description":"A real trigger_payload for manually testing an event_integration_webhook\ntrigger, built from Nango's currently-synced records — same shape a live\nwebhook delivery produces. The Builder UI calls this before POST\n/{workflow_id}/run so \"Run now\" exercises the workflow with real data\ninstead of an empty {} that only fails once some downstream node\ntemplates into {{trigger.record...}}. Same role check as /run — anyone\nwho can start a run can preview its payload.\n\n404 (not 422) when there's nothing to test with yet: this is a \"no data\"\ncondition, not a malformed request — the workflow itself may be\nperfectly valid and simply have no matching synced record right now.","operationId":"get_test_trigger_payload_v1_workflows__workflow_id__test_trigger_payload_get","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/runs/{run_id}/approval":{"post":{"tags":["workflows"],"summary":"Resolve Run Approval","description":"Approve or reject a run paused on an approval_gate.\n\nSignals WorkflowRunExecutor.resolve_approval. The workflow writes the run\nrow itself (back to 'running', or 'cancelled' on rejection) — this endpoint\ndeliberately does not, so the row can never disagree with the workflow.","operationId":"resolve_run_approval_v1_workflows_runs__run_id__approval_post","parameters":[{"name":"run_id","in":"path","required":true,"schema":{"type":"string","title":"Run Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApprovalRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows":{"post":{"tags":["workflows"],"summary":"Create Workflow","description":"A new workflow always starts as a draft — activation is a separate,\nvalidated step.","operationId":"create_workflow_v1_workflows_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkflowRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/{workflow_id}":{"patch":{"tags":["workflows"],"summary":"Update Workflow","operationId":"update_workflow_v1_workflows__workflow_id__patch","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateWorkflowRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["workflows"],"summary":"Delete Workflow","operationId":"delete_workflow_v1_workflows__workflow_id__delete","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/{workflow_id}/activate":{"post":{"tags":["workflows"],"summary":"Activate Workflow","operationId":"activate_workflow_v1_workflows__workflow_id__activate_post","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/workflows/{workflow_id}/deactivate":{"post":{"tags":["workflows"],"summary":"Deactivate Workflow","operationId":"deactivate_workflow_v1_workflows__workflow_id__deactivate_post","parameters":[{"name":"workflow_id","in":"path","required":true,"schema":{"type":"string","title":"Workflow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/internal/workflows/run-failed":{"post":{"tags":["internal"],"summary":"Run Failed","operationId":"run_failed_v1_internal_workflows_run_failed_post","parameters":[{"name":"x-webhook-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Webhook-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunFailedRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/internal/nodes/execute":{"post":{"tags":["internal"],"summary":"Execute Node","operationId":"execute_node_v1_internal_nodes_execute_post","parameters":[{"name":"x-webhook-secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Webhook-Secret"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExecuteNodeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/status":{"get":{"tags":["billing"],"summary":"Status","description":"Balance, burn, licenses, and renewal date for the Usage & Billing screen.\n\nExempt orgs (`billing_active = false`) get `{\"billingActive\": false}` and\nnothing money-related — the screen renders its usage-only variant from\n`/usage` alone.\n\nAny internal member may call this, but only admins and superadmins get\nthe full financial payload (balance, burn, invoices-adjacent fields). A\nplain `user` gets `billingActive`, `daysLeft` (the chat low-balance\nnotice), plus everything the license-consent dialogs render when a\nnon-admin action would need a new line: `licenses`, `prices`, `card`,\n`collection`, `currency`, `term`, `renewalDate`, `termStart`, `termEnd`.\nNo balance, burn, `suggestedPackUsd`, `topup*`, or invoices.","operationId":"status_v1_billing_status_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Status V1 Billing Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/catalog":{"get":{"tags":["billing"],"summary":"Read Catalog","description":"What Opero sells and the constants the screens render it with.\n\nAny signed-in user may read it: the signup wizard offers currencies and\nplans before the org has a billing row of its own. Nothing here is\norg-specific. Cached with the catalog itself (300 s), so this is one\nPostgres read per process per five minutes at worst.","operationId":"read_catalog_v1_billing_catalog_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Read Catalog V1 Billing Catalog Get"}}}}}}},"/v1/billing/prices":{"get":{"tags":["billing"],"summary":"Prices","description":"Per-seat and per-add-on list prices for the signup wizard, straight\nfrom the Metronome rate card. Any signed-in user may read them (no org\nyet).","operationId":"prices_v1_billing_prices_get","parameters":[{"name":"currency","in":"query","required":true,"schema":{"type":"string","title":"Currency"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Prices V1 Billing Prices Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/usage":{"get":{"tags":["billing"],"summary":"Usage","description":"The `billing_usage_summary` RPC payload, camelCased. Works for every\norg — exempt orgs are metered too and see their own usage.","operationId":"usage_v1_billing_usage_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Usage V1 Billing Usage Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/invoices":{"get":{"tags":["billing"],"summary":"Invoices","description":"The org's Stripe invoices (newest first, as Stripe returns them).","operationId":"invoices_v1_billing_invoices_get","parameters":[{"name":"org_id","in":"query","required":true,"schema":{"type":"string","title":"Org Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Invoices V1 Billing Invoices Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/contract/refresh":{"post":{"tags":["billing"],"summary":"Contract Refresh","description":"On-demand refresh of the cached Metronome contract, run synchronously\nso the Billing admin screen's \"Refresh now\" button shows the result\nimmediately (unlike `/status`'s background-task refresh on a stale\ncache, which answers from the old cache first).","operationId":"contract_refresh_v1_billing_contract_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgIdBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/packs/buy":{"post":{"tags":["billing"],"summary":"Packs Buy","description":"Buy a credit pack: a payment-gated PREPAID commit on the contract.\n\n`queued`, not `bought`: the vendor charges the saved card first and\nreleases the credits only when that payment settles (~17 s in the spike).\nWhether a card is saved at all is the vendor's business — the app makes no\nStripe call here; a missing card ends as an unpaid vendor invoice.","operationId":"packs_buy_v1_billing_packs_buy_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PacksBuyBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/topup":{"post":{"tags":["billing"],"summary":"Topup","description":"Turn auto top-up on or off, with burn-derived defaults.\n\n`{\"supported\": false}` when the vendor cannot set the threshold config on\na live contract (TOPUP_SUPPORTED) — the switch renders disabled and\nnothing is called or stored.","operationId":"topup_v1_billing_topup_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopupBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/card-link":{"post":{"tags":["billing"],"summary":"Card Link","description":"A Stripe Checkout session in `setup` mode: the org admin saves a card\nwithout paying anything now. The frontend opens the returned url.","operationId":"card_link_v1_billing_card_link_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardLinkBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/customer":{"post":{"tags":["billing"],"summary":"Create Customer","description":"Self-serve signup, right after the Company step: create the org's\nStripe customer so Stripe checks the billing address and VAT id while the\nform is still on screen. Without this, a VAT id Stripe refuses only\nsurfaces at Activate, with no field left to fix it in.\n\nSame guards as `/checkout` — one Stripe customer per org, created once.","operationId":"create_customer_v1_billing_customer_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgIdBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/billing-details":{"patch":{"tags":["billing"],"summary":"Billing Details","description":"Change the billing address or VAT id of a self-serve org — during\nsignup (the Company step resubmits here after Stripe refused a VAT id)\nand after activation, from the Billing details card. A managed org's\ndetails stay a superadmin's to set through `/activate`.\n\nWhether the VAT id is offered at all is the client's call (Stripe takes\nan EU VAT id only, and the country list lives there); this checks the\nshape and lets Stripe judge the number itself.","operationId":"billing_details_v1_billing_billing_details_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingDetailsBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/checkout":{"post":{"tags":["billing"],"summary":"Checkout","description":"Self-serve activation, step 1: save a card. The Stripe webhook does\nthe rest (`checkout.session.completed` → `activate_org`).","operationId":"checkout_v1_billing_checkout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CardLinkBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/activate":{"post":{"tags":["billing"],"summary":"Activate","operationId":"activate_v1_billing_activate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivateBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/deactivate":{"post":{"tags":["billing"],"summary":"Deactivate","operationId":"deactivate_v1_billing_deactivate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgIdBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/read-only":{"post":{"tags":["billing"],"summary":"Set Read Only","description":"Manual override for `org_billing.read_only` — the same flag a Stripe\n`invoice.paid` webhook clears automatically. For confirming payment\nthat arrived by a means the webhook doesn't see (bank transfer,\nsupport-assisted), or for blocking a billed org outside of activation\n(`start_read_only` on `/activate` only covers day one).","operationId":"set_read_only_v1_billing_read_only_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetReadOnlyBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/vendor-ids/reconcile":{"post":{"tags":["billing"],"summary":"Reconcile Vendor Ids","description":"Live-check the org's cached Stripe/Metronome ids against the vendor's\nreal state and null whichever are confirmed gone, instead of trusting a\ncache that never learns about a change made by hand in Stripe or\nMetronome (e.g. a superadmin deleting a test Stripe customer in the\nStripe dashboard). Used by the superadmin panel's Refresh button and by\nthe delete-organization guard, so neither ever needs a manual SQL clear\nfor an id the vendor has already dropped.\n\nA Stripe customer is \"gone\" when the retrieve 404s or answers with\n`deleted: true` (Stripe keeps deleted customers retrievable forever with\nthat flag, per the API — it does not 404 them). A Metronome contract is\n\"gone\" when the retrieve 404s, or \"ended\" when its own `ending_before`\n(the same field `cache.py` reads for `term_end`) is in the past — either\nis enough to clear both Metronome ids, matching the manual instructions\nthis replaces (confirm the contract has ended; Metronome customers are\nnot archived here).\n\nAny other vendor error (5xx, timeout, auth) leaves the id untouched —\nonly a confirmed answer clears anything.","operationId":"reconcile_vendor_ids_v1_billing_vendor_ids_reconcile_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrgIdBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/licenses/push":{"post":{"tags":["billing"],"summary":"Licenses Push","operationId":"licenses_push_v1_billing_licenses_push_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicensePushBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/licenses/check":{"post":{"tags":["billing"],"summary":"Licenses Check","description":"Reused by every Next.js route that needs the same over-capacity\ncheck `require_license_capacity` runs in-process for the workflows\nrouter — one implementation, one 402 message.","operationId":"licenses_check_v1_billing_licenses_check_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LicenseCheckBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/internal/retry-pushes":{"post":{"tags":["billing"],"summary":"Retry Pushes","description":"`ww`'s `billing-push-retry` schedule (every 30s) calls this to retry\nevery queued license push across every billed org. `push_license`\nalready owns the retry bookkeeping — it clears an entry's `pending_push`\nrow on success and re-queues it with `attempts` incremented on a repeat\nfailure (`_queue_push`) — so this just walks the queues and calls it\nonce per entry, under the same advisory lock every licenses write uses.","operationId":"retry_pushes_v1_billing_internal_retry_pushes_post","parameters":[{"name":"X-Webhook-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Webhook-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Retry Pushes V1 Billing Internal Retry Pushes Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/billing/internal/refresh-caches":{"post":{"tags":["billing"],"summary":"Refresh Caches","description":"`ww`'s nightly `refresh-caches` step calls this to force every billed\norg's cached contract/licenses/prices current, independent of the\nwebhook-triggered 5-minute refresh.","operationId":"refresh_caches_v1_billing_internal_refresh_caches_post","parameters":[{"name":"X-Webhook-Secret","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Webhook-Secret"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Refresh Caches V1 Billing Internal Refresh Caches Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/document-sources/content/{document_id}":{"get":{"tags":["document-sources"],"summary":"Stream Source Content","operationId":"stream_source_content_v1_document_sources_content__document_id__get","parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/document-sources/purge":{"post":{"tags":["document-sources"],"summary":"Purge Document Source","operationId":"purge_document_source_v1_document_sources_purge_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurgeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/document-sources/stop-processing":{"post":{"tags":["document-sources"],"summary":"Stop Document Source Processing","description":"Stop the running work of a source whose Sync was turned off.","operationId":"stop_document_source_processing_v1_document_sources_stop_processing_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurgeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/document-sources/remove-folders":{"post":{"tags":["document-sources"],"summary":"Remove Document Source Folders","description":"Start deleting the documents of config.removing_folders. This can take\nlonger than the nginx timeout, so the result shows on the source row.","operationId":"remove_document_source_folders_v1_document_sources_remove_folders_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurgeRequest"}}},"required":true},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/":{"get":{"summary":"Root Health Check","operationId":"root_health_check__get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"ActivateBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"plan":{"type":"string","title":"Plan"},"term":{"type":"string","enum":["monthly","annual"],"title":"Term"},"currency":{"type":"string","title":"Currency"},"seats":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Seats"},"workflows":{"type":"integer","minimum":0.0,"title":"Workflows","default":0},"connectors":{"type":"integer","minimum":0.0,"title":"Connectors","default":0},"external_orgs":{"type":"integer","minimum":0.0,"title":"External Orgs","default":0},"phone_numbers":{"type":"integer","minimum":0.0,"title":"Phone Numbers","default":0},"collection":{"type":"string","enum":["charge_automatically","send_invoice"],"title":"Collection"},"net_payment_terms_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Net Payment Terms Days","default":30},"billing_email":{"type":"string","title":"Billing Email"},"address":{"$ref":"#/components/schemas/AddressBody"},"vat_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vat Id"},"discount_percent":{"anyOf":[{"type":"number","exclusiveMaximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Discount Percent"},"discount_ending_before":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discount Ending Before"},"prepaid_seats":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Prepaid Seats"},"prepaid_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prepaid Until"},"contract_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contract End"},"starting_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Starting At"},"start_read_only":{"type":"boolean","title":"Start Read Only","default":false}},"type":"object","required":["org_id","plan","term","currency","collection","billing_email","address"],"title":"ActivateBody"},"AddressBody":{"properties":{"country":{"type":"string","title":"Country"},"line1":{"type":"string","title":"Line1"},"city":{"type":"string","title":"City"},"postal_code":{"type":"string","title":"Postal Code"}},"type":"object","required":["country","line1","city","postal_code"],"title":"AddressBody"},"ApprovalRequest":{"properties":{"approved":{"type":"boolean","title":"Approved"},"node_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Node Id"}},"type":"object","required":["approved"],"title":"ApprovalRequest"},"BillingDetailsBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"address":{"$ref":"#/components/schemas/AddressBody"},"vat_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vat Id"}},"type":"object","required":["org_id","address"],"title":"BillingDetailsBody"},"CardLinkBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"return_origin":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Return Origin"}},"type":"object","required":["org_id"],"title":"CardLinkBody"},"ChartEdit":{"properties":{"title":{"type":"string","maxLength":500,"title":"Title"},"description":{"type":"string","maxLength":60000,"title":"Description","default":""},"chart_type":{"type":"string","enum":["bar","line"],"title":"Chart Type"},"x_label":{"type":"string","maxLength":300,"title":"X Label"},"y_label":{"type":"string","maxLength":300,"title":"Y Label"},"unit":{"type":"string","maxLength":100,"title":"Unit"},"x_values":{"items":{"anyOf":[{"type":"string"},{"type":"number"}]},"type":"array","maxItems":200,"minItems":1,"title":"X Values"},"series":{"items":{"$ref":"#/components/schemas/Series"},"type":"array","maxItems":12,"minItems":1,"title":"Series"}},"additionalProperties":false,"type":"object","required":["title","chart_type","x_label","y_label","unit","x_values","series"],"title":"ChartEdit"},"ChatCompletionRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages"},"stream":{"type":"boolean","title":"Stream","default":true},"conversationId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversationid"},"orgId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Orgid"},"orgSlug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Orgslug"},"collectionId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Collectionid"},"guardrailResponse":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Guardrailresponse"},"approvalResponse":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Approvalresponse"},"conversationType":{"anyOf":[{"type":"string","enum":["knowledge","reporting"]},{"type":"null"}],"title":"Conversationtype"},"caseId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caseid"},"contactId":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contactid"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"language":{"anyOf":[{"type":"string","enum":["English","Spanish","French","German","Italian","Portuguese","Dutch","Swedish","Danish"]},{"type":"null"}],"title":"Language"}},"type":"object","required":["messages"],"title":"ChatCompletionRequest"},"CreateDomainBody":{"properties":{"orgId":{"type":"string","title":"Orgid"},"domain":{"type":"string","title":"Domain"}},"type":"object","required":["orgId","domain"],"title":"CreateDomainBody"},"CreateWorkflowRequest":{"properties":{"organization_id":{"type":"string","title":"Organization Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"definition":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Definition"}},"type":"object","required":["organization_id","name"],"title":"CreateWorkflowRequest"},"DocumentMetadata":{"properties":{"id":{"type":"string","minLength":1,"title":"Id"},"file_name":{"type":"string","minLength":1,"title":"File Name"},"file_type":{"type":"string","minLength":1,"title":"File Type"},"s3_key":{"type":"string","minLength":1,"title":"S3 Key"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"}},"type":"object","required":["id","file_name","file_type","s3_key"],"title":"DocumentMetadata","description":"Metadata for document attachments on messages."},"EditableContent":{"properties":{"kind":{"type":"string","enum":["report","instructions","observation"],"title":"Kind"},"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"summary":{"anyOf":[{"type":"string","maxLength":60000},{"type":"number"},{"additionalProperties":{"type":"string","maxLength":60000},"type":"object"}],"title":"Summary"},"sections":{"items":{"$ref":"#/components/schemas/SectionEdit"},"type":"array","maxItems":100,"minItems":1,"title":"Sections"}},"additionalProperties":false,"type":"object","required":["kind","title","summary","sections"],"title":"EditableContent"},"ExecuteNodeRequest":{"properties":{"org_id":{"type":"string","minLength":1,"title":"Org Id"},"kind":{"type":"string","minLength":1,"title":"Kind"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"run_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Run Id"},"node_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Node Id"},"attempt":{"type":"integer","minimum":1.0,"title":"Attempt","default":1},"supports_run_skip":{"type":"boolean","title":"Supports Run Skip","default":false}},"type":"object","required":["org_id","kind"],"title":"ExecuteNodeRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IcConversionRequest":{"properties":{"s3_key":{"type":"string","title":"S3 Key"}},"type":"object","required":["s3_key"],"title":"IcConversionRequest"},"ImageMetadata":{"properties":{"id":{"type":"string","minLength":1,"title":"Id"},"url":{"type":"string","minLength":1,"title":"Url"},"s3_key":{"type":"string","minLength":1,"title":"S3 Key"},"mimetype":{"type":"string","minLength":1,"title":"Mimetype"},"file_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"File Name"},"width":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Width"},"height":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Height"}},"type":"object","required":["id","url","s3_key","mimetype"],"title":"ImageMetadata","description":"Metadata for image attachments on messages."},"LicenseCheckBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"key":{"type":"string","enum":["seats","workflows","connectors","external_orgs","phone_numbers"],"title":"Key"},"delta":{"type":"integer","minimum":1.0,"title":"Delta","default":1}},"type":"object","required":["org_id","key"],"title":"LicenseCheckBody","description":"A pre-flight capacity check: would raising `key`'s in-use count by\n`delta` exceed what's licensed? Next.js routes call this before acting\n(members add, role change to billable, external domains save, phone\nacquire, connection create-session) so an over-capacity, unconsented\naction is blocked with the same message everywhere."},"LicensePushBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"key":{"type":"string","enum":["seats","workflows","connectors","external_orgs","phone_numbers"],"title":"Key"},"collection_choice":{"anyOf":[{"type":"string","enum":["card","invoice"]},{"type":"null"}],"title":"Collection Choice"},"attempt_id":{"type":"string","title":"Attempt Id"},"units":{"anyOf":[{"type":"integer","minimum":1.0},{"type":"null"}],"title":"Units"}},"type":"object","required":["org_id","key","attempt_id"],"title":"LicensePushBody","description":"One license line, pushed the moment the app needs more of it — a new\nactive workflow, a newly acquired phone number, and so on (counter-\ndriven), or a deliberate pre-action purchase from the consent dialog\n(`units` set, see below)."},"Message":{"properties":{"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"},"metadata":{"anyOf":[{"$ref":"#/components/schemas/MessageMetadata"},{"type":"null"}]}},"type":"object","required":["role","content"],"title":"Message"},"MessageMetadata":{"properties":{"visualization_action":{"anyOf":[{"$ref":"#/components/schemas/VisualizationAction"},{"type":"null"}]},"voicememo":{"anyOf":[{"$ref":"#/components/schemas/VoiceMemoMetadata"},{"type":"null"}]},"images":{"anyOf":[{"items":{"$ref":"#/components/schemas/ImageMetadata"},"type":"array"},{"type":"null"}],"title":"Images"},"videos":{"anyOf":[{"items":{"$ref":"#/components/schemas/VideoMetadata"},"type":"array"},{"type":"null"}],"title":"Videos"},"documents":{"anyOf":[{"items":{"$ref":"#/components/schemas/DocumentMetadata"},"type":"array"},{"type":"null"}],"title":"Documents"}},"additionalProperties":true,"type":"object","title":"MessageMetadata","description":"Metadata attached to chat messages."},"OrgIdBody":{"properties":{"org_id":{"type":"string","title":"Org Id"}},"type":"object","required":["org_id"],"title":"OrgIdBody"},"PacksBuyBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"amount_usd":{"type":"integer","minimum":10.0,"title":"Amount Usd"},"purchase_id":{"type":"string","title":"Purchase Id"}},"type":"object","required":["org_id","amount_usd","purchase_id"],"title":"PacksBuyBody"},"PanelSelection":{"properties":{"hidden_series":{"items":{"type":"string","maxLength":80,"minLength":1,"pattern":"^[a-zA-Z0-9_-]+$"},"type":"array","maxItems":6,"title":"Hidden Series"},"search":{"type":"string","maxLength":200,"title":"Search","default":""}},"additionalProperties":false,"type":"object","title":"PanelSelection"},"PurgeRequest":{"properties":{"source_id":{"type":"string","title":"Source Id"}},"type":"object","required":["source_id"],"title":"PurgeRequest"},"QuestionGenerationRequest":{"properties":{"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"},"question_count":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":1.0},{"type":"null"}],"title":"Question Count","default":3},"language":{"anyOf":[{"type":"string","enum":["English","Spanish","French","German","Italian","Portuguese","Dutch","Swedish","Danish"]},{"type":"null"}],"title":"Language"}},"type":"object","title":"QuestionGenerationRequest"},"QuestionGenerationResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"questions":{"items":{"type":"string"},"type":"array","title":"Questions"},"document_count":{"type":"integer","title":"Document Count"},"organization_name":{"type":"string","title":"Organization Name"}},"type":"object","required":["success","questions","document_count","organization_name"],"title":"QuestionGenerationResponse"},"ReactionRequest":{"properties":{"reaction_type":{"type":"string","title":"Reaction Type"}},"type":"object","required":["reaction_type"],"title":"ReactionRequest"},"ReplyRequest":{"properties":{"body_text":{"type":"string","minLength":1,"title":"Body Text"},"idempotency_key":{"type":"string","minLength":8,"title":"Idempotency Key"},"draft_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Draft Id"},"to":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"To"},"cc":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Cc"},"document_ids":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Document Ids"}},"type":"object","required":["body_text","idempotency_key"],"title":"ReplyRequest"},"RewriteRequest":{"properties":{"message_id":{"type":"string","minLength":1,"title":"Message Id"},"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"}},"type":"object","required":["message_id"],"title":"RewriteRequest"},"RunFailedRequest":{"properties":{"run_id":{"type":"string","minLength":1,"title":"Run Id"},"workflow_id":{"type":"string","minLength":1,"title":"Workflow Id"},"org_id":{"type":"string","minLength":1,"title":"Org Id"},"workflow_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Workflow Name"},"node_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Node Id"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["run_id","workflow_id","org_id"],"title":"RunFailedRequest"},"RunWorkflowRequest":{"properties":{"trigger_payload":{"additionalProperties":true,"type":"object","title":"Trigger Payload","default":{}}},"type":"object","title":"RunWorkflowRequest"},"S3EventBatch":{"properties":{"records":{"items":{"$ref":"#/components/schemas/S3FileRecord"},"type":"array","title":"Records"}},"type":"object","required":["records"],"title":"S3EventBatch"},"S3FileRecord":{"properties":{"key":{"type":"string","title":"Key"},"bucket":{"type":"string","title":"Bucket"},"last_modified":{"type":"string","title":"Last Modified"},"size":{"type":"integer","title":"Size"}},"type":"object","required":["key","bucket","last_modified","size"],"title":"S3FileRecord"},"SaveContent":{"properties":{"revision":{"type":"string","maxLength":200,"minLength":1,"title":"Revision"},"content":{"$ref":"#/components/schemas/EditableContent"}},"additionalProperties":false,"type":"object","required":["revision","content"],"title":"SaveContent"},"SectionEdit":{"properties":{"key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key"},"heading":{"type":"string","maxLength":500,"title":"Heading","default":""},"text":{"anyOf":[{"type":"string","maxLength":60000},{"type":"number"},{"additionalProperties":{"type":"string","maxLength":60000},"type":"object"}],"title":"Text","default":""},"follow_up":{"anyOf":[{"type":"string","maxLength":60000},{"type":"number"},{"additionalProperties":{"type":"string","maxLength":60000},"type":"object"}],"title":"Follow Up","default":""},"steps":{"items":{"$ref":"#/components/schemas/StepEdit"},"type":"array","maxItems":100,"title":"Steps"},"charts":{"items":{"$ref":"#/components/schemas/ChartEdit"},"type":"array","maxItems":16,"title":"Charts"},"tables":{"items":{"$ref":"#/components/schemas/TableEdit"},"type":"array","maxItems":16,"title":"Tables"},"evidence_ids":{"items":{"type":"string"},"type":"array","maxItems":24,"title":"Evidence Ids"}},"additionalProperties":false,"type":"object","title":"SectionEdit"},"Series":{"properties":{"label":{"type":"string","maxLength":300,"title":"Label"},"values":{"items":{"anyOf":[{"type":"number"},{"type":"null"}]},"type":"array","maxItems":200,"title":"Values"}},"additionalProperties":false,"type":"object","required":["label","values"],"title":"Series"},"SetReadOnlyBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"read_only":{"type":"boolean","title":"Read Only"}},"type":"object","required":["org_id","read_only"],"title":"SetReadOnlyBody"},"StepEdit":{"properties":{"source_index":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Source Index"},"title":{"type":"string","maxLength":500,"minLength":1,"title":"Title"},"text":{"type":"string","maxLength":60000,"title":"Text"}},"additionalProperties":false,"type":"object","required":["title","text"],"title":"StepEdit"},"StepFailureAlert":{"properties":{"org_slug":{"type":"string","title":"Org Slug"},"workflow_id":{"type":"string","title":"Workflow Id"},"step":{"type":"string","title":"Step"},"consecutive_failures":{"type":"integer","title":"Consecutive Failures"},"total_documents":{"type":"integer","title":"Total Documents"},"error":{"type":"string","title":"Error"}},"type":"object","required":["org_slug","workflow_id","step","consecutive_failures","total_documents","error"],"title":"StepFailureAlert"},"TableEdit":{"properties":{"title":{"type":"string","maxLength":500,"title":"Title"},"columns":{"items":{"type":"string"},"type":"array","maxItems":20,"minItems":1,"title":"Columns"},"rows":{"items":{"items":{"type":"string"},"type":"array"},"type":"array","maxItems":200,"title":"Rows"}},"additionalProperties":false,"type":"object","required":["title","columns","rows"],"title":"TableEdit"},"TitleGenerationRequest":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages"},"conversation_id":{"type":"string","title":"Conversation Id"},"org_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Id"},"org_slug":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Org Slug"},"language":{"anyOf":[{"type":"string","enum":["English","Spanish","French","German","Italian","Portuguese","Dutch","Swedish","Danish"]},{"type":"null"}],"title":"Language"}},"type":"object","required":["messages","conversation_id"],"title":"TitleGenerationRequest"},"TopupBody":{"properties":{"org_id":{"type":"string","title":"Org Id"},"enabled":{"type":"boolean","title":"Enabled"},"threshold_credits":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Threshold Credits"},"recharge_to_credits":{"anyOf":[{"type":"integer","exclusiveMinimum":0.0},{"type":"null"}],"title":"Recharge To Credits"}},"type":"object","required":["org_id","enabled"],"title":"TopupBody"},"UpdateWorkflowRequest":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"definition":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Definition"}},"type":"object","title":"UpdateWorkflowRequest"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VideoMetadata":{"properties":{"id":{"type":"string","minLength":1,"title":"Id"},"url":{"type":"string","minLength":1,"title":"Url"},"s3_key":{"type":"string","minLength":1,"title":"S3 Key"},"mimetype":{"type":"string","minLength":1,"title":"Mimetype"},"duration":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration"},"thumbnail_s3_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail S3 Key"},"thumbnail_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Thumbnail Url"},"width":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Width"},"height":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Height"}},"type":"object","required":["id","url","s3_key","mimetype"],"title":"VideoMetadata","description":"Metadata for video attachments on messages."},"VisualizationAction":{"properties":{"artifact_id":{"type":"string","maxLength":80,"minLength":1,"pattern":"^[a-zA-Z0-9_-]+$","title":"Artifact Id"},"revision":{"type":"integer","maximum":1000000.0,"minimum":1.0,"title":"Revision"},"selections":{"patternProperties":{"^[a-zA-Z0-9_-]+$":{"$ref":"#/components/schemas/PanelSelection"}},"propertyNames":{"maxLength":80,"minLength":1},"type":"object","title":"Selections"}},"additionalProperties":false,"type":"object","required":["artifact_id","revision"],"title":"VisualizationAction"},"VoiceMemoMetadata":{"properties":{"s3Key":{"type":"string","minLength":1,"title":"S3Key"},"voiceMemoId":{"type":"string","minLength":1,"title":"Voicememoid"},"transcript":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transcript"},"duration":{"type":"integer","minimum":0.0,"title":"Duration"},"mimeType":{"type":"string","minLength":1,"title":"Mimetype"},"fileSize":{"type":"integer","minimum":0.0,"title":"Filesize"}},"type":"object","required":["s3Key","voiceMemoId","duration","mimeType","fileSize"],"title":"VoiceMemoMetadata","description":"Metadata for voice memo attachments on messages."}}}}