{"openapi":"3.1.0","info":{"title":"unLocked CRM API","version":"1.0.0","description":"Complete API surface of the unLocked CRM platform.\n\n**Two tiers:**\n1. **Public API** (`/public-api`) — stable, documented REST API for external integrations. API-key or OAuth Bearer auth, scoped permissions, 100 req/min rate limit. The `resource` query parameter selects the collection; the HTTP method selects the operation.\n2. **Edge Functions** (everything else) — internal serverless endpoints that power the app UI, AI features, telephony, quoting, automations, and third-party webhooks. These are documented for completeness; request shapes are function-specific and not covered by the public API stability guarantee.\n\nAll endpoints are Supabase Edge Functions invoked over HTTPS with JSON bodies. `OPTIONS` preflight is supported on every function.","contact":{"name":"unLocked Support","email":"support@unlockedcrm.ai"},"x-rate-limit":{"description":"Default 120 requests/minute per API key (burst 20/second). Exceeding it returns 429 with a Retry-After header.","requestsPerMinute":120,"burstPerSecond":20,"retryAfterHeader":"Retry-After"}},"servers":[{"url":"https://gzigyepfasiumngxilai.supabase.co/functions/v1","description":"Production"}],"security":[{"OAuth2":["read:contacts","write:contacts","read:leads","write:leads","read:policies","write:policies","read:quotes","write:quotes","read:commissions","write:commissions","read:tasks","write:tasks","read:appointments","write:appointments","read:activities","write:activities","read:communications","write:communications","read:agent_ai","write:agent_ai"]},{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Public API key (scoped, rate-limited). Created in Settings → API. Keys are issued with an explicit subset of the named scopes listed in x-scopes (same scope names as the OAuth2 scheme).","x-scopes":{"read:contacts":"Read contact records","write:contacts":"Create and update contact records","read:leads":"Read leads and pipeline records","write:leads":"Create and update leads","read:policies":"Read policy records, renewals, and lapse status","write:policies":"Create and update policy records","read:quotes":"Read quotes and comparison results","write:quotes":"Create and update quotes","read:commissions":"Read commission statements and reconciliation data","write:commissions":"Create and update commission records","read:tasks":"Read tasks and reminders","write:tasks":"Create and update tasks","read:appointments":"Read calendar appointments","write:appointments":"Create and update appointments","read:activities":"Read activity and timeline history","write:activities":"Write activity and timeline entries","read:communications":"Read calls, SMS, and email history","write:communications":"Send SMS, email, and place calls","read:agent_ai":"Read AI agent configuration and run history","write:agent_ai":"Trigger AI agent runs and update configuration"}},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"Supabase user JWT (Authorization: Bearer <token>) — the session token of a signed-in app user."},"ToolSecretAuth":{"type":"apiKey","in":"header","name":"X-Tool-Secret","description":"Shared server-to-server secret for AI agent tool webhooks."},"WebhookSignature":{"type":"apiKey","in":"header","name":"Stripe-Signature / X-Twilio-Signature / provider secret","description":"Provider-signed webhook verification (varies by provider)."},"OAuth2":{"type":"oauth2","description":"OAuth 2.0 authorization code flow with PKCE against the unLocked CRM authorization server. Discovery: https://unlockedcrm.ai/.well-known/oauth-authorization-server. Protected-resource metadata (RFC 9728): https://unlockedcrm.ai/.well-known/oauth-protected-resource. Request least-privilege scopes.","flows":{"authorizationCode":{"authorizationUrl":"https://mcp.unlockedcrm.ai/oauth?action=authorize","tokenUrl":"https://mcp.unlockedcrm.ai/oauth?action=token","refreshUrl":"https://mcp.unlockedcrm.ai/oauth?action=token","scopes":{"read:contacts":"Read contact records","write:contacts":"Create and update contact records","read:leads":"Read leads and pipeline records","write:leads":"Create and update leads","read:policies":"Read policy records, renewals, and lapse status","write:policies":"Create and update policy records","read:quotes":"Read quotes and comparison results","write:quotes":"Create and update quotes","read:commissions":"Read commission statements and reconciliation data","write:commissions":"Create and update commission records","read:tasks":"Read tasks and reminders","write:tasks":"Create and update tasks","read:appointments":"Read calendar appointments","write:appointments":"Create and update appointments","read:activities":"Read activity and timeline history","write:activities":"Write activity and timeline entries","read:communications":"Read calls, SMS, and email history","write:communications":"Send SMS, email, and place calls","read:agent_ai":"Read AI agent configuration and run history","write:agent_ai":"Trigger AI agent runs and update configuration"}}}}},"schemas":{"Lead":{"type":"object","description":"Standard lead fields are written to the leads table. Unknown top-level keys (or keys nested under `custom_fields`) are resolved against the workspace's custom_fields definitions. Common Zapier/GHL aliases are auto-rewritten (see `x-lead-field-aliases`).","additionalProperties":true,"properties":{"first_name":{"type":"string"},"last_name":{"type":"string"},"name":{"type":"string","description":"Auto-split into first_name/last_name when those are absent."},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"status":{"type":"string"},"source":{"type":"string"},"custom_fields":{"type":"object","additionalProperties":true,"example":{"income":"85000","preferred_contact_time":"Evenings"}}},"example":{"first_name":"Jane","last_name":"Doe","email":"jane@example.com","income":"85000","custom_fields":{"preferred_contact_time":"Evenings"}}},"LeadWriteResult":{"type":"object","properties":{"data":{"type":"object","description":"The created/updated lead row."},"matched_custom_fields":{"type":"array","items":{"type":"string"}},"unknown_fields":{"type":"array","items":{"type":"string"}},"custom_field_errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"error":{"type":"string"}}}}}},"BulkRequest":{"type":"object","description":"Envelope for `action=bulk`. Up to 1,000 records per request.","properties":{"mode":{"type":"string","enum":["create","update","upsert"],"default":"create"},"records":{"type":"array","items":{"type":"object","additionalProperties":true},"maxItems":1000}},"required":["records"]},"Error":{"type":"object","description":"Every non-2xx response from the unLocked CRM API is `application/json` with this envelope. HTML error pages are never returned to API clients.","required":["error"],"properties":{"error":{"type":"object","required":["code","message","status","retryable"],"properties":{"code":{"type":"string","description":"Stable machine-readable error code.","enum":["invalid_request","validation_failed","unauthenticated","permission_denied","not_found","conflict","rate_limited","upstream_error","internal_error"]},"message":{"type":"string","description":"Human-readable description of what went wrong."},"status":{"type":"integer","description":"HTTP status code, repeated in the body for agents that only read bodies."},"retryable":{"type":"boolean","description":"True when re-sending the same request may succeed after a delay."},"resolution":{"type":"string","description":"Actionable hint describing how to fix or recover from the error."},"required_scope":{"type":"string","description":"On 403, the OAuth scope the caller is missing."},"retry_after_seconds":{"type":"integer","description":"On 429/503, how long to wait before retrying."},"details":{"type":"array","description":"Field-level problems, when applicable.","items":{"type":"object","properties":{"field":{"type":"string"},"issue":{"type":"string"}}}},"request_id":{"type":"string","description":"Correlation id to quote in support requests."},"docs_url":{"type":"string","format":"uri","description":"Link to documentation for this error code."}}}}},"GenericResponse":{"type":"object","description":"Standard JSON response envelope. `success` indicates whether the operation completed; `data` carries the operation-specific payload.","properties":{"success":{"type":"boolean","description":"True when the operation succeeded."},"data":{"description":"Operation-specific payload. Shape depends on the endpoint."},"message":{"type":"string","description":"Human-readable status message."}},"required":["success"]}},"responses":{"BadRequest":{"description":"Request was malformed or referenced an unknown resource.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"invalid_request":{"summary":"Request was malformed or referenced an unknown resource.","value":{"error":{"code":"invalid_request","message":"Request was malformed or referenced an unknown resource.","status":400,"retryable":false,"resolution":"Check the `resource` query parameter and required body fields, then retry.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors","details":[{"field":"resource","issue":"unknown resource value"}]}}}}}}},"Unauthorized":{"description":"Missing or invalid credentials.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"unauthenticated":{"summary":"Missing or invalid credentials.","value":{"error":{"code":"unauthenticated","message":"Missing or invalid credentials.","status":401,"retryable":false,"resolution":"Send a valid `x-api-key` header or `Authorization: Bearer <jwt>` and retry.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors"}}}}}}},"Forbidden":{"description":"Permission denied for this resource or action.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"permission_denied":{"summary":"Permission denied for this resource or action.","value":{"error":{"code":"permission_denied","message":"Permission denied for this resource or action.","status":403,"retryable":false,"resolution":"Request the scope named in `error.required_scope` (see the scopes table) and retry.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors","required_scope":"leads:write"}}}}}}},"NotFound":{"description":"The requested record or endpoint does not exist.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"not_found":{"summary":"The requested record or endpoint does not exist.","value":{"error":{"code":"not_found","message":"The requested record or endpoint does not exist.","status":404,"retryable":false,"resolution":"Verify the `id` and workspace, then retry. Do not retry with the same id.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors"}}}}}}},"Conflict":{"description":"The write conflicts with existing state.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"conflict":{"summary":"The write conflicts with existing state.","value":{"error":{"code":"conflict","message":"The write conflicts with existing state.","status":409,"retryable":false,"resolution":"Fetch the current record, merge, and retry once.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors"}}}}}}},"UnprocessableEntity":{"description":"One or more field values failed validation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"validation_failed":{"summary":"One or more field values failed validation.","value":{"error":{"code":"validation_failed","message":"One or more field values failed validation.","status":422,"retryable":false,"resolution":"Read `error.details[]` for the offending fields and correct them before retrying.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors","details":[{"field":"email","issue":"must be a valid email address"}]}}}}}}},"RateLimited":{"description":"Rate limit exceeded (100 requests/minute).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"rate_limited":{"summary":"Rate limit exceeded (100 requests/minute).","value":{"error":{"code":"rate_limited","message":"Rate limit exceeded (100 requests/minute).","status":429,"retryable":true,"resolution":"Wait the number of seconds in the `Retry-After` header, then retry with backoff.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors","retry_after_seconds":30}}}}}}},"ServerError":{"description":"Unexpected server error.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"internal_error":{"summary":"Unexpected server error.","value":{"error":{"code":"internal_error","message":"Unexpected server error.","status":500,"retryable":true,"resolution":"Retryable. Retry with exponential backoff and include `error.request_id` in any support request.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors"}}}}}}},"BadGateway":{"description":"A downstream carrier or provider API failed.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"},"examples":{"upstream_error":{"summary":"A downstream carrier or provider API failed.","value":{"error":{"code":"upstream_error","message":"A downstream carrier or provider API failed.","status":502,"retryable":true,"resolution":"Retryable. Retry with exponential backoff; if it persists, contact info@unlockedcrm.ai.","request_id":"req_01J9ZC7Q2X5T","docs_url":"https://unlockedcrm.ai/api#errors"}}}}}}}}},"tags":[{"name":"Public API","description":"Stable external REST API — the only surface covered by the stability guarantee."},{"name":"AI & Agents","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Admin & Provisioning","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Automation & Scheduled Jobs","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Billing & Payments","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Calendar & Booking","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Core CRM","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Email & Notifications","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Integrations & Webhooks","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Quoting & Enrollment","description":"Internal edge functions (documented for completeness; no stability guarantee)."},{"name":"Telephony & Messaging","description":"Internal edge functions (documented for completeness; no stability guarantee)."}],"paths":{"/public-api":{"get":{"tags":["Public API"],"summary":"List a collection, or fetch one record","description":"Omit `id` to list the collection, or pass `id` to fetch a single record. `resource=health` needs no credentials; `resource=whoami` reports the workspace and permissions the credentials resolve to.","parameters":[{"name":"resource","in":"query","required":true,"description":"Which collection the request addresses.","schema":{"type":"string","enum":["leads","clients","activities","tasks","policies","appointments","communications","webhooks","pipelines","pipeline_stages","opportunities","workflows","email_campaigns","commissions","aca_leads","agent_ai_call_logs","agent_ai_scripts","agent_ai_campaigns","quotes","tags","call_recordings","call_disposition_logs","agent_presence","inbound_campaigns","inbound_vendors","health","whoami"]},"example":"leads"},{"name":"id","in":"query","description":"Record id. Omit to list; required for single-record fetch.","schema":{"type":"string","format":"uuid"}},{"name":"limit","in":"query","schema":{"type":"integer","maximum":100,"default":50}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}},{"name":"sort","in":"query","description":"field:direction","schema":{"type":"string","example":"created_at:desc"}},{"name":"fields","in":"query","description":"Comma-separated columns to return.","schema":{"type":"string"}},{"name":"search","in":"query","schema":{"type":"string"}},{"name":"status","in":"query","schema":{"type":"string"}}],"responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getPublicApi"},"post":{"tags":["Public API"],"summary":"Create records","description":"Creates one record from the request body. Pass `action=bulk` with a `records` array to create up to 1,000 at once. For `resource=leads` the body follows the Lead schema — unknown keys are resolved against the workspace's custom fields.","parameters":[{"name":"resource","in":"query","required":true,"schema":{"type":"string"},"example":"leads"},{"name":"action","in":"query","description":"Set to `bulk` to submit a records array.","schema":{"type":"string","enum":["bulk"]}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Lead"},{"$ref":"#/components/schemas/BulkRequest"},{"type":"object","additionalProperties":true,"description":"Record body for any non-lead resource."}]}}}},"responses":{"200":{"description":"Created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadWriteResult"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"postPublicApi"},"put":{"tags":["Public API"],"summary":"Update a record","parameters":[{"name":"resource","in":"query","required":true,"schema":{"type":"string"}},{"name":"id","in":"query","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/Lead"},{"type":"object","additionalProperties":true,"description":"Record body for any non-lead resource."}]}}}},"responses":{"200":{"description":"Updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadWriteResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"putPublicApi","description":"Update a record"},"delete":{"tags":["Public API"],"summary":"Delete a record","parameters":[{"name":"resource","in":"query","required":true,"schema":{"type":"string"}},{"name":"id","in":"query","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Deleted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"403":{"$ref":"#/components/responses/Forbidden"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"deletePublicApi","description":"Delete a record"}},"/openapi-spec":{"get":{"tags":["Public API"],"summary":"OpenAPI 3.1 specification for the Public API","description":"Machine-readable spec for the public REST API. Anonymous. `?format=yaml` is reserved.","security":[],"responses":{"200":{"description":"OpenAPI JSON document","content":{"application/json":{"schema":{"type":"object"}}}},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getOpenapiSpec"}},"/a2p-auto-approve":{"post":{"tags":["Telephony & Messaging"],"summary":"A2p Auto Approve function.","description":"A2p Auto Approve function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"a2p-auto-approve","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postA2pAutoApprove"}},"/a2p-register":{"post":{"tags":["Telephony & Messaging"],"summary":"Helper to make Twilio API calls","description":"Helper to make Twilio API calls\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"a2p-register","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postA2pRegister"}},"/aca-doc-extract":{"post":{"tags":["Quoting & Enrollment"],"summary":"aca-doc-extract — vision-based document auto-fill for ACA quoting/application.","description":"aca-doc-extract — vision-based document auto-fill for ACA quoting/application. Accepts a base64 image/PDF (driver's license, pay stub, insurance card, etc.)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"aca-doc-extract","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAcaDocExtract"}},"/aca-eligibility-check":{"post":{"tags":["Quoting & Enrollment"],"summary":"For creating new lead","description":"For creating new lead\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"aca-eligibility-check","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAcaEligibilityCheck"}},"/aca-plan-summary":{"post":{"tags":["Quoting & Enrollment"],"summary":"Aca Plan Summary function.","description":"Aca Plan Summary function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"aca-plan-summary","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAcaPlanSummary"}},"/aca-public-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"Subaccount behind the public link — needed to file the quote.","description":"Subaccount behind the public link — needed to file the quote.\n\n**Auth:** Anonymous by design — prospect-facing public quote endpoint.","security":[],"x-internal":true,"x-function-name":"aca-public-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAcaPublicQuote"}},"/aca-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"aca-quote — AGENT marketplace quoting (verify_jwt handled in code).","description":"aca-quote — AGENT marketplace quoting (verify_jwt handled in code). Authentication and response shaping only. The quote itself comes from\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"aca-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAcaQuote"}},"/aca-quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"Aca Quote Ai function.","description":"Aca Quote Ai function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"aca-quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAcaQuoteAi"}},"/aca-self-enroll":{"post":{"tags":["Quoting & Enrollment"],"summary":"Where the lead came from, as a tag on the Contacts page.","description":"Where the lead came from, as a tag on the Contacts page. Keyed by the `source` written to the lead row so the two can't drift apart.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"aca-self-enroll","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAcaSelfEnroll"}},"/add-mailgun-domain":{"post":{"tags":["Core CRM"],"summary":"Same resolution as verify-mailgun-domain and send-mailgun, so the domain is created in the account that will later be as","description":"Same resolution as verify-mailgun-domain and send-mailgun, so the domain is created in the account that will later be asked to verify it and send from it.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"add-mailgun-domain","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAddMailgunDomain"}},"/add-team-seat":{"post":{"tags":["Admin & Provisioning"],"summary":"Claim state, declared out here rather than inside the try so the catch at the bottom can release a claim that was staked","description":"Claim state, declared out here rather than inside the try so the catch at the bottom can release a claim that was staked and provably never reached Stripe.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"add-team-seat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAddTeamSeat"}},"/admin-ban-user":{"post":{"tags":["Admin & Provisioning"],"summary":"Verify caller is an admin or has internal secret","description":"Verify caller is an admin or has internal secret\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"admin-ban-user","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAdminBanUser"}},"/admin-cancel-account":{"post":{"tags":["Admin & Provisioning"],"summary":"Verify caller is an admin","description":"Verify caller is an admin\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"admin-cancel-account","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAdminCancelAccount"}},"/admin-eo-compliance":{"post":{"tags":["Admin & Provisioning"],"summary":"Verify user identity","description":"Verify user identity\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"admin-eo-compliance","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAdminEoCompliance"}},"/admin-legacy-migration-discover":{"post":{"tags":["Admin & Provisioning"],"summary":"admin-legacy-migration-discover READ-ONLY lookup for legacy GoHighLevel → unLocked CRM migration.","description":"admin-legacy-migration-discover READ-ONLY lookup for legacy GoHighLevel → unLocked CRM migration.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"admin-legacy-migration-discover","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAdminLegacyMigrationDiscover"}},"/admin-legacy-migration-migrate":{"post":{"tags":["Admin & Provisioning"],"summary":"admin-legacy-migration-migrate Execute legacy GHL → CRM migration:","description":"admin-legacy-migration-migrate Execute legacy GHL → CRM migration:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"admin-legacy-migration-migrate","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAdminLegacyMigrationMigrate"}},"/admin-provision-user":{"post":{"tags":["Admin & Provisioning"],"summary":"Ensure owner role","description":"Ensure owner role\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"admin-provision-user","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAdminProvisionUser"}},"/agent-activity-summary":{"post":{"tags":["AI & Agents"],"summary":"Resolve caller's role from database — never trust client input","description":"Resolve caller's role from database — never trust client input\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-activity-summary","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentActivitySummary"}},"/agent-ai-call":{"post":{"tags":["AI & Agents"],"summary":"Call-source attribution, forwarded verbatim to the EL-native path via the `...body` spread below and written to agent_ai","description":"Call-source attribution, forwarded verbatim to the EL-native path via the `...body` spread below and written to agent_ai_call_logs there. Declared\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCall"}},"/agent-ai-call-control":{"post":{"tags":["AI & Agents"],"summary":"Handle CORS preflight requests","description":"Handle CORS preflight requests\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-call-control","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCallControl"}},"/agent-ai-call-handler":{"post":{"tags":["AI & Agents"],"summary":"Global map for tracking call-specific state","description":"Global map for tracking call-specific state\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-call-handler","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCallHandler"}},"/agent-ai-call-listen":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-call-listen Browser-facing WebSocket endpoint that lets agency users live-listen to an","description":"agent-ai-call-listen Browser-facing WebSocket endpoint that lets agency users live-listen to an\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-call-listen","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCallListen"}},"/agent-ai-call-resume":{"post":{"tags":["AI & Agents"],"summary":"TwiML Resume Endpoint When the agent-ai-call-handler edge function hits its wall-clock timeout,","description":"TwiML Resume Endpoint When the agent-ai-call-handler edge function hits its wall-clock timeout,\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-call-resume","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCallResume"}},"/agent-ai-call-status":{"post":{"tags":["AI & Agents"],"summary":"Note: This is a Twilio webhook that returns TwiML - CORS headers are not needed Twilio webhooks use POST only and don't ","description":"Note: This is a Twilio webhook that returns TwiML - CORS headers are not needed Twilio webhooks use POST only and don't go through browser CORS checks\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"agent-ai-call-status","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCallStatus"}},"/agent-ai-campaign-processor":{"post":{"tags":["AI & Agents"],"summary":"PROCESSOR BUDGET `BATCH_SIZE` was removed: per-tick per-campaign concurrency is now bounded","description":"PROCESSOR BUDGET `BATCH_SIZE` was removed: per-tick per-campaign concurrency is now bounded\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-campaign-processor","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCampaignProcessor"}},"/agent-ai-campaign-status":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-campaign-status Phase 2.5 §4.5 B3 — derived runtime state for the campaign list / detail UI.","description":"agent-ai-campaign-status Phase 2.5 §4.5 B3 — derived runtime state for the campaign list / detail UI.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-campaign-status","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCampaignStatus"}},"/agent-ai-campaign-summary":{"post":{"tags":["AI & Agents"],"summary":"Agent Ai Campaign Summary function.","description":"Agent Ai Campaign Summary function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-campaign-summary","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCampaignSummary"}},"/agent-ai-clone-voice":{"post":{"tags":["AI & Agents"],"summary":"Returns null if the caller is allowed to create another voice clone, or a Response describing why they aren't.","description":"Returns null if the caller is allowed to create another voice clone, or a Response describing why they aren't. Enforces \"Max plans get unlimited\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-clone-voice","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiCloneVoice"}},"/agent-ai-elevenlabs-backfill-recordings":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-backfill-recordings One-time (idempotent, re-runnable) backfill: walks every historical","description":"agent-ai-elevenlabs-backfill-recordings One-time (idempotent, re-runnable) backfill: walks every historical\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-backfill-recordings","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsBackfillRecordings"}},"/agent-ai-elevenlabs-book-appointment":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-book-appointment EL server tool: creates an appointment after the caller confirmed a","description":"agent-ai-elevenlabs-book-appointment EL server tool: creates an appointment after the caller confirmed a\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-book-appointment","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsBookAppointment"}},"/agent-ai-elevenlabs-cancel-appointment":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-cancel-appointment EL server tool: cancels an existing scheduled appointment for the","description":"agent-ai-elevenlabs-cancel-appointment EL server tool: cancels an existing scheduled appointment for the\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-cancel-appointment","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsCancelAppointment"}},"/agent-ai-elevenlabs-find-slots":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-find-slots EL server tool: returns available appointment slots for the contact's","description":"agent-ai-elevenlabs-find-slots EL server tool: returns available appointment slots for the contact's\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-find-slots","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsFindSlots"}},"/agent-ai-elevenlabs-import-phone":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-import-phone Stage 2 of the EL-native pilot productionization.","description":"agent-ai-elevenlabs-import-phone Stage 2 of the EL-native pilot productionization. Imports a CRM-managed\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-import-phone","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsImportPhone"}},"/agent-ai-elevenlabs-inbound-personalization":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-inbound-personalization Fired by ElevenLabs before its inbound agent answers the call.","description":"agent-ai-elevenlabs-inbound-personalization Fired by ElevenLabs before its inbound agent answers the call. We respond\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-inbound-personalization","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsInboundPersonalization"}},"/agent-ai-elevenlabs-mark-dnc":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-mark-dnc EL server tool: adds the caller's number to the subaccount's DNC list","description":"agent-ai-elevenlabs-mark-dnc EL server tool: adds the caller's number to the subaccount's DNC list\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-mark-dnc","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsMarkDnc"}},"/agent-ai-elevenlabs-outbound-call":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-outbound-call EL-native replacement for the legacy `agent-ai-call` outbound path.","description":"agent-ai-elevenlabs-outbound-call EL-native replacement for the legacy `agent-ai-call` outbound path. Lifts\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-outbound-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsOutboundCall"}},"/agent-ai-elevenlabs-pilot-check":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-pilot-check Returns { pilot: boolean } for the requested subaccount.","description":"agent-ai-elevenlabs-pilot-check Returns { pilot: boolean } for the requested subaccount. Used by the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-pilot-check","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsPilotCheck"}},"/agent-ai-elevenlabs-reconcile-stuck":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-reconcile-stuck The single authority for resolving non-terminal ElevenLabs-native call_logs.","description":"agent-ai-elevenlabs-reconcile-stuck The single authority for resolving non-terminal ElevenLabs-native call_logs.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-reconcile-stuck","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsReconcileStuck"}},"/agent-ai-elevenlabs-remove-inbound-phone":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-remove-inbound-phone The inverse of `agent-ai-elevenlabs-import-phone` with direction='inbound':","description":"agent-ai-elevenlabs-remove-inbound-phone The inverse of `agent-ai-elevenlabs-import-phone` with direction='inbound':\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-remove-inbound-phone","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsRemoveInboundPhone"}},"/agent-ai-elevenlabs-remove-phone":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-remove-phone Phase 2 multi-outbound: remove a CRM phone number's ElevenLabs binding.","description":"agent-ai-elevenlabs-remove-phone Phase 2 multi-outbound: remove a CRM phone number's ElevenLabs binding.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-remove-phone","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsRemovePhone"}},"/agent-ai-elevenlabs-repair-sms-webhooks":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-repair-sms-webhooks One-off, operator-triggered repair for phone numbers whose Twilio SMS","description":"agent-ai-elevenlabs-repair-sms-webhooks One-off, operator-triggered repair for phone numbers whose Twilio SMS\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-repair-sms-webhooks","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsRepairSmsWebhooks"}},"/agent-ai-elevenlabs-reschedule-appointment":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-reschedule-appointment EL server tool: moves an existing scheduled appointment to a new slot.","description":"agent-ai-elevenlabs-reschedule-appointment EL server tool: moves an existing scheduled appointment to a new slot.\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-reschedule-appointment","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsRescheduleAppointment"}},"/agent-ai-elevenlabs-transcript-proxy":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-transcript-proxy Server-side proxy used by `LiveCallListenerDock`'s EL-native branch.","description":"agent-ai-elevenlabs-transcript-proxy Server-side proxy used by `LiveCallListenerDock`'s EL-native branch.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-transcript-proxy","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsTranscriptProxy"}},"/agent-ai-elevenlabs-transfer":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-transfer EL server tool: bridges the live Twilio call leg to a human number.","description":"agent-ai-elevenlabs-transfer EL server tool: bridges the live Twilio call leg to a human number.\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-transfer","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsTransfer"}},"/agent-ai-elevenlabs-update-call-outcome":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-update-call-outcome EL server tool: updates the call's outcome mid-call (e.g.","description":"agent-ai-elevenlabs-update-call-outcome EL server tool: updates the call's outcome mid-call (e.g. when the agent\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-update-call-outcome","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsUpdateCallOutcome"}},"/agent-ai-elevenlabs-webhook":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-elevenlabs-webhook Ingests ElevenLabs post-call events and persists them into CRM.","description":"agent-ai-elevenlabs-webhook Ingests ElevenLabs post-call events and persists them into CRM. Single\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"agent-ai-elevenlabs-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiElevenlabsWebhook"}},"/agent-ai-inbound-call":{"post":{"tags":["AI & Agents"],"summary":"Note: This is a Twilio webhook that returns TwiML - CORS headers are not needed Twilio webhooks use POST only and don't ","description":"Note: This is a Twilio webhook that returns TwiML - CORS headers are not needed Twilio webhooks use POST only and don't go through browser CORS checks\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"agent-ai-inbound-call","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiInboundCall"}},"/agent-ai-realtime-token":{"post":{"tags":["AI & Agents"],"summary":"Handle CORS preflight requests","description":"Handle CORS preflight requests\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-realtime-token","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiRealtimeToken"}},"/agent-ai-reconcile-call":{"post":{"tags":["AI & Agents"],"summary":"Reconciles an agent_ai_call_logs row against Twilio's actual call status.","description":"Reconciles an agent_ai_call_logs row against Twilio's actual call status. Used when status callbacks are missed/dropped, so we don't blindly mark\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-reconcile-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiReconcileCall"}},"/agent-ai-script-generator":{"post":{"tags":["AI & Agents"],"summary":"Generates or updates an Agent AI call script using Lovable AI.","description":"Generates or updates an Agent AI call script using Lovable AI. Returns structured JSON via tool-calling: name, openingScript, primaryScript, voicemailScript, bookingRules, objections[].\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-script-generator","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiScriptGenerator"}},"/agent-ai-test-tools":{"post":{"tags":["AI & Agents"],"summary":"Agent AI Test Tools — executes tool calls from the in-browser Test Sandbox.","description":"Agent AI Test Tools — executes tool calls from the in-browser Test Sandbox. Modes:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-test-tools","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiTestTools"}},"/agent-ai-transfer-fallback":{"post":{"tags":["AI & Agents"],"summary":"Transfer Fallback Handler — Multi-Agent Cascade Called by Twilio when a <Dial> attempt completes (via the action= attrib","description":"Transfer Fallback Handler — Multi-Agent Cascade Called by Twilio when a <Dial> attempt completes (via the action= attribute).\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"agent-ai-transfer-fallback","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiTransferFallback"}},"/agent-ai-transfer-whisper":{"post":{"tags":["AI & Agents"],"summary":"Warm Transfer Whisper Briefing Called by Twilio's <Number url=\"...\"> when the receiving agent picks up.","description":"Warm Transfer Whisper Briefing Called by Twilio's <Number url=\"...\"> when the receiving agent picks up.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-transfer-whisper","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiTransferWhisper"}},"/agent-ai-translate-campaign-opening":{"post":{"tags":["AI & Agents"],"summary":"Thin auth wrapper: invoked from the UI on campaign create/edit to translate the script opening into the campaign languag","description":"Thin auth wrapper: invoked from the UI on campaign create/edit to translate the script opening into the campaign language and cache it on\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-translate-campaign-opening","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiTranslateCampaignOpening"}},"/agent-ai-translate-receptionist-greeting":{"post":{"tags":["AI & Agents"],"summary":"Thin auth wrapper: invoked from the Arwyn Receptionist tab on Save to translate the greeting into the receptionist langu","description":"Thin auth wrapper: invoked from the Arwyn Receptionist tab on Save to translate the greeting into the receptionist language and cache it on\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-translate-receptionist-greeting","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiTranslateReceptionistGreeting"}},"/agent-ai-tts":{"post":{"tags":["AI & Agents"],"summary":"Handle CORS preflight requests","description":"Handle CORS preflight requests\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-tts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiTts"}},"/agent-ai-voice-explore":{"post":{"tags":["AI & Agents"],"summary":"Agent AI demo: ElevenLabs Voice Library (\"Explore\" tab).","description":"Agent AI demo: ElevenLabs Voice Library (\"Explore\" tab). Called ONLY by the demo Voice tab (src/pages/demo/agentAiDemo/tabs/VoiceTab.tsx).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-voice-explore","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiVoiceExplore"}},"/agent-ai-voice-fallback":{"post":{"tags":["AI & Agents"],"summary":"agent-ai-voice-fallback Wired as the Voice URL **Fallback** on every active Twilio number.","description":"agent-ai-voice-fallback Wired as the Voice URL **Fallback** on every active Twilio number.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-ai-voice-fallback","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentAiVoiceFallback"}},"/agent-builder-ai":{"post":{"tags":["AI & Agents"],"summary":"agent-builder-ai Lightweight assistant for the AI Agents builder UI.","description":"agent-builder-ai Lightweight assistant for the AI Agents builder UI. Covers three modes:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-builder-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentBuilderAi"}},"/agent-builtin-scheduler":{"post":{"tags":["AI & Agents"],"summary":"Built-in agent scheduler.","description":"Built-in agent scheduler. Cron pings this once; it fans out to every (subaccount, user) tuple that has the agent enabled and invokes the worker.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-builtin-scheduler","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentBuiltinScheduler"}},"/agent-chat":{"post":{"tags":["AI & Agents"],"summary":"CMS-aware Medicare & Health Insurance System Prompt This knowledge block enhances understanding of CMS rules, Medicare p","description":"CMS-aware Medicare & Health Insurance System Prompt This knowledge block enhances understanding of CMS rules, Medicare products, ACA, and transitions.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-chat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentChat"}},"/agent-client-retention":{"post":{"tags":["AI & Agents"],"summary":"Agent Client Retention function.","description":"Agent Client Retention function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-client-retention","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentClientRetention"}},"/agent-coverage-opportunity":{"post":{"tags":["AI & Agents"],"summary":"Medicare Coverage Opportunity Agent Daily cron sweep that flags Medicare-related opportunities and creates tasks for hum","description":"Medicare Coverage Opportunity Agent Daily cron sweep that flags Medicare-related opportunities and creates tasks for human review.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-coverage-opportunity","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentCoverageOpportunity"}},"/agent-insights":{"post":{"tags":["AI & Agents"],"summary":"Create AI prompt based on agent metrics","description":"Create AI prompt based on agent metrics\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentInsights"}},"/agent-lead-conversion":{"post":{"tags":["AI & Agents"],"summary":"Kill-switch guard","description":"Kill-switch guard\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-lead-conversion","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentLeadConversion"}},"/agent-presence":{"post":{"tags":["AI & Agents"],"summary":"Agent Presence function.","description":"Agent Presence function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-presence","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentPresence"}},"/agent-revenue-integrity":{"post":{"tags":["AI & Agents"],"summary":"---- Normalization helpers (shared by dry-run + live run) -----------------","description":"---- Normalization helpers (shared by dry-run + live run) -----------------\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-revenue-integrity","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentRevenueIntegrity"}},"/agent-user-dispatcher":{"post":{"tags":["AI & Agents"],"summary":"agent-user-dispatcher: runs every minute via pg_cron.","description":"agent-user-dispatcher: runs every minute via pg_cron. Finds active scheduled user_agents and invokes agent-user-executor for those\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-user-dispatcher","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentUserDispatcher"}},"/agent-user-executor":{"post":{"tags":["AI & Agents"],"summary":"agent-user-executor: runs user-built agents (Phase 5 Track B) Loads an agent + its triggers/conditions/actions, evaluate","description":"agent-user-executor: runs user-built agents (Phase 5 Track B) Loads an agent + its triggers/conditions/actions, evaluates against records,\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"agent-user-executor","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAgentUserExecutor"}},"/ai-analytics-insights":{"post":{"tags":["AI & Agents"],"summary":"AUTH + SPEND GUARD","description":"AUTH + SPEND GUARD\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-analytics-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiAnalyticsInsights"}},"/ai-analyze-leads":{"post":{"tags":["AI & Agents"],"summary":"Fetch leads data","description":"Fetch leads data\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-analyze-leads","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiAnalyzeLeads"}},"/ai-analyze-voice-profile":{"post":{"tags":["AI & Agents"],"summary":"Ai Analyze Voice Profile function.","description":"Ai Analyze Voice Profile function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-analyze-voice-profile","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiAnalyzeVoiceProfile"}},"/ai-assistant-chat":{"post":{"tags":["AI & Agents"],"summary":"Input validation schema","description":"Input validation schema\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-assistant-chat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiAssistantChat"}},"/ai-automation-builder":{"post":{"tags":["AI & Agents"],"summary":"Triggers are described by the model in flat, human terms and must be translated into the shape the config panel and the ","description":"Triggers are described by the model in flat, human terms and must be translated into the shape the config panel and the processors actually read.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-automation-builder","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiAutomationBuilder"}},"/ai-build-workflow":{"post":{"tags":["AI & Agents"],"summary":"Deterministic day math.","description":"Deterministic day math. The model's day arithmetic is not reliable — the same prompt has produced 125, 90 and 75 day spans on consecutive runs — so the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-build-workflow","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiBuildWorkflow"}},"/ai-call-coaching":{"post":{"tags":["AI & Agents"],"summary":"Returns a 200 response with not_ready=true so the UI can render a friendly empty state instead of a generic \"non-2xx\" er","description":"Returns a 200 response with not_ready=true so the UI can render a friendly empty state instead of a generic \"non-2xx\" error toast. Used when the call\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-call-coaching","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiCallCoaching"}},"/ai-call-summary":{"post":{"tags":["AI & Agents"],"summary":"Ai Call Summary function.","description":"Ai Call Summary function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-call-summary","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiCallSummary"}},"/ai-campaign-insights":{"post":{"tags":["AI & Agents"],"summary":"AUTH + SPEND GUARD","description":"AUTH + SPEND GUARD\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-campaign-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiCampaignInsights"}},"/ai-campaign-reports-insights":{"post":{"tags":["AI & Agents"],"summary":"AUTH + SPEND GUARD","description":"AUTH + SPEND GUARD\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-campaign-reports-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiCampaignReportsInsights"}},"/ai-chat":{"post":{"tags":["AI & Agents"],"summary":"SECURITY: Dynamic CORS based on request origin - no more wildcard","description":"SECURITY: Dynamic CORS based on request origin - no more wildcard\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-chat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiChat"}},"/ai-chat-suggest-followups":{"post":{"tags":["AI & Agents"],"summary":"Ai Chat Suggest Followups function.","description":"Ai Chat Suggest Followups function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-chat-suggest-followups","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiChatSuggestFollowups"}},"/ai-commission-intelligence":{"post":{"tags":["AI & Agents"],"summary":"Rate limiting","description":"Rate limiting\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-commission-intelligence","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiCommissionIntelligence"}},"/ai-communication":{"post":{"tags":["AI & Agents"],"summary":"AUTHENTICATION - Mandatory","description":"AUTHENTICATION - Mandatory\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-communication","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiCommunication"}},"/ai-deep-research":{"post":{"tags":["AI & Agents"],"summary":"COMPREHENSIVE INSURANCE CARRIER KNOWLEDGE BASE v2","description":"COMPREHENSIVE INSURANCE CARRIER KNOWLEDGE BASE v2\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-deep-research","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiDeepResearch"}},"/ai-form-builder":{"post":{"tags":["AI & Agents"],"summary":"AI Form Builder — generates and iterates form field arrays from natural language.","description":"AI Form Builder — generates and iterates form field arrays from natural language. Uses Lovable AI gateway with structured tool-calling for reliable JSON output.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-form-builder","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiFormBuilder"}},"/ai-generate-content":{"post":{"tags":["AI & Agents"],"summary":"Validation schema","description":"Validation schema\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-generate-content","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiGenerateContent"}},"/ai-generate-image":{"post":{"tags":["AI & Agents"],"summary":"Select model based on quality","description":"Select model based on quality\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-generate-image","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiGenerateImage"}},"/ai-generate-note":{"post":{"tags":["AI & Agents"],"summary":"AUTHENTICATION - Mandatory","description":"AUTHENTICATION - Mandatory\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-generate-note","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiGenerateNote"}},"/ai-generate-pdf":{"post":{"tags":["AI & Agents"],"summary":"Ai Generate Pdf function.","description":"Ai Generate Pdf function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-generate-pdf","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiGeneratePdf"}},"/ai-generate-sheets":{"post":{"tags":["AI & Agents"],"summary":"Ai Generate Sheets function.","description":"Ai Generate Sheets function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-generate-sheets","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiGenerateSheets"}},"/ai-generate-slides":{"post":{"tags":["AI & Agents"],"summary":"Ai Generate Slides function.","description":"Ai Generate Slides function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-generate-slides","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiGenerateSlides"}},"/ai-generate-sms":{"post":{"tags":["AI & Agents"],"summary":"AUTHENTICATION - Mandatory","description":"AUTHENTICATION - Mandatory\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-generate-sms","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiGenerateSms"}},"/ai-insights":{"post":{"tags":["AI & Agents"],"summary":"Rate limiting","description":"Rate limiting\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiInsights"}},"/ai-lead-insights":{"post":{"tags":["AI & Agents"],"summary":"Get Supabase client","description":"Get Supabase client\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-lead-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiLeadInsights"}},"/ai-lead-score":{"post":{"tags":["AI & Agents"],"summary":"Deterministic lead scoring engine.","description":"Deterministic lead scoring engine. Uses subaccount scoring_settings weights + bonus factors (recency, completeness, source quality).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-lead-score","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiLeadScore"}},"/ai-map-csv-columns":{"post":{"tags":["AI & Agents"],"summary":"Which importer is asking.","description":"Which importer is asking. Drives the domain vocabulary in the system prompt. Defaults to \"contacts\" so existing callers are unaffected.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-map-csv-columns","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiMapCsvColumns"}},"/ai-market-briefing":{"post":{"tags":["AI & Agents"],"summary":"Ai Market Briefing function.","description":"Ai Market Briefing function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-market-briefing","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiMarketBriefing"}},"/ai-newsletter-generate":{"post":{"tags":["AI & Agents"],"summary":"Validate auth","description":"Validate auth\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-newsletter-generate","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiNewsletterGenerate"}},"/ai-pipeline-intelligence":{"post":{"tags":["AI & Agents"],"summary":"------- SSE helpers -------","description":"------- SSE helpers -------\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-pipeline-intelligence","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiPipelineIntelligence"}},"/ai-policy-intelligence":{"post":{"tags":["AI & Agents"],"summary":"Rate limiting","description":"Rate limiting\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-policy-intelligence","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiPolicyIntelligence"}},"/ai-predictive-insights":{"post":{"tags":["AI & Agents"],"summary":"Fetch last 90 days of call logs for this subaccount","description":"Fetch last 90 days of call logs for this subaccount\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-predictive-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiPredictiveInsights"}},"/ai-sms-reply":{"post":{"tags":["AI & Agents"],"summary":"AI SMS Auto-Reply Edge Function (v5 — Intelligence Upgrade) v5 improvements:","description":"AI SMS Auto-Reply Edge Function (v5 — Intelligence Upgrade) v5 improvements:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-sms-reply","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiSmsReply"}},"/ai-suggest-reply":{"post":{"tags":["AI & Agents"],"summary":"AUTHENTICATION - Mandatory","description":"AUTHENTICATION - Mandatory\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-suggest-reply","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiSuggestReply"}},"/ai-task-intelligence":{"post":{"tags":["AI & Agents"],"summary":"Rate limiting","description":"Rate limiting\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-task-intelligence","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiTaskIntelligence"}},"/ai-tool-drift-check":{"post":{"tags":["AI & Agents"],"summary":"Runs one check; a thrown check degrades to a single info finding.","description":"Runs one check; a thrown check degrades to a single info finding.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-tool-drift-check","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiToolDriftCheck"}},"/ai-transform-crm-text":{"post":{"tags":["AI & Agents"],"summary":"Ai Transform Crm Text function.","description":"Ai Transform Crm Text function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-transform-crm-text","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiTransformCrmText"}},"/ai-v2-status":{"post":{"tags":["AI & Agents"],"summary":"unLocked AI v2 — status endpoint.","description":"unLocked AI v2 — status endpoint. The side panel calls this (passing the currently SELECTED subaccount) to decide\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-v2-status","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiV2Status"}},"/ai-workflow-bundle":{"post":{"tags":["AI & Agents"],"summary":"Map a logical step \"tool\" to the edge function that executes it.","description":"Map a logical step \"tool\" to the edge function that executes it.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-workflow-bundle","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiWorkflowBundle"}},"/ai-write-bulk-email":{"post":{"tags":["AI & Agents"],"summary":"Edge function: ai-write-bulk-email Generates a Subject + HTML body for a bulk email using Lovable AI","description":"Edge function: ai-write-bulk-email Generates a Subject + HTML body for a bulk email using Lovable AI\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-write-bulk-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiWriteBulkEmail"}},"/ai-write-bulk-sms":{"post":{"tags":["AI & Agents"],"summary":"Edge function: ai-write-bulk-sms Generates a single SMS message body using Lovable AI, scoped to the","description":"Edge function: ai-write-bulk-sms Generates a single SMS message body using Lovable AI, scoped to the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ai-write-bulk-sms","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAiWriteBulkSms"}},"/analyze-policy":{"post":{"tags":["Core CRM"],"summary":"===== SCANNED PDF / OCR DETECTION ===== Detect if a PDF is scanned (image-based) vs native (text-based)","description":"===== SCANNED PDF / OCR DETECTION ===== Detect if a PDF is scanned (image-based) vs native (text-based)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"analyze-policy","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAnalyzePolicy"}},"/apply-invoice-coupon":{"post":{"tags":["Core CRM"],"summary":"Apply Invoice Coupon function.","description":"Apply Invoice Coupon function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"apply-invoice-coupon","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postApplyInvoiceCoupon"}},"/archive-audit-logs":{"post":{"tags":["Core CRM"],"summary":"Archive Audit Logs Edge Function PURPOSE:","description":"Archive Audit Logs Edge Function PURPOSE:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"archive-audit-logs","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postArchiveAuditLogs"}},"/at-risk-trial-alert":{"post":{"tags":["Core CRM"],"summary":"Fetch all trialing subscriptions","description":"Fetch all trialing subscriptions\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"at-risk-trial-alert","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAtRiskTrialAlert"}},"/atlas-search":{"post":{"tags":["Core CRM"],"summary":"State abbreviation mapping","description":"State abbreviation mapping\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"atlas-search","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postAtlasSearch"}},"/backfill-onboarding-pdfs":{"post":{"tags":["Core CRM"],"summary":"One-shot backfill: re-sends the onboarding PDF email for users who completed onboarding in the last N days but whose adm","description":"One-shot backfill: re-sends the onboarding PDF email for users who completed onboarding in the last N days but whose admin notification never went out\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"backfill-onboarding-pdfs","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBackfillOnboardingPdfs"}},"/backfill-script-standard":{"post":{"tags":["Core CRM"],"summary":"backfill-script-standard Re-runnable sweep that brings agent_ai_scripts rows into full compliance with the","description":"backfill-script-standard Re-runnable sweep that brings agent_ai_scripts rows into full compliance with the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"backfill-script-standard","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBackfillScriptStandard"}},"/backfill-wallet-payment-methods":{"post":{"tags":["Core CRM"],"summary":"BACKFILL: Populate credit_wallets.default_payment_method_id from Stripe One-time admin script.","description":"BACKFILL: Populate credit_wallets.default_payment_method_id from Stripe One-time admin script. NOT scheduled. NOT invoked automatically.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"backfill-wallet-payment-methods","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBackfillWalletPaymentMethods"}},"/build-compile":{"post":{"tags":["Core CRM"],"summary":"build-compile — Build v2 sandboxed code-gen pipeline.","description":"build-compile — Build v2 sandboxed code-gen pipeline. POST { source: string }\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-compile","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildCompile"}},"/build-edit-widget":{"post":{"tags":["Core CRM"],"summary":"build-edit-widget Targeted, single-widget AI editing.","description":"build-edit-widget Targeted, single-widget AI editing.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-edit-widget","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildEditWidget"}},"/build-entity-write":{"post":{"tags":["Core CRM"],"summary":"Entities that are READ-ONLY through the Build write surface.","description":"Entities that are READ-ONLY through the Build write surface. Reads still work via CRM.query / entity_table widgets; writes are blocked because they have\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-entity-write","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildEntityWrite"}},"/build-generate":{"post":{"tags":["Core CRM"],"summary":"Generatable widget types (the AI tool-schema enum).","description":"Generatable widget types (the AI tool-schema enum). EDGE-FN copy — MUST stay in sync with ALLOWED_WIDGET_TYPES in src/lib/builderValidation.ts. Locked by widgetTypeSync.test.ts.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-generate","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildGenerate"}},"/build-generate-code":{"post":{"tags":["Core CRM"],"summary":"build-generate-code — Build v2 generator (TSX + sandbox).","description":"build-generate-code — Build v2 generator (TSX + sandbox). POST {\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-generate-code","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildGenerateCode"}},"/build-page-event":{"post":{"tags":["Core CRM"],"summary":"build-page-event — Phase 4 dispatcher Single entrypoint for Page Automations.","description":"build-page-event — Phase 4 dispatcher Single entrypoint for Page Automations. Looks up matching automations for a\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-page-event","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildPageEvent"}},"/build-rollback":{"post":{"tags":["Core CRM"],"summary":"build-rollback — restore a previously applied Build AI artifact.","description":"build-rollback — restore a previously applied Build AI artifact. Permission model:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-rollback","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildRollback"}},"/build-safe-query":{"post":{"tags":["Core CRM"],"summary":"AI Safe Query Builder Translates natural-language analytics questions into safe, parameterized","description":"AI Safe Query Builder Translates natural-language analytics questions into safe, parameterized\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-safe-query","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildSafeQuery"}},"/build-suggest-binding":{"post":{"tags":["Core CRM"],"summary":"build-suggest-binding AI-assisted data binding for the Build module.","description":"build-suggest-binding AI-assisted data binding for the Build module.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-suggest-binding","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildSuggestBinding"}},"/build-website-generate":{"post":{"tags":["Core CRM"],"summary":"build-website-generate — AI generator for PUBLIC insurance marketing sites & landing pages.","description":"build-website-generate — AI generator for PUBLIC insurance marketing sites & landing pages. Deliberately isolated from build-generate (the CRM dashboard generator): a marketing\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"build-website-generate","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postBuildWebsiteGenerate"}},"/calendar-cron-sync":{"post":{"tags":["Calendar & Booking"],"summary":"Server-side cron sync for calendar events Runs every 5 minutes as a fallback safety net","description":"Server-side cron sync for calendar events Runs every 5 minutes as a fallback safety net\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"calendar-cron-sync","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCalendarCronSync"}},"/calendly-backfill":{"post":{"tags":["Integrations & Webhooks"],"summary":"One-time importer: pulls the caller's existing Calendly meetings (past N months plus everything upcoming) into the appoi","description":"One-time importer: pulls the caller's existing Calendly meetings (past N months plus everything upcoming) into the appointments table. Safe to re-run: events\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"calendly-backfill","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCalendlyBackfill"}},"/calendly-event-types":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get ALL Calendly connections for the subaccount (not just current user)","description":"Get ALL Calendly connections for the subaccount (not just current user)\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"calendly-event-types","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCalendlyEventTypes"}},"/calendly-poll-sync":{"post":{"tags":["Integrations & Webhooks"],"summary":"Scheduled Calendly sync for connections that have no webhook.","description":"Scheduled Calendly sync for connections that have no webhook. Calendly gates webhook subscriptions behind its Standard/Teams/Enterprise plans, so\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"calendly-poll-sync","x-cron-triggered":true,"x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCalendlyPollSync"}},"/calendly-subscribe-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get Calendly connection","description":"Get Calendly connection\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"calendly-subscribe-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCalendlySubscribeWebhook"}},"/calendly-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Verify Calendly webhook signature using HMAC SHA-256","description":"Verify Calendly webhook signature using HMAC SHA-256\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"calendly-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCalendlyWebhook"}},"/campaign-availability":{"post":{"tags":["Core CRM"],"summary":"Auth via API key","description":"Auth via API key\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"campaign-availability","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCampaignAvailability"}},"/campaign-lead-ping":{"post":{"tags":["Core CRM"],"summary":"Auth via API key","description":"Auth via API key\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"campaign-lead-ping","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCampaignLeadPing"}},"/capability-nav-report":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"unLocked AI v2 — navigation snapshot intake.","description":"unLocked AI v2 — navigation snapshot intake. The frontend POSTs its current navigation tree here. We authenticate the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"capability-nav-report","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCapabilityNavReport"}},"/capability-scan":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"unLocked AI v2 — Capability Scan edge function.","description":"unLocked AI v2 — Capability Scan edge function. Thin HTTP wrapper around runFullScan(). Invoked by the Phase 3 pg_cron job\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"capability-scan","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCapabilityScan"}},"/capability-search":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"unLocked AI v2 — Capability Search (test harness).","description":"unLocked AI v2 — Capability Search (test harness). Standalone endpoint to verify the Phase 4 retrieval layer against the live\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"capability-search","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCapabilitySearch"}},"/check-secrets":{"post":{"tags":["Core CRM"],"summary":"List of all secrets we want to check","description":"List of all secrets we want to check\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"check-secrets","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCheckSecrets"}},"/check-stale-leads-sla":{"post":{"tags":["Core CRM"],"summary":"Scheduled edge function (weekly cron) that: #51 — Sends stale lead digest (leads with no activity 14+ days, status ≠ Won","description":"Scheduled edge function (weekly cron) that: #51 — Sends stale lead digest (leads with no activity 14+ days, status ≠ Won/Lost)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"check-stale-leads-sla","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCheckStaleLeadsSla"}},"/check-stale-tickets":{"post":{"tags":["Core CRM"],"summary":"Auth: cron secret","description":"Auth: cron secret\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"check-stale-tickets","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCheckStaleTickets"}},"/check-subscription":{"post":{"tags":["Billing & Payments"],"summary":"Safely convert Stripe's current_period_end (unix seconds or already a Date/string) to ISO string","description":"Safely convert Stripe's current_period_end (unix seconds or already a Date/string) to ISO string\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"check-subscription","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCheckSubscription"}},"/check-tasks-appointments":{"post":{"tags":["Core CRM"],"summary":"Scheduled edge function that handles: #53 — Tasks due today (morning digest, in-app + email)","description":"Scheduled edge function that handles: #53 — Tasks due today (morning digest, in-app + email)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"check-tasks-appointments","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCheckTasksAppointments"}},"/check-whitelabel-dns":{"post":{"tags":["Core CRM"],"summary":"Verifies DNS for a self-serve white-label custom domain.","description":"Verifies DNS for a self-serve white-label custom domain. Checks that both the root domain and its `www` variant resolve\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"check-whitelabel-dns","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCheckWhitelabelDns"}},"/claim-team-seat":{"post":{"tags":["Core CRM"],"summary":"Context: docs/source-of-truth/TEAM_INVITES_SOURCE_OF_TRUTH.md §15 (and §14 for the release side, which is unchanged here","description":"Context: docs/source-of-truth/TEAM_INVITES_SOURCE_OF_TRUTH.md §15 (and §14 for the release side, which is unchanged here).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"claim-team-seat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postClaimTeamSeat"}},"/cms-evaluate-eligibility":{"post":{"tags":["Core CRM"],"summary":"IEP starts 3 months before 65th birthday month","description":"IEP starts 3 months before 65th birthday month\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"cms-evaluate-eligibility","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCmsEvaluateEligibility"}},"/commission-plus-activate":{"post":{"tags":["Billing & Payments"],"summary":"Commission Plus Activate function.","description":"Commission Plus Activate function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"commission-plus-activate","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCommissionPlusActivate"}},"/complete-agent-payment-setup":{"post":{"tags":["Core CRM"],"summary":"Try JWT auth first (works for both paths)","description":"Try JWT auth first (works for both paths)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"complete-agent-payment-setup","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCompleteAgentPaymentSetup"}},"/compulife-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"compulife-quote — Life insurance quoting via Compulife AWS proxy REQUIRED SUPABASE SECRETS (set in Dashboard → Settings ","description":"compulife-quote — Life insurance quoting via Compulife AWS proxy REQUIRED SUPABASE SECRETS (set in Dashboard → Settings → Edge Functions):\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"compulife-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCompulifeQuote"}},"/compute-health-scores":{"post":{"tags":["Core CRM"],"summary":"Fetch all subaccounts","description":"Fetch all subaccounts\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"compute-health-scores","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postComputeHealthScores"}},"/comtrack-auto-sync":{"post":{"tags":["Integrations & Webhooks"],"summary":"Commission+ Auto-Sync — scheduled background function Iterates through all active Commission+ connections with auto_sync","description":"Commission+ Auto-Sync — scheduled background function Iterates through all active Commission+ connections with auto_sync_enabled = true\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"comtrack-auto-sync","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postComtrackAutoSync"}},"/comtrack-sync":{"post":{"tags":["Integrations & Webhooks"],"summary":"Commission+ reference endpoint.","description":"Commission+ reference endpoint. Both values were wrong and both were verified by direct request (2026-08-17):\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"comtrack-sync","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postComtrackSync"}},"/comtrack-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Commission+ Inbound Webhook Receives push updates from Commission+ when:","description":"Commission+ Inbound Webhook Receives push updates from Commission+ when:\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"comtrack-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postComtrackWebhook"}},"/connect-icloud-calendar":{"post":{"tags":["Core CRM"],"summary":"Validate inputs","description":"Validate inputs\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"connect-icloud-calendar","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postConnectIcloudCalendar"}},"/contact-intelligence":{"post":{"tags":["Core CRM"],"summary":"Verify user authentication","description":"Verify user authentication\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"contact-intelligence","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postContactIntelligence"}},"/create-checkout":{"post":{"tags":["Billing & Payments"],"summary":"Server-side validation: only allow known Stripe price IDs","description":"Server-side validation: only allow known Stripe price IDs\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"create-checkout","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCreateCheckout"}},"/create-data-checkout":{"post":{"tags":["Core CRM"],"summary":"Licensed Agent Data product price IDs","description":"Licensed Agent Data product price IDs\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"create-data-checkout","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCreateDataCheckout"}},"/create-mailgun-inbound-route":{"post":{"tags":["Core CRM"],"summary":"Handle CORS preflight","description":"Handle CORS preflight\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"create-mailgun-inbound-route","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCreateMailgunInboundRoute"}},"/create-notification":{"post":{"tags":["Core CRM"],"summary":"Rate limiting","description":"Rate limiting\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"create-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCreateNotification"}},"/create-portal-session":{"post":{"tags":["Core CRM"],"summary":"Find the user's Stripe customer ID","description":"Find the user's Stripe customer ID\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"create-portal-session","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCreatePortalSession"}},"/create-team-user":{"post":{"tags":["Core CRM"],"summary":"Create Team User Edge Function SECURITY: Admin-only endpoint with restricted CORS","description":"Create Team User Edge Function SECURITY: Admin-only endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"create-team-user","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCreateTeamUser"}},"/create-tiktok-review-user":{"post":{"tags":["Core CRM"],"summary":"Create TikTok Review User - Admin-only endpoint SECURITY: This function requires admin authentication and reads","description":"Create TikTok Review User - Admin-only endpoint SECURITY: This function requires admin authentication and reads\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"create-tiktok-review-user","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCreateTiktokReviewUser"}},"/csg-dvh-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"New API parameters","description":"New API parameters\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"csg-dvh-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCsgDvhQuote"}},"/csg-eapp":{"post":{"tags":["Quoting & Enrollment"],"summary":"CSG E-App — enrollment application management.","description":"CSG E-App — enrollment application management. Docs: https://enrollmentplatform.docs.apiary.io/ (see docs/csg-eapp/SCOPING.md)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"csg-eapp","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCsgEapp"}},"/csg-eapp-probe":{"post":{"tags":["Quoting & Enrollment"],"summary":"CSG E-App access probe — uses documented header (x-api-token) and endpoints per https://enrollmentplatform.docs.apiary.i","description":"CSG E-App access probe — uses documented header (x-api-token) and endpoints per https://enrollmentplatform.docs.apiary.io/\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"csg-eapp-probe","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCsgEappProbe"}},"/csg-eapp-sync":{"post":{"tags":["Quoting & Enrollment"],"summary":"Derive our status string from CSG's boolean flags (most-advanced wins).","description":"Derive our status string from CSG's boolean flags (most-advanced wins).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"csg-eapp-sync","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCsgEappSync"}},"/csg-hi-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"In-memory fallback for same instance; primary cache is in csg_token_cache table.","description":"In-memory fallback for same instance; primary cache is in csg_token_cache table.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"csg-hi-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCsgHiQuote"}},"/csg-ma-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"Drugs the client is taking — passed to CSG as rxcui[] so per-plan tier copays populate.","description":"Drugs the client is taking — passed to CSG as rxcui[] so per-plan tier copays populate. CSG returns concrete dollar copays for each of the 5 standard Part D tiers per plan\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"csg-ma-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCsgMaQuote"}},"/csg-medigap-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"Service-role callers only: the tenant whose rate-limit budget this call spends.","description":"Service-role callers only: the tenant whose rate-limit budget this call spends.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"csg-medigap-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postCsgMedigapQuote"}},"/daily-no-call-digest":{"post":{"tags":["Core CRM"],"summary":"onboarding progress","description":"onboarding progress\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"daily-no-call-digest","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDailyNoCallDigest"}},"/data-proxy":{"post":{"tags":["Core CRM"],"summary":"Initialize Supabase URL and anon key","description":"Initialize Supabase URL and anon key\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"data-proxy","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDataProxy"}},"/decay-memories":{"post":{"tags":["Core CRM"],"summary":"Memory Decay Logic Reduces the relevance_weight of memories over time based on:","description":"Memory Decay Logic Reduces the relevance_weight of memories over time based on:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"decay-memories","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDecayMemories"}},"/deduct-wallet":{"post":{"tags":["Billing & Payments"],"summary":"Context: docs/source-of-truth/BILLING_WALLET_SOURCE_OF_TRUTH.md","description":"Context: docs/source-of-truth/BILLING_WALLET_SOURCE_OF_TRUTH.md\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"deduct-wallet","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDeductWallet"}},"/delete-appointment":{"post":{"tags":["Core CRM"],"summary":"===== Google helpers =====","description":"===== Google helpers =====\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"delete-appointment","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDeleteAppointment"}},"/delete-conversation":{"post":{"tags":["Core CRM"],"summary":"Authorized, complete deletion of a conversation (thread) from the Inbox.","description":"Authorized, complete deletion of a conversation (thread) from the Inbox. The client-side delete could only remove interaction rows the caller personally\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"delete-conversation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDeleteConversation"}},"/delete-secret":{"post":{"tags":["Core CRM"],"summary":"Get environment variables once at the start","description":"Get environment variables once at the start\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"delete-secret","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDeleteSecret"}},"/delete-team-user":{"post":{"tags":["Core CRM"],"summary":"Delete Team User Edge Function SECURITY: Admin-only endpoint with restricted CORS","description":"Delete Team User Edge Function SECURITY: Admin-only endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"delete-team-user","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDeleteTeamUser"}},"/diag-el-audit":{"post":{"tags":["Core CRM"],"summary":"Diag El Audit function.","description":"Diag El Audit function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"diag-el-audit","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDiagElAudit"}},"/diag-elevenlabs-pilot":{"post":{"tags":["Core CRM"],"summary":"Diag Elevenlabs Pilot function.","description":"Diag Elevenlabs Pilot function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"diag-elevenlabs-pilot","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDiagElevenlabsPilot"}},"/diag-inbound-routing":{"post":{"tags":["Core CRM"],"summary":"diag-inbound-routing — RETIRED.","description":"diag-inbound-routing — RETIRED. Returns 410 Gone. Was a read-only diagnostic for the 2026-08-18 inbound-routing incident on\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"diag-inbound-routing","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDiagInboundRouting"}},"/diag-incident-1258":{"post":{"tags":["Core CRM"],"summary":"READ-ONLY incident diagnostic for the 12:58Z regression on +15717123991 / phnum_9901.","description":"READ-ONLY incident diagnostic for the 12:58Z regression on +15717123991 / phnum_9901. Calls EL GET /v1/convai/phone-numbers/{id} and Twilio GET /IncomingPhoneNumbers/{sid}.json.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"diag-incident-1258","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDiagIncident1258"},"get":{"tags":["Core CRM"],"summary":"READ-ONLY incident diagnostic for the 12:58Z regression on +15717123991 / phnum_9901.","description":"READ-ONLY incident diagnostic for the 12:58Z regression on +15717123991 / phnum_9901. Calls EL GET /v1/convai/phone-numbers/{id} and Twilio GET /IncomingPhoneNumbers/{sid}.json.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"diag-incident-1258","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getDiagIncident1258"}},"/diag-meta-page-discovery":{"post":{"tags":["Core CRM"],"summary":"READ-ONLY diagnostic for Ticket-655 — \"only one Facebook Page appears under Available Pages\".","description":"READ-ONLY diagnostic for Ticket-655 — \"only one Facebook Page appears under Available Pages\". Answers, from Facebook itself rather than from our stored copy, WHY a Page is missing.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"diag-meta-page-discovery","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDiagMetaPageDiscovery"}},"/disconnect-nipr":{"post":{"tags":["Core CRM"],"summary":"Verify the user has access to this subaccount","description":"Verify the user has access to this subaccount\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"disconnect-nipr","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDisconnectNipr"}},"/domains-provision":{"post":{"tags":["Core CRM"],"summary":"domains-provision (authenticated) — connect a custom domain to a website.","description":"domains-provision (authenticated) — connect a custom domain to a website. Validates the caller owns the website, asks Cloudflare (or the stub adapter) to create a\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"domains-provision","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDomainsProvision"}},"/domains-verify":{"post":{"tags":["Core CRM"],"summary":"domains-verify (authenticated) — re-check a custom domain's DNS/SSL status with Cloudflare and update the `domains` row.","description":"domains-verify (authenticated) — re-check a custom domain's DNS/SSL status with Cloudflare and update the `domains` row. When status becomes \"active\", render-website will serve it.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"domains-verify","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDomainsVerify"}},"/downline-ai-insights":{"post":{"tags":["Core CRM"],"summary":"Downline Ai Insights function.","description":"Downline Ai Insights function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"downline-ai-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDownlineAiInsights"}},"/drug-intake-chat":{"post":{"tags":["Core CRM"],"summary":"Conversational AI Drug Intake Walks through medication capture via Q&A, asking follow-ups for dosage/frequency,","description":"Conversational AI Drug Intake Walks through medication capture via Q&A, asking follow-ups for dosage/frequency,\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"drug-intake-chat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDrugIntakeChat"}},"/dvh-plan-explain":{"post":{"tags":["Quoting & Enrollment"],"summary":"Dvh Plan Explain function.","description":"Dvh Plan Explain function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"dvh-plan-explain","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDvhPlanExplain"}},"/dvh-quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"Dvh Quote Ai function.","description":"Dvh Quote Ai function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"dvh-quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postDvhQuoteAi"}},"/el-pilot-diag":{"post":{"tags":["Core CRM"],"summary":"Temporary read-only diagnostic for EL pilot env + EL dashboard pull.","description":"Temporary read-only diagnostic for EL pilot env + EL dashboard pull. No secrets are echoed. Returns presence/length/last4 only.\n\n**Auth:** Server-to-server: shared secret in X-Tool-Secret header.","security":[{"ToolSecretAuth":[]}],"x-internal":true,"x-function-name":"el-pilot-diag","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postElPilotDiag"}},"/elevenlabs-audio-isolation":{"post":{"tags":["Core CRM"],"summary":"ElevenLabs Audio Isolation Edge Function Cleans noisy call recordings by isolating speech from background noise.","description":"ElevenLabs Audio Isolation Edge Function Cleans noisy call recordings by isolating speech from background noise.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"elevenlabs-audio-isolation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postElevenlabsAudioIsolation"}},"/elevenlabs-dubbing":{"post":{"tags":["Core CRM"],"summary":"ElevenLabs Dubbing / Multi-language Edge Function Auto-translates agent AI scripts into other languages while preserving","description":"ElevenLabs Dubbing / Multi-language Edge Function Auto-translates agent AI scripts into other languages while preserving\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"elevenlabs-dubbing","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postElevenlabsDubbing"}},"/elevenlabs-tts":{"post":{"tags":["Core CRM"],"summary":"Default to turbo v2.5 for speed (power dialer greetings, live scenarios) Use multilingual only when explicitly requested","description":"Default to turbo v2.5 for speed (power dialer greetings, live scenarios) Use multilingual only when explicitly requested for quality\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"elevenlabs-tts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postElevenlabsTts"}},"/embed-email-calendar":{"post":{"tags":["Core CRM"],"summary":"deno-lint-ignore-file no-explicit-any Background worker: generates 768-dim embeddings for emails + appointments","description":"deno-lint-ignore-file no-explicit-any Background worker: generates 768-dim embeddings for emails + appointments\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"embed-email-calendar","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postEmbedEmailCalendar"}},"/embed-knowledge":{"post":{"tags":["Core CRM"],"summary":"===== IMPROVED CHUNKING: Section-aware with better overlap =====","description":"===== IMPROVED CHUNKING: Section-aware with better overlap =====\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"embed-knowledge","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postEmbedKnowledge"}},"/end-impersonation":{"post":{"tags":["Core CRM"],"summary":"End Impersonation Edge Function SECURITY: Authenticated endpoint with restricted CORS","description":"End Impersonation Edge Function SECURITY: Authenticated endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"end-impersonation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postEndImpersonation"}},"/enroll-campaign-contacts":{"post":{"tags":["Core CRM"],"summary":"Get user from auth header","description":"Get user from auth header\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"enroll-campaign-contacts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postEnrollCampaignContacts"}},"/execute-math-operation":{"post":{"tags":["Core CRM"],"summary":"Get the contact to retrieve current field value","description":"Get the contact to retrieve current field value\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"execute-math-operation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postExecuteMathOperation"}},"/extract-insurance-dictation":{"post":{"tags":["Core CRM"],"summary":"Extract Insurance Dictation function.","description":"Extract Insurance Dictation function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"extract-insurance-dictation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postExtractInsuranceDictation"}},"/extract-memories":{"post":{"tags":["Core CRM"],"summary":"Call Lovable AI for extraction","description":"Call Lovable AI for extraction\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"extract-memories","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postExtractMemories"}},"/facebook-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"⚠️ DEPRECATED — DO NOT USE This is the legacy single-tenant Facebook webhook handler.","description":"⚠️ DEPRECATED — DO NOT USE This is the legacy single-tenant Facebook webhook handler.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"facebook-webhook","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postFacebookWebhook"},"get":{"tags":["Integrations & Webhooks"],"summary":"⚠️ DEPRECATED — DO NOT USE This is the legacy single-tenant Facebook webhook handler.","description":"⚠️ DEPRECATED — DO NOT USE This is the legacy single-tenant Facebook webhook handler.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"facebook-webhook","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getFacebookWebhook"}},"/family-tree-insights":{"post":{"tags":["Core CRM"],"summary":"Family Tree Insights function.","description":"Family Tree Insights function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"family-tree-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postFamilyTreeInsights"}},"/fetch-nipr-entity":{"post":{"tags":["Core CRM"],"summary":"─── Retry wrapper ────────────────────────────────────────────────────────────","description":"─── Retry wrapper ────────────────────────────────────────────────────────────\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"fetch-nipr-entity","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postFetchNiprEntity"}},"/fetch-twilio-full-recording":{"post":{"tags":["Core CRM"],"summary":"fetch-twilio-full-recording Stage 2.10 background sweep.","description":"fetch-twilio-full-recording Stage 2.10 background sweep. For each `agent_ai_call_logs` row queued with\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"fetch-twilio-full-recording","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postFetchTwilioFullRecording"}},"/fetch-twilio-recording":{"post":{"tags":["Core CRM"],"summary":"Fetch Twilio Recording function.","description":"Fetch Twilio Recording function.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"fetch-twilio-recording","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postFetchTwilioRecording"},"get":{"tags":["Core CRM"],"summary":"Fetch Twilio Recording function.","description":"Fetch Twilio Recording function.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"fetch-twilio-recording","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getFetchTwilioRecording"}},"/fraud-monitor":{"post":{"tags":["Core CRM"],"summary":"Fraud monitor: scans recent signup_attempts and fires Slack alerts on suspicious activity.","description":"Fraud monitor: scans recent signup_attempts and fires Slack alerts on suspicious activity. Designed to be called every 2 minutes by a cron / scheduler. Requires CRON_SECRET header.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"fraud-monitor","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postFraudMonitor"}},"/generate-admin-update":{"post":{"tags":["Core CRM"],"summary":"Generate Admin Update function.","description":"Generate Admin Update function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-admin-update","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateAdminUpdate"}},"/generate-call-identity-vcf":{"post":{"tags":["Core CRM"],"summary":"Generate Call Identity Vcf function.","description":"Generate Call Identity Vcf function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-call-identity-vcf","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateCallIdentityVcf"}},"/generate-call-summary":{"post":{"tags":["Core CRM"],"summary":"Look up call context (direction, agent, contact) BEFORE the AI call so the model never inverts agent vs.","description":"Look up call context (direction, agent, contact) BEFORE the AI call so the model never inverts agent vs. contact roles. This mirrors the same fix\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-call-summary","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateCallSummary"}},"/generate-commission-insights":{"post":{"tags":["Core CRM"],"summary":"Generate Commission Insights function.","description":"Generate Commission Insights function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-commission-insights","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateCommissionInsights"}},"/generate-ics-invite":{"post":{"tags":["Core CRM"],"summary":"Format date to ICS format: YYYYMMDDTHHMMSSZ","description":"Format date to ICS format: YYYYMMDDTHHMMSSZ\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-ics-invite","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateIcsInvite"}},"/generate-onboarding-checklist":{"post":{"tags":["Core CRM"],"summary":"Canonical feature catalog — the AI may ONLY select from these category: \"ready\" = auto-activated, \"assisted\" = team will","description":"Canonical feature catalog — the AI may ONLY select from these category: \"ready\" = auto-activated, \"assisted\" = team will help\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-onboarding-checklist","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateOnboardingChecklist"}},"/generate-retirement-pdf":{"post":{"tags":["Core CRM"],"summary":"Generate Retirement Pdf function.","description":"Generate Retirement Pdf function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-retirement-pdf","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateRetirementPdf"}},"/generate-soa-pdf":{"post":{"tags":["Core CRM"],"summary":"Generate Soa Pdf function.","description":"Generate Soa Pdf function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"generate-soa-pdf","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGenerateSoaPdf"}},"/get-call-transcript":{"post":{"tags":["Core CRM"],"summary":"Returns the transcript for a call_recording or agent_ai_call_log.","description":"Returns the transcript for a call_recording or agent_ai_call_log. If transcript is missing but a recording_url exists, performs on-demand\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"get-call-transcript","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGetCallTranscript"}},"/get-campaign-stats":{"post":{"tags":["Core CRM"],"summary":"Use user JWT to respect RLS","description":"Use user JWT to respect RLS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"get-campaign-stats","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGetCampaignStats"}},"/get-downline-data":{"post":{"tags":["Core CRM"],"summary":"Validate user","description":"Validate user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"get-downline-data","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGetDownlineData"}},"/get-meeting-credentials":{"post":{"tags":["Core CRM"],"summary":"supabase/functions/get-meeting-credentials/index.ts SECURITY: Returns Zoom meeting credentials (join URL, start URL, pas","description":"supabase/functions/get-meeting-credentials/index.ts SECURITY: Returns Zoom meeting credentials (join URL, start URL, password,\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"get-meeting-credentials","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGetMeetingCredentials"}},"/get-owner-plan-info":{"post":{"tags":["Core CRM"],"summary":"Get Owner Plan Info function.","description":"Get Owner Plan Info function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"get-owner-plan-info","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGetOwnerPlanInfo"}},"/get-stripe-publishable-key":{"post":{"tags":["Core CRM"],"summary":"Get Stripe Publishable Key function.","description":"Get Stripe Publishable Key function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"get-stripe-publishable-key","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGetStripePublishableKey"}},"/get-wallet":{"post":{"tags":["Core CRM"],"summary":"Recharge tiers for smart adjustment","description":"Recharge tiers for smart adjustment\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"get-wallet","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGetWallet"}},"/ghl-import-manager":{"post":{"tags":["Integrations & Webhooks"],"summary":"Ghl Import Manager function.","description":"Ghl Import Manager function.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"ghl-import-manager","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGhlImportManager"}},"/ghl-import-resume":{"post":{"tags":["Integrations & Webhooks"],"summary":"Cron job: runs every 2 minutes to resume stalled/queued GHL import chunks.","description":"Cron job: runs every 2 minutes to resume stalled/queued GHL import chunks.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"ghl-import-resume","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGhlImportResume"}},"/ghl-import-worker":{"post":{"tags":["Integrations & Webhooks"],"summary":"─── Auth: Only allow service-to-service calls ───","description":"─── Auth: Only allow service-to-service calls ───\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"ghl-import-worker","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGhlImportWorker"}},"/gmail-send-email":{"post":{"tags":["Email & Notifications"],"summary":"ENFORCEMENT: Check DND status before sending email","description":"ENFORCEMENT: Check DND status before sending email\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"gmail-send-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGmailSendEmail"}},"/gmail-sync":{"post":{"tags":["Email & Notifications"],"summary":"trigger-workflow requires a valid userId.","description":"trigger-workflow requires a valid userId. Subaccount-scoped email_accounts rows can have a null user_id, so we validate before firing the customer_replied bridge.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"gmail-sync","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGmailSync"}},"/google-ads-attach-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Google Ads Attach Webhook function.","description":"Google Ads Attach Webhook function.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"google-ads-attach-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleAdsAttachWebhook"}},"/google-ads-lead-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Constant-time key comparison to prevent timing attacks","description":"Constant-time key comparison to prevent timing attacks\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"google-ads-lead-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleAdsLeadWebhook"}},"/google-ads-list-accounts":{"post":{"tags":["Integrations & Webhooks"],"summary":"Google Ads List Accounts function.","description":"Google Ads List Accounts function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-ads-list-accounts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleAdsListAccounts"}},"/google-ads-list-lead-forms":{"post":{"tags":["Integrations & Webhooks"],"summary":"CRM webhook URL substring used to detect \"our\" webhook on a lead form","description":"CRM webhook URL substring used to detect \"our\" webhook on a lead form\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-ads-list-lead-forms","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleAdsListLeadForms"}},"/google-ads-save-account":{"post":{"tags":["Integrations & Webhooks"],"summary":"Google Ads Save Account function.","description":"Google Ads Save Account function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-ads-save-account","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleAdsSaveAccount"}},"/google-calendar-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Token refresh helper","description":"Token refresh helper\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"google-calendar-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleCalendarWebhook"},"get":{"tags":["Integrations & Webhooks"],"summary":"Token refresh helper","description":"Token refresh helper\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"google-calendar-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getGoogleCalendarWebhook"}},"/google-list-calendars":{"post":{"tags":["Integrations & Webhooks"],"summary":"Parse body to get subaccountId","description":"Parse body to get subaccountId\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-list-calendars","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleListCalendars"}},"/google-meet-create":{"post":{"tags":["Integrations & Webhooks"],"summary":"Refresh Google access token","description":"Refresh Google access token\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-meet-create","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleMeetCreate"}},"/google-renew-subscriptions":{"post":{"tags":["Integrations & Webhooks"],"summary":"Renews Google Calendar push notification subscriptions before they expire Should run daily via cron to ensure continuous","description":"Renews Google Calendar push notification subscriptions before they expire Should run daily via cron to ensure continuous real-time sync\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-renew-subscriptions","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleRenewSubscriptions"}},"/google-save-calendar-selection":{"post":{"tags":["Integrations & Webhooks"],"summary":"Upsert calendar selections - first delete existing for this user/provider/subaccount, then insert This handles the subac","description":"Upsert calendar selections - first delete existing for this user/provider/subaccount, then insert This handles the subaccount_id in the unique constraint properly\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-save-calendar-selection","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSaveCalendarSelection"}},"/google-sheets-action":{"post":{"tags":["Integrations & Webhooks"],"summary":"Column mappings for create/update","description":"Column mappings for create/update\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-sheets-action","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSheetsAction"}},"/google-sheets-get-headers":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get first row (headers) from the worksheet","description":"Get first row (headers) from the worksheet\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-sheets-get-headers","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSheetsGetHeaders"}},"/google-sheets-list-drives":{"post":{"tags":["Integrations & Webhooks"],"summary":"Check if token is expired","description":"Check if token is expired\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-sheets-list-drives","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSheetsListDrives"}},"/google-sheets-list-spreadsheets":{"post":{"tags":["Integrations & Webhooks"],"summary":"List Google Sheets in the specified drive","description":"List Google Sheets in the specified drive\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-sheets-list-spreadsheets","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSheetsListSpreadsheets"}},"/google-sheets-list-worksheets":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get spreadsheet metadata including worksheets","description":"Get spreadsheet metadata including worksheets\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-sheets-list-worksheets","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSheetsListWorksheets"}},"/google-sheets-oauth-callback":{"post":{"tags":["Integrations & Webhooks"],"summary":"Verify HMAC signature on state","description":"Verify HMAC signature on state\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-sheets-oauth-callback","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSheetsOauthCallback"}},"/google-sheets-oauth-init":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get authenticated user","description":"Get authenticated user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-sheets-oauth-init","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSheetsOauthInit"}},"/google-subscribe-calendar":{"post":{"tags":["Integrations & Webhooks"],"summary":"Token refresh helper","description":"Token refresh helper\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"google-subscribe-calendar","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGoogleSubscribeCalendar"}},"/grant-trial-bonus-day":{"post":{"tags":["Core CRM"],"summary":"Daily cron: extend Stripe trial by 1 day for users whose AI took a real action yesterday, up to 7 bonus days.","description":"Daily cron: extend Stripe trial by 1 day for users whose AI took a real action yesterday, up to 7 bonus days. Triggered by pg_cron at 03:00 UTC.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"grant-trial-bonus-day","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postGrantTrialBonusDay"}},"/healthsherpa-push":{"post":{"tags":["Integrations & Webhooks"],"summary":"HealthSherpa push.","description":"HealthSherpa push. Supports two products:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"healthsherpa-push","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postHealthsherpaPush"}},"/healthsherpa-save-settings":{"post":{"tags":["Integrations & Webhooks"],"summary":"Secure endpoint for saving HealthSherpa settings (Phase 4 hardened).","description":"Secure endpoint for saving HealthSherpa settings (Phase 4 hardened). Secrets are stored encrypted at rest via DB trigger (pgcrypto + vault).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"healthsherpa-save-settings","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postHealthsherpaSaveSettings"}},"/healthsherpa-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"HealthSherpa inbound webhook.","description":"HealthSherpa inbound webhook. HealthSherpa delivers ONE event per Medicare submission, shaped\n\n**Auth:** HealthSherpa webhook: verified via X-API-Key against the configured inbound key, or HMAC x-webhook-signature.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"healthsherpa-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postHealthsherpaWebhook"}},"/hi-quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"Rate limiting","description":"Rate limiting\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"hi-quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postHiQuoteAi"}},"/impersonate-user":{"post":{"tags":["Core CRM"],"summary":"Impersonate User Edge Function SECURITY: Admin-only endpoint with restricted CORS","description":"Impersonate User Edge Function SECURITY: Admin-only endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"impersonate-user","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postImpersonateUser"}},"/inbound-email-webhook":{"post":{"tags":["Core CRM"],"summary":"Verify Mailgun webhook signature (HMAC-SHA256) Mailgun signs webhooks with: signature = HMAC(SHA256, signing-key, timest","description":"Verify Mailgun webhook signature (HMAC-SHA256) Mailgun signs webhooks with: signature = HMAC(SHA256, signing-key, timestamp + token)\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"inbound-email-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postInboundEmailWebhook"},"get":{"tags":["Core CRM"],"summary":"Verify Mailgun webhook signature (HMAC-SHA256) Mailgun signs webhooks with: signature = HMAC(SHA256, signing-key, timest","description":"Verify Mailgun webhook signature (HMAC-SHA256) Mailgun signs webhooks with: signature = HMAC(SHA256, signing-key, timestamp + token)\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"inbound-email-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getInboundEmailWebhook"}},"/inbound-webhook":{"post":{"tags":["Core CRM"],"summary":"Handle CORS preflight","description":"Handle CORS preflight\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"inbound-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postInboundWebhook"}},"/ingest-knowledge-pack":{"post":{"tags":["Core CRM"],"summary":"ingest-knowledge-pack — platform admin uploads a carrier knowledge source (UW guide, brochure, rate sheet, commission sc","description":"ingest-knowledge-pack — platform admin uploads a carrier knowledge source (UW guide, brochure, rate sheet, commission schedule) and embeds it into\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ingest-knowledge-pack","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postIngestKnowledgePack"}},"/insurance-news":{"post":{"tags":["Core CRM"],"summary":"Run all queries in parallel instead of sequentially","description":"Run all queries in parallel instead of sequentially\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"insurance-news","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postInsuranceNews"}},"/internal-backfill-weiss-dryrun":{"post":{"tags":["Core CRM"],"summary":"One-shot dry-run wrapper for Richard Weiss Outlook backfill","description":"One-shot dry-run wrapper for Richard Weiss Outlook backfill\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"internal-backfill-weiss-dryrun","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postInternalBackfillWeissDryrun"}},"/itk-quote":{"post":{"tags":["Core CRM"],"summary":"itk-quote — Final Expense, Term & IUL quoting via Insurance Toolkits API (redeploy: pickup ITK_API_KEY) REQUIRED SUPABAS","description":"itk-quote — Final Expense, Term & IUL quoting via Insurance Toolkits API (redeploy: pickup ITK_API_KEY) REQUIRED SUPABASE SECRETS:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"itk-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postItkQuote"}},"/ixn-quotes":{"post":{"tags":["Quoting & Enrollment"],"summary":"IXN error payloads we have seen embed: \"referenceId: <uuid>\" in the message.","description":"IXN error payloads we have seen embed: \"referenceId: <uuid>\" in the message.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ixn-quotes","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postIxnQuotes"}},"/ixnQuoteTest":{"post":{"tags":["Quoting & Enrollment"],"summary":"Initialize Supabase for auth validation","description":"Initialize Supabase for auth validation\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ixnQuoteTest","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postIxnQuoteTest"}},"/lead-cap-billing-trigger":{"post":{"tags":["Billing & Payments"],"summary":"Lead Cap Billing Trigger Invoked by DB trigger when an agent's remaining lead balance crosses the","description":"Lead Cap Billing Trigger Invoked by DB trigger when an agent's remaining lead balance crosses the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"lead-cap-billing-trigger","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postLeadCapBillingTrigger"}},"/life-compulife-quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"Life Compulife Quote Ai function.","description":"Life Compulife Quote Ai function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"life-compulife-quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postLifeCompulifeQuoteAi"}},"/life-public-quote":{"post":{"tags":["Quoting & Enrollment"],"summary":"life-public-quote — PUBLIC (verify_jwt = false) Powers the consumer life quote widget at /q/:slug (\"Beacon\" phase 1).","description":"life-public-quote — PUBLIC (verify_jwt = false) Powers the consumer life quote widget at /q/:slug (\"Beacon\" phase 1).\n\n**Auth:** Anonymous by design — prospect-facing public quote endpoint.","security":[],"x-internal":true,"x-function-name":"life-public-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postLifePublicQuote"}},"/list-team-users":{"post":{"tags":["Core CRM"],"summary":"List Team Users Edge Function SECURITY: Admin-only endpoint with restricted CORS","description":"List Team Users Edge Function SECURITY: Admin-only endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"list-team-users","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postListTeamUsers"}},"/load-recent-webhook-sample":{"post":{"tags":["Core CRM"],"summary":"Verify access","description":"Verify access\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"load-recent-webhook-sample","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postLoadRecentWebhookSample"}},"/local-presence-reputation-check":{"post":{"tags":["Core CRM"],"summary":"Provider hook: returns null when no reputation provider is configured, which is currently always.","description":"Provider hook: returns null when no reputation provider is configured, which is currently always. Returning null is the designed no-op — the caller's\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"local-presence-reputation-check","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postLocalPresenceReputationCheck"}},"/log-admin-action":{"post":{"tags":["Core CRM"],"summary":"Log Admin Action Edge Function SECURITY: Admin-only endpoint with restricted CORS","description":"Log Admin Action Edge Function SECURITY: Admin-only endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"log-admin-action","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postLogAdminAction"}},"/login-rate-limit":{"post":{"tags":["Core CRM"],"summary":"Server-Side Login Rate Limiter Edge Function Checks and records failed login attempts per (email + IP).","description":"Server-Side Login Rate Limiter Edge Function Checks and records failed login attempts per (email + IP).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"login-rate-limit","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postLoginRateLimit"}},"/ma-plan-explain":{"post":{"tags":["Quoting & Enrollment"],"summary":"A missing value means the carrier did not report it — say so explicitly, and never let downstream math treat it as $0.","description":"A missing value means the carrier did not report it — say so explicitly, and never let downstream math treat it as $0.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ma-plan-explain","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMaPlanExplain"}},"/ma-quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"Valid US state codes","description":"Valid US state codes\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"ma-quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMaQuoteAi"}},"/mailgun-stats":{"post":{"tags":["Email & Notifications"],"summary":"Handle CORS preflight","description":"Handle CORS preflight\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"mailgun-stats","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMailgunStats"}},"/mailgun-webhook":{"post":{"tags":["Email & Notifications"],"summary":"Rate limiting map (IP -> { count, resetTime })","description":"Rate limiting map (IP -> { count, resetTime })\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"mailgun-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMailgunWebhook"}},"/make-voice-call":{"post":{"tags":["Telephony & Messaging"],"summary":"Outbound Voice Call with GHL-style features: - DND check before calling","description":"Outbound Voice Call with GHL-style features: - DND check before calling\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"make-voice-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMakeVoiceCall"}},"/manual-recharge":{"post":{"tags":["Billing & Payments"],"summary":"Fund amounts available for wallet top-up (all in USD)","description":"Fund amounts available for wallet top-up (all in USD)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"manual-recharge","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postManualRecharge"}},"/marketplace-checkout":{"post":{"tags":["Billing & Payments"],"summary":"Get authenticated user","description":"Get authenticated user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"marketplace-checkout","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMarketplaceCheckout"}},"/mcp-server":{"post":{"tags":["Core CRM"],"summary":"MCP (Model Context Protocol) server wrapper around the unLocked Public API.","description":"MCP (Model Context Protocol) server wrapper around the unLocked Public API. Lets AI agents (ChatGPT, Claude, Cursor) discover and call CRM tools natively.\n\n**Auth:** CRM API key via x-api-key header OR OAuth 2.0 access token via Authorization: Bearer (MCP clients).","security":[{"ApiKeyAuth":[]}],"x-internal":false,"x-function-name":"mcp-server","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMcpServer"}},"/medicare-ppl-explain":{"post":{"tags":["Core CRM"],"summary":"Handle CORS preflight requests","description":"Handle CORS preflight requests\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"medicare-ppl-explain","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMedicarePplExplain"}},"/medicare-public-quote":{"post":{"tags":["Core CRM"],"summary":"Another adult in the household.","description":"Another adult in the household. Most Medigap carriers publish a discount for this — commonly 5–14% — and an agent applies it, so omitting it quoted\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"medicare-public-quote","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMedicarePublicQuote"}},"/medigap-quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"Rate limiting","description":"Rate limiting\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"medigap-quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMedigapQuoteAi"}},"/meta-check-permissions":{"post":{"tags":["Integrations & Webhooks"],"summary":"Capability → scope mapping comes from _shared/meta-oauth-scopes.ts so it cannot drift from what oauth-init actually asks","description":"Capability → scope mapping comes from _shared/meta-oauth-scopes.ts so it cannot drift from what oauth-init actually asks Facebook for.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-check-permissions","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaCheckPermissions"}},"/meta-connections":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get authenticated user","description":"Get authenticated user\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-connections","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaConnections"}},"/meta-disconnect":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get Meta account","description":"Get Meta account\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-disconnect","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaDisconnect"}},"/meta-fetch-insights":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get Meta account","description":"Get Meta account\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-fetch-insights","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaFetchInsights"}},"/meta-forms":{"post":{"tags":["Integrations & Webhooks"],"summary":"Parse request body for subaccountId and mode","description":"Parse request body for subaccountId and mode\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-forms","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaForms"}},"/meta-map-fields":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get user's profile to get subaccount_id","description":"Get user's profile to get subaccount_id\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-map-fields","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaMapFields"}},"/meta-refresh-tokens":{"post":{"tags":["Integrations & Webhooks"],"summary":"Renews Meta long-lived user tokens before they expire (~60 days).","description":"Renews Meta long-lived user tokens before they expire (~60 days). This function was dead twice over until 2026-08-11, and that is the reason Meta customers\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-refresh-tokens","x-cron-triggered":true,"x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaRefreshTokens"}},"/meta-reset-permissions":{"post":{"tags":["Integrations & Webhooks"],"summary":"Explicit \"Reset Facebook Page permissions\" escape hatch — DELETE /me/permissions.","description":"Explicit \"Reset Facebook Page permissions\" escape hatch — DELETE /me/permissions. Facebook keeps a per-app, per-Facebook-user grant of which Pages we may see, and the OAuth\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-reset-permissions","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaResetPermissions"}},"/meta-retry-leads":{"post":{"tags":["Integrations & Webhooks"],"summary":"Statuses worth another attempt.","description":"Statuses worth another attempt. 'completed' is done and 'skipped_duplicate' is a legitimate outcome rather than a failure, so neither is ever re-attempted.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-retry-leads","x-cron-triggered":true,"x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaRetryLeads"}},"/meta-select-page":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get Meta account","description":"Get Meta account\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-select-page","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaSelectPage"}},"/meta-send-message":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get channel (includes subaccount_id for isolation)","description":"Get channel (includes subaccount_id for isolation)\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-send-message","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaSendMessage"}},"/meta-subscribe-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Get Meta channel with page access token","description":"Get Meta channel with page access token\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-subscribe-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaSubscribeWebhook"}},"/meta-sync-assets":{"post":{"tags":["Integrations & Webhooks"],"summary":"Re-reads the Pages, Instagram accounts and ad accounts for a connected Meta account and refreshes the cached copies in m","description":"Re-reads the Pages, Instagram accounts and ad accounts for a connected Meta account and refreshes the cached copies in meta_accounts / meta_channels. Backs the \"Refresh Pages\"\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-sync-assets","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaSyncAssets"}},"/meta-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Verify Meta webhook signature.","description":"Verify Meta webhook signature. Env var notes (canonical names):\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postMetaWebhook"},"get":{"tags":["Integrations & Webhooks"],"summary":"Verify Meta webhook signature.","description":"Verify Meta webhook signature. Env var notes (canonical names):\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"meta-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getMetaWebhook"}},"/notify-800-number":{"post":{"tags":["Email & Notifications"],"summary":"Slack notifications for 800 number request lifecycle events.","description":"Slack notifications for 800 number request lifecycle events.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-800-number","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotify800Number"}},"/notify-agency-new-signup":{"post":{"tags":["Email & Notifications"],"summary":"Agency admin emails to notify","description":"Agency admin emails to notify\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-agency-new-signup","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyAgencyNewSignup"}},"/notify-agency-past-due-resolved":{"post":{"tags":["Email & Notifications"],"summary":"Notify Agency Past Due Resolved function.","description":"Notify Agency Past Due Resolved function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-agency-past-due-resolved","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyAgencyPastDueResolved"}},"/notify-agency-reactivation":{"post":{"tags":["Email & Notifications"],"summary":"Notify Agency Reactivation function.","description":"Notify Agency Reactivation function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-agency-reactivation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyAgencyReactivation"}},"/notify-agency-upgrade":{"post":{"tags":["Email & Notifications"],"summary":"Agency admin emails to notify — mirrors notify-agency-new-signup","description":"Agency admin emails to notify — mirrors notify-agency-new-signup\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-agency-upgrade","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyAgencyUpgrade"}},"/notify-ai-onboarding-completed":{"post":{"tags":["Email & Notifications"],"summary":"Notify Ai Onboarding Completed function.","description":"Notify Ai Onboarding Completed function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-ai-onboarding-completed","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyAiOnboardingCompleted"}},"/notify-cancellation":{"post":{"tags":["Email & Notifications"],"summary":"True when this fires because the user added their goodbye note on the final step, after the cancellation was already rep","description":"True when this fires because the user added their goodbye note on the final step, after the cancellation was already reported. Staff still need the note,\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-cancellation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyCancellation"}},"/notify-lead-subscription-request":{"post":{"tags":["Email & Notifications"],"summary":"Sends two emails when a user submits a lead subscription intake form: 1) Notification to agency admins with the full sub","description":"Sends two emails when a user submits a lead subscription intake form: 1) Notification to agency admins with the full submission details\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-lead-subscription-request","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyLeadSubscriptionRequest"}},"/notify-onboarding-completed":{"post":{"tags":["Email & Notifications"],"summary":"Best-effort display name from auth user_metadata, explicitly preferring first + last name.","description":"Best-effort display name from auth user_metadata, explicitly preferring first + last name.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-onboarding-completed","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifyOnboardingCompleted"}},"/notify-slack-support":{"post":{"tags":["Email & Notifications"],"summary":"Handle CORS preflight requests","description":"Handle CORS preflight requests\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"notify-slack-support","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNotifySlackSupport"}},"/npi-search":{"post":{"tags":["Core CRM"],"summary":"NPI Registry proxy - keeps NPPES traffic off the browser so the Lovable preview proxy / CORS quirks can't drop the reque","description":"NPI Registry proxy - keeps NPPES traffic off the browser so the Lovable preview proxy / CORS quirks can't drop the request.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"npi-search","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postNpiSearch"}},"/oauth-callback":{"post":{"tags":["Core CRM"],"summary":"Rate limiting for security","description":"Rate limiting for security\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"oauth-callback","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOauthCallback"}},"/oauth-init":{"post":{"tags":["Core CRM"],"summary":"Optional `login_hint`: pre-selects an account on the provider's chooser when the user has several signed in.","description":"Optional `login_hint`: pre-selects an account on the provider's chooser when the user has several signed in. It is a HINT only — the provider still shows its own sign-in and the user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"oauth-init","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOauthInit"}},"/oauth-server":{"post":{"tags":["Core CRM"],"summary":"OAuth 2.0 Server for unLocked CRM Public API.","description":"OAuth 2.0 Server for unLocked CRM Public API. Implements RFC 6749 (Authorization Code) + RFC 7636 (PKCE) + RFC 7009 (Revocation).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"oauth-server","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOauthServer"},"get":{"tags":["Core CRM"],"summary":"OAuth 2.0 Server for unLocked CRM Public API.","description":"OAuth 2.0 Server for unLocked CRM Public API. Implements RFC 6749 (Authorization Code) + RFC 7636 (PKCE) + RFC 7009 (Revocation).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"oauth-server","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getOauthServer"}},"/onboarding-purchase-number":{"post":{"tags":["Core CRM"],"summary":"Onboarding wrapper around `twilio-phone-numbers` that automatically comps the very first phone number a subaccount has e","description":"Onboarding wrapper around `twilio-phone-numbers` that automatically comps the very first phone number a subaccount has ever owned. Subsequent numbers\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"onboarding-purchase-number","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOnboardingPurchaseNumber"}},"/openai-service":{"post":{"tags":["Core CRM"],"summary":"Build messages array","description":"Build messages array\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"openai-service","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOpenaiService"}},"/outlook-backfill-details":{"post":{"tags":["Email & Notifications"],"summary":"One-time Outlook backfill — repair blank synced appointments.","description":"One-time Outlook backfill — repair blank synced appointments. Outlook's /me/events/delta only re-emits CHANGED events, so resetting the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"outlook-backfill-details","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookBackfillDetails"}},"/outlook-delta-sync":{"post":{"tags":["Email & Notifications"],"summary":"Outlook Delta Sync Edge Function Uses Microsoft Graph delta queries for robust incremental synchronization","description":"Outlook Delta Sync Edge Function Uses Microsoft Graph delta queries for robust incremental synchronization\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"outlook-delta-sync","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookDeltaSync"}},"/outlook-list-calendars":{"post":{"tags":["Email & Notifications"],"summary":"Outlook List Calendars Edge Function Lists all calendars from user's Outlook account via Microsoft Graph API","description":"Outlook List Calendars Edge Function Lists all calendars from user's Outlook account via Microsoft Graph API\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"outlook-list-calendars","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookListCalendars"}},"/outlook-mail-sync":{"post":{"tags":["Email & Notifications"],"summary":"Outlook (Microsoft Graph) Mail Sync — mirrors gmail-sync, writes to email_messages / email_threads.","description":"Outlook (Microsoft Graph) Mail Sync — mirrors gmail-sync, writes to email_messages / email_threads. Invoked by frontend hook (useEmailThreads) after Outlook is connected, just like gmail-sync.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"outlook-mail-sync","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookMailSync"}},"/outlook-refresh-token":{"post":{"tags":["Email & Notifications"],"summary":"Outlook Refresh Token Edge Function Refreshes expired Outlook OAuth access tokens using refresh token","description":"Outlook Refresh Token Edge Function Refreshes expired Outlook OAuth access tokens using refresh token\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"outlook-refresh-token","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookRefreshToken"}},"/outlook-renew-subscriptions":{"post":{"tags":["Email & Notifications"],"summary":"Outlook Renew Subscriptions Edge Function Renews Microsoft Graph webhook subscriptions before they expire","description":"Outlook Renew Subscriptions Edge Function Renews Microsoft Graph webhook subscriptions before they expire\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"outlook-renew-subscriptions","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookRenewSubscriptions"}},"/outlook-save-calendar-selection":{"post":{"tags":["Email & Notifications"],"summary":"Outlook Save Calendar Selection Edge Function Saves user's selection of which Outlook calendars to sync","description":"Outlook Save Calendar Selection Edge Function Saves user's selection of which Outlook calendars to sync\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"outlook-save-calendar-selection","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookSaveCalendarSelection"}},"/outlook-subscribe-webhook":{"post":{"tags":["Email & Notifications"],"summary":"Outlook Subscribe Webhook Function Creates Microsoft Graph webhook subscriptions for calendar change notifications.","description":"Outlook Subscribe Webhook Function Creates Microsoft Graph webhook subscriptions for calendar change notifications.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"outlook-subscribe-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookSubscribeWebhook"}},"/outlook-webhook":{"post":{"tags":["Email & Notifications"],"summary":"Outlook Webhook Edge Function Handles incoming webhook notifications from Microsoft Graph","description":"Outlook Webhook Edge Function Handles incoming webhook notifications from Microsoft Graph\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"outlook-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postOutlookWebhook"}},"/parse-drugs":{"post":{"tags":["Core CRM"],"summary":"If image provided, run OCR via Gemini vision","description":"If image provided, run OCR via Gemini vision\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"parse-drugs","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postParseDrugs"}},"/parse-eo-document":{"post":{"tags":["Core CRM"],"summary":"Get user from token","description":"Get user from token\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"parse-eo-document","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postParseEoDocument"}},"/parse-pdf":{"post":{"tags":["Core CRM"],"summary":"Step 1: Try text extraction (handles both compressed and uncompressed streams)","description":"Step 1: Try text extraction (handles both compressed and uncompressed streams)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"parse-pdf","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postParsePdf"}},"/parse-providers":{"post":{"tags":["Core CRM"],"summary":"Parse Providers function.","description":"Parse Providers function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"parse-providers","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postParseProviders"}},"/phone-system-alerts":{"post":{"tags":["Telephony & Messaging"],"summary":"Agency admin emails to notify","description":"Agency admin emails to notify\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"phone-system-alerts","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPhoneSystemAlerts"}},"/portal-activation-notify":{"post":{"tags":["Core CRM"],"summary":"Sends two emails when a client first activates their portal: 1) Welcome email to the client","description":"Sends two emails when a client first activates their portal: 1) Welcome email to the client\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"portal-activation-notify","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPortalActivationNotify"}},"/portal-book-appointment":{"post":{"tags":["Core CRM"],"summary":"Books an appointment from the client portal.","description":"Books an appointment from the client portal. Reuses the agent's CRM availability rules + merges Google/Outlook busy\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"portal-book-appointment","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPortalBookAppointment"}},"/postmaster-fetch":{"post":{"tags":["Core CRM"],"summary":"Get authenticated user","description":"Get authenticated user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"postmaster-fetch","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPostmasterFetch"}},"/private-plans-api":{"post":{"tags":["Quoting & Enrollment"],"summary":"==================== Types ====================","description":"==================== Types ====================\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"private-plans-api","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPrivatePlansApi"}},"/private-plans-quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"Private Plans Quote Ai function.","description":"Private Plans Quote Ai function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"private-plans-quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPrivatePlansQuoteAi"}},"/private-plans-search":{"post":{"tags":["Quoting & Enrollment"],"summary":"==================== Types ====================","description":"==================== Types ====================\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"private-plans-search","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPrivatePlansSearch"}},"/process-abandoned-checkout":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Abandoned Checkout Recovery Drip Runs via cron every hour.","description":"Abandoned Checkout Recovery Drip Runs via cron every hour. Finds users who signed up but never completed\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-abandoned-checkout","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessAbandonedCheckout"}},"/process-birthday-reminders":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Local hour, in the workspace's own timezone, at which birthday outreach may start going out.","description":"Local hour, in the workspace's own timezone, at which birthday outreach may start going out. The cron runs hourly and each workspace is skipped until its\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-birthday-reminders","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessBirthdayReminders"}},"/process-booking-nudges":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Booking-link SMS Nudge scheduler.","description":"Booking-link SMS Nudge scheduler. Runs on a cron (every ~5 minutes). For each upcoming appointment that came\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-booking-nudges","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessBookingNudges"}},"/process-campaigns":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"BATCH CONFIGURATION FOR SCALE The send-sms ceiling is PER SUBACCOUNT, not global: check_high_cost_rate_limit is called","description":"BATCH CONFIGURATION FOR SCALE The send-sms ceiling is PER SUBACCOUNT, not global: check_high_cost_rate_limit is called\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-campaigns","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessCampaigns"}},"/process-cancellation-drip":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"============= EMAIL TEMPLATE HELPERS =============","description":"============= EMAIL TEMPLATE HELPERS =============\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-cancellation-drip","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessCancellationDrip"}},"/process-custom-date-reminders":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Local hour, in the workspace's own timezone, at which nudges may start going out.","description":"Local hour, in the workspace's own timezone, at which nudges may start going out. The cron runs hourly and each workspace is skipped until its own clock\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-custom-date-reminders","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessCustomDateReminders"}},"/process-email-campaign-retries":{"post":{"tags":["Email & Notifications"],"summary":"A throttled campaign finishes HERE, not in send-email-campaign (which skips its notification while sends are deferred) —","description":"A throttled campaign finishes HERE, not in send-email-campaign (which skips its notification while sends are deferred) — so notify the owner\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-email-campaign-retries","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessEmailCampaignRetries"}},"/process-enrollment-period":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"process-enrollment-period Server-side replacement for the client-only useEnrollmentPeriodScanner hook.","description":"process-enrollment-period Server-side replacement for the client-only useEnrollmentPeriodScanner hook.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-enrollment-period","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessEnrollmentPeriod"}},"/process-medicare-eligibility":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"The age being turned.","description":"The age being turned. 65 (Medicare IEP) unless the workflow says otherwise.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-medicare-eligibility","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessMedicareEligibility"}},"/process-medicare-pending-eligible":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"process-medicare-pending-eligible Server-side firing engine for the \"Medicare Pending → Eligible\" trigger","description":"process-medicare-pending-eligible Server-side firing engine for the \"Medicare Pending → Eligible\" trigger\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-medicare-pending-eligible","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessMedicarePendingEligible"}},"/process-nipr-alert-billing":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"NIPR PDB ALERT MONTHLY BILLING Scheduled job to process monthly alert subscriptions","description":"NIPR PDB ALERT MONTHLY BILLING Scheduled job to process monthly alert subscriptions\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-nipr-alert-billing","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessNiprAlertBilling"}},"/process-onboarding-emails":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Subaccounts whose members should NOT receive onboarding drip emails","description":"Subaccounts whose members should NOT receive onboarding drip emails\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-onboarding-emails","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessOnboardingEmails"}},"/process-onboarding-queue":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Processes the scheduled_onboarding_emails queue.","description":"Processes the scheduled_onboarding_emails queue. Runs every minute via pg_cron. Picks up rows where send_at <= now() and sent = false,\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-onboarding-queue","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessOnboardingQueue"}},"/process-policy-renewal":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"process-policy-renewal Server-side replacement for the client-only useRenewalScanner hook.","description":"process-policy-renewal Server-side replacement for the client-only useRenewalScanner hook. The\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-policy-renewal","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessPolicyRenewal"}},"/process-quote-attachment":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Process Quote Attachment function.","description":"Process Quote Attachment function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-quote-attachment","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessQuoteAttachment"}},"/process-resend-unopened":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Find campaigns with resendToUnopened enabled that are past their delay window","description":"Find campaigns with resendToUnopened enabled that are past their delay window\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"process-resend-unopened","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessResendUnopened"}},"/process-scheduled-emails":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Load a scheduled campaign's attachments once, up front, so the bytes are reused across every recipient instead of being ","description":"Load a scheduled campaign's attachments once, up front, so the bytes are reused across every recipient instead of being re-downloaded per send.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-scheduled-emails","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessScheduledEmails"}},"/process-scheduled-nudges":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Process Scheduled Nudges This edge function processes pending scheduled messages from the scheduled_messages table.","description":"Process Scheduled Nudges This edge function processes pending scheduled messages from the scheduled_messages table.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-scheduled-nudges","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessScheduledNudges"}},"/process-scheduled-opportunities":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Processes due rows in scheduled_opportunity_additions (Contacts → \"Add/Update Opportunity\", Scheduled & Drip modes).","description":"Processes due rows in scheduled_opportunity_additions (Contacts → \"Add/Update Opportunity\", Scheduled & Drip modes). For each due row it creates the real\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-scheduled-opportunities","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessScheduledOpportunities"}},"/process-scheduled-quote-sends":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Cron-driven processor that sends due scheduled quotes.","description":"Cron-driven processor that sends due scheduled quotes. Reads scheduled_quote_sends where status='pending' AND scheduled_for <= now(),\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-scheduled-quote-sends","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessScheduledQuoteSends"}},"/process-single-email-queue":{"post":{"tags":["Email & Notifications"],"summary":"Process Single Email Queue function.","description":"Process Single Email Queue function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-single-email-queue","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessSingleEmailQueue"}},"/process-sms-queue":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"SMS Queue Processor — consumes sms_send_queue rows that were deferred due to 10DLC throughput limits (1 msg/sec/number).","description":"SMS Queue Processor — consumes sms_send_queue rows that were deferred due to 10DLC throughput limits (1 msg/sec/number).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-sms-queue","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessSmsQueue"}},"/process-task-reminders":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Get current date (UTC midnight for comparison)","description":"Get current date (UTC midnight for comparison)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-task-reminders","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessTaskReminders"}},"/process-workflow-jobs":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"process-workflow-jobs (legacy compatibility entrypoint) Keep this function as a thin proxy only.","description":"process-workflow-jobs (legacy compatibility entrypoint) Keep this function as a thin proxy only. The real processor is\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"process-workflow-jobs","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProcessWorkflowJobs"}},"/prospector-webhook":{"post":{"tags":["Core CRM"],"summary":"Prospector → CRM Webhook (Phase 2) Phase 2 additions:","description":"Prospector → CRM Webhook (Phase 2) Phase 2 additions:\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"prospector-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProspectorWebhook"}},"/provider-calendar-event":{"post":{"tags":["Core CRM"],"summary":"Push, update, cancel, and RSVP calendar events directly on the user's connected Google Calendar or Outlook Calendar via ","description":"Push, update, cancel, and RSVP calendar events directly on the user's connected Google Calendar or Outlook Calendar via their OAuth tokens.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"provider-calendar-event","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProviderCalendarEvent"}},"/provision-user-wallet":{"post":{"tags":["Admin & Provisioning"],"summary":"provision-user-wallet PHASE 2 — Per-User Per-Subaccount Wallet Infrastructure","description":"provision-user-wallet PHASE 2 — Per-User Per-Subaccount Wallet Infrastructure\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"provision-user-wallet","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProvisionUserWallet"}},"/proxy-twilio-recording":{"post":{"tags":["Core CRM"],"summary":"Proxy Twilio Recording function.","description":"Proxy Twilio Recording function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"proxy-twilio-recording","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postProxyTwilioRecording"}},"/public-appointment-cancel":{"post":{"tags":["Core CRM"],"summary":"===== Google helpers =====","description":"===== Google helpers =====\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"public-appointment-cancel","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPublicAppointmentCancel"}},"/public-appointment-reschedule":{"post":{"tags":["Core CRM"],"summary":"===== Google helpers =====","description":"===== Google helpers =====\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"public-appointment-reschedule","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postPublicAppointmentReschedule"}},"/quote-ai":{"post":{"tags":["Quoting & Enrollment"],"summary":"RATE LIMITING - In-memory fast check","description":"RATE LIMITING - In-memory fast check\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"quote-ai","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postQuoteAi"}},"/rebill-subaccount":{"post":{"tags":["Billing & Payments"],"summary":"Call atomic rebill RPC — handles vendor cost deduction from agency wallet and markup-based deduction from sub-account wa","description":"Call atomic rebill RPC — handles vendor cost deduction from agency wallet and markup-based deduction from sub-account wallet in a single transaction\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"rebill-subaccount","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRebillSubaccount"}},"/recalculate-all-scores":{"post":{"tags":["Core CRM"],"summary":"Get user's subaccount_id for proper isolation","description":"Get user's subaccount_id for proper isolation\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"recalculate-all-scores","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRecalculateAllScores"}},"/recompute-agent-profile":{"post":{"tags":["Core CRM"],"summary":"Recomputes agent_ai_profiles for one user (on-demand) or all users (cron)","description":"Recomputes agent_ai_profiles for one user (on-demand) or all users (cron)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"recompute-agent-profile","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRecomputeAgentProfile"}},"/reconcile-seats":{"post":{"tags":["Core CRM"],"summary":"─── AUTH: cron secret or service role ───","description":"─── AUTH: cron secret or service role ───\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"reconcile-seats","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postReconcileSeats"}},"/record-call":{"post":{"tags":["Core CRM"],"summary":"Get authorization header","description":"Get authorization header\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"record-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRecordCall"}},"/recover-missed-onboarding":{"post":{"tags":["Core CRM"],"summary":"Auth: accept anon key (from cron), cron secret header, or service role pg_cron calls with anon key Bearer token which pa","description":"Auth: accept anon key (from cron), cron secret header, or service role pg_cron calls with anon key Bearer token which passes Supabase gateway auth\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"recover-missed-onboarding","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRecoverMissedOnboarding"}},"/refresh-oauth-tokens":{"post":{"tags":["Core CRM"],"summary":"Check if token needs encryption by trying to decrypt it Returns true if token needs to be encrypted (is plaintext or enc","description":"Check if token needs encryption by trying to decrypt it Returns true if token needs to be encrypted (is plaintext or encrypted with wrong key)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"refresh-oauth-tokens","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRefreshOauthTokens"}},"/remove-team-seat":{"post":{"tags":["Admin & Provisioning"],"summary":"OPTIONAL and additive.","description":"OPTIONAL and additive. Absent means \"no key\", which is byte-identical to this function's behaviour before it existed — so any caller that does not\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"remove-team-seat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRemoveTeamSeat"}},"/render-website":{"post":{"tags":["Core CRM"],"summary":"Public website renderer (verify_jwt = false).","description":"Public website renderer (verify_jwt = false). Resolves the incoming custom-domain host (X-Forwarded-Host, set by the Cloudflare\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"render-website","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRenderWebsite"}},"/repair-el-inbound-webhook":{"post":{"tags":["Core CRM"],"summary":"repair-el-inbound-webhook — RETIRED.","description":"repair-el-inbound-webhook — RETIRED. Returns 410 Gone. Was a one-off repair that rewrote a Twilio number's VoiceUrl and\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"repair-el-inbound-webhook","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRepairElInboundWebhook"}},"/report-export":{"post":{"tags":["Core CRM"],"summary":"report-export — robust server-side CSV export for the Custom Report Builder.","description":"report-export — robust server-side CSV export for the Custom Report Builder. The browser sends a fully-resolved ExportPlan (see src/lib/reportExport.ts);\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"report-export","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postReportExport"}},"/resolve-zip-counties":{"post":{"tags":["Core CRM"],"summary":"ZIP -> counties, from the CMS marketplace API.","description":"ZIP -> counties, from the CMS marketplace API. WHY THIS EXISTS. Correcting IA Agency's county data needs an authoritative ZIP -> county\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"resolve-zip-counties","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postResolveZipCounties"}},"/resume-scheduled-workflows":{"post":{"tags":["Core CRM"],"summary":"resume-scheduled-workflows Background cron job that:","description":"resume-scheduled-workflows Background cron job that:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"resume-scheduled-workflows","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postResumeScheduledWorkflows"}},"/retireflo-intake":{"post":{"tags":["Core CRM"],"summary":"RetireFlo survey intake → creates/updates a lead, tags Medicare or ACA.","description":"RetireFlo survey intake → creates/updates a lead, tags Medicare or ACA. Tag-based workflows (\"contact_tag_added\" trigger) handle the drip.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"retireflo-intake","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRetirefloIntake"}},"/retirement-crm-automation":{"post":{"tags":["Core CRM"],"summary":"Retirement Crm Automation function.","description":"Retirement Crm Automation function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"retirement-crm-automation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRetirementCrmAutomation"}},"/retry-workflow-run":{"post":{"tags":["Core CRM"],"summary":"retry-workflow-run — re-queue a failed workflow execution by re-invoking trigger-workflow with the original trigger_data","description":"retry-workflow-run — re-queue a failed workflow execution by re-invoking trigger-workflow with the original trigger_data. Used by the support chat inline \"Retry this run\" action.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"retry-workflow-run","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRetryWorkflowRun"}},"/revert-workflow-snapshot":{"post":{"tags":["Core CRM"],"summary":"Verify the user owns the workflow (or shares its subaccount)","description":"Verify the user owns the workflow (or shares its subaccount)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"revert-workflow-snapshot","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRevertWorkflowSnapshot"}},"/rotate-api-key":{"post":{"tags":["Core CRM"],"summary":"Rotate API Key Edge Function SECURITY: Admin-only endpoint with restricted CORS","description":"Rotate API Key Edge Function SECURITY: Admin-only endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"rotate-api-key","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRotateApiKey"}},"/rotate-encryption-key":{"post":{"tags":["Core CRM"],"summary":"CRITICAL SECURITY FUNCTION Rotates the OAuth encryption key by re-encrypting all tokens","description":"CRITICAL SECURITY FUNCTION Rotates the OAuth encryption key by re-encrypting all tokens\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"rotate-encryption-key","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postRotateEncryptionKey"}},"/save-secret":{"post":{"tags":["Core CRM"],"summary":"Get environment variables once at the start","description":"Get environment variables once at the start\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"save-secret","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSaveSecret"}},"/search-knowledge-packs":{"post":{"tags":["Core CRM"],"summary":"search-knowledge-packs — semantic search across platform-curated carrier knowledge.","description":"search-knowledge-packs — semantic search across platform-curated carrier knowledge. Any authenticated user can call this. Returns chunks with\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"search-knowledge-packs","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSearchKnowledgePacks"}},"/secure-update-role":{"post":{"tags":["Core CRM"],"summary":"SECURITY: Secure Role Update Edge Function This function handles role changes with proper authorization checks.","description":"SECURITY: Secure Role Update Edge Function This function handles role changes with proper authorization checks.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"secure-update-role","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSecureUpdateRole"}},"/security-audit-reminder":{"post":{"tags":["Core CRM"],"summary":"Security Audit Reminder Edge Function Sends quarterly reminders to admins to perform security audits","description":"Security Audit Reminder Edge Function Sends quarterly reminders to admins to perform security audits\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"security-audit-reminder","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSecurityAuditReminder"}},"/seed-vault-from-env":{"post":{"tags":["Core CRM"],"summary":"seed-vault-from-env One-time / repeatable admin tool to migrate secrets from the Lovable env store","description":"seed-vault-from-env One-time / repeatable admin tool to migrate secrets from the Lovable env store\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"seed-vault-from-env","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSeedVaultFromEnv"}},"/self-cancel-subscription":{"post":{"tags":["Billing & Payments"],"summary":"The target `team_members` row, as read here.","description":"The target `team_members` row, as read here. `TargetTeamMemberRow` is the subset authorizeMemberCancel decides on; the rest is what this handler needs\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"self-cancel-subscription","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSelfCancelSubscription"}},"/send-2fa-code":{"post":{"tags":["Email & Notifications"],"summary":"Email 2FA Code Generator & Sender Actions:","description":"Email 2FA Code Generator & Sender Actions:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-2fa-code","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSend2faCode"}},"/send-a2p-request-emails":{"post":{"tags":["Email & Notifications"],"summary":"Authenticate the user — only CRM users can submit A2P requests","description":"Authenticate the user — only CRM users can submit A2P requests\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-a2p-request-emails","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendA2pRequestEmails"}},"/send-a2p-status-update":{"post":{"tags":["Email & Notifications"],"summary":"Send A2p Status Update function.","description":"Send A2p Status Update function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-a2p-status-update","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendA2pStatusUpdate"}},"/send-activation-email":{"post":{"tags":["Email & Notifications"],"summary":"Send Activation Email function.","description":"Send Activation Email function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-activation-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendActivationEmail"}},"/send-activity-summary":{"post":{"tags":["Email & Notifications"],"summary":"Send Activity Summary function.","description":"Send Activity Summary function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-activity-summary","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendActivitySummary"}},"/send-admin-update-email":{"post":{"tags":["Email & Notifications"],"summary":"Get the update","description":"Get the update\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-admin-update-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendAdminUpdateEmail"}},"/send-affiliate-payout-notification":{"post":{"tags":["Email & Notifications"],"summary":"Build payment method info if provided","description":"Build payment method info if provided\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-affiliate-payout-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendAffiliatePayoutNotification"}},"/send-affiliate-signup-notification":{"post":{"tags":["Email & Notifications"],"summary":"unLocked CRM branded affiliate signup notification email template","description":"unLocked CRM branded affiliate signup notification email template\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-affiliate-signup-notification","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendAffiliateSignupNotification"}},"/send-appointment-reminders":{"post":{"tags":["Email & Notifications"],"summary":"Phone normalization now handled by shared ensureE164 utility","description":"Phone normalization now handled by shared ensureE164 utility\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-appointment-reminders","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendAppointmentReminders"}},"/send-attribution-notification":{"post":{"tags":["Email & Notifications"],"summary":"Get user profile","description":"Get user profile\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-attribution-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendAttributionNotification"}},"/send-auth-email":{"post":{"tags":["Email & Notifications"],"summary":"Email templates for different auth actions","description":"Email templates for different auth actions\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-auth-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendAuthEmail"}},"/send-booking-notification":{"post":{"tags":["Email & Notifications"],"summary":"Notification settings for a booking that has no booking_link_id — Agent AI and portal bookings go straight through atomi","description":"Notification settings for a booking that has no booking_link_id — Agent AI and portal bookings go straight through atomic_book_appointment and never\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-booking-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendBookingNotification"}},"/send-build-idea":{"post":{"tags":["Email & Notifications"],"summary":"Send Build Idea function.","description":"Send Build Idea function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-build-idea","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendBuildIdea"}},"/send-clinic-invite":{"post":{"tags":["Email & Notifications"],"summary":"--- Ad-hoc in-memory rate limit (mirror of send-portal-invite) --------------","description":"--- Ad-hoc in-memory rate limit (mirror of send-portal-invite) --------------\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-clinic-invite","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendClinicInvite"}},"/send-communication":{"post":{"tags":["Email & Notifications"],"summary":"Persist Gmail's thread truth immediately after a successful send, so replies can thread without waiting for gmail-sync (","description":"Persist Gmail's thread truth immediately after a successful send, so replies can thread without waiting for gmail-sync (which may never run for all-outbound threads).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-communication","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendCommunication"}},"/send-crm-notification":{"post":{"tags":["Email & Notifications"],"summary":"Placeholder token used by infoCard/ctaButton so that brandedTemplate can swap in the resolved branding.primaryColor at r","description":"Placeholder token used by infoCard/ctaButton so that brandedTemplate can swap in the resolved branding.primaryColor at render-time.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-crm-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendCrmNotification"}},"/send-data-purchase-confirmation":{"post":{"tags":["Email & Notifications"],"summary":"Send email via Resend API","description":"Send email via Resend API\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-data-purchase-confirmation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendDataPurchaseConfirmation"}},"/send-email-campaign":{"post":{"tags":["Email & Notifications"],"summary":"Attachment schema.","description":"Attachment schema. `storagePath` points into the private `email-attachments` bucket and is read with the service-role client at send time; `url` is the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-email-campaign","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendEmailCampaign"}},"/send-email-reminders":{"post":{"tags":["Email & Notifications"],"summary":"Automated Email Reminder Scheduler Sends email reminders at:","description":"Automated Email Reminder Scheduler Sends email reminders at:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-email-reminders","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendEmailReminders"}},"/send-feature-nudges":{"post":{"tags":["Email & Notifications"],"summary":"Weekly cron function: sends one \"Have you tried X?\" notification per user for features they haven't used yet.","description":"Weekly cron function: sends one \"Have you tried X?\" notification per user for features they haven't used yet. Auto-hides when they try the feature.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-feature-nudges","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendFeatureNudges"}},"/send-feedback-email":{"post":{"tags":["Email & Notifications"],"summary":"Send Feedback Email function.","description":"Send Feedback Email function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-feedback-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendFeedbackEmail"}},"/send-form-notification":{"post":{"tags":["Email & Notifications"],"summary":"Client confirmation settings","description":"Client confirmation settings\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-form-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendFormNotification"}},"/send-integration-request":{"post":{"tags":["Email & Notifications"],"summary":"Send Integration Request function.","description":"Send Integration Request function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-integration-request","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendIntegrationRequest"}},"/send-invite-accepted":{"post":{"tags":["Email & Notifications"],"summary":"Get the team member details","description":"Get the team member details\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-invite-accepted","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendInviteAccepted"}},"/send-license-expiration-reminders":{"post":{"tags":["Email & Notifications"],"summary":"─── Helpers ────────────────────────────────────────────────────────────────","description":"─── Helpers ────────────────────────────────────────────────────────────────\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-license-expiration-reminders","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendLicenseExpirationReminders"}},"/send-mailgun":{"post":{"tags":["Email & Notifications"],"summary":"MICROSOFT TOKEN REFRESH","description":"MICROSOFT TOKEN REFRESH\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"send-mailgun","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendMailgun"}},"/send-max-confirmation":{"post":{"tags":["Email & Notifications"],"summary":"Send Max Confirmation function.","description":"Send Max Confirmation function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-max-confirmation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendMaxConfirmation"}},"/send-mention-notification":{"post":{"tags":["Email & Notifications"],"summary":"Verify the caller","description":"Verify the caller\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-mention-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendMentionNotification"}},"/send-new-user-notification":{"post":{"tags":["Email & Notifications"],"summary":"Authenticate the caller","description":"Authenticate the caller\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-new-user-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendNewUserNotification"}},"/send-notification-test":{"post":{"tags":["Email & Notifications"],"summary":"Send Notification Test function.","description":"Send Notification Test function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-notification-test","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendNotificationTest"}},"/send-onboarding-email":{"post":{"tags":["Email & Notifications"],"summary":"── Test-all path (no dedup) ──────────────────────────────────────────────","description":"── Test-all path (no dedup) ──────────────────────────────────────────────\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-onboarding-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendOnboardingEmail"}},"/send-password-reset":{"post":{"tags":["Email & Notifications"],"summary":"Create Supabase admin client to generate password reset link","description":"Create Supabase admin client to generate password reset link\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-password-reset","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendPasswordReset"}},"/send-portal-invite":{"post":{"tags":["Email & Notifications"],"summary":"--- Ad-hoc in-memory rate limit --------------------------------------------- NOTE: Backend has no shared rate-limit pri","description":"--- Ad-hoc in-memory rate limit --------------------------------------------- NOTE: Backend has no shared rate-limit primitive; this is best-effort per\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-portal-invite","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendPortalInvite"}},"/send-pro-confirmation":{"post":{"tags":["Email & Notifications"],"summary":"Send email via Resend API","description":"Send email via Resend API\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-pro-confirmation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendProConfirmation"}},"/send-prospector-confirmation":{"post":{"tags":["Email & Notifications"],"summary":"Send email via Resend API","description":"Send email via Resend API\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-prospector-confirmation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendProspectorConfirmation"}},"/send-quote-to-contact":{"post":{"tags":["Email & Notifications"],"summary":"Sends a quote to a contact via email and/or SMS, with a generated PDF \"Quote Summary\" attachment.","description":"Sends a quote to a contact via email and/or SMS, with a generated PDF \"Quote Summary\" attachment. Logs a single combined activity to\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-quote-to-contact","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendQuoteToContact"}},"/send-sms":{"post":{"tags":["Email & Notifications"],"summary":"Outbound SMS sender with Agency-Level A2P Support: - Subaccount isolation: Only uses phones owned by the sending subacco","description":"Outbound SMS sender with Agency-Level A2P Support: - Subaccount isolation: Only uses phones owned by the sending subaccount\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-sms","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendSms"}},"/send-smtp-email":{"post":{"tags":["Email & Notifications"],"summary":"Decrypt SMTP password using the shared encryption utilities","description":"Decrypt SMTP password using the shared encryption utilities\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-smtp-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendSmtpEmail"}},"/send-subaccount-invitation":{"post":{"tags":["Email & Notifications"],"summary":"Send via Mailgun","description":"Send via Mailgun\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-subaccount-invitation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendSubaccountInvitation"}},"/send-support-notification":{"post":{"tags":["Email & Notifications"],"summary":"Support ticket notifications go ONLY to this hardcoded allow-list.","description":"Support ticket notifications go ONLY to this hardcoded allow-list. Do NOT derive recipients from user_roles, workspace owners, submitters,\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-support-notification","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendSupportNotification"}},"/send-system-alert":{"post":{"tags":["Email & Notifications"],"summary":"Handle CORS preflight","description":"Handle CORS preflight\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-system-alert","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendSystemAlert"}},"/send-team-invite":{"post":{"tags":["Email & Notifications"],"summary":"Send Team Invite Edge Function PURPOSE:","description":"Send Team Invite Edge Function PURPOSE:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-team-invite","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendTeamInvite"}},"/send-tiktok-event":{"post":{"tags":["Email & Notifications"],"summary":"SHA-256 hash function for PII data (required by TikTok Events API) TikTok requires email and phone to be lowercase, trim","description":"SHA-256 hash function for PII data (required by TikTok Events API) TikTok requires email and phone to be lowercase, trimmed, and SHA-256 hashed\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-tiktok-event","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendTiktokEvent"}},"/send-welcome-email":{"post":{"tags":["Email & Notifications"],"summary":"Send Welcome Email function.","description":"Send Welcome Email function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-welcome-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendWelcomeEmail"}},"/send-whatsapp":{"post":{"tags":["Email & Notifications"],"summary":"Secure Twilio WhatsApp sender with DND enforcement SECURITY: Restricted CORS + server-side subaccount validation","description":"Secure Twilio WhatsApp sender with DND enforcement SECURITY: Restricted CORS + server-side subaccount validation\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-whatsapp","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendWhatsapp"}},"/send-whitelabel-request":{"post":{"tags":["Email & Notifications"],"summary":"\"Book a 15-minute kickoff call\" CTA in the White Label confirmation email.","description":"\"Book a 15-minute kickoff call\" CTA in the White Label confirmation email. Kept in step with the same buttons on the White Label settings page — both are\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"send-whitelabel-request","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSendWhitelabelRequest"}},"/set-sample-listening":{"post":{"tags":["Core CRM"],"summary":"Look up workflow for ownership/membership check","description":"Look up workflow for ownership/membership check\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"set-sample-listening","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSetSampleListening"}},"/setup-agent-payment-method":{"post":{"tags":["Core CRM"],"summary":"Authenticate caller","description":"Authenticate caller\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"setup-agent-payment-method","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSetupAgentPaymentMethod"}},"/setup-whitelabel-payment-method":{"post":{"tags":["Core CRM"],"summary":"White-label subaccounts that support agent payment setup via the generalized page.","description":"White-label subaccounts that support agent payment setup via the generalized page. Add future white-label client subaccount IDs here.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"setup-whitelabel-payment-method","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSetupWhitelabelPaymentMethod"}},"/signup-guard":{"post":{"tags":["Core CRM"],"summary":"Pre-signup guard: checks IP + email against blocklists before allowing signup.","description":"Pre-signup guard: checks IP + email against blocklists before allowing signup. Also logs every attempt to signup_attempts for monitoring + auto-rolling domain blocks.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"signup-guard","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSignupGuard"}},"/soa-create-appointment":{"post":{"tags":["Core CRM"],"summary":"Creates the calendar appointment for an SOA signed IN-APP (SOAForms.tsx signs both parties directly on soa_forms, so soa","description":"Creates the calendar appointment for an SOA signed IN-APP (SOAForms.tsx signs both parties directly on soa_forms, so soa-public-sign never runs for it).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"soa-create-appointment","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSoaCreateAppointment"}},"/soa-public-sign":{"post":{"tags":["Core CRM"],"summary":"Public endpoint — no JWT required, uses token-based auth","description":"Public endpoint — no JWT required, uses token-based auth\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"soa-public-sign","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSoaPublicSign"}},"/soa-send-for-signature":{"post":{"tags":["Core CRM"],"summary":"Authenticate user","description":"Authenticate user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"soa-send-for-signature","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSoaSendForSignature"}},"/stripe-advanced-support-webhook":{"post":{"tags":["Billing & Payments"],"summary":"Helper function to send emails via Resend API (no SDK needed)","description":"Helper function to send emails via Resend API (no SDK needed)\n\n**Auth:** Stripe webhook: verified via Stripe-Signature header.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"stripe-advanced-support-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postStripeAdvancedSupportWebhook"}},"/stripe-kaleb-preview":{"post":{"tags":["Billing & Payments"],"summary":"Temporary read-only diagnostic function — see docs/client-kaleb-dodson-upgrade-button/PREVIEW_FUNCTION_TECHNICAL.md","description":"Temporary read-only diagnostic function — see docs/client-kaleb-dodson-upgrade-button/PREVIEW_FUNCTION_TECHNICAL.md\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"stripe-kaleb-preview","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postStripeKalebPreview"}},"/stripe-max-audit":{"post":{"tags":["Billing & Payments"],"summary":"Temporary read-only audit function — see docs/client-kaleb-dodson-upgrade-button/ for the Kaleb investigation that trigg","description":"Temporary read-only audit function — see docs/client-kaleb-dodson-upgrade-button/ for the Kaleb investigation that triggered this. Surveys Max-plan subscriptions\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"stripe-max-audit","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postStripeMaxAudit"}},"/stripe-trial-audit-readonly":{"post":{"tags":["Billing & Payments"],"summary":"TEMPORARY READ-ONLY audit function.","description":"TEMPORARY READ-ONLY audit function. Delete after use. Split into modes to stay under gateway timeout: ?mode=failed|trialing|descriptor\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"stripe-trial-audit-readonly","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postStripeTrialAuditReadonly"}},"/stripe-webhook":{"post":{"tags":["Billing & Payments"],"summary":"Safely convert Stripe's current_period_end (unix seconds or already a Date/string) to ISO string","description":"Safely convert Stripe's current_period_end (unix seconds or already a Date/string) to ISO string\n\n**Auth:** Stripe webhook: verified via Stripe-Signature header.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"stripe-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postStripeWebhook"}},"/subaccount-email-stats":{"post":{"tags":["Core CRM"],"summary":"User-scoped client for data queries","description":"User-scoped client for data queries\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"subaccount-email-stats","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSubaccountEmailStats"}},"/submit-website-lead":{"post":{"tags":["Core CRM"],"summary":"submit-website-lead — public (verify_jwt=false) endpoint for lead_form submissions on published websites.","description":"submit-website-lead — public (verify_jwt=false) endpoint for lead_form submissions on published websites. The owning subaccount/user is resolved server-side from the\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"submit-website-lead","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSubmitWebsiteLead"}},"/summarize-conversation":{"post":{"tags":["Core CRM"],"summary":"Format messages for the AI","description":"Format messages for the AI\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"summarize-conversation","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSummarizeConversation"}},"/support-chat":{"post":{"tags":["Core CRM"],"summary":"Screen-specific context based on current page","description":"Screen-specific context based on current page\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"support-chat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSupportChat"}},"/support-preflight-scan":{"post":{"tags":["Core CRM"],"summary":"Proactive pre-flight scan for the unLocked AI support widget.","description":"Proactive pre-flight scan for the unLocked AI support widget. Returns a small array of \"issues\" the user almost certainly wants to know\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"support-preflight-scan","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSupportPreflightScan"}},"/support-resolution-embed":{"post":{"tags":["Core CRM"],"summary":"Embeds a resolved support ticket or chat into support_resolution_kb as canonical training material for future answers.","description":"Embeds a resolved support ticket or chat into support_resolution_kb as canonical training material for future answers. Idempotent on (source_kind, source_id).\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"support-resolution-embed","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSupportResolutionEmbed"}},"/sync-ad-accounts":{"post":{"tags":["Core CRM"],"summary":"Get authenticated user","description":"Get authenticated user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-ad-accounts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncAdAccounts"}},"/sync-calendar":{"post":{"tags":["Core CRM"],"summary":"TOKEN REFRESH FUNCTIONS","description":"TOKEN REFRESH FUNCTIONS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-calendar","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncCalendar"}},"/sync-contacts":{"post":{"tags":["Core CRM"],"summary":"Create admin client for decrypting tokens","description":"Create admin client for decrypting tokens\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-contacts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncContacts"}},"/sync-facebook-forms":{"post":{"tags":["Core CRM"],"summary":"DEPRECATED — SCHEDULED FOR DELETION.","description":"DEPRECATED — SCHEDULED FOR DELETION. Do not build on this function. This is the first-generation Facebook lead-form sync, superseded by `meta-forms`\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-facebook-forms","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncFacebookForms"}},"/sync-google-contacts":{"post":{"tags":["Core CRM"],"summary":"Google Contacts IMPORTER (Google → CRM) Pulls *all* of the connected Google account's contacts via the People API:","description":"Google Contacts IMPORTER (Google → CRM) Pulls *all* of the connected Google account's contacts via the People API:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-google-contacts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncGoogleContacts"}},"/sync-licensing-by-npn":{"post":{"tags":["Core CRM"],"summary":"AWS NIPR Proxy configuration","description":"AWS NIPR Proxy configuration\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-licensing-by-npn","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncLicensingByNpn"}},"/sync-outlook-contacts":{"post":{"tags":["Core CRM"],"summary":"Outlook (Microsoft Graph) Contacts IMPORTER (Outlook → CRM) Mirrors `sync-google-contacts` for Microsoft 365 / Outlook.c","description":"Outlook (Microsoft Graph) Contacts IMPORTER (Outlook → CRM) Mirrors `sync-google-contacts` for Microsoft 365 / Outlook.com accounts.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-outlook-contacts","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncOutlookContacts"}},"/sync-pages":{"post":{"tags":["Core CRM"],"summary":"DEPRECATED for provider 'meta'.","description":"DEPRECATED for provider 'meta'. Removal checklist at the bottom of this header. This function has zero callers — it exists only as an entry in supabase/config.toml — and its\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-pages","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncPages"}},"/sync-signup-to-ghl":{"post":{"tags":["Core CRM"],"summary":"── Atomic deduplication guard ──────────────────────────────────────────── claim_ghl_sync atomically sets ghl_synced=TRU","description":"── Atomic deduplication guard ──────────────────────────────────────────── claim_ghl_sync atomically sets ghl_synced=TRUE and returns TRUE only if\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"sync-signup-to-ghl","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncSignupToGhl"}},"/sync-stripe-invoices":{"post":{"tags":["Core CRM"],"summary":"Accept subaccount_id from request body for scoped wallet lookups","description":"Accept subaccount_id from request body for scoped wallet lookups\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"sync-stripe-invoices","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSyncStripeInvoices"}},"/system-threshold-monitor":{"post":{"tags":["Core CRM"],"summary":"Auth: cron secret or JWT","description":"Auth: cron secret or JWT\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"system-threshold-monitor","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postSystemThresholdMonitor"}},"/teams-meeting-create":{"post":{"tags":["Core CRM"],"summary":"Refresh Microsoft access token","description":"Refresh Microsoft access token\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"teams-meeting-create","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTeamsMeetingCreate"}},"/teams-meeting-delete":{"post":{"tags":["Core CRM"],"summary":"Refresh Microsoft access token","description":"Refresh Microsoft access token\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"teams-meeting-delete","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTeamsMeetingDelete"}},"/teams-meeting-update":{"post":{"tags":["Core CRM"],"summary":"Refresh Microsoft access token","description":"Refresh Microsoft access token\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"teams-meeting-update","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTeamsMeetingUpdate"}},"/temp-fix-login-mj":{"post":{"tags":["Admin & Provisioning"],"summary":"One-shot admin utility — support use only.","description":"One-shot admin utility — support use only. Target: Manjinder \"MJ\" Jhamat (Raj Insurance Services)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"temp-fix-login-mj","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTempFixLoginMj"}},"/temp-set-password-brian":{"post":{"tags":["Admin & Provisioning"],"summary":"One-shot admin utility — support use only.","description":"One-shot admin utility — support use only. Target: Brian Bale (brian@tdhinsure.com -> support@tdhinsure.com)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"temp-set-password-brian","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTempSetPasswordBrian"}},"/temp-set-password-keela":{"post":{"tags":["Admin & Provisioning"],"summary":"One-shot admin utility — support use only.","description":"One-shot admin utility — support use only. Target: Kellie Solo (kellie@solowealthgroup.com)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"temp-set-password-keela","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTempSetPasswordKeela"}},"/temp-set-password-wendy":{"post":{"tags":["Admin & Provisioning"],"summary":"One-shot admin utility — support use only.","description":"One-shot admin utility — support use only. Target: Wendy Beatty (login email wendy@forefrontbrokersolutions.com)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"temp-set-password-wendy","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTempSetPasswordWendy"}},"/temp-update-email":{"post":{"tags":["Admin & Provisioning"],"summary":"Temp Update Email function.","description":"Temp Update Email function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"temp-update-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTempUpdateEmail"}},"/test-advanced-support-slack":{"post":{"tags":["Core CRM"],"summary":"Internal notification email template (to team) - Light blue branded","description":"Internal notification email template (to team) - Light blue branded\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"test-advanced-support-slack","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTestAdvancedSupportSlack"}},"/test-cancellation-drip":{"post":{"tags":["Core CRM"],"summary":"...","description":"... template helpers (same as production)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"test-cancellation-drip","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTestCancellationDrip"}},"/test-checkout-emails":{"post":{"tags":["Core CRM"],"summary":"Test Checkout Emails function.","description":"Test Checkout Emails function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"test-checkout-emails","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTestCheckoutEmails"}},"/test-resend-email":{"post":{"tags":["Core CRM"],"summary":"unLocked CRM branded email templates Primary blue: #4A9EFF (hsl 213 100% 68%)","description":"unLocked CRM branded email templates Primary blue: #4A9EFF (hsl 213 100% 68%)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"test-resend-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTestResendEmail"}},"/test-send-email":{"post":{"tags":["Core CRM"],"summary":"Fallback to env variables if database settings not available","description":"Fallback to env variables if database settings not available\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"test-send-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTestSendEmail"}},"/tiktok-backfill-leads":{"post":{"tags":["Core CRM"],"summary":"TikTok Historical Lead Backfill Edge Function Pulls historical leads from TikTok API for forms that may have missed webh","description":"TikTok Historical Lead Backfill Edge Function Pulls historical leads from TikTok API for forms that may have missed webhook deliveries\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-backfill-leads","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokBackfillLeads"}},"/tiktok-forms":{"post":{"tags":["Core CRM"],"summary":"TikTok Lead Forms Edge Function Fetches lead generation forms from TikTok Ads API","description":"TikTok Lead Forms Edge Function Fetches lead generation forms from TikTok Ads API\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-forms","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokForms"}},"/tiktok-manual-token":{"post":{"tags":["Core CRM"],"summary":"Get authenticated user","description":"Get authenticated user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-manual-token","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokManualToken"}},"/tiktok-map-fields":{"post":{"tags":["Core CRM"],"summary":"TikTok Map Fields Edge Function Saves field mappings between TikTok lead form fields and CRM fields","description":"TikTok Map Fields Edge Function Saves field mappings between TikTok lead form fields and CRM fields\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-map-fields","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokMapFields"}},"/tiktok-poll-leads":{"post":{"tags":["Core CRM"],"summary":"TikTok Poll Leads Edge Function ARCHITECTURE DOCUMENTATION (FIX 7: Internal Alignment)","description":"TikTok Poll Leads Edge Function ARCHITECTURE DOCUMENTATION (FIX 7: Internal Alignment)\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-poll-leads","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokPollLeads"}},"/tiktok-refresh-tokens":{"post":{"tags":["Core CRM"],"summary":"TikTok Refresh Tokens Edge Function Background job to refresh expiring TikTok OAuth tokens","description":"TikTok Refresh Tokens Edge Function Background job to refresh expiring TikTok OAuth tokens\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-refresh-tokens","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokRefreshTokens"}},"/tiktok-retry-leads":{"post":{"tags":["Core CRM"],"summary":"TikTok Retry Leads Edge Function Background job to retry failed lead processing","description":"TikTok Retry Leads Edge Function Background job to retry failed lead processing\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-retry-leads","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokRetryLeads"}},"/tiktok-subscribe-webhook":{"post":{"tags":["Core CRM"],"summary":"TikTok Subscribe Webhook Edge Function Subscribes to TikTok Lead Ads webhook notifications for forms","description":"TikTok Subscribe Webhook Edge Function Subscribes to TikTok Lead Ads webhook notifications for forms\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"tiktok-subscribe-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokSubscribeWebhook"}},"/tiktok-sync-forms":{"post":{"tags":["Core CRM"],"summary":"TikTok Sync Forms Edge Function Background job to sync ad accounts nightly","description":"TikTok Sync Forms Edge Function Background job to sync ad accounts nightly\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"tiktok-sync-forms","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokSyncForms"}},"/tiktok-webhook":{"post":{"tags":["Core CRM"],"summary":"TikTok Webhook Edge Function Receives lead notifications from TikTok Lead Ads","description":"TikTok Webhook Edge Function Receives lead notifications from TikTok Lead Ads\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"tiktok-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTiktokWebhook"},"get":{"tags":["Core CRM"],"summary":"TikTok Webhook Edge Function Receives lead notifications from TikTok Lead Ads","description":"TikTok Webhook Edge Function Receives lead notifications from TikTok Lead Ads\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"tiktok-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getTiktokWebhook"}},"/track-quote-open":{"post":{"tags":["Core CRM"],"summary":"Public open-tracking endpoint for quote emails.","description":"Public open-tracking endpoint for quote emails. Returns a 1x1 transparent GIF and records an open event in `quote_opens`. Designed to be loaded as\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"track-quote-open","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTrackQuoteOpen"}},"/transcribe-agent-ai-call":{"post":{"tags":["Core CRM"],"summary":"Process base64 in chunks to prevent memory issues","description":"Process base64 in chunks to prevent memory issues\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"transcribe-agent-ai-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTranscribeAgentAiCall"}},"/transcribe-call":{"post":{"tags":["Core CRM"],"summary":"Process base64 in chunks to prevent memory issues","description":"Process base64 in chunks to prevent memory issues\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"transcribe-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTranscribeCall"}},"/transcribe-voice":{"post":{"tags":["Core CRM"],"summary":"Transcribe audio using Wispr Flow REST API Expects base64-encoded 16kHz PCM WAV audio","description":"Transcribe audio using Wispr Flow REST API Expects base64-encoded 16kHz PCM WAV audio\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"transcribe-voice","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTranscribeVoice"}},"/trigger-auto-recharge":{"post":{"tags":["Billing & Payments"],"summary":"Recharge tiers for smart adjustment","description":"Recharge tiers for smart adjustment\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"trigger-auto-recharge","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTriggerAutoRecharge"}},"/trigger-day0-onboarding":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Triggers Day 0 onboarding emails with staggered delays: - day0_welcome: immediately","description":"Triggers Day 0 onboarding emails with staggered delays: - day0_welcome: immediately\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"trigger-day0-onboarding","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTriggerDay0Onboarding"}},"/trigger-link-click":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Public endpoint hit when the React route /l/:slug loads.","description":"Public endpoint hit when the React route /l/:slug loads. Records the click, fires trigger-workflow with triggerType='trigger_link_clicked' so any paused\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"trigger-link-click","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTriggerLinkClick"}},"/trigger-workflow":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"BOOKING LINK SAFEGUARD When a user has no active booking link, {{booking_link}}, {{user.calendar_link}},","description":"BOOKING LINK SAFEGUARD When a user has no active booking link, {{booking_link}}, {{user.calendar_link}},\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"trigger-workflow","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTriggerWorkflow"}},"/twilio-a2p-registration":{"post":{"tags":["Telephony & Messaging"],"summary":"Get authenticated user","description":"Get authenticated user\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-a2p-registration","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioA2pRegistration"}},"/twilio-call-queue":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Call Queue Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed queue requests.","description":"Twilio Call Queue Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed queue requests.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-call-queue","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioCallQueue"}},"/twilio-caller-id":{"post":{"tags":["Telephony & Messaging"],"summary":"Initialize Supabase with user's auth","description":"Initialize Supabase with user's auth\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"twilio-caller-id","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioCallerId"}},"/twilio-campaign-chime":{"post":{"tags":["Telephony & Messaging"],"summary":"Validate Twilio signature","description":"Validate Twilio signature\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-campaign-chime","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioCampaignChime"}},"/twilio-conference-manage":{"post":{"tags":["Telephony & Messaging"],"summary":"Create a conference record in the database.","description":"Create a conference record in the database. The actual Twilio Conference is created when the first participant joins via TwiML.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-conference-manage","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioConferenceManage"}},"/twilio-conference-status":{"post":{"tags":["Telephony & Messaging"],"summary":"Terminal call_conferences statuses that must never be revived or overwritten.","description":"Terminal call_conferences statuses that must never be revived or overwritten.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-conference-status","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioConferenceStatus"}},"/twilio-dial-complete":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio <Dial> action handler — terminates the parent call when the browser <Client> leg ends.","description":"Twilio <Dial> action handler — terminates the parent call when the browser <Client> leg ends.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-dial-complete","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioDialComplete"}},"/twilio-end-call":{"post":{"tags":["Telephony & Messaging"],"summary":"End/Hang-up a Twilio Call Uses Twilio's Update Call API to terminate an in-progress call.","description":"End/Hang-up a Twilio Call Uses Twilio's Update Call API to terminate an in-progress call.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"twilio-end-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioEndCall"}},"/twilio-hold-call":{"post":{"tags":["Telephony & Messaging"],"summary":"Hold music options","description":"Hold music options\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"twilio-hold-call","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioHoldCall"}},"/twilio-inbound-sms":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Inbound SMS Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed inbound messages.","description":"Twilio Inbound SMS Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed inbound messages.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-inbound-sms","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioInboundSms"}},"/twilio-incoming-call":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Incoming Call Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed webhook attacks.","description":"Twilio Incoming Call Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed webhook attacks.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-incoming-call","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioIncomingCall"}},"/twilio-phone-numbers":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Phone Number Management Handles search, purchase (with correct webhook configuration), and release","description":"Twilio Phone Number Management Handles search, purchase (with correct webhook configuration), and release\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-phone-numbers","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioPhoneNumbers"}},"/twilio-ring-group":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Ring Group Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed routing requests.","description":"Twilio Ring Group Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed routing requests.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-ring-group","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioRingGroup"}},"/twilio-sms-status":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio SMS Status Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed status updates.","description":"Twilio SMS Status Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed status updates.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-sms-status","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioSmsStatus"}},"/twilio-transfer-call":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Transfer Call function.","description":"Twilio Transfer Call function.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-transfer-call","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioTransferCall"}},"/twilio-trusthub-callback":{"post":{"tags":["Telephony & Messaging"],"summary":"Initialize Supabase client","description":"Initialize Supabase client\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-trusthub-callback","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioTrusthubCallback"}},"/twilio-voice-app-status":{"post":{"tags":["Telephony & Messaging"],"summary":"This endpoint is safe to be auth-protected so it can't be used as a Twilio probe.","description":"This endpoint is safe to be auth-protected so it can't be used as a Twilio probe.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"twilio-voice-app-status","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoiceAppStatus"}},"/twilio-voice-status":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Voice Status Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed status callbacks.","description":"Twilio Voice Status Webhook Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed status callbacks.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-voice-status","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoiceStatus"}},"/twilio-voice-token":{"post":{"tags":["Telephony & Messaging"],"summary":"Generate Twilio Access Token for browser-based calling Manual JWT creation following Twilio's exact specification","description":"Generate Twilio Access Token for browser-based calling Manual JWT creation following Twilio's exact specification\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-voice-token","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoiceToken"}},"/twilio-voice-twiml":{"post":{"tags":["Telephony & Messaging"],"summary":"TwiML endpoint for browser-based voice calls (Twilio Client SDK) SECURITY: Validates X-Twilio-Signature to prevent spoof","description":"TwiML endpoint for browser-based voice calls (Twilio Client SDK) SECURITY: Validates X-Twilio-Signature to prevent spoofed requests\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-voice-twiml","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoiceTwiml"}},"/twilio-voicemail":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Voicemail Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed voicemail requests.","description":"Twilio Voicemail Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed voicemail requests.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-voicemail","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoicemail"}},"/twilio-voicemail-complete":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Voicemail Complete Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed recording callbacks.","description":"Twilio Voicemail Complete Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed recording callbacks.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-voicemail-complete","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoicemailComplete"}},"/twilio-voicemail-drop":{"post":{"tags":["Telephony & Messaging"],"summary":"Resolve CORS headers per-request so the preview, app.unlockedcrm.ai, and crm.awakeningfg.com origins all work (not just ","description":"Resolve CORS headers per-request so the preview, app.unlockedcrm.ai, and crm.awakeningfg.com origins all work (not just the first allowed origin).\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-voicemail-drop","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoicemailDrop"}},"/twilio-voicemail-transcription":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Voicemail Transcription Handler Called by Twilio when voicemail transcription is complete.","description":"Twilio Voicemail Transcription Handler Called by Twilio when voicemail transcription is complete.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-voicemail-transcription","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioVoicemailTranscription"}},"/twilio-whisper":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Whisper Handler - Press 1 to Accept SECURITY: Validates X-Twilio-Signature to prevent spoofed whisper requests.","description":"Twilio Whisper Handler - Press 1 to Accept SECURITY: Validates X-Twilio-Signature to prevent spoofed whisper requests.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-whisper","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioWhisper"}},"/twilio-whisper-result":{"post":{"tags":["Telephony & Messaging"],"summary":"Twilio Whisper Result Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed DTMF results.","description":"Twilio Whisper Result Handler SECURITY: Validates X-Twilio-Signature to prevent spoofed DTMF results.\n\n**Auth:** Twilio webhook receiver (X-Twilio-Signature).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"twilio-whisper-result","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postTwilioWhisperResult"}},"/underwriting-chat":{"post":{"tags":["Core CRM"],"summary":"Render ITK's real carrier read as a compact, model-readable block.","description":"Render ITK's real carrier read as a compact, model-readable block. Kept terse so it grounds the reply without dominating the prompt. The aggregator (ITK /\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"underwriting-chat","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postUnderwritingChat"}},"/unenroll-contact":{"post":{"tags":["Core CRM"],"summary":"User-invoked unenrollment of a contact from a workflow (Automation -> Enrollment).","description":"User-invoked unenrollment of a contact from a workflow (Automation -> Enrollment). The removal logic itself already existed, but only as the `remove_from_workflow`\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"unenroll-contact","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postUnenrollContact"}},"/update-auth-email":{"post":{"tags":["Core CRM"],"summary":"Verify the caller is authenticated","description":"Verify the caller is authenticated\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"update-auth-email","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postUpdateAuthEmail"}},"/update-wallet-settings":{"post":{"tags":["Core CRM"],"summary":"Authenticate user","description":"Authenticate user\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"update-wallet-settings","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postUpdateWalletSettings"}},"/validate-phone":{"post":{"tags":["Core CRM"],"summary":"Resolve who is calling, for api_usage_logs attribution.","description":"Resolve who is calling, for api_usage_logs attribution. config.toml sets verify_jwt = true for this function, so a user JWT is always\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"validate-phone","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postValidatePhone"}},"/verify-admin-access":{"post":{"tags":["Core CRM"],"summary":"Verify Admin Access Edge Function SECURITY: Admin-only endpoint with restricted CORS","description":"Verify Admin Access Edge Function SECURITY: Admin-only endpoint with restricted CORS\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"verify-admin-access","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postVerifyAdminAccess"}},"/verify-mailgun-domain":{"post":{"tags":["Core CRM"],"summary":"NOTE: wildcard CORS (same as add-mailgun-domain).","description":"NOTE: wildcard CORS (same as add-mailgun-domain). This endpoint is JWT-verified and carries no cookie credentials, so `*` is safe — and it is the only way white-label\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"verify-mailgun-domain","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postVerifyMailgunDomain"}},"/verify-recaptcha":{"post":{"tags":["Core CRM"],"summary":"Google reCAPTCHA v2 verification + site-key delivery.","description":"Google reCAPTCHA v2 verification + site-key delivery. Routes:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"verify-recaptcha","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postVerifyRecaptcha"},"get":{"tags":["Core CRM"],"summary":"Google reCAPTCHA v2 verification + site-key delivery.","description":"Google reCAPTCHA v2 verification + site-key delivery. Routes:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"verify-recaptcha","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getVerifyRecaptcha"}},"/voicemail-proxy":{"post":{"tags":["Telephony & Messaging"],"summary":"Voicemail Proxy - Serves voicemail audio files with correct Content-Type headers This edge function proxies audio files ","description":"Voicemail Proxy - Serves voicemail audio files with correct Content-Type headers This edge function proxies audio files from Supabase Storage, ensuring\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"voicemail-proxy","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postVoicemailProxy"}},"/webhook-dispatcher":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Outbound webhook dispatcher.","description":"Outbound webhook dispatcher. POST /functions/v1/webhook-dispatcher\n\n**Auth:** External webhook receiver: verified with provider signing secret.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"webhook-dispatcher","x-cron-triggered":true,"x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postWebhookDispatcher"}},"/webhook-emit":{"post":{"tags":["Core CRM"],"summary":"webhook-emit — internal helper that fans out a single webhook event to all subscribed `api_webhook_subscriptions` rows f","description":"webhook-emit — internal helper that fans out a single webhook event to all subscribed `api_webhook_subscriptions` rows for a subaccount, signs each\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"webhook-emit","x-cron-triggered":true,"x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postWebhookEmit"}},"/webhook-retry-worker":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"Webhook delivery retry worker Re-attempts failed webhook deliveries with exponential backoff:","description":"Webhook delivery retry worker Re-attempts failed webhook deliveries with exponential backoff:\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"webhook-retry-worker","x-cron-triggered":true,"x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postWebhookRetryWorker"}},"/weekly-activity-digest":{"post":{"tags":["Core CRM"],"summary":"Weekly Activity Digest function.","description":"Weekly Activity Digest function.\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"weekly-activity-digest","responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postWeeklyActivityDigest"}},"/workflow-queue-listener":{"post":{"tags":["Automation & Scheduled Jobs"],"summary":"workflow-queue-listener Event-driven workflow job processor.","description":"workflow-queue-listener Event-driven workflow job processor. Invoked by:\n\n**Auth:** Caller must be a signed-in user (Supabase JWT in Authorization: Bearer). Validated in function code.\n\n**Also invoked by pg_cron** on a schedule (internal).","security":[{"BearerAuth":[]}],"x-internal":true,"x-function-name":"workflow-queue-listener","x-cron-triggered":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postWorkflowQueueListener"}},"/zoom-create-meeting":{"post":{"tags":["Integrations & Webhooks"],"summary":"Refresh Zoom access token","description":"Refresh Zoom access token\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"zoom-create-meeting","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postZoomCreateMeeting"}},"/zoom-delete-meeting":{"post":{"tags":["Integrations & Webhooks"],"summary":"Refresh Zoom access token","description":"Refresh Zoom access token\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"zoom-delete-meeting","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postZoomDeleteMeeting"}},"/zoom-disconnect":{"post":{"tags":["Integrations & Webhooks"],"summary":"Helper: return a structured failure (success: false) with secure headers.","description":"Helper: return a structured failure (success: false) with secure headers.\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"zoom-disconnect","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postZoomDisconnect"}},"/zoom-refresh-tokens":{"post":{"tags":["Integrations & Webhooks"],"summary":"Refresh Zoom access token","description":"Refresh Zoom access token\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"zoom-refresh-tokens","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postZoomRefreshTokens"}},"/zoom-update-meeting":{"post":{"tags":["Integrations & Webhooks"],"summary":"Refresh Zoom access token","description":"Refresh Zoom access token\n\n**Auth:** External webhook/callback receiver (provider-verified or token-gated).","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"zoom-update-meeting","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postZoomUpdateMeeting"}},"/zoom-webhook":{"post":{"tags":["Integrations & Webhooks"],"summary":"Decrypt OAuth token","description":"Decrypt OAuth token\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"zoom-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"description":"Function-specific payload. This is an internal endpoint — see api.md for the auth contract; request shapes are defined by the app that calls it."}}}},"x-error-format":"application/json; envelope=error","operationId":"postZoomWebhook"},"get":{"tags":["Integrations & Webhooks"],"summary":"Decrypt OAuth token","description":"Decrypt OAuth token\n\n**Auth:** External webhook receiver: verified with provider signing secret.","security":[{"WebhookSignature":[]}],"x-internal":true,"x-function-name":"zoom-webhook","x-webhook-receiver":true,"responses":{"200":{"description":"Success (JSON body; shape is function-specific)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenericResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/RateLimited"},"500":{"$ref":"#/components/responses/ServerError"}},"x-error-format":"application/json; envelope=error","operationId":"getZoomWebhook"}}},"x-lead-field-aliases":{"income":"household_income","annual_income":"household_income","dob":"date_of_birth","zipcode":"zip_code","postal_code":"zip_code","phone_number":"phone","mobile":"phone","company":"employer","job_title":"occupation"},"x-webhook-events":["lead.created","lead.updated","lead.deleted","lead.status_changed","client.created","client.updated","task.created","task.completed","policy.created","policy.renewed","appointment.created","appointment.cancelled","activity.created","opportunity.created","opportunity.updated","opportunity.stage_changed","workflow.activated","workflow.deactivated","email_campaign.sent","email_campaign.completed","commission.created","commission.updated","sms.sent","sms.received","sms.delivered","sms.failed","quote.saved"],"x-cron-functions":["agent-ai-campaign-processor","agent-ai-elevenlabs-reconcile-stuck","agent-builtin-scheduler","agent-lead-conversion","agent-user-executor","ai-tool-drift-check","calendly-poll-sync","capability-scan","csg-eapp-sync","lead-cap-billing-trigger","meta-refresh-tokens","meta-retry-leads","notify-agency-new-signup","phone-system-alerts","process-birthday-reminders","process-booking-nudges","process-campaigns","process-custom-date-reminders","process-email-campaign-retries","process-enrollment-period","process-medicare-eligibility","process-medicare-pending-eligible","process-policy-renewal","process-scheduled-nudges","process-scheduled-opportunities","process-scheduled-quote-sends","process-single-email-queue","recover-missed-onboarding","send-affiliate-signup-notification","system-threshold-monitor","trigger-workflow","webhook-dispatcher","webhook-emit","webhook-retry-worker","workflow-queue-listener"],"x-function-count":538,"x-scopes":{"read:contacts":"Read contact records","write:contacts":"Create and update contact records","read:leads":"Read leads and pipeline records","write:leads":"Create and update leads","read:policies":"Read policy records, renewals, and lapse status","write:policies":"Create and update policy records","read:quotes":"Read quotes and comparison results","write:quotes":"Create and update quotes","read:commissions":"Read commission statements and reconciliation data","write:commissions":"Create and update commission records","read:tasks":"Read tasks and reminders","write:tasks":"Create and update tasks","read:appointments":"Read calendar appointments","write:appointments":"Create and update appointments","read:activities":"Read activity and timeline history","write:activities":"Write activity and timeline entries","read:communications":"Read calls, SMS, and email history","write:communications":"Send SMS, email, and place calls","read:agent_ai":"Read AI agent configuration and run history","write:agent_ai":"Trigger AI agent runs and update configuration"},"x-error-format":{"media_type":"application/json","envelope":"{\"error\":{\"code\",\"message\",\"status\",\"retryable\",\"resolution\"}}","html_errors":false,"description":"All non-2xx API responses are JSON with a stable `error.code`, human `error.message`, and an actionable `error.resolution`. Agents should branch on `error.code` and honor `error.retryable` / `Retry-After`.","codes":[{"code":"invalid_request","http_status":400,"meaning":"Request was malformed, missing a required parameter, or referenced an unknown resource.","resolution":"Check the `resource` query parameter and required body fields, then retry.","retryable":false},{"code":"validation_failed","http_status":422,"meaning":"One or more field values failed validation.","resolution":"Read `error.details[]` for the offending fields and correct them before retrying.","retryable":false},{"code":"unauthenticated","http_status":401,"meaning":"Missing, malformed, or expired credentials.","resolution":"Send a valid `x-api-key` header or `Authorization: Bearer <jwt>` and retry.","retryable":false},{"code":"permission_denied","http_status":403,"meaning":"The credentials are valid but lack the scope required for this operation.","resolution":"Request the scope named in `error.required_scope` (see the scopes table) and retry.","retryable":false},{"code":"not_found","http_status":404,"meaning":"The record or endpoint does not exist, or is outside the caller's workspace.","resolution":"Verify the `id` and workspace, then retry. Do not retry with the same id.","retryable":false},{"code":"conflict","http_status":409,"meaning":"The write conflicts with existing state (duplicate key, concurrent update).","resolution":"Fetch the current record, merge, and retry once.","retryable":false},{"code":"rate_limited","http_status":429,"meaning":"Rate limit exceeded (100 requests/minute per key).","resolution":"Wait the number of seconds in the `Retry-After` header, then retry with backoff.","retryable":true},{"code":"upstream_error","http_status":502,"meaning":"A downstream carrier or provider API failed.","resolution":"Retryable. Retry with exponential backoff; if it persists, contact info@unlockedcrm.ai.","retryable":true},{"code":"internal_error","http_status":500,"meaning":"Unexpected server error.","resolution":"Retryable. Retry with exponential backoff and include `error.request_id` in any support request.","retryable":true}]}}