{"openapi":"3.1.0","info":{"title":"Luca API","version":"1.0.0","description":"The Luca API is the same surface the coach dashboard runs on. Every endpoint is\nscoped to one coach, and every response is JSON.\n\n## Authentication\n\nTwo credentials work. A Better Auth session cookie (`luca.session_token`) is\nwhat the dashboard uses. An organization API key is what everything else uses.\nsend it as `x-api-key`, or as `Authorization: Bearer <key>`.\n\nThe two are not interchangeable. An API key only reaches the endpoints on the\npublished allowlist, and only with the scopes granted to that key. Endpoints\ndocumented as session-only exist for the dashboard and return 403 to a key, no\nmatter its scopes. Each operation below lists which credentials it accepts.\n\nMint and revoke keys under **API keys**. `GET /api/capabilities` returns the\nlive list of what the calling credential can reach, which is cheaper than\nprobing.\n\n## Workspaces\n\nA user in more than one workspace picks one per request with\n`x-luca-workspace-id` or `x-luca-workspace-slug`. Omit both and the request\nresolves to the caller's default workspace.\n\n## Errors\n\nEvery failure returns the same envelope, on every status:\n\n```json\n{\n  \"error\": {\n    \"code\": \"lead_not_found\",\n    \"message\": \"lead not found\",\n    \"requestId\": \"01JD…\",\n    \"details\": null\n  }\n}\n```\n\nBranch on `error.code`, never on `error.message`. The message is written for\na human and can change. Quote `requestId` in a support ticket and we can find\nthe exact request.\n\nThe statuses worth handling specifically:\n\n| Status | What it means |\n| --- | --- |\n| 401 | No usable credential. |\n| 402 | The workspace is unpaid, past due, or over its monthly message cap. |\n| 403 | The plan tier or the key's scopes do not include this endpoint. |\n| 409 | An idempotency key was reused with a different request body. |\n| 429 | Rate limited. 120 requests per coach per minute, sliding window. |\n\n## Idempotency\n\nMutations that create or launch something accept an `Idempotency-Key` header,\nand some require it. A replayed key returns the original response with\n`Idempotency-Replayed: true` instead of acting twice. Keys are held for 24\nhours.\n\n## Rate limits\n\n120 requests per coach per minute, per endpoint, on a sliding window.\n\nEvery response under `/api` carries the quota policy. Every response that\nreached the counter also carries the live state:\n\n| Header | Meaning |\n| --- | --- |\n| `RateLimit-Policy` | The quota in effect, as `\"default\";q=120;w=60`. |\n| `RateLimit` | What is left, as `\"default\";r=<remaining>;t=<seconds to reset>`. |\n| `RateLimit-Limit` | The same quota as a bare integer. |\n| `RateLimit-Remaining` | Requests left in the current window. |\n| `RateLimit-Reset` | Seconds until the current window rolls over. |\n| `Retry-After` | On a 429 only. Seconds to wait before retrying. |\n\n`RateLimit-Policy` and `RateLimit` follow the IETF RateLimit header fields\ndraft. The `-Limit`/`-Remaining`/`-Reset` triple ships alongside them because\nmost SDKs still read that spelling. A request refused before it is attributed\nto a coach, such as an unauthenticated 401, carries the policy without the live\nstate: there is no counter to report yet.\n\n`RateLimit-Reset` and `Retry-After` count the seconds left in the current\nwindow rather than a whole window, so a client that waits does not wait longer\nthan the limiter would have held it.\n\n## Webhooks\n\nSubscribe to events under **Webhooks** instead of polling.\n`GET /api/webhook-subscriptions/signature-guide` returns the signing scheme\nand a verification example.\n\n## Versioning\n\nThis is version 1 of the API. Every response carries `Luca-API-Version: 1`, and\n`info.version` in this document is the spec revision within that major version.\n\nInside a major version we only make additive changes: new endpoints, new\noptional request fields, new properties on an existing response. Treat unknown\nresponse properties as forgiving — do not fail a parse because a field you have\nnot seen appeared. Anything that would break a correct client (removing a field,\nnarrowing a type, changing a status code, tightening validation) ships as a new\nmajor version on a new path prefix, and version 1 keeps serving.\n\nSend `Luca-API-Version: 1` on a request to assert the major version you built\nagainst. Naming any other major version is refused with 400\n`unsupported_api_version`, rather than served by a version that does not match\nwhat the client expects. Omit the header and the request is served by version 1.\n\n## Deprecation\n\nA retiring endpoint is announced on the endpoint itself, so a running\nintegration finds out without anyone reading a changelog. Two response headers\ncarry it:\n\n| Header | Meaning |\n| --- | --- |\n| `Deprecation` | An HTTP date. The endpoint is deprecated as of this date and still works. |\n| `Sunset` | An HTTP date. After this the endpoint stops answering. |\n\n`Deprecation` follows RFC 9745, `Sunset` follows RFC 8594. A deprecated\noperation is also marked `deprecated: true` in this document, so a generated\nclient can surface it at build time. Watch for both headers and alert on them."},"externalDocs":{"description":"Luca developer documentation","url":"https://setluca.com/developers"},"tags":[{"name":"Capabilities","description":"What the calling credential can actually reach. Read this first. It answers the scope and plan-tier question for the current key without probing every endpoint for a 403."},{"name":"Debug","description":"Inspect how a recent inbound message moved through the pipeline. Diagnostic only, and session-only."},{"name":"Leads","description":"People who messaged the coach. A lead carries the score, stage, consents, notes, and custom fields, and is the anchor every conversation, booking, and campaign enrollment hangs off. Bulk import lives here too. Preview first, then apply."},{"name":"Conversations","description":"Message threads with a lead, across every connected channel. Sending here writes to the real channel, so an auto-send-disabled workspace should queue a draft through the review queue instead."},{"name":"Review queue","description":"Drafts waiting for the coach: approve, reject, or restore them. Luca-drafted DM replies auto-send by default, so a reply lands here when its channel is in review mode, the message is urgent, the account's health blocks sending, or the coach drafted it on demand. `explain` returns why Luca wrote what it wrote."},{"name":"Memory","description":"Durable facts Luca carries between conversations about a coach or a lead. Editing memory changes future drafts."},{"name":"Bookings","description":"Scheduled calls and their outcomes. Covers the booking record, the pre-call brief, guest links, and the outcome each call is closed with."},{"name":"Booking types","description":"The call types a coach offers: duration, attendees, and the schedule each one is bookable on."},{"name":"Booking providers","description":"Connections to Calendly, Cal.com, iClosed, GoHighLevel, or a manual link, plus the calendars and availability they expose."},{"name":"Call events","description":"What happened on a call: recording-derived summaries, feedback, CRM push, and outcome corrections."},{"name":"Campaigns","description":"Multi-step outreach a lead is enrolled into. Draft, simulate against real provider capabilities, publish, then read per-enrollment timelines."},{"name":"Broadcasts","description":"One message to a segment. Preview and approve before launch. You can pause a launched broadcast, but sent messages don't come back."},{"name":"Cadences","description":"Silent-lead rescue. Starts the follow-up sequence for leads who went quiet."},{"name":"A/B tests","description":"Split tests over drafted replies and objection handling. A winner can be adopted into the live playbook."},{"name":"Voice","description":"The voice fingerprint: the corpus of the coach's own writing that every draft is matched against. This is a visible product surface, not backend plumbing: changing it visibly changes how Luca sounds."},{"name":"Knowledge","description":"Source material Luca can cite: offers, program details, and FAQs. Suggestions are Luca proposing new knowledge it inferred; they take effect only once approved."},{"name":"Teach Luca","description":"The question-and-answer loop that fills gaps in what Luca knows about the coach's business."},{"name":"Objections","description":"The objection playbook: recurring objections and the responses that work on them."},{"name":"Learning","description":"What Luca has learned from outcomes: proposed prompt changes awaiting review, and how each sales framework is performing."},{"name":"Copilot","description":"Ask Luca, the in-app chat agent. Chats, streaming tokens, and the confirm/discard step for actions it proposes taking."},{"name":"Analytics","description":"The measurement surface: funnel, revenue, forecast, speed-to-lead, objections, call intelligence, content attribution, and cross-workspace benchmarks. Benchmarks require explicit consent."},{"name":"Insights","description":"The proactive feed. Luca surfaces something worth acting on, and the coach reads, acts on, or dismisses it."},{"name":"Reports","description":"Prepared rollups: the morning report and the scorecard."},{"name":"Audit log","description":"Who changed what, and when. Every mutation that touches coach-visible state writes a row here."},{"name":"Channels","description":"Telegram, Instagram, Messenger, and WhatsApp connections."},{"name":"Integrations","description":"The connector catalog and the integration event stream."},{"name":"CRM","description":"CRM connections: OAuth, field mappings, schema discovery, sync runs, and connection health."},{"name":"OAuth connections","description":"Third-party authorizations granted to this workspace, and revoking them."},{"name":"Webhooks","description":"Outbound event delivery. Subscribe, inspect deliveries, replay a failed one, and verify signatures with the signing guide."},{"name":"Coach profile","description":"The coach record and how they sell: niche, sales framework, objection playbook, and post-call CRM behavior."},{"name":"Onboarding","description":"First-time setup: profile, channel connection, voice corpus seeding, and preferences."},{"name":"Workspaces","description":"List the workspaces the signed-in user belongs to, and create or recover their personal workspace."},{"name":"First run","description":"The activation checklist a new coach works through, and the value it has produced so far."},{"name":"Settings","description":"Workspace behavior toggles: auto-send, multi-part drafts, the tool belt, and voice settings."},{"name":"Team members","description":"Invite people to a workspace, change their role and extra permissions, remove them, and accept or decline an invitation."},{"name":"Privacy","description":"The signed-in user's own choices: terms acceptance and the account advertising choice. API keys cannot call these routes."},{"name":"API keys","description":"Create, scope, and revoke the organization API keys this API accepts. A key is shown once, at creation."},{"name":"Mobile","description":"Push device registration and notification preferences. Notifications carry routing metadata only, never message or draft text."},{"name":"Account safety","description":"The health of a workspace's channel connections against platform rate limits and behavioral limits."},{"name":"Billing","description":"Subscription state, Stripe Checkout, the customer portal, and message top-up packs."},{"name":"Usage","description":"Month-to-date consumption against the plan's message pool and model budget."},{"name":"Cancellation","description":"The cancel flow: context, retention offer, survey, confirmation, and reactivation."}],"x-tagGroups":[{"name":"Platform","tags":["Capabilities","Debug"]},{"name":"Leads & conversations","tags":["Leads","Conversations","Review queue","Memory"]},{"name":"Booking & calls","tags":["Bookings","Booking types","Booking providers","Call events"]},{"name":"Outreach","tags":["Campaigns","Broadcasts","Cadences","A/B tests"]},{"name":"Voice & training","tags":["Voice","Knowledge","Teach Luca","Objections","Learning"]},{"name":"Ask Luca","tags":["Copilot"]},{"name":"Insights & reporting","tags":["Analytics","Insights","Reports","Audit log"]},{"name":"Channels & integrations","tags":["Channels","Integrations","CRM","OAuth connections","Webhooks"]},{"name":"Account & setup","tags":["Coach profile","Workspaces","Onboarding","First run","Settings","Team members","Privacy","API keys","Mobile","Account safety"]},{"name":"Billing","tags":["Billing","Usage","Cancellation"]}],"components":{"schemas":{"ConversationSearchResponse":{"type":"object","properties":{"hits":{"type":"array","items":{"type":"object","properties":{"messageId":{"type":"string"},"leadId":{"type":"string"},"leadName":{"type":["string","null"]},"channel":{"type":"string"},"direction":{"type":"string"},"body":{"type":"string"},"at":{"type":["string","null"]}},"required":["messageId","leadId","leadName","channel","direction","body","at"]}}},"required":["hits"]},"CopilotRecallResponse":{"type":"object","properties":{"hits":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"content":{"type":"string"},"source":{"type":"string"},"trustLevel":{"type":"string","enum":["manual","trusted_pipeline"]}},"required":["id","content","source","trustLevel"]}}},"required":["hits"]},"LeadBestSendTimeResponse":{"type":"object","properties":{"suggestedHourUtc":{"type":["integer","null"],"minimum":0,"maximum":23},"sampleSize":{"type":"integer"},"confidence":{"type":"string","enum":["none","low","medium"]},"histogram":{"type":"array","items":{"type":"object","properties":{"hourUtc":{"type":"integer"},"count":{"type":"integer"}},"required":["hourUtc","count"]}},"note":{"type":["string","null"]}},"required":["suggestedHourUtc","sampleSize","confidence","histogram","note"]},"LeadsCountResponse":{"type":"object","properties":{"count":{"type":"integer"}},"required":["count"]},"TopLeadsResponse":{"type":"object","properties":{"leads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"channel":{"type":"string"},"displayName":{"type":["string","null"]},"stage":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"score":{"type":["number","null"]},"createdAt":{"type":"string"},"lastSeenAt":{"type":["string","null"]}},"required":["id","channel","displayName","stage","tags","score","createdAt","lastSeenAt"]}}},"required":["leads"]},"FunnelInsightsResponse":{"type":"object","properties":{"outcomesByChannel":{"type":"array","items":{"type":"object","properties":{"channel":{"type":"string"},"won":{"type":"number"},"lost":{"type":"number"},"notAFit":{"type":"number"}},"required":["channel","won","lost","notAFit"]}},"objectionBuckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"count":{"type":"number"}},"required":["bucket","count"]}}},"required":["outcomesByChannel","objectionBuckets"]},"VoiceSignalsResponse":{"type":"object","properties":{"signalCounts":{"type":"object","properties":{"approved":{"type":"integer"},"edited":{"type":"integer"},"rejected":{"type":"integer"}},"required":["approved","edited","rejected"]},"avgEditDistance":{"type":["number","null"]},"recentVoiceCorpus":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"source":{"type":"string"},"content":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","source","content","createdAt"]}}},"required":["signalCounts","avgEditDistance","recentVoiceCorpus"]},"VoiceEditDistanceResponse":{"type":"object","properties":{"sampleSize":{"type":"integer"},"avgDistance":{"type":["number","null"]},"medianDistance":{"type":["number","null"]},"p90Distance":{"type":["number","null"]},"windowDays":{"type":"integer"}},"required":["sampleSize","avgDistance","medianDistance","p90Distance","windowDays"]},"VoiceHeavyEditsResponse":{"type":"object","properties":{"heavyEdits":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"reviewQueueId":{"type":["string","null"]},"editDistance":{"type":["number","null"]},"draftBody":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","reviewQueueId","editDistance","draftBody","createdAt"]}}},"required":["heavyEdits"]},"BookingCapabilitiesResponse":{"type":"object","properties":{"capabilities":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string"},"operations":{"type":"array","items":{"type":"object","properties":{"operation":{"type":"string"},"support":{"type":"string","enum":["direct","handoff","unsupported"]}},"required":["operation","support"]}},"editableFields":{"type":"array","items":{"type":"string"}}},"required":["provider","operations","editableFields"]}}},"required":["capabilities"]},"ReplyRewriteResponse":{"type":"object","properties":{"reviewItemId":{"type":"string"},"leadId":{"type":"string"},"originalBody":{"type":"string"},"proposedBody":{"type":"string"},"voiceMatch":{"type":"number"},"criticFlags":{"type":"array","items":{"type":"string"}}},"required":["reviewItemId","leadId","originalBody","proposedBody","voiceMatch","criticFlags"]},"ReplyRewriteRequest":{"type":"object","properties":{"reviewItemId":{"type":"string","format":"uuid"},"instruction":{"type":"string","minLength":1,"maxLength":500}},"required":["reviewItemId","instruction"]},"AbTestListResponse":{"type":"object","properties":{"tests":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","running","paused","completed","archived"]},"testType":{"type":"string","enum":["message_copy","objection_strategy","tone","opening","cta_type","offer_presentation","voice_vs_text","sales_framework","multi_stage"]},"variantA":{"type":"object","properties":{"frameworkId":{"type":"string"},"objectionType":{"type":"string"},"strategy":{"type":"string"}},"additionalProperties":{}},"variantB":{"type":"object","properties":{"frameworkId":{"type":"string"},"objectionType":{"type":"string"},"strategy":{"type":"string"}},"additionalProperties":{}},"trafficSplit":{"type":"integer"},"successMetric":{"type":"string","enum":["call_booked","lead_replied","lead_qualified","ghost_rate","crm_deal_won"]},"minSampleSize":{"type":"integer"},"maxDurationDays":{"type":"integer"},"winner":{"type":["string","null"],"enum":["a","b","none",null]},"startedAt":{"type":["string","null"]},"completedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","coachId","name","description","status","testType","variantA","variantB","trafficSplit","successMetric","minSampleSize","maxDurationDays","winner","startedAt","completedAt","createdAt","updatedAt"]}}},"required":["tests"]},"AbTest":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","running","paused","completed","archived"]},"testType":{"type":"string","enum":["message_copy","objection_strategy","tone","opening","cta_type","offer_presentation","voice_vs_text","sales_framework","multi_stage"]},"variantA":{"type":"object","properties":{"frameworkId":{"type":"string"},"objectionType":{"type":"string"},"strategy":{"type":"string"}},"additionalProperties":{}},"variantB":{"type":"object","properties":{"frameworkId":{"type":"string"},"objectionType":{"type":"string"},"strategy":{"type":"string"}},"additionalProperties":{}},"trafficSplit":{"type":"integer"},"successMetric":{"type":"string","enum":["call_booked","lead_replied","lead_qualified","ghost_rate","crm_deal_won"]},"minSampleSize":{"type":"integer"},"maxDurationDays":{"type":"integer"},"winner":{"type":["string","null"],"enum":["a","b","none",null]},"startedAt":{"type":["string","null"]},"completedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","coachId","name","description","status","testType","variantA","variantB","trafficSplit","successMetric","minSampleSize","maxDurationDays","winner","startedAt","completedAt","createdAt","updatedAt"]},"CreateAbTestRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"variantAFrameworkId":{"type":"string","enum":["sandler","spin","challenger","nepq","gap","straight_line","consultative","solution","value","inbound"]},"variantBFrameworkId":{"type":"string","enum":["sandler","spin","challenger","nepq","gap","straight_line","consultative","solution","value","inbound"]},"successMetric":{"type":"string","enum":["call_booked","lead_replied","lead_qualified","crm_deal_won"],"default":"call_booked"},"trafficSplit":{"type":"integer","minimum":1,"maximum":99,"default":50},"minSampleSize":{"type":"integer","minimum":30,"maximum":100000,"default":50},"maxDurationDays":{"type":"integer","minimum":1,"maximum":365,"default":14},"start":{"type":"boolean","default":false}},"required":["name","variantAFrameworkId","variantBFrameworkId"]},"CreateObjectionAbTestRequest":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","maxLength":500},"objectionType":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"variantAStrategy":{"type":"string","minLength":1,"maxLength":600},"variantBStrategy":{"type":"string","minLength":1,"maxLength":600},"successMetric":{"type":"string","enum":["call_booked","lead_replied","lead_qualified","crm_deal_won"],"default":"call_booked"},"trafficSplit":{"type":"integer","minimum":1,"maximum":99,"default":50},"minSampleSize":{"type":"integer","minimum":30,"maximum":100000,"default":50},"maxDurationDays":{"type":"integer","minimum":1,"maximum":365,"default":14},"start":{"type":"boolean","default":false}},"required":["name","objectionType","variantAStrategy","variantBStrategy"]},"AbTestDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","running","paused","completed","archived"]},"testType":{"type":"string","enum":["message_copy","objection_strategy","tone","opening","cta_type","offer_presentation","voice_vs_text","sales_framework","multi_stage"]},"variantA":{"type":"object","properties":{"frameworkId":{"type":"string"},"objectionType":{"type":"string"},"strategy":{"type":"string"}},"additionalProperties":{}},"variantB":{"type":"object","properties":{"frameworkId":{"type":"string"},"objectionType":{"type":"string"},"strategy":{"type":"string"}},"additionalProperties":{}},"trafficSplit":{"type":"integer"},"successMetric":{"type":"string","enum":["call_booked","lead_replied","lead_qualified","ghost_rate","crm_deal_won"]},"minSampleSize":{"type":"integer"},"maxDurationDays":{"type":"integer"},"winner":{"type":["string","null"],"enum":["a","b","none",null]},"startedAt":{"type":["string","null"]},"completedAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"variantStats":{"type":"array","items":{"type":"object","properties":{"variant":{"type":"string","enum":["a","b"]},"total":{"type":"integer"},"byMetric":{"type":"object","properties":{"lead_replied":{"type":"integer"},"lead_qualified":{"type":"integer"},"call_booked":{"type":"integer"},"call_showed":{"type":"integer"},"deal_won":{"type":"integer"}},"required":["lead_replied","lead_qualified","call_booked","call_showed","deal_won"]}},"required":["variant","total","byMetric"]}}},"required":["id","coachId","name","description","status","testType","variantA","variantB","trafficSplit","successMetric","minSampleSize","maxDurationDays","winner","startedAt","completedAt","createdAt","updatedAt","variantStats"]},"AdoptAbTestResponse":{"type":"object","properties":{"adopted":{"type":"boolean"},"frameworkId":{"type":"string"}},"required":["adopted"]},"FrameworkPerformanceResponse":{"type":"object","properties":{"frameworkId":{"type":["string","null"]},"window":{"type":"object","properties":{"days":{"type":"number"}},"required":["days"]},"byObjection":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string"},"won":{"type":"number"},"lost":{"type":"number"},"notAFit":{"type":"number"},"total":{"type":"number"},"winRate":{"type":"number"}},"required":["bucket","won","lost","notAFit","total","winRate"]}}},"required":["frameworkId","window","byObjection"]},"LearningProposalsResponse":{"type":"object","properties":{"insights":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventType":{"type":"string"},"eventData":{"type":"object","additionalProperties":{}},"createdAt":{"type":"string"},"dismissed":{"type":"boolean"}},"required":["id","eventType","eventData","createdAt","dismissed"]}}},"required":["insights"]},"DismissLearningProposalResponse":{"type":"object","properties":{"dismissed":{"type":"boolean"}},"required":["dismissed"]},"CoachProfileResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"email":{"type":"string"},"timezone":{"type":"string"},"businessHours":{"type":"object","properties":{"mon":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"tue":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"wed":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"thu":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"fri":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sat":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sun":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]}},"required":["mon","tue","wed","thu","fri","sat","sun"]},"toneSlider":{"type":"integer"},"integrations":{"type":"object","properties":{"calendlyConnected":{"type":"boolean"}},"required":["calendlyConnected"]},"autoSendEnabled":{"type":"boolean"},"toolBeltEnabled":{"type":["boolean","null"]},"multiPartDraftsEnabled":{"type":["boolean","null"]},"onboardingCompletedAt":{"type":["string","null"]},"planTier":{"type":"string"},"planStatus":{"type":"string"},"voiceFingerprintVersion":{"type":"integer"}},"required":["id","name","email","timezone","businessHours","toneSlider","integrations","autoSendEnabled","toolBeltEnabled","multiPartDraftsEnabled","onboardingCompletedAt","planTier","planStatus","voiceFingerprintVersion"]},"CoachProfileUpdateResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"timezone":{"type":"string"},"businessHours":{"anyOf":[{"type":"object","properties":{"mon":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"tue":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"wed":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"thu":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"fri":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sat":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sun":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]}},"required":["mon","tue","wed","thu","fri","sat","sun"]},{"type":"object","properties":{"tz":{"type":"string","minLength":1},"days":{"type":"object","properties":{"mon":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"tue":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"wed":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"thu":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"fri":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sat":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sun":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]}},"required":["mon","tue","wed","thu","fri","sat","sun"]}},"required":["tz","days"]}]},"toneSlider":{"type":"integer"}},"required":["id","name","timezone","businessHours","toneSlider"]},"CoachProfilePatch":{"type":"object","properties":{"name":{"type":"string","minLength":1},"timezone":{"type":"string","minLength":1},"businessHours":{"type":"object","properties":{"tz":{"type":"string","minLength":1},"days":{"type":"object","properties":{"mon":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"tue":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"wed":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"thu":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"fri":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sat":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]},"sun":{"anyOf":[{"type":"null"},{"type":"object","properties":{"start":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"},"end":{"type":"string","pattern":"^(?:[01]\\d|2[0-3]):[0-5]\\d$"}},"required":["start","end"]}]}},"required":["mon","tue","wed","thu","fri","sat","sun"]}},"required":["tz","days"]},"toneSlider":{"type":"integer","minimum":0,"maximum":100}}},"CoachProfile":{"type":"object","properties":{"niche":{"type":"string","maxLength":200,"default":""},"audience":{"type":"string","maxLength":400,"default":""},"offer":{"type":"string","maxLength":600,"default":""},"priceRange":{"type":"string","maxLength":120},"outcomes":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"disqualifiers":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"faqs":{"type":"array","items":{"type":"object","properties":{"q":{"type":"string","minLength":1,"maxLength":200},"a":{"type":"string","minLength":1,"maxLength":600}},"required":["q","a"]},"maxItems":20},"callToAction":{"type":"string","maxLength":120,"default":""},"bookingUrl":{"type":["string","null"],"maxLength":500,"format":"uri"},"callMinutes":{"type":["integer","null"],"minimum":5,"maximum":240},"sensitivity":{"type":"string","enum":["standard","health","emotional","income"]},"offers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","minLength":1,"maxLength":600},"price":{"type":"string","maxLength":120},"paymentPlans":{"type":"array","items":{"type":"string","maxLength":120},"maxItems":6},"format":{"type":"string","maxLength":200},"duration":{"type":"string","maxLength":120},"amount":{"type":"number","exclusiveMinimum":0,"maximum":1000000},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"weeks":{"type":"integer","minimum":1,"maximum":260},"included":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12}},"required":["name","description"]},"maxItems":6},"testimonials":{"type":"array","items":{"type":"object","properties":{"quote":{"type":"string","minLength":1,"maxLength":400},"attribution":{"type":"string","maxLength":200}},"required":["quote"]},"maxItems":8},"guarantees":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":4},"objections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string","minLength":1,"maxLength":200},"response":{"type":"string","minLength":1,"maxLength":600}},"required":["objection","response"]},"maxItems":3},"toneBoundaries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5},"sellFramework":{"type":"object","properties":{"id":{"type":"string","enum":["sandler","spin","challenger","nepq","gap","straight_line","consultative","solution","value","inbound","custom"]},"overrides":{"type":"array","items":{"type":"object","properties":{"stageName":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","maxLength":300},"drafterRules":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":12},"disallow":{"type":"array","items":{"type":"string","maxLength":60},"maxItems":8},"nextStageTrigger":{"type":"string","maxLength":300}},"required":["stageName"]},"maxItems":20},"customStages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","minLength":1,"maxLength":300},"signals":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":12,"default":[]},"drafterRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]},"nextStageTrigger":{"type":"string","minLength":1,"maxLength":300},"disallow":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":8}},"required":["name","goal","nextStageTrigger"]},"maxItems":20},"customGuidance":{"type":"string","maxLength":2000},"objectionPriorityOverride":{"type":"array","items":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"maxItems":6}},"required":["id"]},"languages":{"type":"array","items":{"type":"string","enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th"]},"maxItems":16},"defaultLanguage":{"type":["string","null"],"enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th",null]}}},"CoachNicheProfileUpdate":{"type":"object","properties":{"niche":{"type":"string","maxLength":200,"default":""},"audience":{"type":"string","maxLength":400,"default":""},"offer":{"type":"string","maxLength":600,"default":""},"priceRange":{"type":"string","maxLength":120},"outcomes":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"disqualifiers":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"faqs":{"type":"array","items":{"type":"object","properties":{"q":{"type":"string","minLength":1,"maxLength":200},"a":{"type":"string","minLength":1,"maxLength":600}},"required":["q","a"]},"maxItems":20},"callToAction":{"type":"string","maxLength":120,"default":""},"bookingUrl":{"type":["string","null"],"maxLength":500,"format":"uri"},"callMinutes":{"type":["integer","null"],"minimum":5,"maximum":240},"sensitivity":{"type":"string","enum":["standard","health","emotional","income"]},"offers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","minLength":1,"maxLength":600},"price":{"type":"string","maxLength":120},"paymentPlans":{"type":"array","items":{"type":"string","maxLength":120},"maxItems":6},"format":{"type":"string","maxLength":200},"duration":{"type":"string","maxLength":120},"amount":{"type":"number","exclusiveMinimum":0,"maximum":1000000},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"weeks":{"type":"integer","minimum":1,"maximum":260},"included":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12}},"required":["name","description"]},"maxItems":6},"testimonials":{"type":"array","items":{"type":"object","properties":{"quote":{"type":"string","minLength":1,"maxLength":400},"attribution":{"type":"string","maxLength":200}},"required":["quote"]},"maxItems":8},"guarantees":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":4},"objections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string","minLength":1,"maxLength":200},"response":{"type":"string","minLength":1,"maxLength":600}},"required":["objection","response"]},"maxItems":3},"toneBoundaries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5},"sellFramework":{"type":"object","properties":{"id":{"type":"string","enum":["sandler","spin","challenger","nepq","gap","straight_line","consultative","solution","value","inbound","custom"]},"overrides":{"type":"array","items":{"type":"object","properties":{"stageName":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","maxLength":300},"drafterRules":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":12},"disallow":{"type":"array","items":{"type":"string","maxLength":60},"maxItems":8},"nextStageTrigger":{"type":"string","maxLength":300}},"required":["stageName"]},"maxItems":20},"customStages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","minLength":1,"maxLength":300},"signals":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":12,"default":[]},"drafterRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]},"nextStageTrigger":{"type":"string","minLength":1,"maxLength":300},"disallow":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":8}},"required":["name","goal","nextStageTrigger"]},"maxItems":20},"customGuidance":{"type":"string","maxLength":2000},"objectionPriorityOverride":{"type":"array","items":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"maxItems":6}},"required":["id"]},"languages":{"type":"array","items":{"type":"string","enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th"]},"maxItems":16},"defaultLanguage":{"type":["string","null"],"enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th",null]},"expectedUpdatedAt":{"type":"string","format":"date-time"}}},"CoachNicheSetting":{"type":"object","properties":{"niche":{"type":["string","null"],"enum":["fitness","nutrition","weight_loss","strength","business","marketing","sales","finance","career","life","mindset","relationship","dating","spirituality","health","wellness","beauty","other",null]}},"required":["niche"]},"SellFrameworkUpdate":{"type":"object","properties":{"sellFramework":{"type":["object","null"],"properties":{"id":{"type":"string","enum":["sandler","spin","challenger","nepq","gap","straight_line","consultative","solution","value","inbound","custom"]},"overrides":{"type":"array","items":{"type":"object","properties":{"stageName":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","maxLength":300},"drafterRules":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":12},"disallow":{"type":"array","items":{"type":"string","maxLength":60},"maxItems":8},"nextStageTrigger":{"type":"string","maxLength":300}},"required":["stageName"]},"maxItems":20},"customStages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","minLength":1,"maxLength":300},"signals":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":12,"default":[]},"drafterRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]},"nextStageTrigger":{"type":"string","minLength":1,"maxLength":300},"disallow":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":8}},"required":["name","goal","nextStageTrigger"]},"maxItems":20},"customGuidance":{"type":"string","maxLength":2000},"objectionPriorityOverride":{"type":"array","items":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"maxItems":6}},"required":["id"]}},"required":["sellFramework"]},"ExtractFrameworkResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"stages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","minLength":1,"maxLength":300},"signals":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":12,"default":[]},"drafterRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]},"nextStageTrigger":{"type":"string","minLength":1,"maxLength":300},"disallow":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":8}},"required":["name","goal","nextStageTrigger"]}},"message":{"type":"string"}},"required":["ok","stages"]},"ExtractFrameworkRequest":{"type":"object","properties":{"description":{"type":"string","minLength":1,"maxLength":2000}},"required":["description"]},"ObjectionPlaybook":{"type":"object","properties":{"overrides":{"type":"object","properties":{"price":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"timing":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"trust":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"fit":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"authority":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"smokescreen":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}}},"default":{}},"socialProofSources":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"importedPatterns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"objectionType":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"pattern":{"type":"string","maxLength":400},"sampleResponse":{"type":"string","maxLength":600},"confidence":{"type":"number","minimum":0,"maximum":1},"sourceCount":{"type":"integer","minimum":0},"adopted":{"type":"boolean","default":false}},"required":["id","objectionType","pattern","sampleResponse","confidence","sourceCount"]},"maxItems":60,"default":[]}}},"PostCallSettings":{"type":"object","properties":{"remindersEnabled":{"type":"boolean","default":true},"attendancePushEnabled":{"type":"boolean","default":true},"attendanceEmailEnabled":{"type":"boolean","default":false},"autoGenerateSummary":{"type":"boolean","default":true},"crmSyncEnabled":{"type":"boolean","default":true},"summaryDetailLevel":{"type":"string","enum":["full","brief","crm_only"],"default":"full"},"autoNoShowRescue":{"type":"boolean","default":true},"autoFollowUpDraft":{"type":"boolean","default":true}}},"PostCallCrmMappingRead":{"type":"object","properties":{"contactNote":{"type":"boolean","default":true},"customFieldKey":{"type":["string","null"],"maxLength":200,"default":null},"connected":{"type":"boolean"}},"required":["connected"]},"PostCallCrmMapping":{"type":"object","properties":{"contactNote":{"type":"boolean","default":true},"customFieldKey":{"type":["string","null"],"maxLength":200,"default":null}}},"PostCallDealSyncRead":{"type":"object","properties":{"enabled":{"type":"boolean","default":false},"associateNote":{"type":"boolean","default":true},"stageMapping":{"type":"object","properties":{"won":{"type":["string","null"],"maxLength":200,"default":null},"lost":{"type":["string","null"],"maxLength":200,"default":null},"not_a_fit":{"type":["string","null"],"maxLength":200,"default":null}},"default":{"won":null,"lost":null,"not_a_fit":null}},"connected":{"type":"boolean"}},"required":["connected"]},"PostCallDealSync":{"type":"object","properties":{"enabled":{"type":"boolean","default":false},"associateNote":{"type":"boolean","default":true},"stageMapping":{"type":"object","properties":{"won":{"type":["string","null"],"maxLength":200,"default":null},"lost":{"type":["string","null"],"maxLength":200,"default":null},"not_a_fit":{"type":["string","null"],"maxLength":200,"default":null}},"default":{"won":null,"lost":null,"not_a_fit":null}}}},"CallIntelligenceResponse":{"type":"object","properties":{"totalCalls":{"type":"number"},"completed":{"type":"number"},"noShows":{"type":"number"},"rescheduled":{"type":"number"},"cancelled":{"type":"number"},"showRate":{"type":["number","null"]},"previousShowRate":{"type":["number","null"]},"avgRating":{"type":["number","null"]},"won":{"type":"number"},"lost":{"type":"number"},"notAFit":{"type":"number"},"closeRate":{"type":["number","null"]},"previousCloseRate":{"type":["number","null"]},"avgCallToCloseHours":{"type":["number","null"]},"ratingDistribution":{"type":"array","items":{"type":"object","properties":{"rating":{"type":"number"},"count":{"type":"number"}},"required":["rating","count"]}},"multiCallLeadCount":{"type":"number"},"byDayOfWeek":{"type":"array","items":{"type":"object","properties":{"dow":{"type":"number"},"total":{"type":"number"},"showRate":{"type":["number","null"]}},"required":["dow","total","showRate"]}},"bySequence":{"type":"array","items":{"type":"object","properties":{"sequence":{"type":"number"},"total":{"type":"number"},"showRate":{"type":["number","null"]}},"required":["sequence","total","showRate"]}},"surprisePatterns":{"type":"array","items":{"type":"object","properties":{"pattern":{"type":"string"},"count":{"type":"number"}},"required":["pattern","count"]},"x-luca-sensitive":"empty"}},"required":["totalCalls","completed","noShows","rescheduled","cancelled","showRate","previousShowRate","avgRating","won","lost","notAFit","closeRate","previousCloseRate","avgCallToCloseHours","ratingDistribution","multiCallLeadCount","byDayOfWeek","bySequence","surprisePatterns"]},"RecentCallSummariesResponse":{"type":"object","properties":{"calls":{"type":"array","items":{"type":"object","properties":{"callEventId":{"type":"string"},"leadName":{"type":["string","null"],"x-luca-sensitive":"null"},"outcome":{"type":["string","null"],"enum":["completed","no_show","rescheduled","cancelled",null]},"coachRating":{"type":["number","null"]},"completedAt":{"type":["string","null"]},"summary":{"type":["string","null"],"x-luca-sensitive":"null"},"summarySource":{"type":["string","null"],"enum":["auto","coach_triggered","coach_edited","provider",null]}},"required":["callEventId","leadName","outcome","coachRating","completedAt","summary","summarySource"]}}},"required":["calls"]},"LearningInsightsResponse":{"type":"object","properties":{"totalSignals":{"type":"number"},"appliedSignals":{"type":"number"},"pendingSignals":{"type":"number"},"byType":{"type":"object","properties":{"qualification":{"type":"number"},"objectionHandling":{"type":"number"},"leadQuality":{"type":"number"},"general":{"type":"number"}},"required":["qualification","objectionHandling","leadQuality","general"]},"recentExamples":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string","enum":["qualification","objection_handling","lead_quality","general"]},"note":{"type":["string","null"],"x-luca-sensitive":"null"},"applied":{"type":"boolean"},"createdAt":{"type":"string","format":"date-time"}},"required":["type","note","applied","createdAt"]}}},"required":["totalSignals","appliedSignals","pendingSignals","byType","recentExamples"]},"CrmSyncHealthResponse":{"type":"object","properties":{"total":{"type":"number"},"synced":{"type":"number"},"pending":{"type":"number"},"localOnly":{"type":"number"},"failed":{"type":"number"},"permanentlyFailed":{"type":"number"}},"required":["total","synced","pending","localOnly","failed","permanentlyFailed"]},"AnalyticsContextResponse":{"type":"object","properties":{"user":{"type":"object","properties":{"id":{"type":"string"},"emailVerified":{"type":"boolean"},"createdAt":{"type":["string","null"]}},"required":["id","emailVerified","createdAt"]},"organization":{"type":["object","null"],"properties":{"id":{"type":"string"},"slug":{"type":"string"},"createdAt":{"type":["string","null"]}},"required":["id","slug","createdAt"]},"workspace":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":["string","null"]},"slug":{"type":["string","null"]},"planTier":{"type":"string"},"planStatus":{"type":"string"},"onboardingCompleted":{"type":"boolean"},"onboardingCompletedAt":{"type":["string","null"]},"autoSendEnabled":{"type":"boolean"},"voiceFingerprintVersion":{"type":"integer"},"createdAt":{"type":["string","null"]},"activationStage":{"type":"string","enum":["not_started","started","channel_connected","voice_samples_added","preferences_saved","onboarded","first_value"]},"activatedAt":{"type":["string","null"]},"daysToActivation":{"type":["integer","null"]},"adoptedFeatureCount":{"type":"integer"},"lastSemanticEventAt":{"type":["string","null"]},"weeklyActive":{"type":"boolean"}},"required":["id","organizationId","slug","planTier","planStatus","onboardingCompleted","onboardingCompletedAt","autoSendEnabled","voiceFingerprintVersion","createdAt","activationStage","activatedAt","daysToActivation","adoptedFeatureCount","lastSemanticEventAt","weeklyActive"]},"membership":{"type":["object","null"],"properties":{"role":{"type":"string"}},"required":["role"]}},"required":["user","organization","workspace","membership"]},"AnalyticsFunnelResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"channel":{"type":["string","null"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"stages":{"type":"array","items":{"type":"object","properties":{"state":{"type":"string"},"leadCount":{"type":"integer"}},"required":["state","leadCount"]}},"previousWindow":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"previousStages":{"type":"array","items":{"type":"object","properties":{"state":{"type":"string"},"leadCount":{"type":"integer"}},"required":["state","leadCount"]}}},"required":["period","channel","window","stages","previousWindow","previousStages"]},"AnalyticsRevenueResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"channel":{"type":["string","null"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"totalCents":{"type":"integer"},"byChannel":{"type":"array","items":{"type":"object","properties":{"channel":{"type":"string"},"cents":{"type":"integer"}},"required":["channel","cents"]}},"previousWindow":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"previousTotalCents":{"type":"integer"},"roi":{"type":"object","properties":{"planTier":{"type":"string"},"planPriceCents":{"type":"integer"},"multiple":{"type":"number"}},"required":["planTier","planPriceCents","multiple"]}},"required":["period","channel","window","totalCents","byChannel","previousWindow","previousTotalCents","roi"]},"AnalyticsSpeedImpactResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"channel":{"type":["string","null"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"insufficientData":{"type":"boolean"},"sampleSize":{"type":"integer"},"fastThresholdSeconds":{"type":"integer"},"fast":{"type":"object","properties":{"count":{"type":"integer"},"bookedCount":{"type":"integer"},"bookingRate":{"type":["number","null"]}},"required":["count","bookedCount","bookingRate"]},"slow":{"type":"object","properties":{"count":{"type":"integer"},"bookedCount":{"type":"integer"},"bookingRate":{"type":["number","null"]}},"required":["count","bookedCount","bookingRate"]},"bestReplyHourLocal":{"type":["integer","null"]},"lostBookingsEstimate":{"type":"integer"}},"required":["period","channel","window","insufficientData","sampleSize","fastThresholdSeconds","fast","slow","bestReplyHourLocal","lostBookingsEstimate"]},"AnalyticsForecastResponse":{"type":"object","properties":{"insufficientData":{"type":"boolean"},"activeLeads":{"type":"integer"},"onTrackCents":{"type":["integer","null"]},"optimisticCents":{"type":["integer","null"]},"conservativeCents":{"type":["integer","null"]},"avgDealCents":{"type":["integer","null"]},"overallConversionRate":{"type":["number","null"]}},"required":["insufficientData","activeLeads","onTrackCents","optimisticCents","conservativeCents","avgDealCents","overallConversionRate"]},"AnalyticsGhostedLeadsResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"channel":{"type":["string","null"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"ghostedCount":{"type":"integer"},"rescueRecoveryRate":{"type":["number","null"]},"lostRevenueEstimateCents":{"type":["integer","null"]},"topKillers":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"ghostRate":{"type":"number"},"ghostCount":{"type":"integer"}},"required":["label","ghostRate","ghostCount"]}}},"required":["period","channel","window","ghostedCount","rescueRecoveryRate","lostRevenueEstimateCents","topKillers"]},"AnalyticsTrustScoreResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"channel":{"type":["string","null"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"approvalRate":{"type":["number","null"]},"editDistanceP50":{"type":["number","null"]},"rejectionRate":{"type":["number","null"]},"autoSendEnabled":{"type":"boolean"},"approvedCount":{"type":"integer"},"editedCount":{"type":"integer"},"rejectedCount":{"type":"integer"}},"required":["period","channel","window","approvalRate","editDistanceP50","rejectionRate","autoSendEnabled","approvedCount","editedCount","rejectedCount"]},"AnalyticsTrendsResponse":{"type":"object","properties":{"points":{"type":"array","items":{"type":"object","properties":{"weekStart":{"type":"string"},"inbound":{"type":"integer"},"qualified":{"type":"integer"},"booked":{"type":"integer"},"showed":{"type":"integer"},"won":{"type":"integer"},"revenueCents":{"type":"integer"},"medianResponseS":{"type":["integer","null"]}},"required":["weekStart","inbound","qualified","booked","showed","won","revenueCents","medianResponseS"]}}},"required":["points"]},"AnalyticsLeadScoreResponse":{"type":"object","properties":{"score":{"type":["number","null"],"minimum":0,"maximum":100},"confidence":{"type":"string","enum":["low","medium","high"]},"topFeatures":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string"},"rate":{"type":"number"}},"required":["label","rate"]}},"recommendation":{"type":["string","null"]},"insufficientData":{"type":"boolean"}},"required":["score","confidence","topFeatures","recommendation","insufficientData"]},"AnalyticsLossReasonsResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"totalCount":{"type":"integer"},"estimatedRevenueLostCents":{"type":"integer"},"breakdown":{"type":"array","items":{"type":"object","properties":{"category":{"type":"string","enum":["price_objection","ghosted_after_cta","competitor","slow_reply","bad_fit","other"]},"count":{"type":"integer"},"estimatedRevenueLostCents":{"type":"integer"}},"required":["category","count","estimatedRevenueLostCents"]}}},"required":["period","window","totalCount","estimatedRevenueLostCents","breakdown"]},"AnalyticsRecommendationsResponse":{"type":"object","properties":{"weekStart":{"type":["string","null"]},"recommendations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"weekStart":{"type":"string"},"title":{"type":"string"},"body":{"type":"string","x-luca-sensitive":"blank"},"impactEstimate":{"type":["string","null"]},"actionLink":{"type":["string","null"]},"category":{"type":"string","enum":["speed","qualification","channel","content","ghost_recovery","general"]},"dismissed":{"type":"boolean"},"createdAt":{"type":"string"}},"required":["id","coachId","weekStart","title","body","impactEstimate","actionLink","category","dismissed","createdAt"]}}},"required":["weekStart","recommendations"]},"AnalyticsContentAttributionResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"items":{"type":"array","items":{"type":"object","properties":{"contentId":{"type":"string"},"contentType":{"type":"string","enum":["reel","post","story","campaign","manual"]},"contentPreview":{"type":["string","null"]},"leadCount":{"type":"integer"},"qualifiedCount":{"type":"integer"},"bookedCount":{"type":"integer"},"revenueCents":{"type":"integer"}},"required":["contentId","contentType","contentPreview","leadCount","qualifiedCount","bookedCount","revenueCents"]}}},"required":["period","window","items"]},"AnalyticsContentPerformanceResponse":{"type":"object","properties":{"period":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"window":{"type":"object","properties":{"cutoff":{"type":"string"},"until":{"type":["string","null"]}},"required":["cutoff","until"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"channelAccountId":{"type":["string","null"],"format":"uuid"},"externalPostId":{"type":"string"},"mediaType":{"type":"string","enum":["image","video","reel","carousel","story"]},"permalink":{"type":["string","null"]},"caption":{"type":["string","null"]},"publishedAt":{"type":["string","null"]},"reach":{"type":["integer","null"]},"impressions":{"type":["integer","null"]},"likes":{"type":["integer","null"]},"comments":{"type":["integer","null"]},"saves":{"type":["integer","null"]},"shares":{"type":["integer","null"]},"engagementRate":{"type":["number","null"]},"leadsAttributed":{"type":"integer"},"bookingsAttributed":{"type":"integer"},"revenueCents":{"type":"integer"},"insightsAvailable":{"type":"boolean"},"fetchedAt":{"type":"string"}},"required":["id","coachId","channelAccountId","externalPostId","mediaType","permalink","caption","publishedAt","reach","impressions","likes","comments","saves","shares","engagementRate","leadsAttributed","bookingsAttributed","revenueCents","insightsAvailable","fetchedAt"]}}},"required":["period","window","items"]},"AnalyticsTopicPerformanceResponse":{"type":"object","properties":{"weekStart":{"type":["string","null"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"topic":{"type":"string"},"weekStart":{"type":"string"},"postCount":{"type":"integer"},"avgEngagementRate":{"type":["number","null"]},"leadsAttributed":{"type":"integer"},"bookingsAttributed":{"type":"integer"},"revenueCents":{"type":"integer"},"computedAt":{"type":"string"}},"required":["id","coachId","topic","weekStart","postCount","avgEngagementRate","leadsAttributed","bookingsAttributed","revenueCents","computedAt"]}}},"required":["weekStart","items"]},"AnalyticsBenchmarksResponse":{"type":"object","properties":{"comingSoon":{"type":"boolean"},"metrics":{"type":"array","items":{"type":"object","properties":{"metricName":{"type":"string"},"cohortLabel":{"type":"string"},"percentile":{"type":"number","minimum":0,"maximum":100},"coachValue":{"type":"number"},"cohortP50":{"type":"number"},"cohortP25":{"type":["number","null"]},"cohortP75":{"type":["number","null"]},"computedAt":{"type":"string"}},"required":["metricName","cohortLabel","percentile","coachValue","cohortP50","cohortP25","cohortP75","computedAt"]}}},"required":["comingSoon","metrics"]},"BenchmarkConsentResponse":{"type":"object","properties":{"status":{"type":"string","enum":["granted","withdrawn","none"]},"grantedAt":{"type":["string","null"]},"withdrawnAt":{"type":["string","null"]}},"required":["status","grantedAt","withdrawnAt"]},"BenchmarkConsentUpdate":{"type":"object","properties":{"optIn":{"type":"boolean"}},"required":["optIn"]},"ObjectionAnalyticsResponse":{"type":"object","properties":{"period":{"type":"string","enum":["7d","30d","90d"]},"channel":{"type":["string","null"],"enum":["telegram","instagram","messenger","whatsapp",null]},"buckets":{"type":"array","items":{"type":"object","properties":{"bucket":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"count":{"type":"integer"},"topPhrases":{"type":"array","items":{"type":"string"},"x-luca-sensitive":"empty"},"wins":{"type":"integer"},"handled":{"type":"integer"},"total":{"type":"integer"},"distinctLeads":{"type":"integer"}},"required":["bucket","count","topPhrases","wins","handled","total","distinctLeads"]}}},"required":["period","channel","buckets"]},"ObjectionDrilldownResponse":{"type":"object","properties":{"bucket":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"period":{"type":"string","enum":["7d","30d","90d"]},"channel":{"type":["string","null"],"enum":["telegram","instagram","messenger","whatsapp",null]},"conversations":{"type":"array","items":{"type":"object","properties":{"conversationId":{"type":"string","format":"uuid"},"leadDisplayName":{"type":["string","null"],"x-luca-sensitive":"null"},"phrase":{"type":["string","null"],"x-luca-sensitive":"null"},"handled":{"type":"boolean"},"outcome":{"type":["string","null"],"enum":["won","lost","not_a_fit",null]}},"required":["conversationId","leadDisplayName","phrase","handled","outcome"]}},"hasMore":{"type":"boolean"}},"required":["bucket","period","channel","conversations","hasMore"]},"LegalAgreementHistory":{"type":"object","properties":{"acceptances":{"type":"array","items":{"type":"object","properties":{"termsVersion":{"type":"string"},"termsSha256":{"type":"string"},"privacyVersion":{"type":"string"},"privacySha256":{"type":"string"},"statement":{"type":"string"},"acceptedAt":{"type":"string"}},"required":["termsVersion","termsSha256","privacyVersion","privacySha256","statement","acceptedAt"]}}},"required":["acceptances"]},"LegalAgreementStatus":{"type":"object","properties":{"required":{"type":"boolean"},"acceptedAt":{"type":["string","null"]},"documents":{"type":"object","properties":{"status":{"type":"string","enum":["draft","published"]},"terms":{"type":"object","properties":{"version":{"type":"string"},"sha256":{"type":"string"},"url":{"type":"string"}},"required":["version","sha256","url"]},"privacy":{"type":"object","properties":{"version":{"type":"string"},"sha256":{"type":"string"},"url":{"type":"string"}},"required":["version","sha256","url"]},"publishedAt":{"type":"string"}},"required":["status","terms","privacy"]}},"required":["required","acceptedAt","documents"]},"LegalAcceptanceRequest":{"type":"object","properties":{"accepted":{"type":"boolean","enum":[true]},"statement":{"type":"string","enum":["I agree to the Terms of Service and acknowledge the Privacy Policy. I am at least 18 and authorized to use Luca for my business. I will not use Luca to process minors' personal data or regulated medical records."]},"termsVersion":{"type":"string"},"termsSha256":{"type":"string"},"privacyVersion":{"type":"string"},"privacySha256":{"type":"string"}},"required":["accepted","statement","termsVersion","termsSha256","privacyVersion","privacySha256"],"additionalProperties":false},"AdvertisingChoice":{"type":"object","properties":{"allowed":{"type":"boolean"},"chosenAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"noticeVersion":{"type":"string"}},"required":["allowed","chosenAt","expiresAt","noticeVersion"]},"AdvertisingChoiceUpdate":{"type":"object","properties":{"allowed":{"type":"boolean"},"noticeVersion":{"type":"string","enum":["2026-09-08"]}},"required":["allowed","noticeVersion"],"additionalProperties":false},"CopilotChatListResponse":{"type":"object","properties":{"chats":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"scopeType":{"type":"string","enum":["global","lead","campaign","analytics"]},"scopeId":{"type":"string"},"doId":{"type":"string"},"lastActiveAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","title","scopeType","scopeId","doId","lastActiveAt","createdAt"]}}},"required":["chats"]},"CopilotChat":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"title":{"type":"string"},"scopeType":{"type":"string","enum":["global","lead","campaign","analytics"]},"scopeId":{"type":"string"},"doId":{"type":"string"},"lastActiveAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","title","scopeType","scopeId","doId","lastActiveAt","createdAt"]},"CopilotChatCreate":{"type":"object","properties":{"firstMessage":{"type":"string","minLength":1,"maxLength":500},"scopeType":{"type":"string","enum":["global","lead","campaign","analytics"],"default":"global"},"scopeId":{"type":"string","default":""}},"required":["firstMessage"]},"CopilotChatPatch":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":80}},"required":["title"]},"OkResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"CopilotChatTokenResponse":{"type":"object","properties":{"token":{"type":"string"},"doId":{"type":"string"},"chatId":{"type":"string","format":"uuid"}},"required":["token","doId","chatId"]},"CopilotClientEvent":{"type":"object","properties":{"eventName":{"type":"string","enum":["token_fetch_failed","initial_messages_failed","session_failed","session_retry","session_retry_succeeded","message_send_failed","generation_stop","generation_regenerate"]},"chatId":{"type":"string","format":"uuid"},"scopeType":{"type":"string","enum":["global","lead","campaign","analytics"]},"scopeId":{"type":"string"},"message":{"type":"string","minLength":1,"maxLength":500},"metadata":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"number"},{"type":"boolean"},{"type":"null"}]}}},"required":["eventName","message"]},"CopilotProposal":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"threadId":{"type":"string","format":"uuid"},"operationId":{"type":["string","null"]},"planKind":{"type":["string","null"]},"revision":{"type":"integer"},"payload":{"type":"object","properties":{"steps":{"type":"array","items":{"type":"object","properties":{"operationId":{"type":"string","minLength":1,"maxLength":200},"input":{}},"required":["operationId"]}},"items":{"type":"array","items":{}}}},"payloadHash":{"type":["string","null"]},"diff":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"before":{"type":"string","maxLength":2000},"after":{"type":"string","maxLength":2000},"index":{"type":"integer","minimum":0}},"required":["label"]}},"sideEffects":{"type":"array","items":{"type":"string"}},"card":{"type":"object","properties":{"title":{"type":"string"},"text":{"type":"string"},"warning":{"type":"string"},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"label":{"type":"string","minLength":1,"maxLength":100},"kind":{"type":"string","enum":["string","text","number","enum","list"]},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","maxLength":200},"label":{"type":"string","maxLength":200}},"required":["value","label"]},"maxItems":50},"value":{}},"required":["name","label","kind"]}}},"required":["title","text"]},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"status":{"type":"string"},"httpStatus":{"type":["integer","null"]},"message":{"type":["string","null"]},"resultRef":{"type":["string","null"]},"result":{"description":"What the step answered, kept only for a step that spends AI credits so Luca can continue with it. Absent for other steps."},"resultOmitted":{"type":"string","enum":["too_large"],"description":"Set when a step that spends AI credits succeeded but its answer was too large to keep. Absent otherwise."}},"required":["index","status","httpStatus","message","resultRef"]}},"status":{"type":"string"},"expiresAt":{"type":"string"},"stuck":{"type":"boolean","description":"The run ended short, failed, or stopped showing progress, so the coach may retry or discard it."},"toolName":{"type":["string","null"]}},"required":["id","threadId","operationId","planKind","revision","payload","payloadHash","diff","sideEffects","card","outcomes","status","expiresAt","stuck","toolName"]},"CopilotProposalCreateRequest":{"type":"object","properties":{"plan":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["steps"]},"steps":{"type":"array","items":{"type":"object","properties":{"operationId":{"type":"string","minLength":1,"maxLength":200},"input":{}},"required":["operationId"]},"minItems":1,"maxItems":20}},"required":["kind","steps"]},{"type":"object","properties":{"kind":{"type":"string","enum":["batch"]},"operationId":{"type":"string","minLength":1,"maxLength":200},"items":{"type":"array","items":{},"minItems":1,"maxItems":25}},"required":["kind","operationId","items"]}]},"card":{"type":"object","properties":{"title":{"type":"string","minLength":1,"maxLength":200},"text":{"type":"string","maxLength":2000},"fields":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":200},"label":{"type":"string","minLength":1,"maxLength":100},"kind":{"type":"string","enum":["string","text","number","enum","list"]},"options":{"type":"array","items":{"type":"object","properties":{"value":{"type":"string","maxLength":200},"label":{"type":"string","maxLength":200}},"required":["value","label"]},"maxItems":50}},"required":["name","label","kind"]},"maxItems":50}},"required":["title","text"]},"diff":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":200},"before":{"type":"string","maxLength":2000},"after":{"type":"string","maxLength":2000},"index":{"type":"integer","minimum":0}},"required":["label"]},"maxItems":100},"sideEffects":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":20},"clientKey":{"type":"string","minLength":1,"maxLength":100}},"required":["plan","card"]},"CopilotProposalListResponse":{"type":"object","properties":{"actions":{"type":"array","items":{"$ref":"#/components/schemas/CopilotProposal"}}},"required":["actions"]},"CopilotProposalAmendedResponse":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/CopilotProposal"}},"required":["action"]},"CopilotProposalAmendRequest":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0},"fields":{"type":"object","additionalProperties":{}}},"required":["revision","fields"]},"CopilotActionStatusResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"threadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["proposed","confirmed","edited","discarded","expired","executing","applied","partially_applied","failed"]},"decidedAt":{"type":["string","null"],"format":"date-time"}},"required":["id","threadId","status","decidedAt"]},"CopilotProposalConfirmResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"dispatched":{"type":"boolean"},"status":{"type":"string"},"outcomes":{"type":"array","items":{"type":"object","properties":{"index":{"type":"integer"},"status":{"type":"string"},"httpStatus":{"type":["integer","null"]},"message":{"type":["string","null"]},"resultRef":{"type":["string","null"]},"result":{"description":"What the step answered, kept only for a step that spends AI credits so Luca can continue with it. Absent for other steps."},"resultOmitted":{"type":"string","enum":["too_large"],"description":"Set when a step that spends AI credits succeeded but its answer was too large to keep. Absent otherwise."}},"required":["index","status","httpStatus","message","resultRef"]}}},"required":["ok","dispatched"]},"CopilotProposalDecisionRequest":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0}}},"CopilotProposalRetriedResponse":{"type":"object","properties":{"action":{"$ref":"#/components/schemas/CopilotProposal"}},"required":["action"]},"CopilotProposalRetryRequest":{"type":"object","properties":{"revision":{"type":"integer","exclusiveMinimum":0}},"required":["revision"]},"CopilotUsageResponse":{"type":"object","properties":{"periodStart":{"type":"string"},"includedUsed":{"type":"integer","minimum":0},"includedLimit":{"type":"integer","minimum":0},"packsRemaining":{"type":"integer","minimum":0},"overageUsed":{"type":"integer","minimum":0},"overageCostCents":{"type":"integer","minimum":0},"overageCapCents":{"type":"integer","minimum":0},"overageEnabled":{"type":"boolean"},"costMtdUsd":{"type":"number","minimum":0}},"required":["periodStart","includedUsed","includedLimit","packsRemaining","overageUsed","overageCostCents","overageCapCents","overageEnabled","costMtdUsd"]},"CopilotSettingsBody":{"type":"object","properties":{"overageEnabled":{"type":"boolean"},"overageCapCents":{"type":["integer","null"],"minimum":0,"maximum":50000}}},"PackCheckoutResponse":{"type":"object","properties":{"url":{"type":"string","format":"uri"}},"required":["url"]},"PackCheckoutBody":{"type":"object","properties":{"packSku":{"type":"string","enum":["pack_500"]},"successUrl":{"type":"string","format":"uri"},"cancelUrl":{"type":"string","format":"uri"}},"required":["packSku"]},"VoiceCorpusListResponse":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":["string","null"]},"channel":{"type":["string","null"],"enum":["telegram","instagram","messenger","whatsapp",null]},"content":{"type":"string","maxLength":1000,"x-luca-sensitive":"blank"},"createdAt":{"type":"string"}},"required":["id","source","channel","content","createdAt"]}},"version":{"type":"integer"},"totalCount":{"type":"integer","minimum":0}},"required":["entries","version","totalCount"]},"VoiceProfileResponse":{"type":"object","properties":{"version":{"type":"integer"},"personaSummary":{"type":["string","null"]},"corpusExampleCount":{"type":"integer"},"lastRefreshedAt":{"type":["string","null"]}},"required":["version","personaSummary","corpusExampleCount","lastRefreshedAt"]},"VoiceCorpusAddResponse":{"type":"object","properties":{"entry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":["string","null"]},"channel":{"type":["string","null"],"enum":["telegram","instagram","messenger","whatsapp",null]},"content":{"type":"string","maxLength":1000,"x-luca-sensitive":"blank"},"createdAt":{"type":"string"}},"required":["id","source","channel","content","createdAt"]}},"required":["entry"]},"VoiceCorpusEntry":{"type":"object","properties":{"source":{"type":"string","minLength":1},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"content":{"type":"string","minLength":1,"maxLength":1000}},"required":["content"]},"VoiceCorpusBulkAddResponse":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":["string","null"]},"channel":{"type":["string","null"],"enum":["telegram","instagram","messenger","whatsapp",null]},"content":{"type":"string","maxLength":1000,"x-luca-sensitive":"blank"},"createdAt":{"type":"string"}},"required":["id","source","channel","content","createdAt"]}},"version":{"type":"integer"}},"required":["entries","version"]},"VoiceCorpusBulkAdd":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"entries":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1},"content":{"type":"string","minLength":1,"maxLength":1000}},"required":["content"]},"minItems":1,"maxItems":25}},"required":["channel","entries"]},"VoiceCorpusDeleteResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"VoiceCorpusUpdateResponse":{"type":"object","properties":{"entry":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":["string","null"]},"channel":{"type":["string","null"],"enum":["telegram","instagram","messenger","whatsapp",null]},"content":{"type":"string","maxLength":1000,"x-luca-sensitive":"blank"},"createdAt":{"type":"string"}},"required":["id","source","channel","content","createdAt"]}},"required":["entry"]},"VoiceCorpusUpdate":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":1000}},"required":["content"]},"VoiceFingerprintRefreshResponse":{"type":"object","properties":{"version":{"type":"integer"}},"required":["version"]},"WorkspacesResponse":{"type":"object","properties":{"workspaces":{"type":"array","items":{"type":"object","properties":{"coachId":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"slug":{"type":["string","null"]},"role":{"type":"string","enum":["owner","admin","manager","operator","analyst","viewer"]},"permissionOverrides":{"type":"object","properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}}},"required":["coachId","organizationId","name","slug","role","permissionOverrides"]}}},"required":["workspaces"]},"CreateWorkspaceResponse":{"type":"object","properties":{"workspace":{"type":"object","properties":{"coachId":{"type":"string"},"organizationId":{"type":"string"},"name":{"type":"string"},"slug":{"type":["string","null"]},"role":{"type":"string","enum":["owner","admin","manager","operator","analyst","viewer"]},"permissionOverrides":{"type":"object","properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}}},"required":["coachId","organizationId","name","slug","role","permissionOverrides"]}},"required":["workspace"]},"OnboardingStatusResponse":{"type":"object","properties":{"hasChannel":{"type":"boolean"},"hasVoiceCorpus":{"type":"boolean"},"hasProfile":{"type":"boolean"},"setup":{"type":"object","properties":{"niche":{"type":["string","null"]},"nicheDetail":{"type":["string","null"]},"dmHandler":{"type":["string","null"]},"primaryGoal":{"type":["string","null"]}},"required":["niche","nicheDetail","dmHandler","primaryGoal"]},"demo":{"type":"object","properties":{"dmText":{"type":["string","null"]},"draftBody":{"type":["string","null"]},"draftVoiced":{"type":["string","null"]},"usedSample":{"type":["boolean","null"]}},"required":["dmText","draftBody","draftVoiced","usedSample"]},"instagramPreflight":{"type":["object","null"],"properties":{"handle":{"type":"string"},"accountType":{"type":"string","enum":["business","creator","personal","unknown"]},"followerCount":{"type":["integer","null"]}},"required":["handle","accountType","followerCount"]},"channelConnectedAt":{"type":["string","null"]},"completedAt":{"type":["string","null"]},"onboardingStep":{"type":["string","null"]},"answers":{"type":["object","null"],"properties":{"niche":{"type":["string","null"]},"dmVolume":{"type":["string","null"]},"whoAnswers":{"type":["string","null"]},"primaryGoal":{"type":["string","null"]},"leadChannels":{"type":"array","items":{"type":"string"}},"offerPriceBand":{"type":["string","null"]},"customAnswers":{"type":"object","additionalProperties":{"type":"string"}},"updatedAt":{"type":"string","format":"date-time"}},"required":["niche","dmVolume","whoAnswers","primaryGoal","leadChannels","offerPriceBand","customAnswers","updatedAt"]},"experimentAssignments":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"}]}},"waitingLeadCount":{"type":"integer","minimum":0},"waitlistChannels":{"type":"array","items":{"type":"string"}},"annualBillingAvailable":{"type":"boolean"}},"required":["hasChannel","hasVoiceCorpus","hasProfile","setup","demo","instagramPreflight","channelConnectedAt","completedAt","onboardingStep","answers","experimentAssignments","waitingLeadCount","waitlistChannels","annualBillingAvailable"]},"OnboardingAnswerResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"OnboardingAnswer":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","enum":["niche"]},"value":{"type":"string","enum":["strength","fitness","nutrition","running","yoga","business","mindset","life","relationship","other"]},"detail":{"type":"string","maxLength":500}},"required":["key","value"]},{"type":"object","properties":{"key":{"type":"string","enum":["dmVolume"]},"value":{"type":"string","enum":["lt_10","10_50","50_200","200_plus"]},"detail":{"type":"string","maxLength":500}},"required":["key","value"]},{"type":"object","properties":{"key":{"type":"string","enum":["whoAnswers"]},"value":{"type":"string","enum":["me","setter_va","agency","nobody"]},"detail":{"type":"string","maxLength":500}},"required":["key","value"]},{"type":"object","properties":{"key":{"type":"string","enum":["primaryGoal"]},"value":{"type":"string","enum":["book_calls","rescue_leads","save_time","replace_setter"]},"detail":{"type":"string","maxLength":500}},"required":["key","value"]},{"type":"object","properties":{"key":{"type":"string","enum":["offerPriceBand"]},"value":{"type":"string","enum":["lt_500","500_2k","2k_5k","5k_plus","rather_not_say"]},"detail":{"type":"string","maxLength":500}},"required":["key","value"]},{"type":"object","properties":{"key":{"type":"string","enum":["leadChannels"]},"value":{"type":"array","items":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"maxItems":4},"detail":{"type":"string","maxLength":500}},"required":["key","value"]}]},"OnboardingSetupResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"complete":{"type":"boolean"}},"required":["ok","complete"]},"OnboardingSetup":{"type":"object","properties":{"niche":{"type":"string","enum":["strength","fitness","nutrition","running","yoga","business","mindset","life","relationship","other"]},"nicheDetail":{"type":"string","maxLength":500},"dmHandler":{"type":"string","enum":["self","va","nobody"]},"primaryGoal":{"type":"string","enum":["speed","qualification","booking","delegation"]}},"additionalProperties":false},"OnboardingAttributionResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"captured":{"type":"boolean"}},"required":["ok","captured"]},"OnboardingAttribution":{"type":"object","properties":{"utmSource":{"type":["string","null"],"minLength":1,"maxLength":512},"utmMedium":{"type":["string","null"],"minLength":1,"maxLength":512},"utmCampaign":{"type":["string","null"],"minLength":1,"maxLength":512},"utmContent":{"type":["string","null"],"minLength":1,"maxLength":512},"utmTerm":{"type":["string","null"],"minLength":1,"maxLength":512},"fbclid":{"type":["string","null"],"minLength":1,"maxLength":512},"gclid":{"type":["string","null"],"minLength":1,"maxLength":512},"fbc":{"type":["string","null"],"minLength":1,"maxLength":512},"fbp":{"type":["string","null"],"minLength":1,"maxLength":512},"landingPage":{"type":["string","null"],"minLength":1,"maxLength":512},"referrer":{"type":["string","null"],"minLength":1,"maxLength":512}}},"OnboardingStepResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"OnboardingStep":{"type":"object","properties":{"step":{"type":"string","minLength":1,"maxLength":40,"pattern":"^(q:)?[a-zA-Z][\\w-]*$"}},"required":["step"]},"OnboardingConnectTelegramResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"}},"required":["id"]},"ConnectTelegram":{"type":"object","properties":{"reconnectAccountId":{"type":"string","format":"uuid"},"botToken":{"type":"string","minLength":1}},"required":["botToken"]},"InstagramPreflightResponse":{"type":"object","properties":{"handle":{"type":"string"},"accountType":{"type":"string","enum":["business","creator","personal","unknown"]},"followerCount":{"type":["integer","null"]},"displayName":{"type":["string","null"]}},"required":["handle","accountType","followerCount","displayName"]},"InstagramPreflight":{"type":"object","properties":{"handle":{"type":"string","minLength":1,"maxLength":120}},"required":["handle"],"additionalProperties":false},"OnboardingWaitlistResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"OnboardingWaitlist":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]}},"required":["channel"]},"OnboardingVoicePreviewResponse":{"type":"object","properties":{"reply":{"type":"string"},"remaining":{"type":"integer"}},"required":["reply","remaining"]},"VoicePreview":{"type":"object","properties":{"leadMessage":{"type":"string","minLength":1,"maxLength":600},"history":{"type":"array","items":{"type":"object","properties":{"role":{"type":"string","enum":["lead","luca"]},"content":{"type":"string","minLength":1,"maxLength":600}},"required":["role","content"]},"maxItems":8},"usedSample":{"type":"boolean"}},"required":["leadMessage"]},"OnboardingSeedCorpusResponse":{"type":"object","properties":{"count":{"type":"integer"}},"required":["count"]},"SeedVoiceCorpus":{"type":"object","properties":{"entries":{"type":"array","items":{"type":"object","properties":{"source":{"type":"string","minLength":1},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"content":{"type":"string","minLength":1,"maxLength":1000}},"required":["content"]},"minItems":1,"maxItems":25}},"required":["entries"]},"OnboardingPreferencesResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"OnboardingPreferences":{"type":"object","properties":{"autoSendEnabled":{"type":"boolean"}}},"OnboardingCompleteResponse":{"type":"object","properties":{"url":{"type":["string","null"]}},"required":["url"]},"OnboardingComplete":{"type":"object","properties":{"selectedPlan":{"type":"string","enum":["starter","pro","scale"]},"billingInterval":{"type":"string","enum":["month","year"]},"defaultPlanVariant":{"type":"string","minLength":1},"successUrl":{"type":"string","format":"uri"},"cancelUrl":{"type":"string","format":"uri"}},"required":["selectedPlan"],"additionalProperties":false},"CancellationOfferAcceptRequest":{"type":"object","properties":{"flowSessionId":{"type":"string","format":"uuid"},"offer":{"type":"string","enum":["discount","discount_once","pause_1m","pause_2m","downgrade","trial_extension"]}},"required":["flowSessionId","offer"]},"CancellationConfirmResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"accessEndsAt":{"type":["string","null"]},"refundIssued":{"type":"boolean"},"voiceDeadline":{"type":"string"}},"required":["ok","accessEndsAt","refundIssued","voiceDeadline"]},"CancellationConfirmRequest":{"type":"object","properties":{"flowSessionId":{"type":"string","format":"uuid"},"offerDeclined":{"type":"boolean","default":false}},"required":["flowSessionId"]},"CancellationReactivateResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"planStatus":{"type":"string"},"winbackApplied":{"type":"boolean"}},"required":["ok","planStatus","winbackApplied"]},"CancellationReactivateRequest":{"type":"object","properties":{"winback":{"type":"boolean"}}},"CancellationFounderCallRequest":{"type":"object","properties":{"flowSessionId":{"type":"string","format":"uuid"},"fromStep":{"type":"string","enum":["offer","confirmation"]}},"required":["flowSessionId","fromStep"]},"CancellationStartRequest":{"type":"object","properties":{"flowSessionId":{"type":"string","format":"uuid"}},"required":["flowSessionId"]},"CancellationContextResponse":{"type":"object","properties":{"planTier":{"type":"string"},"billingInterval":{"type":"string","enum":["month","year"]},"planStatus":{"type":"string"},"trialOrPaid":{"type":"string","enum":["trial","paid"]},"periodEndsAt":{"type":["string","null"]},"pausedUntil":{"type":["string","null"]},"cancelRequested":{"type":"boolean"},"voiceMessageCount":{"type":"integer","minimum":0},"leadsHandled":{"type":"integer","minimum":0},"callsBooked":{"type":"integer","minimum":0},"midConversationLeads":{"type":"integer","minimum":0},"saveCapped":{"type":"boolean"},"pastDue":{"type":"boolean"},"graceRefund":{"type":"object","properties":{"eligible":{"type":"boolean"},"amountCents":{"type":"integer","minimum":0}},"required":["eligible","amountCents"]},"offersByReason":{"type":"object","properties":{"too_expensive":{"$ref":"#/components/schemas/CancellationReasonOffers"},"not_enough_dms":{"$ref":"#/components/schemas/CancellationReasonOffers"},"voice_mismatch":{"$ref":"#/components/schemas/CancellationReasonOffers"},"missing_feature":{"$ref":"#/components/schemas/CancellationReasonOffers"},"switching":{"$ref":"#/components/schemas/CancellationReasonOffers"},"bugs":{"$ref":"#/components/schemas/CancellationReasonOffers"},"taking_break":{"$ref":"#/components/schemas/CancellationReasonOffers"},"just_testing":{"$ref":"#/components/schemas/CancellationReasonOffers"},"other":{"$ref":"#/components/schemas/CancellationReasonOffers"}}},"founderCallUrl":{"type":["string","null"]},"founderReplyEmail":{"type":"string"},"voiceRetentionDays":{"type":"integer","exclusiveMinimum":0}},"required":["planTier","billingInterval","planStatus","trialOrPaid","periodEndsAt","pausedUntil","cancelRequested","voiceMessageCount","leadsHandled","callsBooked","midConversationLeads","saveCapped","pastDue","graceRefund","offersByReason","founderCallUrl","founderReplyEmail","voiceRetentionDays"]},"CancellationReasonOffers":{"type":"object","properties":{"primary":{"type":["object","null"],"properties":{"kind":{"type":"string","enum":["discount","discount_once","pause_1m","pause_2m","downgrade","trial_extension","pause","founder_call","voice_retraining","roadmap_promise","bug_escalation","cancel_gracefully"]},"percentOff":{"type":"integer","exclusiveMinimum":0},"months":{"type":"integer","exclusiveMinimum":0}},"required":["kind"]},"fallback":{"type":["object","null"],"properties":{"kind":{"type":"string","enum":["discount","discount_once","pause_1m","pause_2m","downgrade","trial_extension","pause","founder_call","voice_retraining","roadmap_promise","bug_escalation","cancel_gracefully"]},"percentOff":{"type":"integer","exclusiveMinimum":0},"months":{"type":"integer","exclusiveMinimum":0}},"required":["kind"]},"skipped":{"type":["string","null"],"enum":["capped","past_due",null]}},"required":["primary","fallback","skipped"]},"CancellationSurveyRequest":{"type":"object","properties":{"flowSessionId":{"type":"string","format":"uuid"},"reason":{"type":"string","enum":["too_expensive","not_enough_dms","voice_mismatch","missing_feature","switching","bugs","taking_break","just_testing","other"]},"freeText":{"type":"string","maxLength":2000}},"required":["flowSessionId","reason"]},"FirstRunStateResponse":{"type":"object","properties":{"firstSessionState":{"type":"string","enum":["first_visit","demo_drafting","demo_ready","activated","dismissed","completed"]},"checklistState":{"type":"object","properties":{"items":{"type":"object","properties":{"review_first_draft":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"approve_or_edit":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"check_voice_match":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"send_test_message":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"explore_ask_luca":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}}},"default":{}},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"planStatus":{"type":"string"},"planTier":{"type":"string"},"trialStartedAt":{"type":["string","null"]},"trialEndsAt":{"type":["string","null"]},"experimentAssignments":{"type":"object","additionalProperties":{"anyOf":[{"type":"string"},{"type":"boolean"}]}},"niche":{"type":"string"},"demoLeadName":{"type":["string","null"]},"extensionOffer":{"type":["object","null"],"properties":{"reason":{"type":"string","enum":["low_usage","high_usage"]},"extraDays":{"type":"integer","exclusiveMinimum":0},"messageCap":{"type":"integer","exclusiveMinimum":0},"discountPriceUsd":{"type":["integer","null"],"exclusiveMinimum":0},"actions":{"type":"object","properties":{"story_template":{"type":"boolean"},"test_message":{"type":"boolean"}}},"claimable":{"type":"boolean"}},"required":["reason","extraDays","messageCap","discountPriceUsd","actions","claimable"]},"unansweredBeforeTrial":{"type":"integer","minimum":0}},"required":["firstSessionState","checklistState","planStatus","planTier","trialStartedAt","trialEndsAt","experimentAssignments","niche","demoLeadName","extensionOffer","unansweredBeforeTrial"]},"FirstRunStateUpdateResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"firstSessionState":{"type":"string","enum":["first_visit","activated","dismissed","completed"]}},"required":["ok","firstSessionState"]},"FirstRunStateUpdate":{"type":"object","properties":{"state":{"type":"string","enum":["first_visit","activated","dismissed","completed"]}},"required":["state"]},"ChecklistItemUpdateResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"checklistState":{"type":"object","properties":{"items":{"type":"object","properties":{"review_first_draft":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"approve_or_edit":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"check_voice_match":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"send_test_message":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}},"explore_ask_luca":{"type":"object","properties":{"status":{"type":"string","enum":["pending","in_progress","completed","skipped"],"default":"pending"},"startedAt":{"type":["string","null"],"format":"date-time","default":null},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}}},"default":{}},"completedAt":{"type":["string","null"],"format":"date-time","default":null}}}},"required":["ok","checklistState"]},"ChecklistItemUpdate":{"type":"object","properties":{"key":{"type":"string","enum":["review_first_draft","approve_or_edit","check_voice_match","send_test_message","explore_ask_luca"]},"status":{"type":"string","enum":["pending","in_progress","completed","skipped"]}},"required":["key","status"]},"TrialValueDashboard":{"type":"object","properties":{"leadsHandled":{"type":"integer","minimum":0},"hoursSaved":{"type":"number","minimum":0},"voiceMatchPercent":{"type":["integer","null"],"minimum":0,"maximum":100},"callsBooked":{"type":"integer","minimum":0},"humanSetterCostUsd":{"type":"integer","minimum":0},"messagesUsed":{"type":"integer","minimum":0},"messageCap":{"type":"integer","exclusiveMinimum":0},"trialDaysTotal":{"type":"integer","exclusiveMinimum":0},"trialDaysRemaining":{"type":"integer","minimum":0}},"required":["leadsHandled","hoursSaved","voiceMatchPercent","callsBooked","humanSetterCostUsd","messagesUsed","messageCap","trialDaysTotal","trialDaysRemaining"]},"GrowthTemplateCopiedResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"firstCopy":{"type":"boolean"}},"required":["ok","firstCopy"]},"PipelineModuleShownResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"firstShown":{"type":"boolean"}},"required":["ok","firstShown"]},"TrialExtensionClaimResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"reason":{"type":"string","enum":["low_usage","high_usage"]},"extraDays":{"type":"integer","exclusiveMinimum":0},"newTrialEndsAt":{"type":"string"},"discountApplied":{"type":"boolean"}},"required":["ok","reason","extraDays","newTrialEndsAt","discountApplied"]},"TeachLucaStateResponse":{"type":"object","properties":{"progress":{"type":"object","properties":{"offer_and_price":{"type":"string","enum":["pending","answered","skipped"]},"top_objections":{"type":"string","enum":["pending","answered","skipped"]},"tone_boundaries":{"type":"string","enum":["pending","answered","skipped"]}}},"nextQuestion":{"type":["string","null"],"enum":["offer_and_price","top_objections","tone_boundaries",null]},"answered":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"complete":{"type":"boolean"},"suggestions":{"type":"object","properties":{"offer":{"type":"string"},"priceBand":{"type":"string","enum":["lt_500","500_2k","2k_5k","5k_plus","rather_not_say"]},"priceDetail":{"type":"string"},"objections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string"},"response":{"type":"string"}},"required":["objection","response"]}},"boundaries":{"type":"array","items":{"type":"string"}}},"required":["objections","boundaries"]},"exampleDm":{"type":["string","null"],"x-luca-sensitive":"null"},"exampleDraft":{"type":["string","null"],"x-luca-sensitive":"null"},"maxObjections":{"type":"number","enum":[3]},"maxBoundaries":{"type":"number","enum":[5]}},"required":["progress","nextQuestion","answered","skipped","complete","suggestions","exampleDm","exampleDraft","maxObjections","maxBoundaries"]},"TeachLucaAnswerResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"progress":{"type":"object","properties":{"offer_and_price":{"type":"string","enum":["pending","answered","skipped"]},"top_objections":{"type":"string","enum":["pending","answered","skipped"]},"tone_boundaries":{"type":"string","enum":["pending","answered","skipped"]}}},"nextQuestion":{"type":["string","null"],"enum":["offer_and_price","top_objections","tone_boundaries",null]},"answered":{"type":"integer","minimum":0},"skipped":{"type":"integer","minimum":0},"complete":{"type":"boolean"},"exampleDraft":{"type":["string","null"],"x-luca-sensitive":"null"}},"required":["ok","progress","nextQuestion","answered","skipped","complete","exampleDraft"]},"TeachLucaSkip":{"type":"object","properties":{"key":{"type":"string","enum":["offer_and_price","top_objections","tone_boundaries"]}},"required":["key"]},"ApiCapabilitiesResponse":{"type":"object","properties":{"apiBasePath":{"type":"string","enum":["/api"]},"auth":{"type":"object","properties":{"apiKeyHeaders":{"type":"array","items":{"type":"string","enum":["x-api-key","authorization"]}},"workspaceHeaders":{"type":"array","items":{"type":"string","enum":["x-luca-workspace-id","x-luca-workspace-slug"]}},"idempotencyHeader":{"type":"string","enum":["idempotency-key"]}},"required":["apiKeyHeaders","workspaceHeaders","idempotencyHeader"]},"boundary":{"type":"object","properties":{"mcpImplementationRepo":{"type":"string","enum":["separate"]},"internalEndpointsAllowed":{"type":"boolean","enum":[false]},"databaseAccessAllowed":{"type":"boolean","enum":[false]},"privateWebhookIngressAllowed":{"type":"boolean","enum":[false]}},"required":["mcpImplementationRepo","internalEndpointsAllowed","databaseAccessAllowed","privateWebhookIngressAllowed"]},"scopes":{"type":"array","items":{"type":"string"}},"operations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"method":{"type":"string","enum":["GET","POST","PUT","PATCH","DELETE"]},"path":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"idempotencyRequired":{"type":"boolean"},"description":{"type":"string"}},"required":["id","method","path","scopes","idempotencyRequired","description"]}},"webhookEvents":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]}},"resourceKinds":{"type":"array","items":{"type":"string"}}},"required":["apiBasePath","auth","boundary","scopes","operations","webhookEvents","resourceKinds"]},"LeadListResponse":{"type":"object","properties":{"leads":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"displayName":{"type":["string","null"],"x-luca-sensitive":"null"},"profilePhotoUrl":{"type":["string","null"],"format":"uri","x-luca-sensitive":"null"},"externalUserId":{"type":"string","x-luca-sensitive":"blank"},"tags":{"type":"array","items":{"type":"string"}},"lastSeenAt":{"type":"string"},"createdAt":{"type":"string"}},"required":["id","channel","displayName","externalUserId","tags","lastSeenAt","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["leads","nextCursor"]},"LeadUpdateResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalUserId":{"type":"string","x-luca-sensitive":"blank"},"displayName":{"type":["string","null"],"x-luca-sensitive":"null"},"profilePhotoUrl":{"type":["string","null"],"format":"uri","x-luca-sensitive":"null"},"customFields":{"x-luca-sensitive":"empty"},"tags":{"type":"array","items":{"type":"string"}},"score":{"type":"integer"},"createdAt":{"type":"string"},"lastSeenAt":{"type":"string"}},"required":["id","coachId","channel","externalUserId","displayName","customFields","tags","score","createdAt","lastSeenAt"]}},"required":["id","lead"]},"LeadCreate":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalUserId":{"type":"string","minLength":1},"displayName":{"type":"string","minLength":1},"stage":{"type":"string","minLength":1},"customFields":{"type":"object","additionalProperties":{}},"tags":{"type":"array","items":{"type":"string","minLength":1}}},"required":["channel","externalUserId"]},"LeadFieldDefinitionUpsert":{"type":"object","properties":{"key":{"type":"string","minLength":1,"pattern":"^[a-z][a-z0-9_]*$"},"label":{"type":"string","minLength":1},"type":{"type":"string","enum":["text","number","boolean","date","select"],"default":"text"},"options":{"type":"object","additionalProperties":{}}},"required":["key","label"]},"LeadImport":{"type":"object","properties":{"source":{"type":"string","minLength":1,"default":"csv_import"},"rows":{"type":"array","items":{"type":"object","additionalProperties":{}},"minItems":1,"maxItems":1000},"mapping":{"type":"object","properties":{"identity":{"type":"object","properties":{"channelColumn":{"type":"string","minLength":1},"channelDefault":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalUserIdColumn":{"type":"string","minLength":1},"displayNameColumn":{"type":"string","minLength":1}},"required":["externalUserIdColumn"]},"tagsColumn":{"type":"string","minLength":1},"tagsDelimiter":{"type":"string","minLength":1,"maxLength":4,"default":","},"stageColumn":{"type":"string","minLength":1},"customFields":{"type":"object","additionalProperties":{"type":"string"}},"identities":{"type":"array","items":{"type":"object","properties":{"channelColumn":{"type":"string","minLength":1},"channelDefault":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalUserIdColumn":{"type":"string","minLength":1},"displayNameColumn":{"type":"string","minLength":1},"verificationStatus":{"type":"string","enum":["inferred","claimed","verified","rejected"],"default":"claimed"},"source":{"type":"string","minLength":1}},"required":["externalUserIdColumn"]},"maxItems":20,"default":[]},"consents":{"type":"array","items":{"type":"object","properties":{"channelColumn":{"type":"string","minLength":1},"channelDefault":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"purpose":{"type":"string","enum":["booking_reminders","marketing","sales_follow_up","support"]},"grantedColumn":{"type":"string","minLength":1},"evidenceColumn":{"type":"string","minLength":1},"source":{"type":"string","minLength":1}},"required":["purpose","grantedColumn"]},"maxItems":20,"default":[]}},"required":["identity"]}},"required":["rows","mapping"]},"LeadExplainResponse":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["explained"]},"leadId":{"type":"string","format":"uuid"},"qualification":{"x-luca-sensitive":"null"},"confidence":{"type":"number"},"at":{"type":"string"}},"required":["status","leadId","qualification","confidence","at"]},{"type":"object","properties":{"status":{"type":"string","enum":["no_reasoning_available"]},"leadId":{"type":"string","format":"uuid"},"reason":{"type":"string","enum":["never_drafted","not_qualified"]}},"required":["status","leadId","reason"]}]},"LeadDetailResponse":{"type":"object","properties":{"lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"displayName":{"type":["string","null"],"x-luca-sensitive":"null"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"stage":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"customFields":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"}},"required":["id","displayName","channel","stage","tags","customFields"]},"journey":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"state":{"type":"string"},"transitionedAt":{"type":"string"},"metadata":{}},"required":["id","state","transitionedAt"]}},"journeyTruncated":{"type":"boolean"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"direction":{"type":"string"},"body":{"type":["string","null"],"x-luca-sensitive":"null"},"receivedAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"media":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"mediaUrl":{"type":"string"},"mediaType":{"type":"string","enum":["audio","image","file"]},"storageKey":{"type":"string"},"transcript":{"type":["string","null"]},"summary":{"type":["string","null"]},"classification":{"type":["string","null"]},"analysisStatus":{"type":"string","enum":["pending","completed","failed","skipped","blocked","cancelled"]},"safetyStatus":{"type":"string","enum":["safe","needs_review","blocked"]}},"required":["id","mediaUrl","mediaType","storageKey","transcript","summary","classification","analysisStatus","safetyStatus"]},"default":[],"x-luca-sensitive":"empty"}},"required":["id","direction","body","receivedAt","sentAt"]}},"notes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"authorUserId":{"type":["string","null"]},"body":{"type":"string","x-luca-sensitive":"blank"},"createdAt":{"type":"string"}},"required":["id","coachId","leadId","authorUserId","body","createdAt"]}},"notesTruncated":{"type":"boolean"},"identities":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalUserId":{"type":"string","x-luca-sensitive":"blank"},"displayName":{"type":["string","null"],"x-luca-sensitive":"null"},"verificationStatus":{"type":"string","enum":["inferred","claimed","verified","rejected"]},"source":{"type":"string"},"sourceRef":{"type":["string","null"]}},"required":["id","channel","externalUserId","displayName","verificationStatus","source","sourceRef"]}},"consents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"purpose":{"type":"string","enum":["booking_reminders","marketing","sales_follow_up","support"]},"source":{"type":"string"},"evidenceId":{"type":"string"},"grantedAt":{"type":"string"},"revokedAt":{"type":["string","null"]}},"required":["id","channel","purpose","source","evidenceId","grantedAt","revokedAt"]}}},"required":["lead","journey","messages","notes","identities","consents"]},"LeadPatch":{"type":"object","properties":{"displayName":{"type":"string","minLength":1},"stage":{"type":"string","minLength":1},"customFields":{"type":"object","additionalProperties":{}},"tags":{"type":"array","items":{"type":"string","minLength":1}}}},"LeadDraftResponse":{"type":"object","properties":{"draft":{"type":"object","properties":{"body":{"type":"string","x-luca-sensitive":"blank"},"reviewQueueId":{"type":["string","null"]},"voiceMatch":{"type":"number"},"criticFlags":{"type":"array","items":{"type":"string"}}},"required":["body","reviewQueueId","voiceMatch","criticFlags"]}},"required":["draft"]},"LeadDraftRequest":{"type":"object","properties":{"guidance":{"type":"string","minLength":1,"maxLength":500}}},"LeadIdentityCreate":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalUserId":{"type":"string","minLength":1},"displayName":{"type":"string","minLength":1},"verificationStatus":{"type":"string","enum":["inferred","claimed","verified","rejected"],"default":"claimed"},"source":{"type":"string","minLength":1,"default":"api"},"sourceRef":{"type":"string","minLength":1}},"required":["channel","externalUserId"]},"LeadConsentGrant":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"purpose":{"type":"string","enum":["booking_reminders","marketing","sales_follow_up","support"]},"source":{"type":"string","minLength":1},"evidenceId":{"type":"string","minLength":1},"grantedAt":{"type":["string","null"],"format":"date-time"}},"required":["channel","purpose","source","evidenceId"]},"LeadConsentRevoke":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"purpose":{"type":"string","enum":["booking_reminders","marketing","sales_follow_up","support"]}},"required":["channel","purpose"]},"CadencePauseResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"leadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["cancelled"]}},"required":["ok","leadId","status"]},"CadencePauseRequest":{"type":"object","properties":{"reason":{"type":"string","minLength":1,"maxLength":500}}},"LeadNoteCreateResponse":{"type":"object","properties":{"note":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"authorUserId":{"type":["string","null"]},"body":{"type":"string","x-luca-sensitive":"blank"},"createdAt":{"type":"string"}},"required":["id","coachId","leadId","authorUserId","body","createdAt"]}},"required":["note"]},"LeadNoteCreate":{"type":"object","properties":{"body":{"type":"string","minLength":1}},"required":["body"]},"LeadNoteDeleteResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"LeadDraftingPauseResponse":{"type":"object","properties":{"pausedUntil":{"type":["string","null"]}},"required":["pausedUntil"]},"LeadDraftingPauseRequest":{"type":"object","properties":{"duration":{"type":"string","enum":["1h","24h","7d","30d","until_resumed"]}},"required":["duration"]},"LeadDraftingResumeResponse":{"type":"object","properties":{"restartedTurnId":{"type":["string","null"],"format":"uuid"},"restartedTurnIds":{"type":"array","items":{"type":"string","format":"uuid"}},"skippedReason":{"type":"string","enum":["already_replied","window_closed","turn_not_latest","nothing_paused"]}},"required":["restartedTurnId","restartedTurnIds"]},"InsightListResponse":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["metric_drop","metric_spike","opportunity","milestone","risk"]},"severity":{"type":"string","enum":["info","warning","urgent"]},"metric":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"currentValue":{"type":["number","null"]},"previousValue":{"type":["number","null"]},"deltaPct":{"type":["number","null"]},"actionRoute":{"type":["string","null"]},"actionLabel":{"type":["string","null"]},"dedupeKey":{"type":"string"},"status":{"type":"string","enum":["unread","read","dismissed","actioned","expired"]},"detectedAt":{"type":"string"},"readAt":{"type":["string","null"]},"dismissedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","kind","severity","metric","title","body","currentValue","previousValue","deltaPct","actionRoute","actionLabel","dedupeKey","status","detectedAt","readAt","dismissedAt","expiresAt","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["items","nextCursor"]},"InsightUnreadCountResponse":{"type":"object","properties":{"count":{"type":"integer"}},"required":["count"]},"Insight":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["metric_drop","metric_spike","opportunity","milestone","risk"]},"severity":{"type":"string","enum":["info","warning","urgent"]},"metric":{"type":"string"},"title":{"type":"string"},"body":{"type":"string"},"currentValue":{"type":["number","null"]},"previousValue":{"type":["number","null"]},"deltaPct":{"type":["number","null"]},"actionRoute":{"type":["string","null"]},"actionLabel":{"type":["string","null"]},"dedupeKey":{"type":"string"},"status":{"type":"string","enum":["unread","read","dismissed","actioned","expired"]},"detectedAt":{"type":"string"},"readAt":{"type":["string","null"]},"dismissedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","kind","severity","metric","title","body","currentValue","previousValue","deltaPct","actionRoute","actionLabel","dedupeKey","status","detectedAt","readAt","dismissedAt","expiresAt","createdAt"]},"AlertSettingsResponse":{"type":"object","properties":{"feedEnabled":{"type":"boolean"},"digestEnabled":{"type":"boolean"},"pushEnabled":{"type":"boolean"},"toggles":{"type":"object","additionalProperties":{"type":"boolean"}},"thresholds":{"type":"object","additionalProperties":{"type":"number"}},"updatedAt":{"type":"string"}},"required":["feedEnabled","digestEnabled","pushEnabled","toggles","thresholds","updatedAt"]},"AlertSettingsPatch":{"type":"object","properties":{"feedEnabled":{"type":"boolean"},"digestEnabled":{"type":"boolean"},"pushEnabled":{"type":"boolean"},"toggles":{"type":"object","properties":{"metric_drop":{"type":"boolean"},"metric_spike":{"type":"boolean"},"opportunity":{"type":"boolean"},"milestone":{"type":"boolean"},"risk":{"type":"boolean"}},"additionalProperties":false},"thresholds":{"type":"object","properties":{"show_rate_drop":{"type":"number","exclusiveMaximum":0,"minimum":-1},"revenue_drop":{"type":"number","exclusiveMaximum":0,"minimum":-1},"reply_speed_regression":{"type":"number","exclusiveMinimum":0,"maximum":50},"ghost_rate_spike":{"type":"number","exclusiveMinimum":0,"maximum":50},"hot_leads_silent":{"type":"integer","exclusiveMinimum":0,"maximum":1000},"bookings_spike":{"type":"number","exclusiveMinimum":0,"maximum":50},"trust_graduation":{"type":"number","exclusiveMinimum":0,"maximum":1}},"additionalProperties":false}}},"ProviderLabStatusResponse":{"type":"object","properties":{"enabled":{"type":"boolean"},"scenarios":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["all_healthy","instagram_comment_ready","instagram_public_reply_blocked","instagram_comment_duplicate_cooldown","instagram_comment_ai_classifier","instagram_comment_auto_sent","instagram_account_disconnected","whatsapp_freeform_open","whatsapp_template_required","whatsapp_template_missing","crm_hubspot_ready","crm_ghl_ready","crm_conflict_or_missing_scope","booking_ready","booking_provider_down","webhook_failed_replayable","broadcast_ready","broadcast_mixed_eligibility"]},"label":{"type":"string"},"description":{"type":"string"},"category":{"type":"string","enum":["full","channel","crm","booking","webhook","broadcast"]},"providers":{"type":"array","items":{"type":"string"}}},"required":["id","label","description","category","providers"]}},"summary":{"type":"object","properties":{"enabled":{"type":"boolean"},"activeScenario":{"type":["string","null"],"enum":["all_healthy","instagram_comment_ready","instagram_public_reply_blocked","instagram_comment_duplicate_cooldown","instagram_comment_ai_classifier","instagram_comment_auto_sent","instagram_account_disconnected","whatsapp_freeform_open","whatsapp_template_required","whatsapp_template_missing","crm_hubspot_ready","crm_ghl_ready","crm_conflict_or_missing_scope","booking_ready","booking_provider_down","webhook_failed_replayable","broadcast_ready","broadcast_mixed_eligibility",null]},"health":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"status":{"type":"string","enum":["ready","degraded","blocked","missing"]},"message":{"type":"string"}},"required":["area","status","message"]}},"resources":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"label":{"type":"string"}},"required":["type","id"]}}},"required":["enabled","activeScenario","health","resources"]}},"required":["enabled","scenarios","summary"]},"ProviderLabApplyResponse":{"type":"object","properties":{"scenario":{"type":"string","enum":["all_healthy","instagram_comment_ready","instagram_public_reply_blocked","instagram_comment_duplicate_cooldown","instagram_comment_ai_classifier","instagram_comment_auto_sent","instagram_account_disconnected","whatsapp_freeform_open","whatsapp_template_required","whatsapp_template_missing","crm_hubspot_ready","crm_ghl_ready","crm_conflict_or_missing_scope","booking_ready","booking_provider_down","webhook_failed_replayable","broadcast_ready","broadcast_mixed_eligibility"]},"summary":{"type":"object","properties":{"enabled":{"type":"boolean"},"activeScenario":{"type":["string","null"],"enum":["all_healthy","instagram_comment_ready","instagram_public_reply_blocked","instagram_comment_duplicate_cooldown","instagram_comment_ai_classifier","instagram_comment_auto_sent","instagram_account_disconnected","whatsapp_freeform_open","whatsapp_template_required","whatsapp_template_missing","crm_hubspot_ready","crm_ghl_ready","crm_conflict_or_missing_scope","booking_ready","booking_provider_down","webhook_failed_replayable","broadcast_ready","broadcast_mixed_eligibility",null]},"health":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"status":{"type":"string","enum":["ready","degraded","blocked","missing"]},"message":{"type":"string"}},"required":["area","status","message"]}},"resources":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"label":{"type":"string"}},"required":["type","id"]}}},"required":["enabled","activeScenario","health","resources"]}},"required":["scenario","summary"]},"ProviderLabApply":{"type":"object","properties":{"scenario":{"type":"string","enum":["all_healthy","instagram_comment_ready","instagram_public_reply_blocked","instagram_comment_duplicate_cooldown","instagram_comment_ai_classifier","instagram_comment_auto_sent","instagram_account_disconnected","whatsapp_freeform_open","whatsapp_template_required","whatsapp_template_missing","crm_hubspot_ready","crm_ghl_ready","crm_conflict_or_missing_scope","booking_ready","booking_provider_down","webhook_failed_replayable","broadcast_ready","broadcast_mixed_eligibility"]},"provider":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]}},"required":["scenario"]},"ProviderLabFaultResponse":{"type":"object","properties":{"fault":{"type":"string","enum":["hold_booking_reminder_dispatch","release_booking_reminder_dispatch","delay_crm_sync","delay_crm_response","reject_crm_request","reject_channel_request","delay_channel_request","rate_limit_channel_request","ambiguous_channel_request","malformed_channel_response","partial_send","unauthorized_channel_request","forbidden_channel_request","server_error_channel_request","connection_reset_channel_request","timeout_channel_request","missing_acknowledgement_channel_request","reject_message_finalization","reject_credential_scrub","fail_cleanup","fail_repair","delay_lifecycle_request","reject_lifecycle_request","delay_connection_report","reject_connection_report","report_account_health_red","report_account_health_yellow","fail_account_health_probe","fail_release_lookup"]},"eventId":{"type":"string","format":"uuid"}},"required":["fault","eventId"]},"ProviderLabFaultRequest":{"oneOf":[{"type":"object","properties":{"fault":{"type":"string","enum":["hold_booking_reminder_dispatch"]},"bookingId":{"type":"string","format":"uuid"},"communicationId":{"type":"string","format":"uuid"},"reviewId":{"type":"string","format":"uuid"},"timeoutMs":{"type":"integer","minimum":1000,"maximum":120000}},"required":["fault","bookingId","communicationId","reviewId","timeoutMs"]},{"type":"object","properties":{"fault":{"type":"string","enum":["release_booking_reminder_dispatch"]},"eventId":{"type":"string","format":"uuid"},"bookingId":{"type":"string","format":"uuid"},"communicationId":{"type":"string","format":"uuid"},"reviewId":{"type":"string","format":"uuid"}},"required":["fault","eventId","bookingId","communicationId","reviewId"]},{"type":"object","properties":{"fault":{"type":"string","enum":["delay_crm_sync"]},"connectionId":{"type":"string","format":"uuid"},"subjectId":{"type":"string","format":"uuid"},"delayMs":{"type":"integer","minimum":1,"maximum":10000}},"required":["fault","connectionId","subjectId","delayMs"]},{"type":"object","properties":{"fault":{"type":"string","enum":["delay_crm_response"]},"connectionId":{"type":"string","format":"uuid"},"subjectId":{"type":"string","format":"uuid"},"operation":{"type":"string","enum":["contact_search","note_create","note_update","contact_fields","deal_lookup","deal_stage","note_deal_association"]},"delayMs":{"type":"integer","minimum":1,"maximum":10000}},"required":["fault","connectionId","subjectId","operation","delayMs"]},{"type":"object","properties":{"fault":{"type":"string","enum":["reject_crm_request"]},"connectionId":{"type":"string","format":"uuid"},"subjectId":{"type":"string","format":"uuid"},"operation":{"type":"string","enum":["contact_search","note_create","note_update","contact_fields","deal_lookup","deal_stage","note_deal_association"]},"status":{"type":"integer","minimum":400,"maximum":599}},"required":["fault","connectionId","subjectId","operation","status"]},{"type":"object","properties":{"fault":{"type":"string","enum":["reject_channel_request"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["delay_channel_request"]},"expectedText":{"type":"string","minLength":1},"delayMs":{"type":"integer","minimum":1,"maximum":10000}},"required":["fault","expectedText","delayMs"]},{"type":"object","properties":{"fault":{"type":"string","enum":["rate_limit_channel_request"]},"expectedText":{"type":"string","minLength":1},"retryAfterSeconds":{"type":"integer","minimum":1,"maximum":3600}},"required":["fault","expectedText","retryAfterSeconds"]},{"type":"object","properties":{"fault":{"type":"string","enum":["ambiguous_channel_request"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["malformed_channel_response"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["partial_send"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["unauthorized_channel_request"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["forbidden_channel_request"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["server_error_channel_request"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["connection_reset_channel_request"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["timeout_channel_request"]},"expectedText":{"type":"string","minLength":1},"delayMs":{"type":"integer","minimum":1,"maximum":10000}},"required":["fault","expectedText","delayMs"]},{"type":"object","properties":{"fault":{"type":"string","enum":["missing_acknowledgement_channel_request"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["reject_message_finalization"]},"expectedText":{"type":"string","minLength":1}},"required":["fault","expectedText"]},{"type":"object","properties":{"fault":{"type":"string","enum":["reject_credential_scrub"]},"channelAccountId":{"type":"string","format":"uuid"}},"required":["fault","channelAccountId"]},{"type":"object","properties":{"fault":{"type":"string","enum":["fail_cleanup"]},"channelAccountId":{"type":"string","format":"uuid"}},"required":["fault","channelAccountId"]},{"type":"object","properties":{"fault":{"type":"string","enum":["fail_repair"]},"channelAccountId":{"type":"string","format":"uuid"}},"required":["fault","channelAccountId"]},{"type":"object","properties":{"fault":{"type":"string","enum":["delay_lifecycle_request"]},"provider":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"operation":{"type":"string","enum":["delete_subscriptions","get_me","get_webhook_info","set_webhook","delete_webhook","register_phone_number","subscribe_app","unsubscribe_app","subscribe_page","unsubscribe_page"]},"delayMs":{"type":"integer","minimum":1,"maximum":10000}},"required":["fault","provider","operation","delayMs"]},{"type":"object","properties":{"fault":{"type":"string","enum":["reject_lifecycle_request"]},"provider":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"operation":{"type":"string","enum":["delete_subscriptions","get_me","get_webhook_info","set_webhook","delete_webhook","register_phone_number","subscribe_app","unsubscribe_app","subscribe_page","unsubscribe_page"]},"status":{"type":"integer","minimum":400,"maximum":599}},"required":["fault","provider","operation","status"]},{"type":"object","properties":{"fault":{"type":"string","enum":["delay_connection_report"]},"delayMs":{"type":"integer","minimum":1,"maximum":15000}},"required":["fault","delayMs"]},{"type":"object","properties":{"fault":{"type":"string","enum":["reject_connection_report"]}},"required":["fault"]},{"type":"object","properties":{"fault":{"type":"string","enum":["report_account_health_red"]},"channelAccountId":{"type":"string","format":"uuid"}},"required":["fault","channelAccountId"]},{"type":"object","properties":{"fault":{"type":"string","enum":["report_account_health_yellow"]},"channelAccountId":{"type":"string","format":"uuid"}},"required":["fault","channelAccountId"]},{"type":"object","properties":{"fault":{"type":"string","enum":["fail_account_health_probe"]},"channelAccountId":{"type":"string","format":"uuid"}},"required":["fault","channelAccountId"]},{"type":"object","properties":{"fault":{"type":"string","enum":["fail_release_lookup"]}},"required":["fault"]}]},"ProviderLabResetResponse":{"type":"object","properties":{"summary":{"type":"object","properties":{"enabled":{"type":"boolean"},"activeScenario":{"type":["string","null"],"enum":["all_healthy","instagram_comment_ready","instagram_public_reply_blocked","instagram_comment_duplicate_cooldown","instagram_comment_ai_classifier","instagram_comment_auto_sent","instagram_account_disconnected","whatsapp_freeform_open","whatsapp_template_required","whatsapp_template_missing","crm_hubspot_ready","crm_ghl_ready","crm_conflict_or_missing_scope","booking_ready","booking_provider_down","webhook_failed_replayable","broadcast_ready","broadcast_mixed_eligibility",null]},"health":{"type":"array","items":{"type":"object","properties":{"area":{"type":"string"},"status":{"type":"string","enum":["ready","degraded","blocked","missing"]},"message":{"type":"string"}},"required":["area","status","message"]}},"resources":{"type":"array","items":{"type":"object","properties":{"type":{"type":"string"},"id":{"type":"string"},"label":{"type":"string"}},"required":["type","id"]}}},"required":["enabled","activeScenario","health","resources"]}},"required":["summary"]},"IntegrationConnectorsResponse":{"type":"object","properties":{"connectors":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","enum":["zapier","make"]},"name":{"type":"string"},"type":{"type":"string","enum":["automation"]},"auth":{"type":"string","enum":["api_key"]},"usesWebhookSubscriptions":{"type":"boolean"},"supportedTriggers":{"type":"array","items":{"type":"string"}},"supportedActions":{"type":"array","items":{"type":"string"}},"triggerInventory":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"eventType":{"type":"string"},"delivery":{"type":"string","enum":["rest_hook","instant_webhook"]},"category":{"type":"string","enum":["lead","message","review","booking","campaign","broadcast","crm","integration"]},"sampleResource":{"type":"string"},"dedupeField":{"type":"string"},"replaySupported":{"type":"boolean"},"subscriptionMetadata":{"type":"object","additionalProperties":{},"default":{},"description":"Opaque JSON object"},"samplePayload":{"type":"object","additionalProperties":{},"default":{},"description":"Opaque JSON object"}},"required":["id","label","description","eventType","delivery","category","sampleResource","dedupeField","replaySupported"]}},"actionInventory":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"description":{"type":"string"},"method":{"type":"string"},"path":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"idempotencyRequired":{"type":"boolean"},"idempotencyKeyExample":{"type":"string"},"requestBodyExample":{"type":"object","additionalProperties":{},"default":{},"description":"Opaque JSON object"}},"required":["id","label","description","method","path","scopes","idempotencyRequired","idempotencyKeyExample"]}}},"required":["id","name","type","auth","usesWebhookSubscriptions","supportedTriggers","supportedActions","triggerInventory","actionInventory"]}},"crmProviders":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"displayName":{"type":"string"},"auth":{"type":"string","enum":["oauth","api_key"]},"capabilityFlags":{"type":"object","properties":{"tags":{"type":"boolean"},"customFields":{"type":"boolean"},"deals":{"type":"boolean"},"pipelines":{"type":"boolean"},"calendar":{"type":"boolean"},"webhooks":{"type":"boolean"},"ownerAssignment":{"type":"boolean"},"bidirectionalSync":{"type":"boolean"}},"required":["tags","customFields","deals","pipelines","calendar","webhooks","ownerAssignment","bidirectionalSync"]},"providerFields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","enum"]},"dangerous":{"type":"boolean"}},"required":["key","label","type"]}}},"required":["provider","displayName","auth","capabilityFlags","providerFields"]}}},"required":["connectors","crmProviders"]},"CrmOAuthUrlResponse":{"type":"object","properties":{"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"authUrl":{"type":"string","format":"uri"},"state":{"type":"string"},"requiredScopes":{"type":"array","items":{"type":"string"}},"redirectUri":{"type":"string"}},"required":["provider","authUrl","state","requiredScopes","redirectUri"]},"CrmConnection":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"status":{"type":"string","enum":["connected","needs_auth","paused","disabled"]},"capabilityFlags":{"type":"object","properties":{"tags":{"type":"boolean"},"customFields":{"type":"boolean"},"deals":{"type":"boolean"},"pipelines":{"type":"boolean"},"calendar":{"type":"boolean"},"webhooks":{"type":"boolean"},"ownerAssignment":{"type":"boolean"},"bidirectionalSync":{"type":"boolean"}},"required":["tags","customFields","deals","pipelines","calendar","webhooks","ownerAssignment","bidirectionalSync"]},"settings":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"healthStatus":{"type":"string"},"lastHealthCheckAt":{"type":["string","null"]},"connectedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","provider","status","capabilityFlags","settings","healthStatus","lastHealthCheckAt","connectedAt","createdAt","updatedAt"]},"CrmOAuthCallback":{"type":"object","properties":{"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"code":{"type":"string","minLength":1},"state":{"type":"string","minLength":1},"redirectUri":{"type":"string","format":"uri"}},"required":["provider","code","state"]},"CrmConnectionsResponse":{"type":"object","properties":{"connections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"status":{"type":"string","enum":["connected","needs_auth","paused","disabled"]},"capabilityFlags":{"type":"object","properties":{"tags":{"type":"boolean"},"customFields":{"type":"boolean"},"deals":{"type":"boolean"},"pipelines":{"type":"boolean"},"calendar":{"type":"boolean"},"webhooks":{"type":"boolean"},"ownerAssignment":{"type":"boolean"},"bidirectionalSync":{"type":"boolean"}},"required":["tags","customFields","deals","pipelines","calendar","webhooks","ownerAssignment","bidirectionalSync"]},"settings":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"healthStatus":{"type":"string"},"lastHealthCheckAt":{"type":["string","null"]},"connectedAt":{"type":"string"},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","provider","status","capabilityFlags","settings","healthStatus","lastHealthCheckAt","connectedAt","createdAt","updatedAt"]}}},"required":["connections"]},"CrmConnectionCreate":{"type":"object","properties":{"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"credentialsRef":{"type":"string","pattern":"^v1\\.[A-Za-z0-9+/]{16}\\.[A-Za-z0-9+/]{22,}={0,2}$"},"settings":{"type":"object","additionalProperties":{},"default":{}}},"required":["provider","credentialsRef"]},"CrmProviderSchemaResponse":{"type":"object","properties":{"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"fields":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"label":{"type":"string"},"type":{"type":"string","enum":["string","number","boolean","date","enum"]},"resource":{"type":"string","enum":["contact","deal","note","tag","owner","pipeline","stage"],"default":"contact"},"required":{"type":"boolean","default":false},"dangerous":{"type":"boolean","default":false},"options":{"type":"array","items":{"type":"string"},"default":[]}},"required":["key","label","type"]}},"owners":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}},"pipelines":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"stages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}}},"required":["id","name","stages"]}},"tags":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"}},"required":["id","name"]}},"webhookEvents":{"type":"array","items":{"type":"string"}},"sampleRecords":{"type":"array","items":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"x-luca-sensitive":"empty"},"warnings":{"type":"array","items":{"type":"object","properties":{"operation":{"type":"string","enum":["contact_properties","custom_fields","deal_pipelines","owners","pipelines","sample_contacts","tags"]},"reason":{"type":"string","enum":["missing_account_identifier","request_failed"]}},"required":["operation","reason"]},"default":[]},"fetchedAt":{"type":"string"}},"required":["provider","fields","owners","pipelines","tags","webhookEvents","sampleRecords","fetchedAt"]},"CrmHealth":{"type":"object","properties":{"status":{"type":"string","enum":["healthy","missing_credentials","missing_scopes","error"]},"missingScopes":{"type":"array","items":{"type":"string"},"default":[]},"signals":{"type":"array","items":{"type":"string"},"default":[]},"checkedAt":{"type":"string"}},"required":["status","checkedAt"]},"CrmWebhookStatus":{"type":"object","properties":{"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"enabled":{"type":"boolean"},"targetUrl":{"type":"string","format":"uri"},"providerWebhookId":{"type":["string","null"]},"eventTypes":{"type":"array","items":{"type":"string"}},"status":{"type":"string","enum":["configured","pending","failed"]},"lastVerifiedAt":{"type":["string","null"]}},"required":["provider","enabled","targetUrl","providerWebhookId","eventTypes","status","lastVerifiedAt"]},"CrmWebhookSetup":{"type":"object","properties":{"enabled":{"type":"boolean","default":true},"targetUrl":{"type":"string","format":"uri"}}},"CrmFieldMappingsResponse":{"type":"object","properties":{"mappings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"lucaField":{"type":"string"},"providerField":{"type":"string"},"direction":{"type":"string","enum":["luca_to_crm","crm_to_luca","bidirectional"]},"transform":{"type":"object","additionalProperties":{},"default":{}},"dangerous":{"type":"boolean","default":false},"status":{"type":"string","default":"suggested"}},"required":["lucaField","providerField","direction"]}}},"required":["mappings"]},"CrmFieldMappingsConfirm":{"type":"object","properties":{"mappings":{"type":"array","items":{"type":"object","properties":{"lucaField":{"type":"string","minLength":1},"providerField":{"type":"string","minLength":1},"direction":{"type":"string","enum":["luca_to_crm","crm_to_luca","bidirectional"]},"transform":{"type":"object","additionalProperties":{},"default":{}},"dangerous":{"type":"boolean","default":false}},"required":["lucaField","providerField","direction"]}}},"required":["mappings"]},"CrmSyncRun":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"mode":{"type":"string","enum":["dry_run","live"]},"direction":{"type":"string","enum":["luca_to_crm","crm_to_luca","bidirectional"]},"status":{"type":"string","enum":["planned","applied","failed","cancelled"]},"plannedMutations":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"resource":{"type":"string","enum":["contact","deal","note","tag","field"]},"externalId":{"type":"string"},"lucaId":{"type":"string"},"fields":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"},"dangerous":{"type":"boolean"}},"required":["action","resource","fields"]}},"appliedMutations":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"resource":{"type":"string","enum":["contact","deal","note","tag","field"]},"externalId":{"type":"string"},"lucaId":{"type":"string"},"fields":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"},"dangerous":{"type":"boolean"}},"required":["action","resource","fields"]}},"conflictReport":{"description":"Opaque JSON value"},"error":{"type":["string","null"]},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","connectionId","provider","mode","direction","status","plannedMutations","appliedMutations","conflictReport","error","createdAt","completedAt"]},"CrmSyncRunCreate":{"type":"object","properties":{"mode":{"type":"string","enum":["dry_run","live"],"default":"dry_run"},"direction":{"type":"string","enum":["luca_to_crm","crm_to_luca","bidirectional"],"default":"bidirectional"}}},"CrmSyncRunsResponse":{"type":"object","properties":{"syncRuns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"connectionId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"mode":{"type":"string","enum":["dry_run","live"]},"direction":{"type":"string","enum":["luca_to_crm","crm_to_luca","bidirectional"]},"status":{"type":"string","enum":["planned","applied","failed","cancelled"]},"plannedMutations":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"resource":{"type":"string","enum":["contact","deal","note","tag","field"]},"externalId":{"type":"string"},"lucaId":{"type":"string"},"fields":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"},"dangerous":{"type":"boolean"}},"required":["action","resource","fields"]}},"appliedMutations":{"type":"array","items":{"type":"object","properties":{"action":{"type":"string"},"resource":{"type":"string","enum":["contact","deal","note","tag","field"]},"externalId":{"type":"string"},"lucaId":{"type":"string"},"fields":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"},"dangerous":{"type":"boolean"}},"required":["action","resource","fields"]}},"conflictReport":{"description":"Opaque JSON value"},"error":{"type":["string","null"]},"createdAt":{"type":"string"},"completedAt":{"type":["string","null"]}},"required":["id","connectionId","provider","mode","direction","status","plannedMutations","appliedMutations","conflictReport","error","createdAt","completedAt"]}}},"required":["syncRuns"]},"CrmProviderWebhookResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"dedupeKey":{"type":"string"},"status":{"type":"string"},"replayed":{"type":"boolean"}},"required":["dedupeKey","status","replayed"]},"CrmProviderWebhook":{"type":"object","properties":{"eventId":{"type":"string","minLength":1},"eventType":{"type":"string","minLength":1,"default":"crm.contact.updated"},"resourceType":{"type":"string","minLength":1},"resourceId":{"type":"string","minLength":1},"payload":{"type":"object","additionalProperties":{},"default":{}}}},"IntegrationEventsResponse":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["webhook","zapier","make","crm","api","worker"]},"provider":{"type":["string","null"]},"eventType":{"type":"string"},"resourceType":{"type":["string","null"]},"resourceId":{"type":["string","null"]},"status":{"type":"string"},"payload":{"x-luca-sensitive":"empty"},"error":{"type":["string","null"]},"dedupeKey":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","source","provider","eventType","resourceType","resourceId","status","payload","error","dedupeKey","createdAt"]}},"nextCursor":{"type":["string","null"],"default":null}},"required":["events"]},"KnowledgeSourceListResponse":{"type":"object","properties":{"sources":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["notion","google_docs","website","instagram_bio"]},"config":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"pageIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":50},"fileIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":50}}},"status":{"type":"string","enum":["connected","syncing","error","disconnected"]},"lastSyncedAt":{"type":["string","null"]},"lastError":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","type","config","status","lastSyncedAt","lastError","createdAt"]}}},"required":["sources"]},"KnowledgeSourceRow":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["notion","google_docs","website","instagram_bio"]},"config":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"pageIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":50},"fileIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":50}}},"status":{"type":"string","enum":["connected","syncing","error","disconnected"]},"lastSyncedAt":{"type":["string","null"]},"lastError":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","type","config","status","lastSyncedAt","lastError","createdAt"]},"KnowledgeSourceCreate":{"type":"object","properties":{"type":{"type":"string","enum":["notion","google_docs","website","instagram_bio"]},"config":{"type":"object","properties":{"url":{"type":"string","maxLength":2000,"format":"uri"},"pageIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":50},"fileIds":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":50}}}},"required":["type","config"]},"KnowledgeSourceDeleteResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"KnowledgeSourceSyncResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"sourceId":{"type":"string","format":"uuid"}},"required":["ok","sourceId"]},"ProfileSuggestionListResponse":{"type":"object","properties":{"suggestions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"sourceId":{"type":"string","format":"uuid"},"fieldPath":{"type":"string"},"currentValue":{},"suggestedValue":{},"evidence":{"type":"object","properties":{"excerpt":{"type":"string"},"locator":{"type":"string"}},"required":["excerpt","locator"]},"status":{"type":"string","enum":["pending","approved","rejected"]},"createdAt":{"type":"string"},"resolvedAt":{"type":["string","null"]}},"required":["id","sourceId","fieldPath","evidence","status","createdAt","resolvedAt"]}}},"required":["suggestions"]},"ProfileSuggestionResolveResponse":{"type":"object","properties":{"suggestion":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"sourceId":{"type":"string","format":"uuid"},"fieldPath":{"type":"string"},"currentValue":{},"suggestedValue":{},"evidence":{"type":"object","properties":{"excerpt":{"type":"string"},"locator":{"type":"string"}},"required":["excerpt","locator"]},"status":{"type":"string","enum":["pending","approved","rejected"]},"createdAt":{"type":"string"},"resolvedAt":{"type":["string","null"]}},"required":["id","sourceId","fieldPath","evidence","status","createdAt","resolvedAt"]}},"required":["suggestion"]},"WebhookEventsResponse":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]},"created_at":{"type":"string"},"organization_id":{"type":"string"},"workspace_id":{"type":["string","null"],"format":"uuid"},"data":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"}},"required":["id","type","created_at","organization_id","workspace_id","data"]}}},"required":["events"]},"WebhookSubscriptionsResponse":{"type":"object","properties":{"subscriptions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string"},"coachId":{"type":["string","null"],"format":"uuid"},"targetUrl":{"type":"string"},"eventTypes":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]}},"status":{"type":"string","enum":["active","paused","disabled","deleted"]},"consumerMetadata":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"expiresAt":{"type":["string","null"]},"health":{"type":"string","enum":["healthy","degraded","down"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","coachId","targetUrl","eventTypes","status","consumerMetadata","expiresAt","createdAt","updatedAt"]}}},"required":["subscriptions"]},"WebhookSubscription":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string"},"coachId":{"type":["string","null"],"format":"uuid"},"targetUrl":{"type":"string"},"eventTypes":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]}},"status":{"type":"string","enum":["active","paused","disabled","deleted"]},"consumerMetadata":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"signingSecret":{"type":"string"},"expiresAt":{"type":["string","null"]},"health":{"type":"string","enum":["healthy","degraded","down"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","coachId","targetUrl","eventTypes","status","consumerMetadata","expiresAt","createdAt","updatedAt"]},"WebhookSubscriptionCreate":{"type":"object","properties":{"targetUrl":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]},"minItems":1},"workspaceScoped":{"type":"boolean","default":true},"consumerMetadata":{"type":"object","additionalProperties":{},"default":{}},"expiresAt":{"type":"string","format":"date-time"}},"required":["targetUrl","eventTypes"]},"WebhookSubscriptionPublic":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"organizationId":{"type":"string"},"coachId":{"type":["string","null"],"format":"uuid"},"targetUrl":{"type":"string"},"eventTypes":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]}},"status":{"type":"string","enum":["active","paused","disabled","deleted"]},"consumerMetadata":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"expiresAt":{"type":["string","null"]},"health":{"type":"string","enum":["healthy","degraded","down"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","organizationId","coachId","targetUrl","eventTypes","status","consumerMetadata","expiresAt","createdAt","updatedAt"]},"WebhookSubscriptionUpdate":{"type":"object","properties":{"targetUrl":{"type":"string","format":"uri"},"eventTypes":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]},"minItems":1},"status":{"type":"string","enum":["active","paused","disabled"]},"consumerMetadata":{"type":"object","additionalProperties":{}}}},"WebhookTestDeliveryResponse":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventId":{"type":"string"},"subscriptionId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","delivered","failed","dead_lettered"]},"payloadHash":{"type":"string"},"attemptCount":{"type":"integer"},"nextAttemptAt":{"type":"string"},"responseStatus":{"type":["integer","null"]},"responseBodySnippet":{"type":["string","null"]},"replaySourceDeliveryId":{"type":["string","null"],"format":"uuid"},"deliveredAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","eventId","subscriptionId","status","payloadHash","attemptCount","nextAttemptAt","responseStatus","responseBodySnippet","replaySourceDeliveryId","deliveredAt","createdAt","updatedAt"]}},"event":{"type":"object","properties":{"organizationId":{"type":"string"},"id":{"type":"string"},"type":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]}},"required":["organizationId","id","type"]}},"required":["deliveries","event"]},"WebhookTestEvent":{"type":"object","properties":{"type":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"],"default":"lead.created"},"data":{"type":"object","additionalProperties":{},"default":{}}}},"WebhookDeliveriesResponse":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventId":{"type":"string"},"subscriptionId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","delivered","failed","dead_lettered"]},"payloadHash":{"type":"string"},"attemptCount":{"type":"integer"},"nextAttemptAt":{"type":"string"},"responseStatus":{"type":["integer","null"]},"responseBodySnippet":{"type":["string","null"]},"replaySourceDeliveryId":{"type":["string","null"],"format":"uuid"},"deliveredAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","eventId","subscriptionId","status","payloadHash","attemptCount","nextAttemptAt","responseStatus","responseBodySnippet","replaySourceDeliveryId","deliveredAt","createdAt","updatedAt"]}}},"required":["deliveries"]},"WebhookSignatureGuide":{"type":"object","properties":{"algorithm":{"type":"string","enum":["HMAC-SHA256"]},"signedPayloadFormat":{"type":"string","enum":["timestamp.raw_body"]},"signaturePrefix":{"type":"string","enum":["v1="]},"digestEncoding":{"type":"string","enum":["base64url"]},"toleranceSeconds":{"type":"integer"},"headers":{"type":"object","properties":{"eventId":{"type":"string","enum":["x-luca-event-id"]},"deliveryId":{"type":"string","enum":["x-luca-delivery-id"]},"timestamp":{"type":"string","enum":["x-luca-timestamp"]},"signature":{"type":"string","enum":["x-luca-signature"]}},"required":["eventId","deliveryId","timestamp","signature"]},"duplicateHandling":{"type":"string"}},"required":["algorithm","signedPayloadFormat","signaturePrefix","digestEncoding","toleranceSeconds","headers","duplicateHandling"]},"WebhookDelivery":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventId":{"type":"string"},"subscriptionId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","delivered","failed","dead_lettered"]},"payloadHash":{"type":"string"},"attemptCount":{"type":"integer"},"nextAttemptAt":{"type":"string"},"responseStatus":{"type":["integer","null"]},"responseBodySnippet":{"type":["string","null"]},"replaySourceDeliveryId":{"type":["string","null"],"format":"uuid"},"deliveredAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","eventId","subscriptionId","status","payloadHash","attemptCount","nextAttemptAt","responseStatus","responseBodySnippet","replaySourceDeliveryId","deliveredAt","createdAt","updatedAt"]},"WebhookReplayResponse":{"type":"object","properties":{"deliveries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"eventId":{"type":"string"},"subscriptionId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","delivered","failed","dead_lettered"]},"payloadHash":{"type":"string"},"attemptCount":{"type":"integer"},"nextAttemptAt":{"type":"string"},"responseStatus":{"type":["integer","null"]},"responseBodySnippet":{"type":["string","null"]},"replaySourceDeliveryId":{"type":["string","null"],"format":"uuid"},"deliveredAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","eventId","subscriptionId","status","payloadHash","attemptCount","nextAttemptAt","responseStatus","responseBodySnippet","replaySourceDeliveryId","deliveredAt","createdAt","updatedAt"]}}},"required":["deliveries"]},"WebhookReplayEvent":{"type":"object","properties":{"subscriptionId":{"type":"string","format":"uuid"}}},"WebhookBulkReplay":{"type":"object","properties":{"eventTypes":{"type":"array","items":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]},"minItems":1},"from":{"type":"string","format":"date-time"},"to":{"type":"string","format":"date-time"},"limit":{"type":"integer","minimum":1,"maximum":100,"default":100}}},"MemoryListResponse":{"type":"object","properties":{"memories":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"content":{"type":"string","x-luca-sensitive":"blank"},"source":{"type":"string"},"sourceRefId":{"type":["string","null"]},"confidence":{"type":"number"},"metadata":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"createdByType":{"type":"string","enum":["coach","agent","system"]},"createdById":{"type":["string","null"]},"reason":{"type":["string","null"],"x-luca-sensitive":"null"},"evidence":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"trustLevel":{"type":"string","enum":["manual","trusted_pipeline","inferred","disputed"]},"supersedesMemoryId":{"type":["string","null"],"format":"uuid"},"supersededAt":{"type":["string","null"]},"disputedAt":{"type":["string","null"]},"disputedReason":{"type":["string","null"]},"leadId":{"type":["string","null"],"format":"uuid"},"archivedAt":{"type":["string","null"]},"factOrigin":{"type":["string","null"],"enum":["profile_text","coach_edit","lead_message",null]},"sourceField":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","content","source","sourceRefId","confidence","metadata","createdByType","createdById","reason","evidence","trustLevel","supersedesMemoryId","supersededAt","disputedAt","disputedReason","leadId","archivedAt","factOrigin","sourceField","createdAt","updatedAt"]}}},"required":["memories"]},"MemoryRow":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"content":{"type":"string","x-luca-sensitive":"blank"},"source":{"type":"string"},"sourceRefId":{"type":["string","null"]},"confidence":{"type":"number"},"metadata":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"createdByType":{"type":"string","enum":["coach","agent","system"]},"createdById":{"type":["string","null"]},"reason":{"type":["string","null"],"x-luca-sensitive":"null"},"evidence":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"trustLevel":{"type":"string","enum":["manual","trusted_pipeline","inferred","disputed"]},"supersedesMemoryId":{"type":["string","null"],"format":"uuid"},"supersededAt":{"type":["string","null"]},"disputedAt":{"type":["string","null"]},"disputedReason":{"type":["string","null"]},"leadId":{"type":["string","null"],"format":"uuid"},"archivedAt":{"type":["string","null"]},"factOrigin":{"type":["string","null"],"enum":["profile_text","coach_edit","lead_message",null]},"sourceField":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","content","source","sourceRefId","confidence","metadata","createdByType","createdById","reason","evidence","trustLevel","supersedesMemoryId","supersededAt","disputedAt","disputedReason","leadId","archivedAt","factOrigin","sourceField","createdAt","updatedAt"]},"MemoryPatch":{"type":"object","properties":{"content":{"type":"string","minLength":1,"maxLength":2000},"source":{"type":"string","minLength":1,"maxLength":80},"sourceRefId":{"type":["string","null"],"minLength":1,"maxLength":200},"confidence":{"type":"number","minimum":0,"maximum":1},"metadata":{"type":"object","additionalProperties":{}},"createdByType":{"type":"string","enum":["coach","agent","system"]},"createdById":{"type":["string","null"],"minLength":1,"maxLength":200},"reason":{"type":["string","null"],"minLength":1,"maxLength":500},"evidence":{"type":"object","additionalProperties":{}},"trustLevel":{"type":"string","enum":["manual","trusted_pipeline","inferred","disputed"]},"restore":{"type":"boolean"},"disputed":{"type":"boolean"},"disputedReason":{"type":["string","null"],"minLength":1,"maxLength":500},"preferred":{"type":"boolean"},"expectedUpdatedAt":{"type":"string","format":"date-time"}}},"MemoryDeleteResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"MemoryBulkResponse":{"type":"object","properties":{"action":{"type":"string","enum":["archive","restore"]},"affected":{"type":"integer","minimum":0},"ids":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["action","affected","ids"]},"MemoryBulkRequest":{"type":"object","properties":{"action":{"type":"string","enum":["archive","restore"]},"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["action","ids"]},"LearnedFactListResponse":{"type":"object","properties":{"facts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"content":{"type":"string","x-luca-sensitive":"blank"},"quote":{"type":["string","null"],"x-luca-sensitive":"null"},"reason":{"type":["string","null"],"x-luca-sensitive":"null"},"sourceField":{"type":["string","null"]},"status":{"type":"string","enum":["proposed","verified"]},"origin":{"type":"string","enum":["profile_text","coach_edit","lead_message"]},"createdAt":{"type":"string"}},"required":["id","content","quote","reason","sourceField","status","origin","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["facts","nextCursor"]},"LearnedFactDecisionResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["confirmed","rejected"]}},"required":["id","status"]},"OauthConnectionsResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"connections":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"clientId":{"type":"string"},"clientName":{"type":"string"},"scopes":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"lastUsedAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]}},"required":["id","clientId","clientName","scopes","createdAt","updatedAt","lastUsedAt","revokedAt"]}}},"required":["ok","connections"]},"OauthConnectionRevokeResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"id":{"type":"string"},"revokedAt":{"type":"string"}},"required":["ok","id","revokedAt"]},"MobileDeviceResponse":{"type":"object","properties":{"appEnvironment":{"type":"string","enum":["development","preview","production"]},"appVersion":{"type":["string","null"]},"deviceName":{"type":["string","null"]},"enabled":{"type":"boolean"},"id":{"type":"string","format":"uuid"},"lastSeenAt":{"type":"string"},"nativeBuildVersion":{"type":["string","null"]},"platform":{"type":"string","enum":["ios","android"]},"revokedAt":{"type":["string","null"]}},"required":["appEnvironment","appVersion","deviceName","enabled","id","lastSeenAt","nativeBuildVersion","platform","revokedAt"]},"MobileDeviceRegistration":{"type":"object","properties":{"appEnvironment":{"type":"string","enum":["development","preview","production"]},"appVersion":{"type":"string","minLength":1,"maxLength":64},"deviceName":{"type":"string","minLength":1,"maxLength":120},"expoPushToken":{"type":"string","minLength":10,"maxLength":512},"installIdHash":{"type":"string","minLength":16,"maxLength":128},"nativeBuildVersion":{"type":"string","minLength":1,"maxLength":64},"platform":{"type":"string","enum":["ios","android"]}},"required":["appEnvironment","expoPushToken","installIdHash","platform"]},"MobileDeviceDeleteResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"MobileNotificationPreferencesResponse":{"type":"object","properties":{"preferences":{"type":"object","properties":{"bookingConfirmed":{"type":"boolean"},"draftCreated":{"type":"boolean"},"leadQualified":{"type":"boolean"},"proactiveInsights":{"type":"boolean"},"productSecurity":{"type":"boolean"},"silentLeadFollowUp":{"type":"boolean"}},"required":["bookingConfirmed","draftCreated","leadQualified","proactiveInsights","productSecurity","silentLeadFollowUp"]},"updatedAt":{"type":"string"}},"required":["preferences","updatedAt"]},"MobileNotificationPreferencesPatch":{"type":"object","properties":{"bookingConfirmed":{"type":"boolean"},"draftCreated":{"type":"boolean"},"leadQualified":{"type":"boolean"},"proactiveInsights":{"type":"boolean"},"productSecurity":{"type":"boolean"},"silentLeadFollowUp":{"type":"boolean"}}},"BookingProviderListResponse":{"type":"object","properties":{"providers":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"label":{"type":"string","minLength":1},"health":{"type":"string","enum":["connected","missing_credentials","degraded"]},"capabilities":{"type":"array","items":{"type":"string","enum":["connect","health","list_event_types","list_calendars","availability","direct_booking","booking_link","reschedule","cancel","webhooks","no_show"]}},"operations":{"type":"array","items":{"type":"object","properties":{"operation":{"type":"string","enum":["connection_health","list_booking_types","list_calendars","select_calendar","availability","book","details","reschedule","cancel","update_invitee","update_location","update_content","update_conference","add_attendee","remove_attendee","booking_link","management_link","attendance_read","attendance_write","webhooks","reconciliation"]},"support":{"type":"string","enum":["direct","handoff","unsupported"]}},"required":["operation","support"]}},"editableFields":{"type":"array","items":{"type":"string","enum":["invitee_name","invitee_email","phone","answers","notes","title","agenda","location","conference_type"]}},"connectionMode":{"type":"string","enum":["oauth","api_key","manual"]},"supportsDirectBooking":{"type":"boolean"},"supportsBookingLinkFallback":{"type":"boolean"},"supportsReschedule":{"type":"boolean"},"supportsCancel":{"type":"boolean"},"supportsNoShow":{"type":"boolean"}},"required":["provider","label","health","capabilities","operations","editableFields","connectionMode","supportsDirectBooking","supportsBookingLinkFallback","supportsReschedule","supportsCancel","supportsNoShow"]}}},"required":["providers"]},"BookingProviderConnectionResponse":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"health":{"type":"string","enum":["connected","missing_credentials","degraded"]},"connectedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"reconnectRequired":{"type":"boolean"},"webhookSecret":{"type":"string","minLength":1}},"required":["provider","health","connectedAt","expiresAt","reconnectRequired"]},"BookingProviderConnectionCreate":{"type":"object","properties":{"credentials":{"type":"object","properties":{"accessToken":{"type":"string","minLength":1},"refreshToken":{"type":["string","null"],"minLength":1},"accountId":{"type":"string","minLength":1},"locationId":{"type":"string","minLength":1}},"required":["accessToken"],"additionalProperties":{}},"expiresAt":{"type":["string","null"],"format":"date-time"}},"required":["credentials"]},"BookingProviderMetadataResponse":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"source":{"type":"string","enum":["live_provider","fallback","provider_error"],"default":"fallback"},"warnings":{"type":"array","items":{"type":"string"},"default":[]},"eventTypes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"name":{"type":"string","minLength":1},"durationMinutes":{"type":"integer","exclusiveMinimum":0},"bookingUrl":{"type":"string","format":"uri"}},"required":["id","provider","name","durationMinutes"]}},"calendars":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"name":{"type":"string","minLength":1},"timezone":{"type":"string","minLength":1}},"required":["id","provider","name","timezone"]}}},"required":["provider","eventTypes","calendars"]},"BookingTypeListResponse":{"type":"object","properties":{"bookingTypes":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"externalId":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"active":{"type":"boolean","default":true},"isDefault":{"type":"boolean","default":false},"durationMinutes":{"type":"integer","minimum":5,"maximum":1440,"default":30},"timezone":{"type":"string","minLength":1},"minimumNoticeMinutes":{"type":"integer","minimum":0,"maximum":525600,"default":0},"bookingHorizonDays":{"type":"integer","minimum":1,"maximum":730,"default":60},"bufferBeforeMinutes":{"type":"integer","minimum":0,"maximum":1440,"default":0},"bufferAfterMinutes":{"type":"integer","minimum":0,"maximum":1440,"default":0},"location":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["google_meet"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["phone"]},"phoneNumber":{"type":"string","minLength":1}},"required":["type","phoneNumber"]},{"type":"object","properties":{"type":{"type":"string","enum":["in_person"]},"address":{"type":"string","minLength":1}},"required":["type","address"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"instructions":{"type":"string","minLength":1}},"required":["type","instructions"]}],"default":{"type":"google_meet"}},"destinationCalendarId":{"type":["string","null"],"minLength":1},"guestPolicy":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"agentPolicy":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["provider","name","timezone","guestPolicy","agentPolicy","id","coachId","createdAt","updatedAt"]}}},"required":["bookingTypes"]},"BookingTypeResponse":{"type":"object","properties":{"bookingType":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"externalId":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"active":{"type":"boolean","default":true},"isDefault":{"type":"boolean","default":false},"durationMinutes":{"type":"integer","minimum":5,"maximum":1440,"default":30},"timezone":{"type":"string","minLength":1},"minimumNoticeMinutes":{"type":"integer","minimum":0,"maximum":525600,"default":0},"bookingHorizonDays":{"type":"integer","minimum":1,"maximum":730,"default":60},"bufferBeforeMinutes":{"type":"integer","minimum":0,"maximum":1440,"default":0},"bufferAfterMinutes":{"type":"integer","minimum":0,"maximum":1440,"default":0},"location":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["google_meet"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["phone"]},"phoneNumber":{"type":"string","minLength":1}},"required":["type","phoneNumber"]},{"type":"object","properties":{"type":{"type":"string","enum":["in_person"]},"address":{"type":"string","minLength":1}},"required":["type","address"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"instructions":{"type":"string","minLength":1}},"required":["type","instructions"]}],"default":{"type":"google_meet"}},"destinationCalendarId":{"type":["string","null"],"minLength":1},"guestPolicy":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"agentPolicy":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["provider","name","timezone","guestPolicy","agentPolicy","id","coachId","createdAt","updatedAt"]}},"required":["bookingType"]},"BookingTypeCreate":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"externalId":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"active":{"type":"boolean","default":true},"isDefault":{"type":"boolean","default":false},"durationMinutes":{"type":"integer","minimum":5,"maximum":1440,"default":30},"timezone":{"type":"string","minLength":1},"minimumNoticeMinutes":{"type":"integer","minimum":0,"maximum":525600,"default":0},"bookingHorizonDays":{"type":"integer","minimum":1,"maximum":730,"default":60},"bufferBeforeMinutes":{"type":"integer","minimum":0,"maximum":1440,"default":0},"bufferAfterMinutes":{"type":"integer","minimum":0,"maximum":1440,"default":0},"location":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["google_meet"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["phone"]},"phoneNumber":{"type":"string","minLength":1}},"required":["type","phoneNumber"]},{"type":"object","properties":{"type":{"type":"string","enum":["in_person"]},"address":{"type":"string","minLength":1}},"required":["type","address"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"instructions":{"type":"string","minLength":1}},"required":["type","instructions"]}],"default":{"type":"google_meet"}},"destinationCalendarId":{"type":["string","null"],"minLength":1},"guestPolicy":{"type":"object","properties":{"allowCancellation":{"type":"boolean"}},"default":{},"additionalProperties":false},"agentPolicy":{"type":"object","properties":{"leadCanCancel":{"type":"boolean"},"leadCanReschedule":{"type":"boolean"},"cancelMinimumNoticeMinutes":{"type":"integer","minimum":0},"rescheduleMinimumNoticeMinutes":{"type":"integer","minimum":0},"reminderOffsetsMinutes":{"type":"array","items":{"type":"integer","exclusiveMinimum":0}},"bookingLinkFollowUpOffsetsMinutes":{"type":"array","items":{"type":"integer","exclusiveMinimum":0}},"bookingLinkFollowUpMode":{"type":"string","enum":["off","review_first","auto_send"]},"noShowRecoveryEnabled":{"type":"boolean"},"noShowRecoveryMode":{"type":"string","enum":["off","review_first","auto_send"]},"noShowRecoveryOffsetsMinutes":{"type":"array","items":{"type":"integer","exclusiveMinimum":0}},"cancellationReasonMode":{"type":"string","enum":["off","review_first","auto_send"]}},"default":{},"additionalProperties":false}},"required":["provider","name","timezone"]},"BookingTypeUpdate":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"externalId":{"type":["string","null"],"minLength":1},"name":{"type":"string","minLength":1,"maxLength":120},"active":{"type":"boolean"},"isDefault":{"type":"boolean"},"durationMinutes":{"type":"integer","minimum":5,"maximum":1440},"timezone":{"type":"string","minLength":1},"minimumNoticeMinutes":{"type":"integer","minimum":0,"maximum":525600},"bookingHorizonDays":{"type":"integer","minimum":1,"maximum":730},"bufferBeforeMinutes":{"type":"integer","minimum":0,"maximum":1440},"bufferAfterMinutes":{"type":"integer","minimum":0,"maximum":1440},"location":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["google_meet"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["phone"]},"phoneNumber":{"type":"string","minLength":1}},"required":["type","phoneNumber"]},{"type":"object","properties":{"type":{"type":"string","enum":["in_person"]},"address":{"type":"string","minLength":1}},"required":["type","address"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"instructions":{"type":"string","minLength":1}},"required":["type","instructions"]}]},"destinationCalendarId":{"type":["string","null"],"minLength":1},"guestPolicy":{"type":"object","properties":{"allowCancellation":{"type":"boolean"}},"additionalProperties":false},"agentPolicy":{"type":"object","properties":{"leadCanCancel":{"type":"boolean"},"leadCanReschedule":{"type":"boolean"},"cancelMinimumNoticeMinutes":{"type":"integer","minimum":0},"rescheduleMinimumNoticeMinutes":{"type":"integer","minimum":0},"reminderOffsetsMinutes":{"type":"array","items":{"type":"integer","exclusiveMinimum":0}},"bookingLinkFollowUpOffsetsMinutes":{"type":"array","items":{"type":"integer","exclusiveMinimum":0}},"bookingLinkFollowUpMode":{"type":"string","enum":["off","review_first","auto_send"]},"noShowRecoveryEnabled":{"type":"boolean"},"noShowRecoveryMode":{"type":"string","enum":["off","review_first","auto_send"]},"noShowRecoveryOffsetsMinutes":{"type":"array","items":{"type":"integer","exclusiveMinimum":0}},"cancellationReasonMode":{"type":"string","enum":["off","review_first","auto_send"]}},"additionalProperties":false}}},"BookingScheduleResponse":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"weekday":{"type":"integer","minimum":0,"maximum":6},"startMinute":{"type":"integer","minimum":0,"maximum":1439},"endMinute":{"type":"integer","minimum":1,"maximum":1440}},"required":["weekday","startMinute","endMinute"]},"maxItems":100},"overrides":{"type":"array","items":{"type":"object","properties":{"localDate":{"type":"string","format":"date"},"available":{"type":"boolean"},"startMinute":{"type":["integer","null"],"minimum":0,"maximum":1439},"endMinute":{"type":["integer","null"],"minimum":1,"maximum":1440}},"required":["localDate","available"]},"maxItems":366},"bookingTypeId":{"type":"string","format":"uuid"}},"required":["rules","overrides","bookingTypeId"]},"BookingScheduleReplace":{"type":"object","properties":{"rules":{"type":"array","items":{"type":"object","properties":{"weekday":{"type":"integer","minimum":0,"maximum":6},"startMinute":{"type":"integer","minimum":0,"maximum":1439},"endMinute":{"type":"integer","minimum":1,"maximum":1440}},"required":["weekday","startMinute","endMinute"]},"maxItems":100},"overrides":{"type":"array","items":{"type":"object","properties":{"localDate":{"type":"string","format":"date"},"available":{"type":"boolean"},"startMinute":{"type":["integer","null"],"minimum":0,"maximum":1439},"endMinute":{"type":["integer","null"],"minimum":1,"maximum":1440}},"required":["localDate","available"]},"maxItems":366}},"required":["rules","overrides"]},"BookingTypeAttendeeListResponse":{"type":"object","properties":{"attendees":{"type":"array","items":{"type":"object","properties":{"email":{"type":"string","format":"email","x-luca-sensitive":"blank"},"name":{"type":["string","null"],"minLength":1,"x-luca-sensitive":"null"},"optional":{"type":"boolean","default":false},"id":{"type":"string","format":"uuid"},"bookingTypeId":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"}},"required":["email","id","bookingTypeId","coachId","createdAt"]}}},"required":["attendees"]},"BookingTypeAttendeeCreate":{"type":"object","properties":{"email":{"type":"string","format":"email"},"name":{"type":["string","null"],"minLength":1},"optional":{"type":"boolean","default":false}},"required":["email"]},"BookingCalendarSelectionListResponse":{"type":"object","properties":{"calendars":{"type":"array","items":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"calendarId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"timezone":{"type":"string","minLength":1},"accessRole":{"type":"string","minLength":1},"conflictEnabled":{"type":"boolean"},"defaultDestination":{"type":"boolean"},"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["provider","calendarId","name","timezone","accessRole","conflictEnabled","defaultDestination","id","coachId","createdAt","updatedAt"]}}},"required":["calendars"]},"BookingCalendarSelection":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"calendarId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"timezone":{"type":"string","minLength":1},"accessRole":{"type":"string","minLength":1},"conflictEnabled":{"type":"boolean"},"defaultDestination":{"type":"boolean"}},"required":["provider","calendarId","name","timezone","accessRole","conflictEnabled","defaultDestination"]},"BookingCalendarDelete":{"type":"object","properties":{"provider":{"type":"string","enum":["google_calendar"]},"calendarId":{"type":"string","minLength":1}},"required":["provider","calendarId"]},"ManagedBookingAvailabilityResponse":{"type":"object","properties":{"bookingTypeId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"timezone":{"type":"string","minLength":1},"sourceFreshness":{"type":"string","format":"date-time"},"slots":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"bookingTypeId":{"type":"string","format":"uuid"},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1},"durationMinutes":{"type":"integer","exclusiveMinimum":0},"location":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["google_meet"]}},"required":["type"]},{"type":"object","properties":{"type":{"type":"string","enum":["phone"]},"phoneNumber":{"type":"string","minLength":1}},"required":["type","phoneNumber"]},{"type":"object","properties":{"type":{"type":"string","enum":["in_person"]},"address":{"type":"string","minLength":1}},"required":["type","address"]},{"type":"object","properties":{"type":{"type":"string","enum":["custom"]},"instructions":{"type":"string","minLength":1}},"required":["type","instructions"]}]},"sourceFreshness":{"type":"string","format":"date-time"},"availabilityVersion":{"type":"string","minLength":1}},"required":["id","bookingTypeId","provider","startsAt","endsAt","timezone","durationMinutes","location","sourceFreshness","availabilityVersion"]}}},"required":["bookingTypeId","provider","timezone","sourceFreshness","slots"]},"BookingAvailabilityResponse":{"type":"object","properties":{"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"timezone":{"type":"string","minLength":1},"source":{"type":"string","enum":["live_provider","fallback","provider_error"],"default":"fallback"},"warnings":{"type":"array","items":{"type":"string"},"default":[]},"slots":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"displayTimezone":{"type":"string","minLength":1},"displayLabel":{"type":"string","minLength":1},"bookingUrl":{"type":"string","format":"uri"},"directBookingSupported":{"type":"boolean"}},"required":["id","provider","startsAt","endsAt","displayTimezone","displayLabel","directBookingSupported"]}}},"required":["provider","timezone","slots"]},"SalesEpisodeResponse":{"type":"object","properties":{"episode":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","won","lost"]},"outcomeReportedAt":{"type":["string","null"],"format":"date-time"},"amountMinor":{"type":["integer","null"],"minimum":0},"currency":{"type":["string","null"],"pattern":"^[A-Z]{3}$"},"lossReasonDefinitionId":{"type":["string","null"],"format":"uuid"},"lossReasonCode":{"type":["string","null"]},"lossReasonLabel":{"type":["string","null"]},"note":{"type":["string","null"],"x-luca-sensitive":"null"},"nextFollowUpAt":{"type":["string","null"],"format":"date-time"},"followUpTimezone":{"type":["string","null"]},"closedAt":{"type":["string","null"],"format":"date-time"},"version":{"type":"integer","exclusiveMinimum":0},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","leadId","status","outcomeReportedAt","amountMinor","currency","lossReasonDefinitionId","lossReasonCode","lossReasonLabel","note","nextFollowUpAt","followUpTimezone","closedAt","version","createdAt","updatedAt"]}},"required":["episode"]},"SalesEpisodeHistoryResponse":{"type":"object","properties":{"episode":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["open","won","lost"]},"outcomeReportedAt":{"type":["string","null"],"format":"date-time"},"amountMinor":{"type":["integer","null"],"minimum":0},"currency":{"type":["string","null"],"pattern":"^[A-Z]{3}$"},"lossReasonDefinitionId":{"type":["string","null"],"format":"uuid"},"lossReasonCode":{"type":["string","null"]},"lossReasonLabel":{"type":["string","null"]},"note":{"type":["string","null"],"x-luca-sensitive":"null"},"nextFollowUpAt":{"type":["string","null"],"format":"date-time"},"followUpTimezone":{"type":["string","null"]},"closedAt":{"type":["string","null"],"format":"date-time"},"version":{"type":"integer","exclusiveMinimum":0},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"}},"required":["id","leadId","status","outcomeReportedAt","amountMinor","currency","lossReasonDefinitionId","lossReasonCode","lossReasonLabel","note","nextFollowUpAt","followUpTimezone","closedAt","version","createdAt","updatedAt"]},"events":{"type":"array","items":{"type":"object","properties":{"status":{"type":"string","enum":["open","won","lost"]},"outcomeReportedAt":{"type":["string","null"],"format":"date-time"},"amountMinor":{"type":["integer","null"],"minimum":0},"currency":{"type":["string","null"],"pattern":"^[A-Z]{3}$"},"lossReasonDefinitionId":{"type":["string","null"],"format":"uuid"},"lossReasonCode":{"type":["string","null"]},"lossReasonLabel":{"type":["string","null"]},"note":{"type":["string","null"],"x-luca-sensitive":"null"},"nextFollowUpAt":{"type":["string","null"],"format":"date-time"},"followUpTimezone":{"type":["string","null"]},"closedAt":{"type":["string","null"],"format":"date-time"},"version":{"type":"integer","exclusiveMinimum":0},"eventId":{"type":"string","format":"uuid"},"episodeId":{"type":"string","format":"uuid"},"sourceBookingId":{"type":["string","null"],"format":"uuid"},"sourceConversationId":{"type":["string","null"],"format":"uuid"},"kind":{"type":"string","enum":["created","reported_open","won","lost","corrected","reopened"]},"actor":{"type":"string","enum":["coach","ask_luca","system_import"]},"actorId":{"type":["string","null"]},"previousStatus":{"type":["string","null"],"enum":["open","won","lost",null]},"effectiveAt":{"type":"string","format":"date-time"},"createdAt":{"type":"string","format":"date-time"}},"required":["status","outcomeReportedAt","amountMinor","currency","lossReasonDefinitionId","lossReasonCode","lossReasonLabel","note","nextFollowUpAt","followUpTimezone","closedAt","version","eventId","episodeId","sourceBookingId","sourceConversationId","kind","actor","actorId","previousStatus","effectiveAt","createdAt"]}}},"required":["episode","events"]},"SalesReasonDefinitionsResponse":{"type":"object","properties":{"reasons":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bookingTypeId":{"type":["string","null"],"format":"uuid"},"kind":{"type":"string","enum":["lost_sale","cancelled_call","no_show"]},"code":{"type":"string"},"label":{"type":"string"},"active":{"type":"boolean"},"displayOrder":{"type":"integer","minimum":0}},"required":["id","bookingTypeId","kind","code","label","active","displayOrder"]}}},"required":["reasons"]},"SalesReasonDefinitionResponse":{"type":"object","properties":{"reason":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"bookingTypeId":{"type":["string","null"],"format":"uuid"},"kind":{"type":"string","enum":["lost_sale","cancelled_call","no_show"]},"code":{"type":"string"},"label":{"type":"string"},"active":{"type":"boolean"},"displayOrder":{"type":"integer","minimum":0}},"required":["id","bookingTypeId","kind","code","label","active","displayOrder"]}},"required":["reason"]},"SalesReasonDefinitionCreate":{"type":"object","properties":{"bookingTypeId":{"type":["string","null"],"format":"uuid"},"kind":{"type":"string","enum":["lost_sale","cancelled_call","no_show"]},"code":{"type":"string","pattern":"^[a-z][a-z0-9_]{0,63}$"},"label":{"type":"string","minLength":1,"maxLength":120},"displayOrder":{"type":"integer","minimum":0}},"required":["kind","code","label"]},"SalesReasonDefinitionUpdate":{"type":"object","properties":{"label":{"type":"string","minLength":1,"maxLength":120},"active":{"type":"boolean"},"displayOrder":{"type":"integer","minimum":0}}},"SalesOutcomeCreate":{"anyOf":[{"type":"object","properties":{"expectedVersion":{"type":"integer","minimum":0},"note":{"type":["string","null"],"maxLength":5000},"reportedAt":{"type":["string","null"],"format":"date-time"},"status":{"type":"string","enum":["open"]},"nextFollowUpAt":{"type":["string","null"],"format":"date-time"},"followUpTimezone":{"type":"string","minLength":1,"maxLength":100}},"required":["status","nextFollowUpAt","followUpTimezone"]},{"type":"object","properties":{"expectedVersion":{"type":"integer","minimum":0},"note":{"type":["string","null"],"maxLength":5000},"reportedAt":{"type":["string","null"],"format":"date-time"},"status":{"type":"string","enum":["won"]},"amountMinor":{"type":["integer","null"],"minimum":0},"currency":{"type":["string","null"],"pattern":"^[A-Z]{3}$"},"closedAt":{"type":["string","null"],"format":"date-time"}},"required":["status"]},{"type":"object","properties":{"expectedVersion":{"type":"integer","minimum":0},"note":{"type":["string","null"],"maxLength":5000},"reportedAt":{"type":["string","null"],"format":"date-time"},"status":{"type":"string","enum":["lost"]},"lossReasonDefinitionId":{"type":"string","format":"uuid"},"closedAt":{"type":["string","null"],"format":"date-time"}},"required":["status","lossReasonDefinitionId"]}]},"BookingRecoveryResponse":{"type":"object","properties":{"recovery":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"bookingId":{"type":"string","format":"uuid"},"outcomeVersion":{"type":"integer","minimum":0},"state":{"type":"string","enum":["active","paused_for_review","stopped","completed"]},"nextTouchIndex":{"type":"integer","minimum":0},"pendingReviewId":{"type":["string","null"],"format":"uuid"},"stoppedReason":{"type":["string","null"]},"lastSentAt":{"type":["string","null"],"format":"date-time"}},"required":["id","bookingId","outcomeVersion","state","nextTouchIndex","pendingReviewId","stoppedReason","lastSentAt"]}},"required":["recovery"]},"BookingRecoveryStop":{"type":"object","properties":{"recoveryCaseId":{"type":"string","format":"uuid"},"outcomeVersion":{"type":"integer","minimum":0}},"required":["recoveryCaseId","outcomeVersion"],"additionalProperties":false},"BookingGuestLinksResponse":{"type":"object","properties":{"rescheduleUrl":{"type":"string","format":"uri"},"cancelUrl":{"type":"string","format":"uri"},"expiresAt":{"type":"string","format":"date-time"}},"required":["rescheduleUrl","cancelUrl","expiresAt"]},"BookingGuestLinksCreate":{"type":"object","properties":{"expiresInHours":{"type":"integer","minimum":1,"maximum":720,"default":168}}},"BookingGuestLinksRevokeResponse":{"type":"object","properties":{"revoked":{"type":"integer","minimum":0}},"required":["revoked"]},"BookingProviderRequestResponse":{"type":"object","properties":{"id":{"type":"string","minLength":1},"state":{"type":"string","enum":["needs_input","options","accepted","pending_provider","confirmed","handoff_required","conflict","failed"]},"bookingId":{"type":"string","minLength":1},"reason":{"type":"string","minLength":1},"displayText":{"type":"string","minLength":1},"finalStartsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1},"meetingUrl":{"type":"string","minLength":1},"managementUrl":{"type":"string","minLength":1}},"required":["id","state"]},"BookingProviderRequestCreate":{"type":"object","properties":{"leadId":{"type":"string","format":"uuid"},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1},"inviteeEmail":{"type":"string","format":"email"},"inviteeName":{"type":"string","minLength":1,"maxLength":200}},"required":["leadId","bookingTypeId","slotId","startsAt","endsAt","timezone","inviteeEmail"]},"BookingLinkResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","booked","declined","stopped","expired"]},"provider":{"type":"string","enum":["calendly","cal_com","google_calendar"]},"url":{"type":"string","format":"uri"},"needsReconnect":{"type":"boolean"},"bookedStartsAt":{"type":["string","null"],"format":"date-time"}},"required":["id","status","provider","url","needsReconnect","bookedStartsAt"]},"BookingLinkCreate":{"type":"object","properties":{"leadId":{"type":"string","format":"uuid"},"bookingTypeId":{"type":"string","format":"uuid"},"message":{"type":"string","minLength":1,"maxLength":1000},"suggestedDate":{"type":"string","format":"date"}},"required":["leadId","bookingTypeId","message"]},"BookingLifecycleAttentionListResponse":{"type":"object","properties":{"bookings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"slotAt":{"type":"string"},"endAt":{"type":["string","null"]},"bookingTypeId":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["held","confirmed","cancelled","completed","no_show"]},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"providerEventId":{"type":["string","null"]},"providerInviteeId":{"type":["string","null"]},"providerVersion":{"type":["string","null"]},"timezone":{"type":"string"},"locationType":{"type":["string","null"],"enum":["google_meet","phone","in_person","custom",null]},"locationDetails":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"rawPayload":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"},"calendlyEventId":{"type":["string","null"]},"calendlyInviteeId":{"type":["string","null"]},"reconciliationState":{"type":"string","enum":["healthy","attention_required","conflict","resolving"]},"outcomeSource":{"type":["string","null"]},"outcomeObservedAt":{"type":["string","null"]},"rescheduledFromBookingId":{"type":["string","null"],"format":"uuid"},"cancelledAt":{"type":["string","null"]},"cancellationReason":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"leadName":{"type":["string","null"],"x-luca-sensitive":"null"},"bookingTypeName":{"type":["string","null"]},"observations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"source":{"type":"string","enum":["provider_webhook","provider_reconciliation","coach","system"]},"outcome":{"type":"string"},"observedAt":{"type":"string"},"reason":{"type":["string","null"]}},"required":["id","source","outcome","observedAt","reason"]}},"providerSync":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","processing","applied","rejected","synced","failed"]},"attempts":{"type":"integer"},"lastError":{"type":["string","null"]}},"required":["id","status","attempts","lastError"]}},"required":["id","coachId","leadId","slotAt","endAt","bookingTypeId","status","provider","providerEventId","providerInviteeId","providerVersion","timezone","locationType","locationDetails","rawPayload","calendlyEventId","calendlyInviteeId","reconciliationState","outcomeSource","outcomeObservedAt","rescheduledFromBookingId","cancelledAt","cancellationReason","createdAt","updatedAt","leadName","bookingTypeName","observations","providerSync"]}}},"required":["bookings"]},"BookingResponse":{"type":"object","properties":{"booking":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"slotAt":{"type":"string"},"endAt":{"type":["string","null"]},"bookingTypeId":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["held","confirmed","cancelled","completed","no_show"]},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"providerEventId":{"type":["string","null"]},"providerInviteeId":{"type":["string","null"]},"providerVersion":{"type":["string","null"]},"timezone":{"type":"string"},"locationType":{"type":["string","null"],"enum":["google_meet","phone","in_person","custom",null]},"locationDetails":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"rawPayload":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"},"calendlyEventId":{"type":["string","null"]},"calendlyInviteeId":{"type":["string","null"]},"reconciliationState":{"type":"string","enum":["healthy","attention_required","conflict","resolving"]},"outcomeSource":{"type":["string","null"]},"outcomeObservedAt":{"type":["string","null"]},"rescheduledFromBookingId":{"type":["string","null"],"format":"uuid"},"cancelledAt":{"type":["string","null"]},"cancellationReason":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","coachId","leadId","slotAt","endAt","bookingTypeId","status","provider","providerEventId","providerInviteeId","providerVersion","timezone","locationType","locationDetails","rawPayload","calendlyEventId","calendlyInviteeId","reconciliationState","outcomeSource","outcomeObservedAt","rescheduledFromBookingId","cancelledAt","cancellationReason","createdAt","updatedAt"]},"operation":{"type":"object","properties":{"state":{"type":"string","enum":["confirmed","pending_provider"]},"providerSyncId":{"type":["string","null"],"format":"uuid"}},"required":["state","providerSyncId"]}},"required":["booking"]},"BookingLifecycleResolutionCreate":{"anyOf":[{"type":"object","properties":{"status":{"type":"string","enum":["confirmed","cancelled","completed","no_show"]},"reason":{"type":"string","maxLength":2000}},"required":["status"]},{"type":"object","properties":{"action":{"type":"string","enum":["dismiss_duplicate"]},"reason":{"type":"string","maxLength":2000}},"required":["action"]}]},"BookingProviderSyncRetryResponse":{"type":"object","properties":{"queued":{"type":"boolean"}},"required":["queued"]},"BookingNeedsOutcomeListResponse":{"type":"object","properties":{"bookings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"slotAt":{"type":"string"},"status":{"type":"string"},"provider":{"type":"string"},"leadId":{"type":"string"},"leadName":{"type":["string","null"],"x-luca-sensitive":"null"},"leadChannel":{"type":["string","null"]}},"required":["id","slotAt","status","provider","leadId","leadName","leadChannel"]}}},"required":["bookings"]},"BookingListResponse":{"type":"object","properties":{"bookings":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"slotAt":{"type":"string"},"endAt":{"type":["string","null"]},"bookingTypeId":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["held","confirmed","cancelled","completed","no_show"]},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"providerEventId":{"type":["string","null"]},"providerInviteeId":{"type":["string","null"]},"providerVersion":{"type":["string","null"]},"timezone":{"type":"string"},"locationType":{"type":["string","null"],"enum":["google_meet","phone","in_person","custom",null]},"locationDetails":{"type":"object","additionalProperties":{},"description":"Opaque JSON object"},"rawPayload":{"type":"object","additionalProperties":{},"description":"Opaque JSON object","x-luca-sensitive":"empty"},"calendlyEventId":{"type":["string","null"]},"calendlyInviteeId":{"type":["string","null"]},"reconciliationState":{"type":"string","enum":["healthy","attention_required","conflict","resolving"]},"outcomeSource":{"type":["string","null"]},"outcomeObservedAt":{"type":["string","null"]},"rescheduledFromBookingId":{"type":["string","null"],"format":"uuid"},"cancelledAt":{"type":["string","null"]},"cancellationReason":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","coachId","leadId","slotAt","endAt","bookingTypeId","status","provider","providerEventId","providerInviteeId","providerVersion","timezone","locationType","locationDetails","rawPayload","calendlyEventId","calendlyInviteeId","reconciliationState","outcomeSource","outcomeObservedAt","rescheduledFromBookingId","cancelledAt","cancellationReason","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["bookings","nextCursor"]},"BookingCreate":{"type":"object","properties":{"leadId":{"type":"string","format":"uuid"},"slotAt":{"type":["string","null"],"format":"date-time"},"endAt":{"type":["string","null"],"format":"date-time"},"bookingTypeId":{"type":["string","null"],"format":"uuid"},"status":{"type":"string","enum":["held","confirmed","cancelled","completed","no_show"]},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"],"default":"manual"},"providerEventId":{"type":["string","null"]},"providerInviteeId":{"type":["string","null"]},"providerVersion":{"type":["string","null"],"minLength":1},"timezone":{"type":"string","minLength":1,"default":"UTC"},"locationType":{"type":["string","null"],"enum":["google_meet","phone","in_person","custom",null]},"locationDetails":{"type":"object","additionalProperties":{}},"rawPayload":{"type":"object","additionalProperties":{}},"calendlyEventId":{"type":["string","null"]},"calendlyInviteeId":{"type":["string","null"]}},"required":["leadId","slotAt"]},"BookingPatch":{"type":"object","properties":{"slotAt":{"type":["string","null"],"format":"date-time"},"endAt":{"type":["string","null"],"format":"date-time"},"status":{"type":"string","enum":["held","confirmed","cancelled","completed","no_show"]},"provider":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"providerEventId":{"type":["string","null"]},"providerInviteeId":{"type":["string","null"]},"timezone":{"type":"string","minLength":1},"rawPayload":{"type":"object","additionalProperties":{}},"calendlyEventId":{"type":["string","null"]},"calendlyInviteeId":{"type":["string","null"]}}},"BookingBriefResponse":{"type":"object","properties":{"brief":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"bookingId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"content":{"type":"object","properties":{"whoTheyAre":{"type":"string","minLength":1,"maxLength":500},"whatTheyWant":{"type":"string","minLength":1,"maxLength":500},"objections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":6},"unknowns":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":6},"talkingPoints":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":8},"closingAngle":{"type":"string","minLength":1,"maxLength":500}},"required":["whoTheyAre","whatTheyWant","objections","unknowns","talkingPoints","closingAngle"]},"generatedAt":{"type":"string"}},"required":["id","bookingId","leadId","content","generatedAt"],"x-luca-sensitive":"null"}},"required":["brief"]},"CallEventListResponse":{"type":"object","properties":{"callEvents":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"leadName":{"type":["string","null"],"x-luca-sensitive":"null"},"leadChannel":{"type":["string","null"]},"bookingId":{"type":["string","null"]},"bookedAt":{"type":"string"},"scheduledAt":{"type":["string","null"]},"completedAt":{"type":["string","null"]},"outcome":{"type":["string","null"],"enum":["completed","no_show","rescheduled","cancelled",null]},"outcomeUpdatedAt":{"type":["string","null"]},"coachRating":{"type":["number","null"]},"coachNotes":{"type":["string","null"],"x-luca-sensitive":"null"},"summary":{"type":["string","null"],"x-luca-sensitive":"null"},"summarySource":{"type":["string","null"],"enum":["auto","coach_triggered","coach_edited","provider",null]},"summaryStatus":{"type":"string","enum":["idle","generating","ready","failed"]},"summaryStructured":{"type":["object","null"],"properties":{"leadGoals":{"type":"array","items":{"type":"string"},"default":[]},"keyObjections":{"type":"array","items":{"type":"string"},"default":[]},"bookingTriggers":{"type":"array","items":{"type":"string"},"default":[]},"riskFactors":{"type":"array","items":{"type":"string"},"default":[]},"coachingRecommendation":{"type":"string","default":""},"crmNote":{"type":"string","default":""}},"x-luca-sensitive":"null"},"crmSynced":{"type":"boolean"},"crmSyncStatus":{"type":["string","null"],"enum":["pending","syncing","local_only","synced","failed","permanently_failed",null]},"crmSyncError":{"type":["string","null"],"x-luca-sensitive":"null"},"crmPermanentlyFailed":{"type":"boolean"},"feedbackFields":{"type":["object","null"],"properties":{"wasQualified":{"type":"string","enum":["yes","kinda","no"]},"surprise":{"type":"string","maxLength":2000,"x-luca-sensitive":"blank"},"objectionHandlingAccurate":{"type":"boolean"},"followUpNeeded":{"type":"boolean"},"followUpNote":{"type":"string","maxLength":2000,"x-luca-sensitive":"blank"}},"additionalProperties":false},"callSequenceNumber":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","leadId","leadName","leadChannel","bookingId","bookedAt","scheduledAt","completedAt","outcome","outcomeUpdatedAt","coachRating","coachNotes","summary","summarySource","summaryStatus","summaryStructured","crmSynced","crmSyncStatus","crmSyncError","crmPermanentlyFailed","feedbackFields","callSequenceNumber","createdAt"]}}},"required":["callEvents"]},"CallEventResponse":{"type":"object","properties":{"callEvent":{"type":"object","properties":{"id":{"type":"string"},"leadId":{"type":"string"},"leadName":{"type":["string","null"],"x-luca-sensitive":"null"},"leadChannel":{"type":["string","null"]},"bookingId":{"type":["string","null"]},"bookedAt":{"type":"string"},"scheduledAt":{"type":["string","null"]},"completedAt":{"type":["string","null"]},"outcome":{"type":["string","null"],"enum":["completed","no_show","rescheduled","cancelled",null]},"outcomeUpdatedAt":{"type":["string","null"]},"coachRating":{"type":["number","null"]},"coachNotes":{"type":["string","null"],"x-luca-sensitive":"null"},"summary":{"type":["string","null"],"x-luca-sensitive":"null"},"summarySource":{"type":["string","null"],"enum":["auto","coach_triggered","coach_edited","provider",null]},"summaryStatus":{"type":"string","enum":["idle","generating","ready","failed"]},"summaryStructured":{"type":["object","null"],"properties":{"leadGoals":{"type":"array","items":{"type":"string"},"default":[]},"keyObjections":{"type":"array","items":{"type":"string"},"default":[]},"bookingTriggers":{"type":"array","items":{"type":"string"},"default":[]},"riskFactors":{"type":"array","items":{"type":"string"},"default":[]},"coachingRecommendation":{"type":"string","default":""},"crmNote":{"type":"string","default":""}},"x-luca-sensitive":"null"},"crmSynced":{"type":"boolean"},"crmSyncStatus":{"type":["string","null"],"enum":["pending","syncing","local_only","synced","failed","permanently_failed",null]},"crmSyncError":{"type":["string","null"],"x-luca-sensitive":"null"},"crmPermanentlyFailed":{"type":"boolean"},"feedbackFields":{"type":["object","null"],"properties":{"wasQualified":{"type":"string","enum":["yes","kinda","no"]},"surprise":{"type":"string","maxLength":2000,"x-luca-sensitive":"blank"},"objectionHandlingAccurate":{"type":"boolean"},"followUpNeeded":{"type":"boolean"},"followUpNote":{"type":"string","maxLength":2000,"x-luca-sensitive":"blank"}},"additionalProperties":false},"callSequenceNumber":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","leadId","leadName","leadChannel","bookingId","bookedAt","scheduledAt","completedAt","outcome","outcomeUpdatedAt","coachRating","coachNotes","summary","summarySource","summaryStatus","summaryStructured","crmSynced","crmSyncStatus","crmSyncError","crmPermanentlyFailed","feedbackFields","callSequenceNumber","createdAt"]}},"required":["callEvent"]},"CallEventFeedbackCreate":{"type":"object","properties":{"expectedOutcomeUpdatedAt":{"type":["string","null"],"format":"date-time"},"outcome":{"type":"string","enum":["completed","no_show","rescheduled","cancelled"]},"rating":{"type":["integer","null"],"minimum":1,"maximum":5},"notes":{"type":["string","null"],"maxLength":4000},"fields":{"type":"object","properties":{"wasQualified":{"type":"string","enum":["yes","kinda","no"]},"surprise":{"type":"string","maxLength":2000},"objectionHandlingAccurate":{"type":"boolean"},"followUpNeeded":{"type":"boolean"},"followUpNote":{"type":"string","maxLength":2000}},"default":{},"additionalProperties":false},"rescheduledTo":{"type":["string","null"],"format":"date-time"}},"required":["outcome"]},"CallSummaryTriggerResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"callEventId":{"type":"string"}},"required":["ok","callEventId"]},"CallSummaryUpdate":{"type":"object","properties":{"summary":{"type":"string","minLength":1,"maxLength":8000}},"required":["summary"],"additionalProperties":false},"RescueEnrollResponse":{"type":"object","properties":{"enrolled":{"type":"array","items":{"type":"string","format":"uuid"}},"skipped":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["enrolled","skipped"]},"RescueEnrollRequest":{"type":"object","properties":{"leadIds":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100},"cadenceTemplate":{"type":"string","enum":["light","standard","aggressive"]}},"required":["leadIds"]},"BroadcastListResponse":{"type":"object","properties":{"broadcasts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"campaignVersionId":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","previewed","approved","running","paused","cancelled","completed","failed"]},"personalizationMode":{"type":"string","enum":["same_message","personalized_light","personalized_ai"]},"totalRecipients":{"type":"integer"},"canarySize":{"type":"integer"},"batchSize":{"type":"integer"},"sentCount":{"type":"integer"},"failedCount":{"type":"integer"},"skippedCount":{"type":"integer"},"previewVersion":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","campaignId","campaignVersionId","name","status","personalizationMode","totalRecipients","canarySize","batchSize","sentCount","failedCount","skippedCount","previewVersion","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["broadcasts","nextCursor"]},"BroadcastDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"campaignVersionId":{"type":["string","null"],"format":"uuid"},"name":{"type":"string"},"status":{"type":"string","enum":["draft","previewed","approved","running","paused","cancelled","completed","failed"]},"personalizationMode":{"type":"string","enum":["same_message","personalized_light","personalized_ai"]},"totalRecipients":{"type":"integer"},"canarySize":{"type":"integer"},"batchSize":{"type":"integer"},"sentCount":{"type":"integer"},"failedCount":{"type":"integer"},"skippedCount":{"type":"integer"},"previewVersion":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"segment":{"type":"object","properties":{"mode":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["channel","tags","stage","score","sourceCampaignId","sourceTrigger","lastMessageAt","lastReplyAt","bookingStatus","crmField","consent","timezone","localTime","blacklisted"]},"operator":{"type":"string","enum":["equals","not_equals","contains","not_contains","in","not_in","greater_than","less_than","before","after","exists","missing"]},"value":{},"path":{"type":"string","minLength":1}},"required":["field","operator"]}},"groups":{"type":"array","items":{"type":"object","properties":{"mode":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["channel","tags","stage","score","sourceCampaignId","sourceTrigger","lastMessageAt","lastReplyAt","bookingStatus","crmField","consent","timezone","localTime","blacklisted"]},"operator":{"type":"string","enum":["equals","not_equals","contains","not_contains","in","not_in","greater_than","less_than","before","after","exists","missing"]},"value":{},"path":{"type":"string","minLength":1}},"required":["field","operator"]},"default":[]}}}},"channel":{"type":"string","minLength":1},"channels":{"type":"array","items":{"type":"string","minLength":1}},"stage":{"type":"string","minLength":1},"stages":{"type":"array","items":{"type":"string","minLength":1}},"tagsAny":{"type":"array","items":{"type":"string","minLength":1}},"tagsAll":{"type":"array","items":{"type":"string","minLength":1}},"minScore":{"type":"integer"},"maxScore":{"type":"integer"},"includeLeadIds":{"type":"array","items":{"type":"string","format":"uuid"}},"excludeLeadIds":{"type":"array","items":{"type":"string","format":"uuid"}},"limit":{"type":"integer","minimum":1,"maximum":5000}}},"segmentSnapshot":{"type":"object","properties":{"leadIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"leads":{"type":"array","items":{"type":"object","properties":{"leadId":{"type":"string","format":"uuid"},"channel":{"type":"string"},"channelAccountId":{"type":"string","format":"uuid"},"externalUserId":{"type":"string"},"displayName":{"type":["string","null"],"x-luca-sensitive":"null"},"stage":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}},"score":{"type":"integer"},"customFields":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"lastSeenAt":{"type":"string"},"messageBody":{"type":"string","minLength":1,"x-luca-sensitive":"blank"},"templatePart":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"language":{"type":"string","minLength":1},"versionHash":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"parameters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["text"]},"value":{"type":"string","maxLength":4096}},"required":["key","component","index","kind","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["image","video","document"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","component","index","kind","uploadId"]}]},"maxItems":100},"renderedPreview":{"type":"string","maxLength":16000},"providerMetadata":{"type":"object","additionalProperties":{}}},"required":["id","type","templateId","name","language","versionHash","parameters","renderedPreview"],"x-luca-sensitive":"null"},"templateMapping":{"type":["object","null"],"properties":{"templateId":{"type":"string","minLength":1},"templateBindings":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["text"]},"source":{"type":"string","enum":["literal"]},"value":{"type":"string","maxLength":4096}},"required":["key","kind","source","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["text"]},"source":{"type":"string","enum":["lead.name","lead.email","coach.name","booking.start_at","booking.meeting_url","booking.timezone","booking.action_result","campaign.name","broadcast.name"]}},"required":["key","kind","source"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"kind":{"type":"string","enum":["image","video","document"]},"source":{"type":"string","enum":["upload"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","kind","source","uploadId"]}]},"default":[]}},"required":["templateId"],"x-luca-sensitive":"null"},"messageBlocker":{"type":"string"},"consent":{"oneOf":[{"type":"object","properties":{"basis":{"type":"string","enum":["explicit_marketing"]},"consentId":{"type":"string","format":"uuid"},"evidenceId":{"type":"string","minLength":1},"grantedAt":{"type":"string"},"checkedAt":{"type":"string"}},"required":["basis","consentId","evidenceId","grantedAt","checkedAt"]},{"type":"object","properties":{"basis":{"type":"string","enum":["prior_inbound"]},"conversationId":{"type":"string","format":"uuid"},"channelAccountId":{"type":"string","format":"uuid"},"lastInboundAt":{"type":"string"},"checkedAt":{"type":"string"}},"required":["basis","conversationId","channelAccountId","lastInboundAt","checkedAt"]}]}},"required":["leadId","channel","externalUserId","displayName","stage","tags","score","customFields","lastSeenAt"]},"default":[]},"excludedCount":{"type":"integer","default":0},"exclusionReasonCounts":{"type":"object","additionalProperties":{"type":"integer"},"default":{}},"excludedRecipients":{"type":"array","items":{"type":"object","properties":{"leadId":{"type":"string","format":"uuid"},"displayName":{"type":["string","null"],"x-luca-sensitive":"null"},"channel":{"type":"string"},"reason":{"type":"string"}},"required":["leadId","displayName","channel","reason"]},"default":[]},"providerLimits":{"type":"array","items":{"type":"object","properties":{"channel":{"type":"string"},"provider":{"type":"string"},"estimatedRecipients":{"type":"integer"},"limitPerBatch":{"type":"integer"},"risk":{"type":"string","enum":["low","medium","high"]}},"required":["channel","provider","estimatedRecipients","limitPerBatch","risk"]},"default":[]},"totalMatched":{"type":"integer","default":0},"accountSelectionRequired":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"canaryBypassAllowed":{"type":"boolean","default":false},"canaryBypassReason":{"type":"string"},"generatedAt":{"type":"string"}}},"safetyReport":{"type":"object","properties":{"ok":{"type":"boolean"},"warnings":{"type":"array","items":{"type":"string"}},"blockers":{"type":"array","items":{"type":"string"},"default":[]},"findings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"action":{"type":"string","enum":["review","block"]},"message":{"type":"string"},"source":{"type":"string"},"path":{"type":"string"},"nodeId":{"type":"string"},"confidence":{"type":"number"},"evidence":{"type":"string","x-luca-sensitive":"blank"}},"required":["code","action","message","source"]},"default":[]},"thresholds":{"type":"object","properties":{"failureRate":{"type":"number"},"minimumAttempts":{"type":"integer"},"canaryFailureRate":{"type":"number"},"canaryRequiredAboveRecipients":{"type":"integer"}},"required":["failureRate","minimumAttempts","canaryFailureRate","canaryRequiredAboveRecipients"]},"canaryRequired":{"type":"boolean","default":false},"canaryBypassAllowed":{"type":"boolean","default":false},"checkedAt":{"type":"string"}}},"sampleMessages":{"type":"array","items":{"type":"object","properties":{"leadId":{"type":"string","format":"uuid"},"channel":{"type":"string"},"body":{"type":"string","x-luca-sensitive":"blank"}},"required":["leadId","channel","body"]}},"approvedAt":{"type":["string","null"]},"launchedAt":{"type":["string","null"]},"pausedAt":{"type":["string","null"]},"cancelledAt":{"type":["string","null"]},"completedAt":{"type":["string","null"]},"recipients":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["pending","processing","enrolled","sent","skipped","failed","cancelled"]},"canary":{"type":"boolean"},"messageBody":{"type":["string","null"],"x-luca-sensitive":"null"},"failureReason":{"type":["string","null"]},"providerMessageId":{"type":["string","null"]},"providerAcceptedAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","leadId","status","canary","messageBody","failureReason","providerMessageId","providerAcceptedAt","sentAt","createdAt","updatedAt"]},"default":[]},"recipientsTruncated":{"type":"boolean","default":false},"retryBlockedReason":{"type":["string","null"],"enum":["provider_acceptance_unknown"],"default":null},"recipientCounts":{"type":"object","properties":{"cancelled":{"type":"integer","minimum":0,"default":0},"enrolled":{"type":"integer","minimum":0,"default":0},"failed":{"type":"integer","minimum":0,"default":0},"pending":{"type":"integer","minimum":0,"default":0},"processing":{"type":"integer","minimum":0,"default":0},"sent":{"type":"integer","minimum":0,"default":0},"skipped":{"type":"integer","minimum":0,"default":0}},"default":{"cancelled":0,"enrolled":0,"failed":0,"pending":0,"processing":0,"sent":0,"skipped":0}},"canaryRecipientCounts":{"type":"object","properties":{"cancelled":{"type":"integer","minimum":0,"default":0},"enrolled":{"type":"integer","minimum":0,"default":0},"failed":{"type":"integer","minimum":0,"default":0},"pending":{"type":"integer","minimum":0,"default":0},"processing":{"type":"integer","minimum":0,"default":0},"sent":{"type":"integer","minimum":0,"default":0},"skipped":{"type":"integer","minimum":0,"default":0}},"default":{"cancelled":0,"enrolled":0,"failed":0,"pending":0,"processing":0,"sent":0,"skipped":0}}},"required":["id","campaignId","campaignVersionId","name","status","personalizationMode","totalRecipients","canarySize","batchSize","sentCount","failedCount","skippedCount","previewVersion","createdAt","updatedAt","segment","segmentSnapshot","safetyReport","sampleMessages","approvedAt","launchedAt","pausedAt","cancelledAt","completedAt"]},"BroadcastCreate":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1},"segment":{"type":"object","properties":{"mode":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["channel","tags","stage","score","sourceCampaignId","sourceTrigger","lastMessageAt","lastReplyAt","bookingStatus","crmField","consent","timezone","localTime","blacklisted"]},"operator":{"type":"string","enum":["equals","not_equals","contains","not_contains","in","not_in","greater_than","less_than","before","after","exists","missing"]},"value":{},"path":{"type":"string","minLength":1}},"required":["field","operator"]}},"groups":{"type":"array","items":{"type":"object","properties":{"mode":{"type":"string","enum":["all","any"],"default":"all"},"rules":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string","enum":["channel","tags","stage","score","sourceCampaignId","sourceTrigger","lastMessageAt","lastReplyAt","bookingStatus","crmField","consent","timezone","localTime","blacklisted"]},"operator":{"type":"string","enum":["equals","not_equals","contains","not_contains","in","not_in","greater_than","less_than","before","after","exists","missing"]},"value":{},"path":{"type":"string","minLength":1}},"required":["field","operator"]},"default":[]}}}},"channel":{"type":"string","minLength":1},"channels":{"type":"array","items":{"type":"string","minLength":1}},"stage":{"type":"string","minLength":1},"stages":{"type":"array","items":{"type":"string","minLength":1}},"tagsAny":{"type":"array","items":{"type":"string","minLength":1}},"tagsAll":{"type":"array","items":{"type":"string","minLength":1}},"minScore":{"type":"integer"},"maxScore":{"type":"integer"},"includeLeadIds":{"type":"array","items":{"type":"string","format":"uuid"}},"excludeLeadIds":{"type":"array","items":{"type":"string","format":"uuid"}},"limit":{"type":"integer","minimum":1,"maximum":5000}},"default":{}},"personalizationMode":{"type":"string","enum":["same_message","personalized_light","personalized_ai"],"default":"personalized_light"},"canarySize":{"type":"integer","minimum":0,"maximum":100,"default":10},"batchSize":{"type":"integer","minimum":1,"maximum":500,"default":100}},"required":["campaignId","name"]},"BroadcastPreview":{"type":"object","properties":{"sampleSize":{"type":"integer","minimum":1,"maximum":20,"default":3}}},"BroadcastApprove":{"type":"object","properties":{"previewVersion":{"type":"string","format":"date-time"}},"required":["previewVersion"]},"BroadcastControl":{"type":"object","properties":{"reason":{"type":"string","minLength":1}}},"BroadcastRetry":{"type":"object","properties":{"reason":{"type":"string","minLength":1},"failedOnly":{"type":"boolean","default":true}}},"CampaignListResponse":{"type":"object","properties":{"campaigns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","published","paused","archived"]},"latestVersionNumber":{"type":["integer","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"pausedForAccountHealth":{"type":"boolean"},"outcomes":{"type":"object","properties":{"enrolledLeads":{"type":"integer","minimum":0},"replies":{"type":"integer","minimum":0},"bookings":{"type":"integer","minimum":0}},"required":["enrolledLeads","replies","bookings"]}},"required":["id","name","description","status","latestVersionNumber","createdAt","updatedAt","pausedForAccountHealth","outcomes"]}},"nextCursor":{"type":["string","null"]}},"required":["campaigns","nextCursor"]},"CampaignDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","published","paused","archived"]},"latestVersionNumber":{"type":["integer","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"pausedForAccountHealth":{"type":"boolean"},"draft":{"type":"object","properties":{"graph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]},"updatedAt":{"type":"string"}},"required":["graph","updatedAt"]},"publishedVersion":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"versionNumber":{"type":"integer"},"graph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]},"publishedAt":{"type":"string"}},"required":["id","versionNumber","graph","publishedAt"]}},"required":["id","name","description","status","latestVersionNumber","createdAt","updatedAt","pausedForAccountHealth","draft","publishedVersion"]},"CampaignCreate":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"graph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]}},"required":["name"]},"CampaignGenerateResponse":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"graph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]},"assumptions":{"type":"array","items":{"type":"string","minLength":1}},"alternativePlans":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"strategy":{"type":"string","minLength":1},"tradeoffs":{"type":"array","items":{"type":"string","minLength":1},"minItems":1},"recommended":{"type":"boolean"}},"required":["id","name","strategy","tradeoffs","recommended"]},"minItems":3},"recommendedQuestions":{"type":"array","items":{"type":"string","minLength":1}},"providerCapabilityAssumptions":{"type":"array","items":{"type":"string","minLength":1}},"readinessChecklist":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"label":{"type":"string","minLength":1},"status":{"type":"string","enum":["ready","needs_review","blocked"]},"detail":{"type":"string","minLength":1}},"required":["id","label","status","detail"]}},"seedCases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"eventType":{"type":"string","enum":["instagram_comment","instagram_dm","whatsapp_reply","booking_event","crm_event","webhook_event","csv_import","manual_enrollment"]},"sourceKind":{"type":"string","enum":["fake_input","seed_case","replayed_enrollment"]},"lead":{"type":"object","additionalProperties":{}},"eventPayload":{"type":"object","additionalProperties":{}},"context":{"type":"object","additionalProperties":{}},"expectedOutcome":{"type":"string","minLength":1}},"required":["id","name","eventType","sourceKind","lead","eventPayload","context","expectedOutcome"]},"minItems":5},"weakCopyFindings":{"type":"array","items":{"type":"object","properties":{"nodeId":{"type":"string","minLength":1},"severity":{"type":"string","enum":["warning","blocker"]},"issue":{"type":"string","minLength":1},"suggestion":{"type":"string","minLength":1}},"required":["nodeId","severity","issue","suggestion"]}},"publishGate":{"type":"object","properties":{"simulatorPassRequired":{"type":"boolean"},"requiredSeedCaseCount":{"type":"integer","minimum":1},"requiredPassingSeedCases":{"type":"integer","minimum":1},"blocksPublishUntil":{"type":"array","items":{"type":"string","minLength":1}},"detail":{"type":"string","minLength":1}},"required":["simulatorPassRequired","requiredSeedCaseCount","requiredPassingSeedCases","blocksPublishUntil","detail"]},"repairLog":{"type":"array","items":{"type":"string","minLength":1}},"safety":{"type":"object","properties":{"action":{"type":"string","enum":["allow","review","block"]},"blockers":{"type":"array","items":{"type":"string"}},"reviewReasons":{"type":"array","items":{"type":"string"}},"findings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"action":{"type":"string","enum":["review","block"]},"message":{"type":"string"},"source":{"type":"string"},"path":{"type":"string"},"nodeId":{"type":"string"},"confidence":{"type":"number"},"evidence":{"type":"string"}},"required":["code","action","message","source"]}}},"required":["action","blockers","reviewReasons","findings"]}},"required":["name","description","graph","assumptions","alternativePlans","recommendedQuestions","providerCapabilityAssumptions","readinessChecklist","seedCases","weakCopyFindings","publishGate","repairLog","safety"]},"CampaignGenerate":{"type":"object","properties":{"mode":{"type":"string","enum":["new","guided_improvement","improve_existing"],"default":"new"},"prompt":{"type":"string","minLength":1,"maxLength":2000},"targetAudience":{"type":"string","minLength":1,"maxLength":2000},"goal":{"type":"string","enum":["book_call","qualify","nurture","recover","reactivation","event_webinar","promo"]},"primaryChannel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"fallbackChannels":{"type":"array","items":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"maxItems":50,"default":[]},"source":{"type":"string","enum":["instagram_comments","instagram_dm","whatsapp","csv_import","webhook_crm","broadcast"]},"sampleMessages":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50,"default":[]},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50,"default":[]},"pricingAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50,"default":[]},"bookingConstraints":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50,"default":[]},"complianceDisallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50,"default":[]},"toneExamples":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50,"default":[]},"existingGraph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]},"guidance":{"type":"string","minLength":1,"maxLength":2000}},"required":["prompt"]},"CampaignCommentEventListResponse":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"campaignVersionId":{"type":["string","null"],"format":"uuid"},"enrollmentId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"channelAccountId":{"type":["string","null"],"format":"uuid"},"externalUserId":{"type":"string"},"providerMessageId":{"type":"string"},"externalCommentId":{"type":["string","null"]},"externalPostId":{"type":["string","null"]},"externalAdId":{"type":["string","null"]},"externalLiveSourceId":{"type":["string","null"]},"sourceType":{"type":"string"},"triggerNodeId":{"type":"string"},"status":{"type":"string","enum":["matched","suppressed","blocked","pending_review","sent","failed","enrolled","replayed","resolved"]},"priority":{"type":"string"},"suppressionReason":{"type":["string","null"]},"body":{"type":"string","x-luca-sensitive":"blank"},"matchResult":{"x-luca-sensitive":"empty"},"matchExplanation":{"type":["string","null"],"x-luca-sensitive":"null"},"sourceMetadata":{"x-luca-sensitive":"empty"},"providerSnapshot":{"x-luca-sensitive":"empty"},"aiClassification":{"x-luca-sensitive":"empty"},"actionStatuses":{},"safetyNotes":{"x-luca-sensitive":"empty"},"commenterIdentityStatus":{"type":"string"},"commenterDisplayName":{"type":["string","null"],"x-luca-sensitive":"null"},"language":{"type":["string","null"]},"rawSnapshotRedacted":{"type":"boolean"},"repairState":{"type":"string"},"parentEventId":{"type":["string","null"],"format":"uuid"},"primaryReviewQueueId":{"type":["string","null"],"format":"uuid"},"primaryOutboxId":{"type":["string","null"],"format":"uuid"},"resolvedAt":{"type":["string","null"]},"createdAt":{"type":"string"}},"required":["id","campaignId","campaignVersionId","enrollmentId","leadId","channelAccountId","externalUserId","providerMessageId","externalCommentId","externalPostId","triggerNodeId","status","suppressionReason","body","matchResult","sourceMetadata","createdAt"]}},"analytics":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"matched":{"type":"integer","minimum":0},"suppressed":{"type":"integer","minimum":0},"blocked":{"type":"integer","minimum":0},"sent":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"conversionRate":{"type":"number","minimum":0,"maximum":1},"failureRate":{"type":"number","minimum":0,"maximum":1},"topSuppressionReasons":{"type":"array","items":{"type":"object","properties":{"reason":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["reason","count"]}},"providerIssues":{"type":"array","items":{"type":"object","properties":{"issue":{"type":"string"},"count":{"type":"integer","minimum":0}},"required":["issue","count"]}},"liveVsSimulation":{"type":"object","properties":{"expectedSuiteStatus":{"anyOf":[{"type":"string","enum":["missing","stale","failed","passed"]},{"type":"string","enum":["unknown"]}]},"liveEvents":{"type":"integer","minimum":0},"liveFailuresOrBlocks":{"type":"integer","minimum":0},"liveFailureOrBlockRate":{"type":"number","minimum":0,"maximum":1},"summary":{"type":"string"}},"required":["expectedSuiteStatus","liveEvents","liveFailuresOrBlocks","liveFailureOrBlockRate","summary"]}},"required":["total","matched","suppressed","blocked","sent","failed","conversionRate","failureRate","topSuppressionReasons","providerIssues","liveVsSimulation"]},"receiptAudit":{"type":["object","null"],"properties":{"received":{"type":"integer","minimum":0},"withoutDecision":{"type":"integer","minimum":0},"receipts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"providerMessageId":{"type":"string"},"externalCommentId":{"type":["string","null"]},"externalUserId":{"type":"string"},"externalPostId":{"type":["string","null"]},"body":{"type":"string","x-luca-sensitive":"blank"},"receivedAt":{"type":"string"}},"required":["id","providerMessageId","externalCommentId","externalUserId","externalPostId","body","receivedAt"]}}},"required":["received","withoutDecision","receipts"]},"nextCursor":{"type":["string","null"]}},"required":["events","analytics","nextCursor"]},"CampaignAnalyticsResponse":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"campaignName":{"type":"string"},"truncated":{"type":"boolean"},"window":{"type":"object","properties":{"since":{"type":"string"},"until":{"type":"string"}},"required":["since","until"]},"attributionWindows":{"type":"object","properties":{"enrollmentDays":{"type":"integer","exclusiveMinimum":0},"lastTouchDays":{"type":"integer","exclusiveMinimum":0}},"required":["enrollmentDays","lastTouchDays"]},"snapshots":{"type":"object","properties":{"campaignVersions":{"type":"array","items":{"type":"object","properties":{"versionId":{"type":"string","format":"uuid"},"versionNumber":{"type":"integer"},"publishedAt":{"type":"string"},"nodeCount":{"type":"integer","minimum":0},"edgeCount":{"type":"integer","minimum":0},"analyticsGoal":{"type":["string","null"]}},"required":["versionId","versionNumber","publishedAt","nodeCount","edgeCount","analyticsGoal"]}},"broadcastSegments":{"type":"array","items":{"type":"object","properties":{"broadcastRunId":{"type":"string","format":"uuid"},"name":{"type":"string"},"campaignVersionId":{"type":["string","null"],"format":"uuid"},"totalRecipients":{"type":"integer","minimum":0},"segment":{"type":"object","properties":{"excludedCount":{"type":"integer","minimum":0},"generatedAt":{"type":["string","null"]},"leadCount":{"type":"integer","minimum":0}},"required":["excludedCount","generatedAt","leadCount"]},"approvedAt":{"type":["string","null"]}},"required":["broadcastRunId","name","campaignVersionId","totalRecipients","segment","approvedAt"]}}},"required":["campaignVersions","broadcastSegments"]},"attribution":{"type":"object","properties":{"primary":{"type":"object","properties":{"model":{"type":"string","enum":["campaign_enrollment_30_day"]},"leads":{"type":"integer","minimum":0},"bookings":{"type":"integer","minimum":0}},"required":["model","leads","bookings"]},"assist":{"type":"object","properties":{"model":{"type":"string","enum":["broadcast_last_touch_7_day"]},"leads":{"type":"integer","minimum":0}},"required":["model","leads"]}},"required":["primary","assist"]},"metrics":{"type":"object","properties":{"enrolledLeads":{"type":"integer","minimum":0},"qualifiedLeads":{"type":"integer","minimum":0},"replies":{"type":"integer","minimum":0},"bookings":{"type":"integer","minimum":0},"bookingRate":{"type":"number","minimum":0},"noShows":{"type":"integer","minimum":0},"broadcastRecipients":{"type":"integer","minimum":0},"broadcastSent":{"type":"integer","minimum":0},"broadcastFailed":{"type":"integer","minimum":0},"broadcastFailureRate":{"type":"number","minimum":0},"crmWonDeals":{"type":"integer","minimum":0},"crmRevenueCents":{"type":"number","minimum":0}},"required":["enrolledLeads","qualifiedLeads","replies","bookings","bookingRate","noShows","broadcastRecipients","broadcastSent","broadcastFailed","broadcastFailureRate","crmWonDeals","crmRevenueCents"]},"conversionByTrigger":{"type":"array","items":{"type":"object","properties":{"enrolled":{"type":"integer","minimum":0},"qualified":{"type":"integer","minimum":0},"replies":{"type":"integer","minimum":0},"bookings":{"type":"integer","minimum":0},"trigger":{"type":"string"}},"required":["enrolled","qualified","replies","bookings","trigger"]}},"conversionByChannel":{"type":"array","items":{"type":"object","properties":{"enrolled":{"type":"integer","minimum":0},"qualified":{"type":"integer","minimum":0},"replies":{"type":"integer","minimum":0},"bookings":{"type":"integer","minimum":0},"channel":{"type":"string"}},"required":["enrolled","qualified","replies","bookings","channel"]}},"broadcastProgress":{"type":"array","items":{"type":"object","properties":{"broadcastRunId":{"type":"string","format":"uuid"},"name":{"type":"string"},"status":{"type":"string"},"totalRecipients":{"type":"integer","minimum":0},"sentCount":{"type":"integer","minimum":0},"failedCount":{"type":"integer","minimum":0},"skippedCount":{"type":"integer","minimum":0},"progressPct":{"type":"number","minimum":0},"failureRate":{"type":"number","minimum":0}},"required":["broadcastRunId","name","status","totalRecipients","sentCount","failedCount","skippedCount","progressPct","failureRate"]}},"nodePerformance":{"type":"array","items":{"type":"object","properties":{"nodeId":{"type":"string"},"nodeType":{"type":"string"},"label":{"type":["string","null"]},"entered":{"type":"integer","minimum":0},"completed":{"type":"integer","minimum":0},"waiting":{"type":"integer","minimum":0},"failed":{"type":"integer","minimum":0},"dropOff":{"type":"integer","minimum":0},"dropOffRate":{"type":"number","minimum":0},"lastEventAt":{"type":["string","null"]},"lastFailureAt":{"type":["string","null"]}},"required":["nodeId","nodeType","label","entered","completed","waiting","failed","dropOff","dropOffRate","lastEventAt","lastFailureAt"]}},"versionPerformance":{"type":"array","items":{"type":"object","properties":{"versionId":{"type":"string","format":"uuid"},"versionNumber":{"type":"integer"},"enrolled":{"type":"integer","minimum":0},"qualified":{"type":"integer","minimum":0},"replies":{"type":"integer","minimum":0},"bookings":{"type":"integer","minimum":0},"bookingRate":{"type":"number","minimum":0}},"required":["versionId","versionNumber","enrolled","qualified","replies","bookings","bookingRate"]}},"topFailingNodes":{"type":"array","items":{"type":"object","properties":{"nodeId":{"type":"string"},"eventType":{"type":"string"},"failures":{"type":"integer","exclusiveMinimum":0}},"required":["nodeId","eventType","failures"]}}},"required":["campaignId","campaignName","truncated","window","attributionWindows","snapshots","attribution","metrics","conversionByTrigger","conversionByChannel","broadcastProgress","nodePerformance","versionPerformance","topFailingNodes"]},"CampaignProviderCapabilitiesResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"mode":{"type":"string","enum":["publish","simulation","runtime"]},"blockers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["provider_capability_state_missing","provider_target_channel_unknown","provider_channel_disconnected","provider_channel_operation_unsupported","provider_account_health_red","provider_account_health_yellow","provider_readiness_stale","provider_readiness_unknown","provider_instagram_public_reply_strict_safety_missing","provider_instagram_private_reply_requires_comment_context","provider_instagram_rate_limit_backoff","provider_whatsapp_freeform_window_closed","provider_whatsapp_template_missing","provider_whatsapp_consent_missing","provider_whatsapp_phone_missing","provider_whatsapp_interactive_unsupported","provider_whatsapp_template_quality_warning","provider_booking_connection_missing","provider_booking_degraded","provider_crm_connection_missing","provider_crm_scope_missing","provider_crm_conflict_requires_review","provider_webhook_subscription_missing","provider_webhook_delivery_failed"]},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"action":{"type":"string"}},"required":["code","severity","message"]}},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string","enum":["provider_capability_state_missing","provider_target_channel_unknown","provider_channel_disconnected","provider_channel_operation_unsupported","provider_account_health_red","provider_account_health_yellow","provider_readiness_stale","provider_readiness_unknown","provider_instagram_public_reply_strict_safety_missing","provider_instagram_private_reply_requires_comment_context","provider_instagram_rate_limit_backoff","provider_whatsapp_freeform_window_closed","provider_whatsapp_template_missing","provider_whatsapp_consent_missing","provider_whatsapp_phone_missing","provider_whatsapp_interactive_unsupported","provider_whatsapp_template_quality_warning","provider_booking_connection_missing","provider_booking_degraded","provider_crm_connection_missing","provider_crm_scope_missing","provider_crm_conflict_requires_review","provider_webhook_subscription_missing","provider_webhook_delivery_failed"]},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"action":{"type":"string"}},"required":["code","severity","message"]}},"campaignId":{"type":"string","format":"uuid"}},"required":["ok","mode","blockers","warnings","campaignId"]},"CampaignEnrollmentListResponse":{"type":"object","properties":{"enrollments":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"campaignVersionId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","waiting","completed","cancelled","failed"]},"currentNodeId":{"type":["string","null"]},"context":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"enteredNodeAt":{"type":["string","null"]},"startedAt":{"type":"string"},"completedAt":{"type":["string","null"]},"updatedAt":{"type":"string"}},"required":["id","campaignId","campaignVersionId","leadId","status","currentNodeId","context","enteredNodeAt","startedAt","completedAt","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["enrollments","nextCursor"]},"CampaignEnrollmentTimelineResponse":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"enrollment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"campaignVersionId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","waiting","completed","cancelled","failed"]},"currentNodeId":{"type":["string","null"]},"context":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"enteredNodeAt":{"type":["string","null"]},"startedAt":{"type":"string"},"completedAt":{"type":["string","null"]},"updatedAt":{"type":"string"}},"required":["id","campaignId","campaignVersionId","leadId","status","currentNodeId","context","enteredNodeAt","startedAt","completedAt","updatedAt"]},"entries":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"kind":{"type":"string","enum":["step_started","decision","action_requested","action_succeeded","action_failed","provider_blocked","provider_warning","review_queued","wait_started","wait_resumed","booking_event","webhook_event","crm_event","completed","failed","event"]},"eventType":{"type":"string"},"nodeId":{"type":["string","null"]},"title":{"type":"string"},"detail":{"type":["string","null"],"x-luca-sensitive":"null"},"data":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"createdAt":{"type":"string"}},"required":["id","kind","eventType","nodeId","title","detail","data","createdAt"]}}},"required":["campaignId","enrollment","entries"]},"CampaignEnrollmentResponse":{"type":"object","properties":{"enrollment":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"campaignVersionId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["active","waiting","completed","cancelled","failed"]},"currentNodeId":{"type":["string","null"]},"context":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"enteredNodeAt":{"type":["string","null"]},"startedAt":{"type":"string"},"completedAt":{"type":["string","null"]},"updatedAt":{"type":"string"}},"required":["id","campaignId","campaignVersionId","leadId","status","currentNodeId","context","enteredNodeAt","startedAt","completedAt","updatedAt"]},"created":{"type":"boolean"}},"required":["enrollment","created"]},"CampaignEnrollLead":{"type":"object","properties":{"leadId":{"type":"string","format":"uuid"}},"required":["leadId"]},"CampaignSimulationListResponse":{"type":"object","properties":{"simulations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"sourceKind":{"type":"string","enum":["fake_input","seed_case","replayed_enrollment"]},"eventType":{"type":"string","enum":["instagram_comment","instagram_dm","whatsapp_reply","booking_event","crm_event","webhook_event","csv_import","manual_enrollment"]},"status":{"type":"string","enum":["completed","waiting","blocked","max_steps"]},"finalNodeId":{"type":["string","null"]},"blockers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"createdByUserId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","campaignId","sourceKind","eventType","status","finalNodeId","blockers","warnings","createdByUserId","createdAt","updatedAt"]}},"nextCursor":{"type":["string","null"]}},"required":["simulations","nextCursor"]},"CampaignSimulationDetail":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"sourceKind":{"type":"string","enum":["fake_input","seed_case","replayed_enrollment"]},"eventType":{"type":"string","enum":["instagram_comment","instagram_dm","whatsapp_reply","booking_event","crm_event","webhook_event","csv_import","manual_enrollment"]},"status":{"type":"string","enum":["completed","waiting","blocked","max_steps"]},"finalNodeId":{"type":["string","null"]},"blockers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"createdByUserId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"draftGraphHash":{"type":"string"},"campaignVersionId":{"type":["string","null"],"format":"uuid"},"replayedEnrollmentId":{"type":["string","null"],"format":"uuid"},"input":{"type":"object","properties":{"lead":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"eventPayload":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"context":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"startNodeId":{"type":["string","null"]},"maxSteps":{"type":"integer","exclusiveMinimum":0}},"required":["lead","eventPayload","context","startNodeId","maxSteps"]},"trace":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"index":{"type":"integer","minimum":0},"nodeId":{"type":"string"},"nodeType":{"anyOf":[{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},{"type":"string","enum":["missing"]}]},"decision":{"type":"string","enum":["node_missing","complete","complete_no_next","wait_timer","wait_event","wait_condition","advance"]},"nextNodeId":{"type":["string","null"]},"branchOutcome":{"type":["string","null"],"x-luca-sensitive":"null"},"action":{"x-luca-sensitive":"null"},"mockedSideEffect":{"type":["object","null"],"additionalProperties":{},"x-luca-sensitive":"null"},"generatedDraft":{"type":["string","null"],"x-luca-sensitive":"blank"},"waitMs":{"type":["integer","null"],"minimum":0},"findings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"createdAt":{"type":"string"}},"required":["index","nodeId","nodeType","decision","nextNodeId","branchOutcome","mockedSideEffect","generatedDraft","waitMs","findings"]}},"generatedDrafts":{"type":"array","items":{"type":"string","x-luca-sensitive":"blank"}},"mockedSideEffects":{"type":"array","items":{"type":"object","additionalProperties":{}},"x-luca-sensitive":"empty"},"outcome":{"type":"object","additionalProperties":{}}},"required":["id","campaignId","sourceKind","eventType","status","finalNodeId","blockers","warnings","createdByUserId","createdAt","updatedAt","draftGraphHash","campaignVersionId","replayedEnrollmentId","input","trace","generatedDrafts","mockedSideEffects","outcome"]},"CampaignSimulationCreate":{"type":"object","properties":{"sourceKind":{"type":"string","enum":["fake_input","seed_case","replayed_enrollment"],"default":"fake_input"},"eventType":{"type":"string","enum":["instagram_comment","instagram_dm","whatsapp_reply","booking_event","crm_event","webhook_event","csv_import","manual_enrollment"],"default":"manual_enrollment"},"startNodeId":{"type":"string","minLength":1},"lead":{"type":"object","additionalProperties":{},"default":{}},"eventPayload":{"type":"object","additionalProperties":{},"default":{}},"context":{"type":"object","additionalProperties":{},"default":{}},"replayedEnrollmentId":{"type":"string","format":"uuid"},"maxSteps":{"type":"integer","minimum":1,"maximum":100,"default":50}}},"CampaignCommentSimulationSuiteResponse":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"graphHash":{"type":"string"},"status":{"type":"string","enum":["missing","stale","failed","passed"]},"cases":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"expected":{"type":"string","enum":["matched","not_matched","suppressed","provider_ready"]},"passed":{"type":"boolean"},"simulationId":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["completed","waiting","blocked","max_steps"]},"findingCodes":{"type":"array","items":{"type":"string"}}},"required":["id","label","expected","passed","simulationId","status","findingCodes"]}},"simulations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"campaignId":{"type":"string","format":"uuid"},"sourceKind":{"type":"string","enum":["fake_input","seed_case","replayed_enrollment"]},"eventType":{"type":"string","enum":["instagram_comment","instagram_dm","whatsapp_reply","booking_event","crm_event","webhook_event","csv_import","manual_enrollment"]},"status":{"type":"string","enum":["completed","waiting","blocked","max_steps"]},"finalNodeId":{"type":["string","null"]},"blockers":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"createdByUserId":{"type":["string","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"draftGraphHash":{"type":"string"},"campaignVersionId":{"type":["string","null"],"format":"uuid"},"replayedEnrollmentId":{"type":["string","null"],"format":"uuid"},"input":{"type":"object","properties":{"lead":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"eventPayload":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"context":{"type":"object","additionalProperties":{},"x-luca-sensitive":"empty"},"startNodeId":{"type":["string","null"]},"maxSteps":{"type":"integer","exclusiveMinimum":0}},"required":["lead","eventPayload","context","startNodeId","maxSteps"]},"trace":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"index":{"type":"integer","minimum":0},"nodeId":{"type":"string"},"nodeType":{"anyOf":[{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},{"type":"string","enum":["missing"]}]},"decision":{"type":"string","enum":["node_missing","complete","complete_no_next","wait_timer","wait_event","wait_condition","advance"]},"nextNodeId":{"type":["string","null"]},"branchOutcome":{"type":["string","null"],"x-luca-sensitive":"null"},"action":{"x-luca-sensitive":"null"},"mockedSideEffect":{"type":["object","null"],"additionalProperties":{},"x-luca-sensitive":"null"},"generatedDraft":{"type":["string","null"],"x-luca-sensitive":"blank"},"waitMs":{"type":["integer","null"],"minimum":0},"findings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"}},"required":["code","severity","message"]}},"createdAt":{"type":"string"}},"required":["index","nodeId","nodeType","decision","nextNodeId","branchOutcome","mockedSideEffect","generatedDraft","waitMs","findings"]}},"generatedDrafts":{"type":"array","items":{"type":"string","x-luca-sensitive":"blank"}},"mockedSideEffects":{"type":"array","items":{"type":"object","additionalProperties":{}},"x-luca-sensitive":"empty"},"outcome":{"type":"object","additionalProperties":{}}},"required":["id","campaignId","sourceKind","eventType","status","finalNodeId","blockers","warnings","createdByUserId","createdAt","updatedAt","draftGraphHash","campaignVersionId","replayedEnrollmentId","input","trace","generatedDrafts","mockedSideEffects","outcome"]}}},"required":["campaignId","graphHash","status","cases","simulations"]},"CampaignCommentSimulationSuiteCreate":{"type":"object","properties":{"autoSend":{"type":"boolean","default":false}}},"CampaignDraftUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1},"description":{"type":["string","null"],"minLength":1},"graph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]},"expectedDraftUpdatedAt":{"type":"string","format":"date-time"}},"required":["graph"]},"CampaignVersionsResponse":{"type":"object","properties":{"campaignId":{"type":"string","format":"uuid"},"versions":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"versionNumber":{"type":"integer"},"graph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]},"publishedAt":{"type":"string"}},"required":["id","versionNumber","graph","publishedAt"]}}},"required":["campaignId","versions"]},"CampaignStatusUpdate":{"type":"object","properties":{"status":{"type":"string","enum":["archived","paused","published"]}},"required":["status"]},"CampaignPublishResponse":{"type":"object","properties":{"campaign":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":["string","null"]},"status":{"type":"string","enum":["draft","published","paused","archived"]},"latestVersionNumber":{"type":["integer","null"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"},"pausedForAccountHealth":{"type":"boolean"}},"required":["id","name","description","status","latestVersionNumber","createdAt","updatedAt","pausedForAccountHealth"]},"version":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"versionNumber":{"type":"integer"},"graph":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"startNodeId":{"type":"string","minLength":1},"nodes":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"type":{"type":"string","enum":["trigger","condition","action","message","booking","wait_duration","wait_until_time","wait_for_event","wait_for_reply","wait_for_condition","branch","control","stop","handoff","split","exit_on"]},"label":{"type":"string","minLength":1,"maxLength":256},"config":{"type":"object","additionalProperties":{},"default":{}}},"required":["id","type"]},"minItems":1,"maxItems":100},"edges":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":128},"source":{"type":"string","minLength":1,"maxLength":128},"target":{"type":"string","minLength":1,"maxLength":128},"label":{"type":"string","minLength":1,"maxLength":256},"condition":{"type":"object","additionalProperties":{}}},"required":["id","source","target"]},"maxItems":200,"default":[]},"knowledge":{"type":"object","properties":{"offerDescription":{"type":"string","minLength":1,"maxLength":2000},"priceAndPaymentFacts":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"programStructure":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"bookingRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"faqsAndObjections":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disallowedClaims":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"resourceLinks":{"type":"array","items":{"type":"string","maxLength":2000,"format":"uri"},"maxItems":50},"exampleGoodReplies":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"sourceNotes":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50}}},"qualification":{"type":"object","properties":{"requiredFields":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"disqualifiers":{"type":"array","items":{"type":"string","minLength":1,"maxLength":2000},"maxItems":50},"minimumScore":{"type":"number","minimum":0,"maximum":100},"requireExplicitConsentBeforeBooking":{"type":"boolean"},"bookingCtaLogic":{"type":"string","minLength":1,"maxLength":2000},"outcomes":{"type":"array","items":{"type":"string","enum":["qualified","nurture","disqualified","needs_human"]},"maxItems":50}}},"analyticsGoal":{"type":"string","minLength":1,"maxLength":2000}},"required":["version","startNodeId","nodes"]},"publishedAt":{"type":"string"},"campaignId":{"type":"string","format":"uuid"}},"required":["id","versionNumber","graph","publishedAt","campaignId"]},"warnings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string","enum":["blocker","warning"]},"message":{"type":"string"},"nodeId":{"type":"string"},"edgeId":{"type":"string"},"channel":{"type":"string"},"action":{"type":"string"}},"required":["code","severity","message"]}}},"required":["campaign","version","warnings"]},"BillingCheckoutResponse":{"type":"object","properties":{"url":{"type":["string","null"]},"sessionId":{"type":"string"}},"required":["url","sessionId"]},"CheckoutBody":{"type":"object","properties":{"successUrl":{"type":"string","format":"uri"},"cancelUrl":{"type":"string","format":"uri"},"tier":{"type":"string","enum":["starter","pro","scale"],"default":"starter"},"billingInterval":{"type":"string","enum":["month","year"]}}},"BillingPortalResponse":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]},"PortalBody":{"type":"object","properties":{"returnUrl":{"type":"string","format":"uri"}}},"BillingSubscriptionResponse":{"type":"object","properties":{"coachId":{"type":"string","format":"uuid"},"planTier":{"type":["string","null"]},"planStatus":{"type":["string","null"]},"stripeCustomerId":{"type":["string","null"]},"billingInterval":{"type":"string","enum":["month","year"]},"annualBillingAvailable":{"type":"boolean"}},"required":["coachId","planTier","planStatus","stripeCustomerId","billingInterval","annualBillingAvailable"]},"MessagePackCheckoutBody":{"type":"object","properties":{"packSku":{"type":"string","enum":["msg_1000"]},"successUrl":{"type":"string","format":"uri"},"cancelUrl":{"type":"string","format":"uri"}},"required":["packSku"]},"ConversationExportResponse":{"type":"object","properties":{"exportedAt":{"type":"string"},"conversations":{"type":"array","items":{"type":"object","properties":{"conversationId":{"type":"string"},"lead":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"channel":{"type":["string","null"]}},"required":["id","name","channel"]},"phase":{"type":"string"},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"direction":{"type":"string"},"body":{"type":"string"},"channel":{"type":"string"},"sentAt":{"type":["string","null"]}},"required":["id","direction","body","channel","sentAt"]}}},"required":["conversationId","lead","phase","messages"]}}},"required":["exportedAt","conversations"]},"ConversationListResponse":{"type":"object","properties":{"conversations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"leadDisplayName":{"type":["string","null"],"x-luca-sensitive":"null"},"leadProfilePhotoUrl":{"type":["string","null"],"format":"uri","x-luca-sensitive":"null"},"leadProfilePhotoRevision":{"type":["string","null"],"format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"currentPhase":{"type":"string"},"lastInboundAt":{"type":["string","null"]},"lastMessagePreview":{"type":["string","null"],"x-luca-sensitive":"null"},"unread":{"type":"boolean"}},"required":["id","leadId","leadDisplayName","channel","currentPhase","lastInboundAt","lastMessagePreview","unread"]}},"nextCursor":{"type":["string","null"]},"availableChannels":{"type":"array","items":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]}}},"required":["conversations","nextCursor"]},"ConversationTotalsResponse":{"type":"object","properties":{"total":{"type":"integer","minimum":0},"channels":{"type":"array","items":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"total":{"type":"integer","minimum":0},"latestInboundAt":{"type":["string","null"]}},"required":["channel","total","latestInboundAt"]}}},"required":["total","channels"]},"ConversationDetailResponse":{"type":"object","properties":{"conversation":{"type":"object","properties":{"profilePhotoRevision":{"type":["string","null"],"format":"uuid"},"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"channelAccountId":{"type":"string","format":"uuid"},"currentPhase":{"type":"string"},"qualificationProgress":{"x-luca-sensitive":"null"},"lastInboundAt":{"type":["string","null"]},"lastOutboundAt":{"type":["string","null"]},"lastUserMessageAt":{"type":["string","null"]},"unread":{"type":"boolean"}},"required":["id","coachId","leadId","channelAccountId","currentPhase","qualificationProgress","lastInboundAt","lastOutboundAt","lastUserMessageAt"]},"lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalUserId":{"type":"string","x-luca-sensitive":"blank"},"displayName":{"type":["string","null"],"x-luca-sensitive":"null"},"profilePhotoUrl":{"type":["string","null"],"format":"uri","x-luca-sensitive":"null"},"customFields":{"x-luca-sensitive":"empty"},"tags":{"type":"array","items":{"type":"string"}},"score":{"type":"integer"},"createdAt":{"type":"string"},"lastSeenAt":{"type":"string"}},"required":["id","coachId","channel","externalUserId","displayName","customFields","tags","score","createdAt","lastSeenAt"]},"channelAccount":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalAccountId":{"type":"string"},"status":{"type":"string"},"connectedAt":{"type":"string"}},"required":["id","coachId","channel","externalAccountId","status","connectedAt"]},"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"providerMessageId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"sourceType":{"type":"string","enum":["dm","comment","story_reply","story_mention"],"default":"dm"},"body":{"type":"string","x-luca-sensitive":"blank"},"mediaUrls":{"type":"array","items":{"type":"string"},"x-luca-sensitive":"empty"},"media":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"mediaType":{"type":"string","enum":["audio","image","file"]},"url":{"type":"string"},"status":{"type":"string","enum":["pending","completed","failed","skipped","blocked","cancelled"]},"safetyStatus":{"type":"string","enum":["safe","needs_review","blocked"]},"transcript":{"type":["string","null"],"default":null},"processingReason":{"type":["string","null"]},"retry":{"type":["object","null"],"properties":{"eligible":{"type":"boolean"},"active":{"type":"boolean"},"attemptsUsed":{"type":"integer","minimum":0,"maximum":3},"attemptsRemaining":{"type":"integer","minimum":0,"maximum":3},"unavailableReason":{"type":["string","null"],"enum":["retry_active","retry_exhausted","original_missing","cancelled","not_retryable",null]}},"required":["eligible","active","attemptsUsed","attemptsRemaining","unavailableReason"]}},"required":["id","mediaType","url","status","safetyStatus"]},"default":[],"x-luca-sensitive":"empty"},"rawPayload":{"x-luca-sensitive":"null"},"reviewQueueId":{"type":["string","null"],"format":"uuid"},"replyAuthor":{"type":["string","null"],"enum":["coach","luca",null],"default":null},"outboundContentId":{"type":["string","null"],"format":"uuid"},"outboundContentPosition":{"type":["integer","null"],"minimum":0},"status":{"type":"string","enum":["queued","sent","delivered","read","failed","blocked_freeform_window","blocked_instagram_messaging_window","blocked_instagram_comment_reply_window","blocked_messenger_messaging_window","blocked_public_reply_link","blocked_rate_limit","blocked_channel_account_paused","blocked_channel_account_suspended","blocked_channel_account_disconnected","blocked_channel_account_reconnect_required","blocked_channel_account_health_red","blocked_channel_account_status_unknown","partially_sent"]},"failedReason":{"type":["string","null"]},"delivery":{"type":["object","null"],"properties":{"state":{"type":"string","enum":["sending","sent","delivered","read","failed_retryable","failed_not_retryable","failed_account_blocked","delivery_unknown"]},"accountIssue":{"type":["string","null"],"enum":["paused","suspended","disconnected","reconnect_required","health_red","status_unknown",null]}},"required":["state","accountIssue"]},"sentParts":{"type":["integer","null"],"minimum":0},"partialRetry":{"type":["string","null"],"enum":["available","queued","unsafe","unavailable",null]},"receivedAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"deliveredAt":{"type":["string","null"]},"readAt":{"type":["string","null"]}},"required":["id","conversationId","coachId","leadId","channel","providerMessageId","direction","body","mediaUrls","rawPayload","reviewQueueId","outboundContentId","outboundContentPosition","status","failedReason","delivery","sentParts","partialRetry","receivedAt","sentAt","deliveredAt","readAt"]}},"replyFailures":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"idempotencyKey":{"type":"string"},"body":{"type":"string","x-luca-sensitive":"blank"},"content":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1},"textGroupId":{"type":"string","format":"uuid"}},"required":["id","type","text"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["media"]},"uploadId":{"type":"string","format":"uuid"},"mediaKind":{"type":"string","enum":["image","video","audio","voice","document"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"caption":{"type":"string","minLength":1,"maxLength":1024},"altText":{"type":"string","minLength":1,"maxLength":1000}},"required":["id","type","uploadId","mediaKind"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["interactive"]},"interactionKind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"prompt":{"type":"string","minLength":1,"maxLength":1024},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":200},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["booking.select_slot"]},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200},"inviteeEmail":{"type":"string","format":"email"},"inviteeName":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingTypeId","slotId","startsAt","endsAt","timezone","inviteeEmail"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.reschedule"]},"bookingId":{"type":"string","format":"uuid"},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingId","bookingTypeId","slotId","startsAt","endsAt","timezone"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.cancel"]},"bookingId":{"type":"string","format":"uuid"},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["type","bookingId"]}]}},"required":["id","title"]},"minItems":1,"maxItems":20},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","type","interactionKind","prompt","options"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"language":{"type":"string","minLength":1},"versionHash":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"parameters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["text"]},"value":{"type":"string","maxLength":4096}},"required":["key","component","index","kind","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["image","video","document"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","component","index","kind","uploadId"]}]},"maxItems":100},"renderedPreview":{"type":"string","maxLength":16000},"providerMetadata":{"type":"object","additionalProperties":{}}},"required":["id","type","templateId","name","language","versionHash","parameters","renderedPreview"]}]},"minItems":1,"maxItems":12}},"required":["version","parts"],"x-luca-sensitive":"empty"},"reason":{"type":"string","enum":["window_closed","invalid_content","channel_not_released","channel_unavailable"]},"delivery":{"type":"object","properties":{"state":{"type":"string","enum":["sending","sent","delivered","read","failed_retryable","failed_not_retryable","failed_account_blocked","delivery_unknown"]},"accountIssue":{"type":["string","null"],"enum":["paused","suspended","disconnected","reconnect_required","health_red","status_unknown",null]}},"required":["state","accountIssue"]},"createdAt":{"type":"string"}},"required":["id","conversationId","idempotencyKey","body","content","reason","delivery","createdAt"]}},"pendingReview":{"type":["object","null"],"properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"draftBody":{"type":"string","x-luca-sensitive":"blank"},"sourceMessageId":{"type":["string","null"],"format":"uuid"},"originThreadId":{"type":["string","null"],"format":"uuid"},"qualification":{"x-luca-sensitive":"null"},"confidence":{"type":"number"},"voiceMatchScore":{"type":"number"},"status":{"type":"string"},"criticIssues":{"x-luca-sensitive":"null"},"createdAt":{"type":"string"},"resolvedAt":{"type":["string","null"]}},"required":["id","conversationId","coachId","draftBody","sourceMessageId","originThreadId","qualification","confidence","voiceMatchScore","status","criticIssues","createdAt","resolvedAt"]},"copilotContext":{"type":"object","properties":{"scopeType":{"type":"string","enum":["lead"]},"scopeId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"leadDisplayName":{"type":["string","null"],"x-luca-sensitive":"null"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"currentPhase":{"type":"string"},"recentMessageCount":{"type":"integer","minimum":0},"pendingReviewCount":{"type":"integer","minimum":0},"memoryCount":{"type":"integer","minimum":0}},"required":["scopeType","scopeId","leadId","leadDisplayName","channel","currentPhase","recentMessageCount","pendingReviewCount","memoryCount"]}},"required":["conversation","lead","channelAccount","messages","replyFailures","pendingReview","copilotContext"]},"ConversationProfileRefreshResponse":{"type":"object","properties":{"queued":{"type":"boolean"}},"required":["queued"]},"ConversationReadMarkerResponse":{"type":"object","properties":{"readThroughAt":{"type":["string","null"]}},"required":["readThroughAt"]},"ConversationReadMarkerBody":{"type":"object","properties":{"upToMessageId":{"type":"string","format":"uuid"}}},"ConversationMessagesResponse":{"type":"object","properties":{"messages":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"providerMessageId":{"type":"string"},"direction":{"type":"string","enum":["inbound","outbound"]},"sourceType":{"type":"string","enum":["dm","comment","story_reply","story_mention"],"default":"dm"},"body":{"type":"string","x-luca-sensitive":"blank"},"mediaUrls":{"type":"array","items":{"type":"string"},"x-luca-sensitive":"empty"},"media":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"mediaType":{"type":"string","enum":["audio","image","file"]},"url":{"type":"string"},"status":{"type":"string","enum":["pending","completed","failed","skipped","blocked","cancelled"]},"safetyStatus":{"type":"string","enum":["safe","needs_review","blocked"]},"transcript":{"type":["string","null"],"default":null},"processingReason":{"type":["string","null"]},"retry":{"type":["object","null"],"properties":{"eligible":{"type":"boolean"},"active":{"type":"boolean"},"attemptsUsed":{"type":"integer","minimum":0,"maximum":3},"attemptsRemaining":{"type":"integer","minimum":0,"maximum":3},"unavailableReason":{"type":["string","null"],"enum":["retry_active","retry_exhausted","original_missing","cancelled","not_retryable",null]}},"required":["eligible","active","attemptsUsed","attemptsRemaining","unavailableReason"]}},"required":["id","mediaType","url","status","safetyStatus"]},"default":[],"x-luca-sensitive":"empty"},"rawPayload":{"x-luca-sensitive":"null"},"reviewQueueId":{"type":["string","null"],"format":"uuid"},"replyAuthor":{"type":["string","null"],"enum":["coach","luca",null],"default":null},"outboundContentId":{"type":["string","null"],"format":"uuid"},"outboundContentPosition":{"type":["integer","null"],"minimum":0},"status":{"type":"string","enum":["queued","sent","delivered","read","failed","blocked_freeform_window","blocked_instagram_messaging_window","blocked_instagram_comment_reply_window","blocked_messenger_messaging_window","blocked_public_reply_link","blocked_rate_limit","blocked_channel_account_paused","blocked_channel_account_suspended","blocked_channel_account_disconnected","blocked_channel_account_reconnect_required","blocked_channel_account_health_red","blocked_channel_account_status_unknown","partially_sent"]},"failedReason":{"type":["string","null"]},"delivery":{"type":["object","null"],"properties":{"state":{"type":"string","enum":["sending","sent","delivered","read","failed_retryable","failed_not_retryable","failed_account_blocked","delivery_unknown"]},"accountIssue":{"type":["string","null"],"enum":["paused","suspended","disconnected","reconnect_required","health_red","status_unknown",null]}},"required":["state","accountIssue"]},"sentParts":{"type":["integer","null"],"minimum":0},"partialRetry":{"type":["string","null"],"enum":["available","queued","unsafe","unavailable",null]},"receivedAt":{"type":["string","null"]},"sentAt":{"type":["string","null"]},"deliveredAt":{"type":["string","null"]},"readAt":{"type":["string","null"]}},"required":["id","conversationId","coachId","leadId","channel","providerMessageId","direction","body","mediaUrls","rawPayload","reviewQueueId","outboundContentId","outboundContentPosition","status","failedReason","delivery","sentParts","partialRetry","receivedAt","sentAt","deliveredAt","readAt"]}},"nextCursor":{"type":["string","null"]}},"required":["messages","nextCursor"]},"ConversationPartialRetryResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["queued"]}},"required":["ok","status"]},"ReviewMediaRetryResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"jobId":{"type":"string","format":"uuid"},"retryNumber":{"type":"integer","minimum":1,"maximum":3},"state":{"type":"string"}},"required":["ok","jobId","retryNumber","state"]},"ConversationSendStatusResponse":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["not_found"]}},"required":["status"]},{"type":"object","properties":{"status":{"type":"string","enum":["accepted"]},"outboundContentId":{"type":["string","null"],"format":"uuid"}},"required":["status","outboundContentId"]}]},"ConversationSendResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["sent","queued"],"default":"sent"},"providerMessageId":{"type":"string"},"outboundContentId":{"type":"string","format":"uuid"},"deduped":{"type":"boolean"}},"required":["ok"]},"ConversationSendBody":{"type":"object","properties":{"body":{"type":"string","minLength":1},"outboundContent":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1},"textGroupId":{"type":"string","format":"uuid"}},"required":["id","type","text"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["media"]},"uploadId":{"type":"string","format":"uuid"},"mediaKind":{"type":"string","enum":["image","video","audio","voice","document"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"caption":{"type":"string","minLength":1,"maxLength":1024},"altText":{"type":"string","minLength":1,"maxLength":1000}},"required":["id","type","uploadId","mediaKind"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["interactive"]},"interactionKind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"prompt":{"type":"string","minLength":1,"maxLength":1024},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":200},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["booking.select_slot"]},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200},"inviteeEmail":{"type":"string","format":"email"},"inviteeName":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingTypeId","slotId","startsAt","endsAt","timezone","inviteeEmail"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.reschedule"]},"bookingId":{"type":"string","format":"uuid"},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingId","bookingTypeId","slotId","startsAt","endsAt","timezone"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.cancel"]},"bookingId":{"type":"string","format":"uuid"},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["type","bookingId"]}]}},"required":["id","title"]},"minItems":1,"maxItems":20},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","type","interactionKind","prompt","options"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"language":{"type":"string","minLength":1},"versionHash":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"parameters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["text"]},"value":{"type":"string","maxLength":4096}},"required":["key","component","index","kind","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["image","video","document"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","component","index","kind","uploadId"]}]},"maxItems":100},"renderedPreview":{"type":"string","maxLength":16000},"providerMetadata":{"type":"object","additionalProperties":{}}},"required":["id","type","templateId","name","language","versionHash","parameters","renderedPreview"]}]},"minItems":1,"maxItems":12}},"required":["version","parts"]},"replacesReplyFailureId":{"type":"string","format":"uuid"}}},"ConversationReplyFailureDismissResponse":{"type":"object","properties":{"dismissed":{"type":"boolean","enum":[true]}},"required":["dismissed"]},"MorningReportResponse":{"type":"object","properties":{"generatedAt":{"type":"string"},"window":{"type":"string","enum":["24h"]},"counts":{"type":"object","properties":{"total":{"type":"number"},"byStatus":{"type":"object","additionalProperties":{"type":"number"}}},"required":["total","byStatus"]},"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"draftBody":{"type":"string","x-luca-sensitive":"blank"},"status":{"type":"string"},"confidence":{"type":"number"},"createdAt":{"type":"string"}},"required":["id","conversationId","leadId","draftBody","status","confidence","createdAt"]}}},"required":["generatedAt","window","counts","items"]},"ScorecardResponse":{"type":"object","properties":{"window":{"type":"object","properties":{"start":{"type":"string"},"end":{"type":"string"}},"required":["start","end"]},"callsBooked":{"type":"number"},"callsCompleted":{"type":"number"},"callsNoShow":{"type":"number"},"showRate":{"type":["number","null"]},"won":{"type":"number"},"lost":{"type":"number"},"notAFit":{"type":"number"},"winRate":{"type":["number","null"]},"medianFirstResponseSeconds":{"type":["number","null"]},"draftsApproved":{"type":"number"},"draftsEdited":{"type":"number"},"draftsRejected":{"type":"number"},"draftsSent":{"type":"number"},"hoursSaved":{"type":"number"}},"required":["window","callsBooked","callsCompleted","callsNoShow","showRate","won","lost","notAFit","winRate","medianFirstResponseSeconds","draftsApproved","draftsEdited","draftsRejected","draftsSent","hoursSaved"]},"ReviewListResponse":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"conversationId":{"type":"string","format":"uuid"},"origin":{"type":"string","enum":["ai_dm_reply","manual_reply","booking_notice","other"]},"sourceMessageId":{"type":["string","null"],"format":"uuid"},"sourceTurnId":{"type":["string","null"],"format":"uuid"},"sourceCommentId":{"type":["string","null"]},"restartsLeft":{"type":["integer","null"],"minimum":0,"maximum":3},"channelAccountId":{"type":"string","format":"uuid"},"draftBody":{"type":"string","x-luca-sensitive":"blank"},"draftParts":{"type":["array","null"],"items":{"type":"string"},"default":null,"x-luca-sensitive":"empty"},"draftContent":{"type":["object","null"],"properties":{"version":{"type":"number","enum":[1]},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1},"textGroupId":{"type":"string","format":"uuid"}},"required":["id","type","text"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["media"]},"uploadId":{"type":"string","format":"uuid"},"mediaKind":{"type":"string","enum":["image","video","audio","voice","document"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"caption":{"type":"string","minLength":1,"maxLength":1024},"altText":{"type":"string","minLength":1,"maxLength":1000}},"required":["id","type","uploadId","mediaKind"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["interactive"]},"interactionKind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"prompt":{"type":"string","minLength":1,"maxLength":1024},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":200},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["booking.select_slot"]},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200},"inviteeEmail":{"type":"string","format":"email"},"inviteeName":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingTypeId","slotId","startsAt","endsAt","timezone","inviteeEmail"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.reschedule"]},"bookingId":{"type":"string","format":"uuid"},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingId","bookingTypeId","slotId","startsAt","endsAt","timezone"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.cancel"]},"bookingId":{"type":"string","format":"uuid"},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["type","bookingId"]}]}},"required":["id","title"]},"minItems":1,"maxItems":20},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","type","interactionKind","prompt","options"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"language":{"type":"string","minLength":1},"versionHash":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"parameters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["text"]},"value":{"type":"string","maxLength":4096}},"required":["key","component","index","kind","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["image","video","document"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","component","index","kind","uploadId"]}]},"maxItems":100},"renderedPreview":{"type":"string","maxLength":16000},"providerMetadata":{"type":"object","additionalProperties":{}}},"required":["id","type","templateId","name","language","versionHash","parameters","renderedPreview"]}]},"minItems":1,"maxItems":12}},"default":null,"required":["version","parts"],"x-luca-sensitive":"null"},"qualification":{"x-luca-sensitive":"null"},"confidence":{"type":"number"},"voiceMatchScore":{"type":"number"},"criticIssues":{"x-luca-sensitive":"null"},"status":{"type":"string","enum":["pending","approved","rejected","sent","superseded","stale"]},"priority":{"type":"string","enum":["urgent","normal"],"default":"normal"},"signals":{"type":["array","null"],"items":{"type":"string"},"default":null,"x-luca-sensitive":"null"},"category":{"type":"string"},"isHotLead":{"type":"boolean"},"isDemo":{"type":"boolean","default":false},"whatsappFreeformOpen":{"type":["boolean","null"]},"createdAt":{"type":"string"},"leadId":{"type":"string","format":"uuid"},"leadDisplayName":{"type":["string","null"],"x-luca-sensitive":"null"},"leadPaused":{"type":"boolean","default":false},"leadPausedUntil":{"type":["string","null"],"default":null},"leadChannel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"safetyReasons":{"type":"array","items":{"type":"string"},"default":[]},"mediaContext":{"type":["string","null"],"default":null,"x-luca-sensitive":"null"},"safetyFindings":{"type":"array","items":{},"default":[],"x-luca-sensitive":"empty"},"media":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"mediaType":{"type":"string","enum":["audio","image","file"]},"url":{"type":"string"},"status":{"type":"string","enum":["pending","completed","failed","skipped","blocked","cancelled"]},"safetyStatus":{"type":"string","enum":["safe","needs_review","blocked"]},"transcript":{"type":["string","null"],"default":null},"processingReason":{"type":["string","null"]},"retry":{"type":["object","null"],"properties":{"eligible":{"type":"boolean"},"active":{"type":"boolean"},"attemptsUsed":{"type":"integer","minimum":0,"maximum":3},"attemptsRemaining":{"type":"integer","minimum":0,"maximum":3},"unavailableReason":{"type":["string","null"],"enum":["retry_active","retry_exhausted","original_missing","cancelled","not_retryable",null]}},"required":["eligible","active","attemptsUsed","attemptsRemaining","unavailableReason"]}},"required":["id","mediaType","url","status","safetyStatus"]},"default":[],"x-luca-sensitive":"empty"},"objectionVariants":{"type":["array","null"],"items":{"type":"object","properties":{"label":{"type":"string","maxLength":60},"body":{"type":"string","maxLength":1500},"rationale":{"type":"string","maxLength":400}},"required":["label","body","rationale"]},"default":null,"x-luca-sensitive":"null"}},"required":["id","conversationId","restartsLeft","channelAccountId","draftBody","qualification","confidence","voiceMatchScore","criticIssues","status","category","isHotLead","whatsappFreeformOpen","createdAt","leadId","leadDisplayName","leadChannel"]}},"nextCursor":{"type":["string","null"]},"asOf":{"type":"string","format":"date-time"}},"required":["items","nextCursor"]},"ReviewSlaResponse":{"type":"object","properties":{"medianFirstResponseMs":{"type":["number","null"]},"trend":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"medianMs":{"type":"number"},"count":{"type":"number"}},"required":["day","medianMs","count"]}},"sampleSize":{"type":"number"},"windowDays":{"type":"number"}},"required":["medianFirstResponseMs","trend","sampleSize","windowDays"]},"ReviewSummaryResponse":{"type":"object","properties":{"pendingCount":{"type":"integer"},"recent":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"createdAt":{"type":"string"},"isHotLead":{"type":"boolean"},"leadDisplayName":{"type":["string","null"],"x-luca-sensitive":"null"}},"required":["id","createdAt","isHotLead","leadDisplayName"]}}},"required":["pendingCount","recent"]},"ReviewDraftingResponse":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"turnId":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"leadDisplayName":{"type":["string","null"],"x-luca-sensitive":"null"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"status":{"type":"string","enum":["collecting","sealed","waiting_media","ready","processing","paused","cancelled","review_required"]},"state":{"type":"string","enum":["drafting","pausing","cancelling","paused","cancelled","failed"]},"preview":{"type":"string","x-luca-sensitive":"blank"},"attempt":{"type":"integer","minimum":1},"restartsLeft":{"type":"integer","minimum":0,"maximum":3},"leadPaused":{"type":"boolean"},"leadPausedUntil":{"type":["string","null"]},"resumeSkippedReason":{"type":["string","null"],"enum":["already_replied","window_closed",null]},"startedAt":{"type":"string"}},"required":["turnId","leadId","leadDisplayName","channel","status","state","preview","attempt","restartsLeft","leadPaused","leadPausedUntil","resumeSkippedReason","startedAt"]}}},"required":["items"]},"ReviewChangesResponse":{"oneOf":[{"type":"object","properties":{"version":{"type":"string","format":"date-time"},"pendingCount":{"type":"integer","minimum":0},"draftingCount":{"type":"integer","minimum":0},"reload":{"type":"boolean","enum":[true]}},"required":["version","pendingCount","draftingCount","reload"]},{"type":"object","properties":{"version":{"type":"string","format":"date-time"},"pendingCount":{"type":"integer","minimum":0},"draftingCount":{"type":"integer","minimum":0},"reload":{"type":"boolean","enum":[false]},"resolvedIds":{"type":"array","items":{"type":"string","format":"uuid"}},"addedIds":{"type":"array","items":{"type":"string","format":"uuid"}}},"required":["version","pendingCount","draftingCount","reload","resolvedIds","addedIds"]}]},"DraftingCancelResponse":{"type":"object","properties":{"turnId":{"type":"string","format":"uuid"},"state":{"type":"string","enum":["drafting","pausing","cancelling","paused","cancelled","failed"]}},"required":["turnId","state"]},"DraftingRetryResponse":{"type":"object","properties":{"turnId":{"type":"string","format":"uuid"},"attempt":{"type":"integer","minimum":2}},"required":["turnId","attempt"]},"ReviewRegenerateResponse":{"type":"object","properties":{"supersededReviewQueueId":{"type":"string","format":"uuid"},"turnId":{"type":"string","format":"uuid"},"attempt":{"type":"integer","minimum":2}},"required":["supersededReviewQueueId","turnId","attempt"]},"ReviewRegenerateRequest":{"type":"object","properties":{"hint":{"type":"string","maxLength":500}}},"ReviewBulkResponse":{"type":"object","properties":{"results":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"outcome":{"type":"string","enum":["approved","rejected","skipped","failed"]},"reason":{"type":"string","enum":["review_item_not_found","review_media_not_found","turn_not_found","lead_not_found","objection_variant_not_found","objection_type_not_found","already_resolved","review_item_not_pending","review_item_not_rejected","draft_sending","turn_finished","auto_send_not_eligible","booking_communication_not_restorable","invalid_outbound_content","no_source_turn","turn_not_latest","turn_not_restartable","drafting_retry_limit","cancelled","retry_exhausted","retry_active","original_missing","not_retryable"]}},"required":["id","outcome"]}}},"required":["results"]},"ReviewBulk":{"type":"object","properties":{"ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100}},"required":["ids"]},"DraftExplainResponse":{"oneOf":[{"type":"object","properties":{"status":{"type":"string","enum":["explained"]},"id":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"draftBody":{"type":"string","x-luca-sensitive":"blank"},"confidence":{"type":"number"},"voiceMatchScore":{"type":"number"},"criticIssues":{"x-luca-sensitive":"null"},"qualification":{"x-luca-sensitive":"null"},"createdAt":{"type":"string"}},"required":["status","id","leadId","draftBody","confidence","voiceMatchScore","criticIssues","qualification","createdAt"]},{"type":"object","properties":{"status":{"type":"string","enum":["no_reasoning_available"]},"id":{"type":"string","format":"uuid"},"leadId":{"type":"string","format":"uuid"},"reason":{"type":"string","enum":["never_drafted","not_qualified"]}},"required":["status","id","leadId","reason"]}]},"ReviewResolveResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"dispatched":{"type":"boolean"}},"required":["ok"]},"ReviewApprove":{"type":"object","properties":{"finalBody":{"type":"string","minLength":1},"finalParts":{"type":"array","items":{"type":"string","minLength":1},"minItems":1,"maxItems":4},"outboundContent":{"type":"object","properties":{"version":{"type":"number","enum":[1]},"parts":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["text"]},"text":{"type":"string","minLength":1},"textGroupId":{"type":"string","format":"uuid"}},"required":["id","type","text"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["media"]},"uploadId":{"type":"string","format":"uuid"},"mediaKind":{"type":"string","enum":["image","video","audio","voice","document"]},"fileName":{"type":"string","minLength":1,"maxLength":255},"caption":{"type":"string","minLength":1,"maxLength":1024},"altText":{"type":"string","minLength":1,"maxLength":1000}},"required":["id","type","uploadId","mediaKind"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["interactive"]},"interactionKind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"prompt":{"type":"string","minLength":1,"maxLength":1024},"options":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1,"maxLength":200},"title":{"type":"string","minLength":1,"maxLength":200},"description":{"type":"string","minLength":1,"maxLength":200},"action":{"oneOf":[{"type":"object","properties":{"type":{"type":"string","enum":["booking.select_slot"]},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200},"inviteeEmail":{"type":"string","format":"email"},"inviteeName":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingTypeId","slotId","startsAt","endsAt","timezone","inviteeEmail"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.reschedule"]},"bookingId":{"type":"string","format":"uuid"},"bookingTypeId":{"type":"string","format":"uuid"},"slotId":{"type":"string","minLength":1,"maxLength":500},"startsAt":{"type":"string","format":"date-time"},"endsAt":{"type":"string","format":"date-time"},"timezone":{"type":"string","minLength":1,"maxLength":200}},"required":["type","bookingId","bookingTypeId","slotId","startsAt","endsAt","timezone"]},{"type":"object","properties":{"type":{"type":"string","enum":["booking.cancel"]},"bookingId":{"type":"string","format":"uuid"},"reason":{"type":"string","minLength":1,"maxLength":500}},"required":["type","bookingId"]}]}},"required":["id","title"]},"minItems":1,"maxItems":20},"expiresAt":{"type":"string","format":"date-time"}},"required":["id","type","interactionKind","prompt","options"]},{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"language":{"type":"string","minLength":1},"versionHash":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"parameters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["text"]},"value":{"type":"string","maxLength":4096}},"required":["key","component","index","kind","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["image","video","document"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","component","index","kind","uploadId"]}]},"maxItems":100},"renderedPreview":{"type":"string","maxLength":16000},"providerMetadata":{"type":"object","additionalProperties":{}}},"required":["id","type","templateId","name","language","versionHash","parameters","renderedPreview"]}]},"minItems":1,"maxItems":12}},"required":["version","parts"]}}},"ReviewReject":{"type":"object","properties":{"reasonCode":{"type":"string","enum":["wrong_facts","wrong_tone","too_long","too_pushy","should_not_reply","other"]},"note":{"type":"string","minLength":1,"maxLength":280}}},"ObjectionVariantSelect":{"type":"object","properties":{"label":{"type":"string","minLength":1}},"required":["label"]},"ReviewComposerResponse":{"type":"object","properties":{"composer":{"type":"object","properties":{"canSend":{"type":"boolean"},"text":{"type":"boolean"},"media":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["image","video","audio","voice","document"]},"maxBytes":{"type":"integer","exclusiveMinimum":0},"mimeTypes":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","maxBytes"]}},"interactions":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"maxOptions":{"type":"integer","exclusiveMinimum":0},"titleMaxLength":{"type":"integer","exclusiveMinimum":0},"descriptionMaxLength":{"type":"integer","exclusiveMinimum":0}},"required":["kind","maxOptions","titleMaxLength"]}},"templates":{"type":"boolean"},"externallyBlocked":{"type":"boolean"},"blocker":{"type":"string"}},"required":["canSend","text","media","interactions","templates","externallyBlocked"]},"metaWindow":{"oneOf":[{"type":"object","properties":{"kind":{"type":"string","enum":["open"]}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","enum":["human_agent"]}},"required":["kind"]},{"type":"object","properties":{"kind":{"type":"string","enum":["blocked"]},"reason":{"type":"string"}},"required":["kind","reason"]}]}},"required":["composer","metaWindow"]},"ChannelListResponse":{"type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalAccountId":{"type":"string"},"displayName":{"type":"string","minLength":1},"status":{"type":"string","enum":["connected","disconnected","paused","suspended","reconnect_required"]},"aiDmAutoSendEnabled":{"type":"boolean"},"aiDmAutoSendActive":{"type":"boolean"},"connectedAt":{"type":"string"},"coachState":{"type":"object","properties":{"code":{"type":"string","enum":["connected","checking","degraded","action_required","reconnect_required","paused","externally_blocked"]},"label":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"actions":{"type":"array","items":{"type":"string","enum":["check_health","repair_webhook","reconnect","disconnect","review_provider_access","retry_cleanup"]}}},"required":["code","label","description","actions"]},"cleanup":{"type":"object","properties":{"status":{"type":"string","enum":["completed","queued","retry_required"]}},"required":["status"]},"composer":{"type":"object","properties":{"canSend":{"type":"boolean"},"text":{"type":"boolean"},"media":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["image","video","audio","voice","document"]},"maxBytes":{"type":"integer","exclusiveMinimum":0},"mimeTypes":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","maxBytes"]}},"interactions":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"maxOptions":{"type":"integer","exclusiveMinimum":0},"titleMaxLength":{"type":"integer","exclusiveMinimum":0},"descriptionMaxLength":{"type":"integer","exclusiveMinimum":0}},"required":["kind","maxOptions","titleMaxLength"]}},"templates":{"type":"boolean"},"externallyBlocked":{"type":"boolean"},"blocker":{"type":"string"}},"required":["canSend","text","media","interactions","templates","externallyBlocked"]},"health":{"type":"object","properties":{"status":{"type":"string","enum":["green","yellow","red"]},"signals":{"type":"array","items":{"type":"string"}},"checkedAt":{"type":["string","null"]},"readiness":{"type":["object","null"],"properties":{"version":{"type":"number","enum":[1]},"status":{"type":"string","enum":["ready","degraded","blocked","unknown"]},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","unknown"]},"source":{"type":"string","enum":["provider","local","cached"]},"detail":{"type":"string"}},"required":["key","status","source"]}},"checkedAt":{"type":"string"}},"required":["version","status","checks","checkedAt"]}},"required":["status","signals","checkedAt"]}},"required":["id","channel","externalAccountId","status","aiDmAutoSendEnabled","aiDmAutoSendActive","connectedAt","coachState","composer"]}}},"required":["accounts"]},"ChannelCatalogResponse":{"type":"object","properties":{"channels":{"type":"array","items":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"status":{"type":"string","enum":["available","coming_soon"]},"releaseMode":{"type":"string","enum":["off","internal","public"]},"visibility":{"type":"string","enum":["hidden","coming_soon","visible"]}},"required":["channel","status","releaseMode","visibility"]}}},"required":["channels"]},"ChannelFeatureCatalogResponse":{"type":"object","properties":{"features":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string","minLength":1},"provider":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"operation":{"type":"string","minLength":1},"support":{"type":"string","enum":["direct","partial","unsupported"]},"status":{"type":"string","enum":["supported","unsupported","externally_blocked","certification_needed"]},"direction":{"type":"string","enum":["control","inbound","outbound","mixed"]},"requiredPermissions":{"type":"array","items":{"type":"string","minLength":1}},"requiredWebhookFields":{"type":"array","items":{"type":"string","minLength":1}},"supportedInteractionTypes":{"type":"array","items":{"type":"string","minLength":1}},"externalApprovalRequirements":{"type":"array","items":{"type":"string","enum":["luca_live_check","external_provider_approval"]}},"providerVersion":{"type":"string"},"policy":{"type":"string"},"limitation":{"type":"string","minLength":1},"sourceUrl":{"type":"string","format":"uri"},"lastReviewed":{"type":"string","minLength":1},"blocker":{"type":"string"},"release":{"type":"object","properties":{"mode":{"type":"string","enum":["off","internal","public"]},"visibility":{"type":"string","enum":["hidden","coming_soon","visible"]},"lucaLiveCertified":{"type":"boolean"},"externalProviderApproved":{"type":"boolean"}},"required":["mode","visibility","lucaLiveCertified","externalProviderApproved"]}},"required":["key","provider","operation","support","status","direction","requiredPermissions","requiredWebhookFields","supportedInteractionTypes","externalApprovalRequirements","sourceUrl","lastReviewed","release"]}}},"required":["features"]},"ChannelAccountSummary":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalAccountId":{"type":"string"},"displayName":{"type":"string","minLength":1},"status":{"type":"string","enum":["connected","disconnected","paused","suspended","reconnect_required"]},"aiDmAutoSendEnabled":{"type":"boolean"},"aiDmAutoSendActive":{"type":"boolean"},"connectedAt":{"type":"string"},"coachState":{"type":"object","properties":{"code":{"type":"string","enum":["connected","checking","degraded","action_required","reconnect_required","paused","externally_blocked"]},"label":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"actions":{"type":"array","items":{"type":"string","enum":["check_health","repair_webhook","reconnect","disconnect","review_provider_access","retry_cleanup"]}}},"required":["code","label","description","actions"]},"cleanup":{"type":"object","properties":{"status":{"type":"string","enum":["completed","queued","retry_required"]}},"required":["status"]},"composer":{"type":"object","properties":{"canSend":{"type":"boolean"},"text":{"type":"boolean"},"media":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["image","video","audio","voice","document"]},"maxBytes":{"type":"integer","exclusiveMinimum":0},"mimeTypes":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","maxBytes"]}},"interactions":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"maxOptions":{"type":"integer","exclusiveMinimum":0},"titleMaxLength":{"type":"integer","exclusiveMinimum":0},"descriptionMaxLength":{"type":"integer","exclusiveMinimum":0}},"required":["kind","maxOptions","titleMaxLength"]}},"templates":{"type":"boolean"},"externallyBlocked":{"type":"boolean"},"blocker":{"type":"string"}},"required":["canSend","text","media","interactions","templates","externallyBlocked"]},"health":{"type":"object","properties":{"status":{"type":"string","enum":["green","yellow","red"]},"signals":{"type":"array","items":{"type":"string"}},"checkedAt":{"type":["string","null"]},"readiness":{"type":["object","null"],"properties":{"version":{"type":"number","enum":[1]},"status":{"type":"string","enum":["ready","degraded","blocked","unknown"]},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","unknown"]},"source":{"type":"string","enum":["provider","local","cached"]},"detail":{"type":"string"}},"required":["key","status","source"]}},"checkedAt":{"type":"string"}},"required":["version","status","checks","checkedAt"]}},"required":["status","signals","checkedAt"]}},"required":["id","channel","externalAccountId","status","aiDmAutoSendEnabled","aiDmAutoSendActive","connectedAt","coachState","composer"]},"ChannelCreate":{"type":"object","properties":{"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalAccountId":{"type":"string","minLength":1},"encryptedCredentials":{"type":"string","minLength":1}},"required":["channel","externalAccountId","encryptedCredentials"]},"ChannelAiDmAutoSendResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"enabled":{"type":"boolean"},"workspaceAutoSendEnabled":{"type":"boolean"}},"required":["id","enabled","workspaceAutoSendEnabled"]},"ChannelAiDmAutoSendPatch":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]},"ChannelPatchResponse":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"status":{"type":"string","enum":["connected","disconnected","paused","suspended","reconnect_required"]}},"required":["id","status"]},"ChannelPatch":{"type":"object","properties":{"action":{"type":"string","enum":["pause","resume"]}},"required":["action"],"additionalProperties":false},"ChannelDeleteResponse":{"type":"object","properties":{"ok":{"type":"boolean"},"account":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalAccountId":{"type":"string"},"displayName":{"type":"string","minLength":1},"status":{"type":"string","enum":["connected","disconnected","paused","suspended","reconnect_required"]},"aiDmAutoSendEnabled":{"type":"boolean"},"aiDmAutoSendActive":{"type":"boolean"},"connectedAt":{"type":"string"},"coachState":{"type":"object","properties":{"code":{"type":"string","enum":["connected","checking","degraded","action_required","reconnect_required","paused","externally_blocked"]},"label":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"actions":{"type":"array","items":{"type":"string","enum":["check_health","repair_webhook","reconnect","disconnect","review_provider_access","retry_cleanup"]}}},"required":["code","label","description","actions"]},"cleanup":{"type":"object","properties":{"status":{"type":"string","enum":["completed","queued","retry_required"]}},"required":["status"]},"composer":{"type":"object","properties":{"canSend":{"type":"boolean"},"text":{"type":"boolean"},"media":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["image","video","audio","voice","document"]},"maxBytes":{"type":"integer","exclusiveMinimum":0},"mimeTypes":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","maxBytes"]}},"interactions":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"maxOptions":{"type":"integer","exclusiveMinimum":0},"titleMaxLength":{"type":"integer","exclusiveMinimum":0},"descriptionMaxLength":{"type":"integer","exclusiveMinimum":0}},"required":["kind","maxOptions","titleMaxLength"]}},"templates":{"type":"boolean"},"externallyBlocked":{"type":"boolean"},"blocker":{"type":"string"}},"required":["canSend","text","media","interactions","templates","externallyBlocked"]},"health":{"type":"object","properties":{"status":{"type":"string","enum":["green","yellow","red"]},"signals":{"type":"array","items":{"type":"string"}},"checkedAt":{"type":["string","null"]},"readiness":{"type":["object","null"],"properties":{"version":{"type":"number","enum":[1]},"status":{"type":"string","enum":["ready","degraded","blocked","unknown"]},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","unknown"]},"source":{"type":"string","enum":["provider","local","cached"]},"detail":{"type":"string"}},"required":["key","status","source"]}},"checkedAt":{"type":"string"}},"required":["version","status","checks","checkedAt"]}},"required":["status","signals","checkedAt"]}},"required":["id","channel","externalAccountId","status","aiDmAutoSendEnabled","aiDmAutoSendActive","connectedAt","coachState","composer"]},"cleanup":{"type":"object","properties":{"status":{"type":"string","enum":["completed","queued","retry_required"]}},"required":["status"]}},"required":["ok"]},"ChannelHealthResponse":{"type":"object","properties":{"account":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalAccountId":{"type":"string"},"displayName":{"type":"string","minLength":1},"status":{"type":"string","enum":["connected","disconnected","paused","suspended","reconnect_required"]},"aiDmAutoSendEnabled":{"type":"boolean"},"aiDmAutoSendActive":{"type":"boolean"},"connectedAt":{"type":"string"},"coachState":{"type":"object","properties":{"code":{"type":"string","enum":["connected","checking","degraded","action_required","reconnect_required","paused","externally_blocked"]},"label":{"type":"string","minLength":1},"description":{"type":"string","minLength":1},"actions":{"type":"array","items":{"type":"string","enum":["check_health","repair_webhook","reconnect","disconnect","review_provider_access","retry_cleanup"]}}},"required":["code","label","description","actions"]},"cleanup":{"type":"object","properties":{"status":{"type":"string","enum":["completed","queued","retry_required"]}},"required":["status"]},"composer":{"type":"object","properties":{"canSend":{"type":"boolean"},"text":{"type":"boolean"},"media":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["image","video","audio","voice","document"]},"maxBytes":{"type":"integer","exclusiveMinimum":0},"mimeTypes":{"type":"array","items":{"type":"string","minLength":1}}},"required":["kind","maxBytes"]}},"interactions":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string","enum":["buttons","list","quick_replies","inline_buttons"]},"maxOptions":{"type":"integer","exclusiveMinimum":0},"titleMaxLength":{"type":"integer","exclusiveMinimum":0},"descriptionMaxLength":{"type":"integer","exclusiveMinimum":0}},"required":["kind","maxOptions","titleMaxLength"]}},"templates":{"type":"boolean"},"externallyBlocked":{"type":"boolean"},"blocker":{"type":"string"}},"required":["canSend","text","media","interactions","templates","externallyBlocked"]},"health":{"type":"object","properties":{"status":{"type":"string","enum":["green","yellow","red"]},"signals":{"type":"array","items":{"type":"string"}},"checkedAt":{"type":["string","null"]},"readiness":{"type":["object","null"],"properties":{"version":{"type":"number","enum":[1]},"status":{"type":"string","enum":["ready","degraded","blocked","unknown"]},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","unknown"]},"source":{"type":"string","enum":["provider","local","cached"]},"detail":{"type":"string"}},"required":["key","status","source"]}},"checkedAt":{"type":"string"}},"required":["version","status","checks","checkedAt"]}},"required":["status","signals","checkedAt"]}},"required":["id","channel","externalAccountId","status","aiDmAutoSendEnabled","aiDmAutoSendActive","connectedAt","coachState","composer"]},"status":{"type":"string","enum":["green","yellow","red"]},"signals":{"type":"array","items":{"type":"string"}},"readiness":{"type":["object","null"],"properties":{"version":{"type":"number","enum":[1]},"status":{"type":"string","enum":["ready","degraded","blocked","unknown"]},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","unknown"]},"source":{"type":"string","enum":["provider","local","cached"]},"detail":{"type":"string"}},"required":["key","status","source"]}},"checkedAt":{"type":"string"}},"required":["version","status","checks","checkedAt"]}},"required":["status","signals"]},"WhatsAppTemplatesResponse":{"type":"object","properties":{"templates":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"body":{"type":"string"},"language":{"type":"string"},"category":{"type":"string"},"status":{"type":"string","enum":["approved"]},"versionHash":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"components":{"type":"array","items":{}},"parameterRequirements":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"buttonSubtype":{"type":"string","enum":["url","copy_code","flow"]},"kind":{"type":"string","enum":["text"]}},"required":["key","component","index","kind"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"buttonSubtype":{"type":"string","enum":["url","copy_code","flow"]},"kind":{"type":"string","enum":["image","video","document"]}},"required":["key","component","index","kind"]}]}},"syncedAt":{"type":"string"}},"required":["id","name","body","language","category","status","versionHash","components","parameterRequirements","syncedAt"]}},"billingNotice":{"type":"string","enum":["Meta bills WhatsApp messages to your WhatsApp Business Account. Luca does not calculate or add provider charges."]}},"required":["templates","billingNotice"]},"WhatsAppTemplateSyncResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"status":{"type":"string","enum":["queued"]}},"required":["ok","status"]},"WhatsAppTemplatePreviewResponse":{"type":"object","properties":{"template":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","enum":["template"]},"templateId":{"type":"string","minLength":1},"name":{"type":"string","minLength":1},"language":{"type":"string","minLength":1},"versionHash":{"type":"string","pattern":"^sha256:[a-f0-9]{64}$"},"parameters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["text"]},"value":{"type":"string","maxLength":4096}},"required":["key","component","index","kind","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["image","video","document"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","component","index","kind","uploadId"]}]},"maxItems":100},"renderedPreview":{"type":"string","maxLength":16000},"providerMetadata":{"type":"object","additionalProperties":{}}},"required":["id","type","templateId","name","language","versionHash","parameters","renderedPreview"]},"billingNotice":{"type":"string","enum":["Meta bills WhatsApp messages to your WhatsApp Business Account. Luca does not calculate or add provider charges."]}},"required":["template","billingNotice"]},"WhatsAppTemplatePreviewRequest":{"type":"object","properties":{"parameters":{"type":"array","items":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header","body","button"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["text"]},"value":{"type":"string","maxLength":4096}},"required":["key","component","index","kind","value"]},{"type":"object","properties":{"key":{"type":"string","minLength":1,"maxLength":200},"component":{"type":"string","enum":["header"]},"index":{"type":"integer","minimum":0},"parameterName":{"type":"string","minLength":1,"maxLength":200},"buttonIndex":{"type":"integer","minimum":0},"kind":{"type":"string","enum":["image","video","document"]},"uploadId":{"type":"string","format":"uuid"},"fileName":{"type":"string","minLength":1,"maxLength":255}},"required":["key","component","index","kind","uploadId"]}]},"maxItems":100}},"required":["parameters"]},"AccountSafetyOverviewResponse":{"type":"object","properties":{"accounts":{"type":"array","items":{"type":"object","properties":{"channelAccount":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"externalAccountId":{"type":"string"},"status":{"type":"string"},"connectedAt":{"type":"string"}},"required":["id","channel","externalAccountId","status","connectedAt"]},"safety":{"type":["object","null"],"properties":{"status":{"type":"string"},"signals":{},"messagesSent24h":{"type":"integer"},"lastProbeAt":{"type":["string","null"]},"updatedAt":{"type":"string"},"readiness":{"type":["object","null"],"properties":{"version":{"type":"number","enum":[1]},"status":{"type":"string","enum":["ready","degraded","blocked","unknown"]},"checks":{"type":"array","items":{"type":"object","properties":{"key":{"type":"string"},"status":{"type":"string","enum":["pass","warn","fail","unknown"]},"source":{"type":"string","enum":["provider","local","cached"]},"detail":{"type":"string"}},"required":["key","status","source"]}},"checkedAt":{"type":"string"}},"required":["version","status","checks","checkedAt"]}},"required":["status","messagesSent24h","lastProbeAt","updatedAt"]}},"required":["channelAccount","safety"]}}},"required":["accounts"]},"UsageResponse":{"type":"object","properties":{"since":{"type":"string"},"totalUsd":{"type":"number"},"totalCalls":{"type":"number"},"byAgent":{"type":"array","items":{"type":"object","properties":{"agent":{"type":"string"},"totalUsd":{"type":"number"},"calls":{"type":"number"}},"required":["agent","totalUsd","calls"]}},"byDay":{"type":"array","items":{"type":"object","properties":{"day":{"type":"string"},"totalUsd":{"type":"number"}},"required":["day","totalUsd"]}},"cap":{"type":"object","properties":{"planTier":{"type":"string"},"capUsd":{"type":"number"},"totalUsd":{"type":"number"},"remainingUsd":{"type":"number"},"overCap":{"type":"boolean"}},"required":["planTier","capUsd","totalUsd","remainingUsd","overCap"]},"aiAddonUnits":{"type":"integer","default":0}},"required":["since","totalUsd","totalCalls","byAgent","byDay","cap"]},"MessagePoolResponse":{"type":"object","properties":{"planTier":{"type":"string"},"used":{"type":"integer"},"allowed":{"type":"integer"},"remaining":{"type":"integer"},"usagePct":{"type":"integer"},"warn":{"type":"boolean"},"exhausted":{"type":"boolean"},"isTrialCap":{"type":"boolean","default":false}},"required":["planTier","used","allowed","remaining","usagePct","warn","exhausted"]},"AuditLogListResponse":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":["string","null"],"format":"uuid"},"actorType":{"type":"string"},"action":{"type":"string"},"targetType":{"type":"string"},"targetId":{"type":"string"},"metadata":{},"createdAt":{"type":"string"}},"required":["id","coachId","actorType","action","targetType","targetId","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["items","nextCursor"]},"InboundPipelineDebugResponse":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"coachId":{"type":"string","format":"uuid"},"eventName":{"type":"string"},"channel":{"type":["string","null"]},"channelAccountId":{"type":["string","null"],"format":"uuid"},"leadId":{"type":["string","null"],"format":"uuid"},"conversationId":{"type":["string","null"],"format":"uuid"},"providerMessageId":{"type":["string","null"]},"reviewQueueId":{"type":["string","null"],"format":"uuid"},"payload":{},"createdAt":{"type":"string"}},"required":["id","coachId","eventName","channel","channelAccountId","leadId","conversationId","providerMessageId","reviewQueueId","createdAt"]}},"nextCursor":{"type":["string","null"]}},"required":["events","nextCursor"]},"InboundActivityResponse":{"type":"object","properties":{"events":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"channel":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"occurredAt":{"type":"string","format":"date-time"},"conversationId":{"type":["string","null"],"format":"uuid"},"outcome":{"type":"string","enum":["message_accepted","duplicate_ignored","action_accepted","action_ignored","reply_accepted","reply_blocked","reply_failed","retry_available"]}},"required":["id","channel","occurredAt","conversationId","outcome"]}},"nextCursor":{"type":["string","null"]}},"required":["events","nextCursor"]},"DeveloperApiKeysResponse":{"type":"object","properties":{"apiKeys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"prefix":{"type":["string","null"]},"start":{"type":["string","null"]},"scopes":{"type":"array","items":{"type":"string","enum":["leads:read","leads:write","conversations:read","conversations:write","analytics:read","bookings:read","bookings:write","call_events:read","call_events:write","review_queue:read","review_queue:write","voice:read","cadences:write","reports:read","coach:read","usage:read","safety:read","channels:read","channels:write","insights:write","learning:read","learning:write","knowledge:read","knowledge:write","memory:read","memory:write","broadcasts:read","broadcasts:write","campaigns:read","campaigns:write","webhooks:read","webhooks:write","integrations:read","integrations:write"]}},"capabilityTier":{"type":"string","enum":["read","draft","queue_ops","full"]},"dataSensitivityTier":{"type":"string","enum":["redacted","full_content"]},"workspaceIds":{"type":"array","items":{"type":"string","format":"uuid"}},"workspaceMode":{"type":"string","enum":["current","selected","all"]},"createdByUserId":{"type":["string","null"]},"rateLimitEnabled":{"type":"boolean"},"rateLimitMax":{"type":["integer","null"]},"rateLimitTimeWindow":{"type":["integer","null"]},"remaining":{"type":["integer","null"]},"lastUsedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]},"status":{"type":"string","enum":["active","expired","revoked"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","prefix","start","scopes","capabilityTier","dataSensitivityTier","workspaceIds","workspaceMode","createdByUserId","rateLimitEnabled","rateLimitMax","rateLimitTimeWindow","remaining","lastUsedAt","expiresAt","revokedAt","status","createdAt","updatedAt"]}},"workspaces":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"slug":{"type":"string"},"name":{"type":"string"}},"required":["id","slug","name"]}},"availableScopes":{"type":"array","items":{"type":"string","enum":["leads:read","leads:write","conversations:read","conversations:write","analytics:read","bookings:read","bookings:write","call_events:read","call_events:write","review_queue:read","review_queue:write","voice:read","cadences:write","reports:read","coach:read","usage:read","safety:read","channels:read","channels:write","insights:write","learning:read","learning:write","knowledge:read","knowledge:write","memory:read","memory:write","broadcasts:read","broadcasts:write","campaigns:read","campaigns:write","webhooks:read","webhooks:write","integrations:read","integrations:write"]}},"canManageApiKeys":{"type":"boolean"}},"required":["apiKeys","workspaces","availableScopes","canManageApiKeys"]},"DeveloperApiKeyCreateResponse":{"type":"object","properties":{"apiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"prefix":{"type":["string","null"]},"start":{"type":["string","null"]},"scopes":{"type":"array","items":{"type":"string","enum":["leads:read","leads:write","conversations:read","conversations:write","analytics:read","bookings:read","bookings:write","call_events:read","call_events:write","review_queue:read","review_queue:write","voice:read","cadences:write","reports:read","coach:read","usage:read","safety:read","channels:read","channels:write","insights:write","learning:read","learning:write","knowledge:read","knowledge:write","memory:read","memory:write","broadcasts:read","broadcasts:write","campaigns:read","campaigns:write","webhooks:read","webhooks:write","integrations:read","integrations:write"]}},"capabilityTier":{"type":"string","enum":["read","draft","queue_ops","full"]},"dataSensitivityTier":{"type":"string","enum":["redacted","full_content"]},"workspaceIds":{"type":"array","items":{"type":"string","format":"uuid"}},"workspaceMode":{"type":"string","enum":["current","selected","all"]},"createdByUserId":{"type":["string","null"]},"rateLimitEnabled":{"type":"boolean"},"rateLimitMax":{"type":["integer","null"]},"rateLimitTimeWindow":{"type":["integer","null"]},"remaining":{"type":["integer","null"]},"lastUsedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]},"status":{"type":"string","enum":["active","expired","revoked"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","prefix","start","scopes","capabilityTier","dataSensitivityTier","workspaceIds","workspaceMode","createdByUserId","rateLimitEnabled","rateLimitMax","rateLimitTimeWindow","remaining","lastUsedAt","expiresAt","revokedAt","status","createdAt","updatedAt"]},"key":{"type":"string"},"examples":{"type":"object","properties":{"xApiKey":{"type":"string"},"authorization":{"type":"string"},"workspace":{"type":"string"},"idempotentWrite":{"type":"string"}},"required":["xApiKey","authorization","workspace","idempotentWrite"]}},"required":["apiKey","key","examples"]},"DeveloperApiKeyCreate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"scopes":{"type":"array","items":{"type":"string","enum":["leads:read","leads:write","conversations:read","conversations:write","analytics:read","bookings:read","bookings:write","call_events:read","call_events:write","review_queue:read","review_queue:write","voice:read","cadences:write","reports:read","coach:read","usage:read","safety:read","channels:read","channels:write","insights:write","learning:read","learning:write","knowledge:read","knowledge:write","memory:read","memory:write","broadcasts:read","broadcasts:write","campaigns:read","campaigns:write","webhooks:read","webhooks:write","integrations:read","integrations:write"]},"minItems":1},"workspaceMode":{"type":"string","enum":["current","selected","all"],"default":"current"},"workspaceIds":{"type":"array","items":{"type":"string","format":"uuid"},"default":[]},"expiresInDays":{"type":["integer","null"],"exclusiveMinimum":0,"maximum":365},"rateLimitMax":{"type":"integer","exclusiveMinimum":0,"maximum":10000},"capabilityTier":{"type":"string","enum":["read","draft","queue_ops","full"]},"dataSensitivityTier":{"type":"string","enum":["redacted","full_content"]}},"required":["name","scopes"]},"DeveloperApiKey":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":["string","null"]},"prefix":{"type":["string","null"]},"start":{"type":["string","null"]},"scopes":{"type":"array","items":{"type":"string","enum":["leads:read","leads:write","conversations:read","conversations:write","analytics:read","bookings:read","bookings:write","call_events:read","call_events:write","review_queue:read","review_queue:write","voice:read","cadences:write","reports:read","coach:read","usage:read","safety:read","channels:read","channels:write","insights:write","learning:read","learning:write","knowledge:read","knowledge:write","memory:read","memory:write","broadcasts:read","broadcasts:write","campaigns:read","campaigns:write","webhooks:read","webhooks:write","integrations:read","integrations:write"]}},"capabilityTier":{"type":"string","enum":["read","draft","queue_ops","full"]},"dataSensitivityTier":{"type":"string","enum":["redacted","full_content"]},"workspaceIds":{"type":"array","items":{"type":"string","format":"uuid"}},"workspaceMode":{"type":"string","enum":["current","selected","all"]},"createdByUserId":{"type":["string","null"]},"rateLimitEnabled":{"type":"boolean"},"rateLimitMax":{"type":["integer","null"]},"rateLimitTimeWindow":{"type":["integer","null"]},"remaining":{"type":["integer","null"]},"lastUsedAt":{"type":["string","null"]},"expiresAt":{"type":["string","null"]},"revokedAt":{"type":["string","null"]},"status":{"type":"string","enum":["active","expired","revoked"]},"createdAt":{"type":"string"},"updatedAt":{"type":"string"}},"required":["id","name","prefix","start","scopes","capabilityTier","dataSensitivityTier","workspaceIds","workspaceMode","createdByUserId","rateLimitEnabled","rateLimitMax","rateLimitTimeWindow","remaining","lastUsedAt","expiresAt","revokedAt","status","createdAt","updatedAt"]},"DeveloperApiKeyUpdate":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"scopes":{"type":"array","items":{"type":"string","enum":["leads:read","leads:write","conversations:read","conversations:write","analytics:read","bookings:read","bookings:write","call_events:read","call_events:write","review_queue:read","review_queue:write","voice:read","cadences:write","reports:read","coach:read","usage:read","safety:read","channels:read","channels:write","insights:write","learning:read","learning:write","knowledge:read","knowledge:write","memory:read","memory:write","broadcasts:read","broadcasts:write","campaigns:read","campaigns:write","webhooks:read","webhooks:write","integrations:read","integrations:write"]},"minItems":1},"workspaceMode":{"type":"string","enum":["current","selected","all"]},"workspaceIds":{"type":"array","items":{"type":"string","format":"uuid"}},"expiresInDays":{"type":["integer","null"],"exclusiveMinimum":0,"maximum":365},"rateLimitMax":{"type":"integer","exclusiveMinimum":0,"maximum":10000},"capabilityTier":{"type":"string","enum":["read","draft","queue_ops","full"]},"dataSensitivityTier":{"type":"string","enum":["redacted","full_content"]}}},"AutoSendResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"enabled":{"type":"boolean"}},"required":["ok","enabled"]},"AutoSendPatch":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]},"ToolBeltResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"enabled":{"type":"boolean"}},"required":["ok","enabled"]},"ToolBeltPatch":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]},"MultiPartDraftsResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"enabled":{"type":"boolean"}},"required":["ok","enabled"]},"MultiPartDraftsPatch":{"type":"object","properties":{"enabled":{"type":"boolean"}},"required":["enabled"]},"VoiceSettingsResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"toneSlider":{"type":["integer","null"]},"version":{"type":"integer"}},"required":["ok","toneSlider"]},"VoicePatch":{"type":"object","properties":{"toneSlider":{"type":"integer","minimum":0,"maximum":100},"bumpFingerprint":{"type":"boolean"}}},"ObjectionImportResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]},"requested":{"type":"boolean","enum":[true]},"conversationCount":{"type":"integer"}},"required":["ok","requested","conversationCount"]},"ObjectionImportRequest":{"type":"object","properties":{"source":{"type":"string","enum":["csv_upload","paste"]},"conversations":{"type":"array","items":{"type":"object","properties":{"leadMessage":{"type":"string","minLength":1,"maxLength":1000},"coachResponse":{"type":"string","minLength":1,"maxLength":1000},"leadFollowUp":{"type":"string","maxLength":1000}},"required":["leadMessage","coachResponse"]},"minItems":1,"maxItems":100}},"required":["source","conversations"]},"ImportedObjectionPatternListResponse":{"type":"object","properties":{"patterns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"objectionType":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"pattern":{"type":"string"},"sampleResponse":{"type":"string"},"confidence":{"type":"number"},"sourceCount":{"type":"integer"},"adopted":{"type":"boolean"}},"required":["id","objectionType","pattern","sampleResponse","confidence","sourceCount","adopted"]}}},"required":["patterns"]},"ImportedObjectionPatternAdoptResponse":{"type":"object","properties":{"pattern":{"type":"object","properties":{"id":{"type":"string"},"objectionType":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"pattern":{"type":"string"},"sampleResponse":{"type":"string"},"confidence":{"type":"number"},"sourceCount":{"type":"integer"},"adopted":{"type":"boolean"}},"required":["id","objectionType","pattern","sampleResponse","confidence","sourceCount","adopted"]}},"required":["pattern"]},"ImportedObjectionPatternDeleteResponse":{"type":"object","properties":{"ok":{"type":"boolean","enum":[true]}},"required":["ok"]},"MembersResponse":{"type":"object","properties":{"members":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","admin","manager","operator","analyst","viewer"]},"permissionOverrides":{"type":["object","null"],"properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}},"joinedAt":{"type":"string"},"capabilities":{"type":"object","properties":{"updateRole":{"type":"boolean"},"remove":{"type":"boolean"}},"required":["updateRole","remove"]}},"required":["id","userId","email","name","role","permissionOverrides","joinedAt","capabilities"]}},"invitations":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["admin","manager","operator","analyst","viewer"]},"status":{"type":"string","enum":["pending"]},"expiresAt":{"type":["string","null"]},"permissionOverrides":{"type":["object","null"],"properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}},"createdAt":{"type":"string"},"capabilities":{"type":"object","properties":{"resend":{"type":"boolean"},"revoke":{"type":"boolean"}},"required":["resend","revoke"]}},"required":["id","email","role","status","expiresAt","permissionOverrides","createdAt","capabilities"]}},"callerRole":{"type":"string","enum":["owner","admin","manager","operator","analyst","viewer"]},"maxMembers":{"type":"number"},"memberCount":{"type":"number"},"capabilities":{"type":"object","properties":{"invite":{"type":"boolean"},"grantablePermissions":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}},"required":["invite","grantablePermissions"]}},"required":["members","invitations","callerRole","maxMembers","memberCount","capabilities"]},"InviteMemberResponse":{"type":"object","properties":{"invitation":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string"},"role":{"type":"string","enum":["admin","manager","operator","analyst","viewer"]},"status":{"type":"string","enum":["pending"]},"expiresAt":{"type":["string","null"]},"permissionOverrides":{"type":["object","null"],"properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}},"createdAt":{"type":"string"},"capabilities":{"type":"object","properties":{"resend":{"type":"boolean"},"revoke":{"type":"boolean"}},"required":["resend","revoke"]}},"required":["id","email","role","status","expiresAt","permissionOverrides","createdAt","capabilities"]}},"required":["invitation"]},"InviteMemberBody":{"type":"object","properties":{"email":{"type":"string","format":"email"},"role":{"type":"string","enum":["admin","manager","operator","analyst","viewer"]},"permissionOverrides":{"type":"object","properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}}},"required":["email","role"]},"UpdateMemberResponse":{"type":"object","properties":{"member":{"type":"object","properties":{"id":{"type":"string"},"userId":{"type":"string"},"email":{"type":"string"},"name":{"type":"string"},"role":{"type":"string","enum":["owner","admin","manager","operator","analyst","viewer"]},"permissionOverrides":{"type":["object","null"],"properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}},"joinedAt":{"type":"string"},"capabilities":{"type":"object","properties":{"updateRole":{"type":"boolean"},"remove":{"type":"boolean"}},"required":["updateRole","remove"]}},"required":["id","userId","email","name","role","permissionOverrides","joinedAt","capabilities"]}},"required":["member"]},"UpdateMemberBody":{"type":"object","properties":{"role":{"type":"string","enum":["admin","manager","operator","analyst","viewer"]},"permissionOverrides":{"type":"object","properties":{"allow":{"type":"array","items":{"type":"string","enum":["campaign:read","campaign:create","campaign:update_draft","campaign:publish","campaign:pause","campaign:archive","ab_test:manage","broadcast:read","broadcast:create","broadcast:preview","broadcast:launch","broadcast:pause","broadcast:cancel","message:read","message:draft","message:approve","message:send","lead:read","lead:create","lead:update","lead:delete","channel:read","channel:connect","channel:update","channel:disconnect","api_key:read","api_key:create","api_key:revoke","member:read","member:invite","member:update_role","member:remove","analytics:read","coach_profile:read","coach_profile:update","billing:read","billing:manage","settings:manage","profile:manage","integrations:manage","memory:manage","knowledge:manage","copilot:use","sales:manage","voice:manage","teach:manage","usage:read","insights:read","insights:write","reports:read"]}}}}}},"AcceptInvitationResponse":{"type":"object","properties":{"workspaceId":{"type":"string"},"workspaceName":{"type":"string"},"organizationId":{"type":"string"}},"required":["workspaceId","workspaceName","organizationId"]},"ErrorEnvelope":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"requestId":{"type":"string"},"details":{}},"required":["code","message","requestId"]}},"required":["error"],"title":"ErrorEnvelope","description":"The response body of every failure, on every status. Branch on `error.code`; `error.message` is written for a human and can change. Quote `error.requestId` in a support ticket."}},"parameters":{"LucaApiVersion":{"name":"Luca-API-Version","in":"header","required":false,"description":"The major version of the API this client was built against. Omit it and the request is served by the current major version. Any other value is refused with 400 `unsupported_api_version`.","schema":{"type":"string","enum":["1"]}}},"securitySchemes":{"sessionCookie":{"type":"apiKey","in":"cookie","name":"luca.session_token","description":"Better Auth session cookie, set by signing in to the dashboard. Shared across app and API on a common parent domain. Every endpoint accepts it."},"apiKey":{"type":"apiKey","in":"header","name":"x-api-key","description":"Organization API key. Reaches only allowlisted endpoints, and only within the scopes granted to the key."},"bearerAuth":{"type":"http","scheme":"bearer","description":"The same organization API key sent as `Authorization: Bearer <key>`, for clients that cannot set a custom header."}}},"security":[{"sessionCookie":[]}],"paths":{"/api/conversations/search":{"get":{"tags":["Conversations"],"summary":"Search message text across the coach's conversations","description":"Case-insensitive text search over inbound and outbound message bodies, newest first, with the lead's display name. At most 10 hits.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"q","in":"query","description":"Free-text search term."},{"schema":{"type":"string","minLength":1,"maxLength":40},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"integer","minimum":1,"maximum":365},"required":false,"name":"sinceDays","in":"query","description":"The `sinceDays` this operation targets."},{"schema":{"type":"integer","minimum":1,"maximum":10,"default":10},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSearchResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getConversationsSearch"}},"/api/memory/recall":{"get":{"tags":["Memory"],"summary":"Recall the coach-level facts that match a question","description":"Ranked search over the coach's active coach-level facts. Only a manual fact or a promoted pipeline fact is returned, so a model-extracted candidate never becomes trusted prompt input.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"q","in":"query","description":"Free-text search term."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotRecallResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getMemoryRecall"}},"/api/leads/{id}/best-send-time":{"get":{"tags":["Leads"],"summary":"Suggest the hour a lead is most likely to reply","description":"The UTC hour with the most inbound messages from this lead, with the sample size and a confidence label. With no inbound history there is no suggestion.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadBestSendTimeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getLeadsByIdBestSendTime"}},"/api/leads/count":{"get":{"tags":["Leads"],"summary":"Count the coach's leads","description":"The number of leads, optionally for one channel and created since a timestamp.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":40},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query","description":"Return only records changed at or after this point."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadsCountResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getLeadsCount"}},"/api/analytics/top-leads":{"get":{"tags":["Analytics"],"summary":"List the highest-scoring leads","description":"Leads ordered by score, then by last activity, optionally only those seen since a timestamp.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100,"default":25},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query","description":"Return only records changed at or after this point."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopLeadsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getAnalyticsTopLeads"}},"/api/analytics/funnel-insights":{"get":{"tags":["Analytics"],"summary":"Get call outcomes and objections for a window","description":"Won, lost and not-a-fit call outcomes per channel, plus how often each objection came up, over a rolling window (30 days by default, 1 to 90 allowed).\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":40},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"integer","minimum":1,"maximum":90,"default":30},"required":false,"name":"windowDays","in":"query","description":"Size of the lookback window, in days."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FunnelInsightsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getAnalyticsFunnelInsights"}},"/api/voice/signals":{"get":{"tags":["Voice"],"summary":"Get how the coach reviewed Luca's drafts lately","description":"Counts of approved, edited and rejected drafts over the last 30 days, the average edit distance of the edited ones, and the five newest voice samples.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceSignalsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getVoiceSignals","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/voice/edit-distance":{"get":{"tags":["Voice"],"summary":"Get the spread of the coach's edits to Luca's drafts","description":"Average, median and 90th-percentile edit distance over the edited drafts in the window. With no edited drafts the distances are null, never zero.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":365,"default":30},"required":false,"name":"days","in":"query","description":"The `days` this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceEditDistanceResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getVoiceEditDistance"}},"/api/voice/heavy-edits":{"get":{"tags":["Voice"],"summary":"List the drafts the coach rewrote the most","description":"Edited drafts whose edit distance reaches the minimum, largest first.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"integer","minimum":1,"default":40},"required":false,"name":"minDistance","in":"query","description":"The `minDistance` this operation targets."},{"schema":{"type":"integer","minimum":1,"maximum":50,"default":10},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceHeavyEditsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getVoiceHeavyEdits"}},"/api/bookings/capabilities":{"get":{"tags":["Bookings"],"summary":"Get what the booking provider can do","description":"What each booking operation does through the coach's provider, direct, by handoff or not at all, and which booking fields can be edited. Without a booking id, the answer lists every provider. With one, it lists only that booking's provider, or nothing when Luca does not manage that provider.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"bookingId","in":"query","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCapabilitiesResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getBookingsCapabilities"}},"/api/replies/rewrite":{"post":{"tags":["Review queue"],"summary":"Rewrite a queued draft","description":"Runs one drafter call that rewrites the queued draft per the instruction and returns the new text. It spends AI credits, and it changes nothing: the review queue row keeps its body until the coach applies the proposal.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyRewriteRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReplyRewriteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postRepliesRewrite","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/ab-tests":{"get":{"tags":["A/B tests"],"summary":"List the coach's A/B tests","description":"Every test this coach has, newest first. Filter by status. Variant config comes back as stored, since its shape depends on what the test compares.\n\n**API key scopes:** `learning:read`.","parameters":[{"schema":{"type":"string","enum":["draft","running","paused","completed","archived"]},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbTestListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["learning:read"]},{"bearerAuth":["learning:read"]}],"operationId":"getAbTests"},"post":{"tags":["A/B tests"],"summary":"Create a sales-framework A/B test","description":"Sets up a head-to-head between two sales frameworks. It starts as a draft unless you pass `start: true`. Only one framework test can run at a time. A framework test matches every lead, so a second one would split the same traffic twice and starve both. You'll get a 409 if one's already running.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAbTestRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbTest"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postAbTests","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/ab-tests/objection":{"post":{"tags":["A/B tests"],"summary":"Create an objection-strategy A/B test","description":"Compares two ways of answering one objection bucket, like price or timing. It starts as a draft unless you pass `start: true`. Buckets are independent, so tests on different buckets run side by side. A second test on the same bucket returns 409.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateObjectionAbTestRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbTest"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postAbTestsObjection","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/ab-tests/{id}":{"get":{"tags":["A/B tests"],"summary":"Get an A/B test with per-variant stats","description":"One test with its per-variant numbers: how many leads each arm saw, and how each is doing against the success metric.\n\n**API key scopes:** `learning:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the A/B test this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbTestDetail"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["learning:read"]},{"bearerAuth":["learning:read"]}],"operationId":"getAbTestsById"}},"/api/ab-tests/{id}/start":{"post":{"tags":["A/B tests"],"summary":"Start an A/B test","description":"Puts a draft or paused test into live lead assignment. Any other status returns 409, and so does a conflicting test that's already running.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the A/B test this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbTest"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postAbTestsByIdStart"}},"/api/ab-tests/{id}/pause":{"post":{"tags":["A/B tests"],"summary":"Pause an A/B test","description":"Stops assigning new leads and keeps the results so far. Only a running test can pause. Start it again later and it picks up where it left off.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the A/B test this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbTest"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postAbTestsByIdPause"}},"/api/ab-tests/{id}/stop":{"post":{"tags":["A/B tests"],"summary":"Stop an A/B test","description":"Ends the test for good and records the winner. A completed test can't go back to running, so a finished result can't be reopened and re-decided.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the A/B test this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AbTest"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postAbTestsByIdStop"}},"/api/ab-tests/{id}/adopt":{"post":{"tags":["A/B tests"],"summary":"Adopt a completed A/B test's winning framework","description":"Switches the coach onto the winning framework. It's a no-op that returns `adopted: false` unless the test is completed and its winner points at a real framework.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the A/B test this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdoptAbTestResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postAbTestsByIdAdopt"}},"/api/framework-performance":{"get":{"tags":["Learning"],"summary":"Get the coach's framework objection-performance snapshot","description":"Win rate by objection bucket for the sales framework the coach has configured right now, over a rolling window (30 days by default, 1 to 90 allowed). These numbers are correlational, so read them as a signal and not as proof.\n\n**API key scopes:** `learning:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":90,"default":30},"required":false,"name":"windowDays","in":"query","description":"Size of the lookback window, in days."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FrameworkPerformanceResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["learning:read"]},{"bearerAuth":["learning:read"]}],"operationId":"getFrameworkPerformance"}},"/api/learning-proposals":{"get":{"tags":["Learning"],"summary":"List the coach's learning proposals","description":"What the A/B tests have learned and are proposing you act on. It defaults to the ab_test.* event types over the last 30 days, newest first, and leaves out dismissed proposals unless you pass `activeOnly=false`.\n\n**API key scopes:** `learning:read`.","parameters":[{"schema":{"type":"string","minLength":1},"required":false,"name":"eventTypes","in":"query","description":"Comma-separated list of event types to include."},{"schema":{"type":"string","enum":["true","false"],"default":"true"},"required":false,"name":"activeOnly","in":"query","description":"Return only records that are still active."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearningProposalsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["learning:read"]},{"bearerAuth":["learning:read"]}],"operationId":"getLearningProposals"}},"/api/learning-proposals/{id}/dismiss":{"post":{"tags":["Learning"],"summary":"Dismiss a learning proposal","description":"Dismisses one proposal so it drops out of the default list. You'll get a 404 when the analytics event doesn't exist, or belongs to another coach.\n\n**API key scopes:** `learning:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the learning proposal this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissLearningProposalResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["learning:write"]},{"bearerAuth":["learning:write"]}],"operationId":"postLearningProposalsByIdDismiss"}},"/api/coaches/me":{"get":{"tags":["Coach profile"],"summary":"Read the current coach profile","description":"The dashboard's first read on every page load. It returns identity, timezone and business hours, the tone slider, legacy workspace defaults, plan tier and status, and whether onboarding is finished. Read per-channel AI DM auto-send from /api/channels. Integrations report connection status only. Provider tokens never leave the server.\n\n**API key scopes:** `coach:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachProfileResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getCoachesMe","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"patch":{"tags":["Coach profile"],"summary":"Update name, timezone, business hours, or tone slider","description":"Updates only the fields you send. Sending `businessHours` sets its `tz` as the coach's timezone too, so the two can't ever disagree.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachProfilePatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachProfileUpdateResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchCoachesMe","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/niche-profile":{"get":{"tags":["Coach profile"],"summary":"Read the coach's niche & offer profile","description":"The coach-authored context the drafter compiles into its prompt: niche, audience, offer, pricing, and FAQs. It's what lets a reply answer an offer question instead of guessing. The response includes `profileUpdatedAt` for full-form compare-and-set saves. You get `null` before the coach has filled it in.\n\n**API key scopes:** `coach:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":["object","null"],"properties":{"niche":{"type":"string","maxLength":200,"default":""},"audience":{"type":"string","maxLength":400,"default":""},"offer":{"type":"string","maxLength":600,"default":""},"priceRange":{"type":"string","maxLength":120},"outcomes":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"disqualifiers":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"faqs":{"type":"array","items":{"type":"object","properties":{"q":{"type":"string","minLength":1,"maxLength":200},"a":{"type":"string","minLength":1,"maxLength":600}},"required":["q","a"]},"maxItems":20},"callToAction":{"type":"string","maxLength":120,"default":""},"bookingUrl":{"type":["string","null"],"maxLength":500,"format":"uri"},"callMinutes":{"type":["integer","null"],"minimum":5,"maximum":240},"sensitivity":{"type":"string","enum":["standard","health","emotional","income"]},"offers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","minLength":1,"maxLength":600},"price":{"type":"string","maxLength":120},"paymentPlans":{"type":"array","items":{"type":"string","maxLength":120},"maxItems":6},"format":{"type":"string","maxLength":200},"duration":{"type":"string","maxLength":120},"amount":{"type":"number","exclusiveMinimum":0,"maximum":1000000},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"weeks":{"type":"integer","minimum":1,"maximum":260},"included":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12}},"required":["name","description"]},"maxItems":6},"testimonials":{"type":"array","items":{"type":"object","properties":{"quote":{"type":"string","minLength":1,"maxLength":400},"attribution":{"type":"string","maxLength":200}},"required":["quote"]},"maxItems":8},"guarantees":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":4},"objections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string","minLength":1,"maxLength":200},"response":{"type":"string","minLength":1,"maxLength":600}},"required":["objection","response"]},"maxItems":3},"toneBoundaries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5},"sellFramework":{"type":"object","properties":{"id":{"type":"string","enum":["sandler","spin","challenger","nepq","gap","straight_line","consultative","solution","value","inbound","custom"]},"overrides":{"type":"array","items":{"type":"object","properties":{"stageName":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","maxLength":300},"drafterRules":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":12},"disallow":{"type":"array","items":{"type":"string","maxLength":60},"maxItems":8},"nextStageTrigger":{"type":"string","maxLength":300}},"required":["stageName"]},"maxItems":20},"customStages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","minLength":1,"maxLength":300},"signals":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":12,"default":[]},"drafterRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]},"nextStageTrigger":{"type":"string","minLength":1,"maxLength":300},"disallow":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":8}},"required":["name","goal","nextStageTrigger"]},"maxItems":20},"customGuidance":{"type":"string","maxLength":2000},"objectionPriorityOverride":{"type":"array","items":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"maxItems":6}},"required":["id"]},"languages":{"type":"array","items":{"type":"string","enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th"]},"maxItems":16},"defaultLanguage":{"type":["string","null"],"enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th",null]},"profileUpdatedAt":{"type":"string","format":"date-time"}},"required":["profileUpdatedAt"]}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getCoachesNicheProfile","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Coach profile"],"summary":"Replace the coach's niche & offer profile","description":"A full replacement, not a patch. Send the whole profile back, or the missing fields get cleared. The sales framework has its own endpoint, so the two editors can't overwrite each other. Include `expectedUpdatedAt` from GET when saving a previously loaded form; the server returns 409 if another write landed first.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachNicheProfileUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachProfile"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putCoachesNicheProfile","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/niche":{"get":{"tags":["Coach profile"],"summary":"Read the coach's canonical niche (benchmark cohort key)","description":"The fixed-taxonomy cohort key that decides which coaches this one is benchmarked against. It's not the free-text `niche` on the niche and offer profile, which describes the business instead of naming a cohort.\n\n**API key scopes:** `coach:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachNicheSetting"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getCoachesNiche","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Coach profile"],"summary":"Set the coach's canonical niche (benchmark cohort key)","description":"Sets the benchmark cohort key. Send `null` to leave the cohort, which drops the coach out of niche benchmark comparisons.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachNicheSetting"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CoachNicheSetting"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putCoachesNiche","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/sell-framework":{"put":{"tags":["Coach profile"],"summary":"Set (or clear) the coach's sales framework","description":"Sets the sales methodology the drafter follows, either a built-in framework or a custom one. Send `null` to clear it. It writes only the framework slice of the profile, so it never clobbers an edit made on the business tab.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SellFrameworkUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":["object","null"],"properties":{"niche":{"type":"string","maxLength":200,"default":""},"audience":{"type":"string","maxLength":400,"default":""},"offer":{"type":"string","maxLength":600,"default":""},"priceRange":{"type":"string","maxLength":120},"outcomes":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"disqualifiers":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"faqs":{"type":"array","items":{"type":"object","properties":{"q":{"type":"string","minLength":1,"maxLength":200},"a":{"type":"string","minLength":1,"maxLength":600}},"required":["q","a"]},"maxItems":20},"callToAction":{"type":"string","maxLength":120,"default":""},"bookingUrl":{"type":["string","null"],"maxLength":500,"format":"uri"},"callMinutes":{"type":["integer","null"],"minimum":5,"maximum":240},"sensitivity":{"type":"string","enum":["standard","health","emotional","income"]},"offers":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":120},"description":{"type":"string","minLength":1,"maxLength":600},"price":{"type":"string","maxLength":120},"paymentPlans":{"type":"array","items":{"type":"string","maxLength":120},"maxItems":6},"format":{"type":"string","maxLength":200},"duration":{"type":"string","maxLength":120},"amount":{"type":"number","exclusiveMinimum":0,"maximum":1000000},"currency":{"type":"string","pattern":"^[A-Z]{3}$"},"weeks":{"type":"integer","minimum":1,"maximum":260},"included":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12}},"required":["name","description"]},"maxItems":6},"testimonials":{"type":"array","items":{"type":"object","properties":{"quote":{"type":"string","minLength":1,"maxLength":400},"attribution":{"type":"string","maxLength":200}},"required":["quote"]},"maxItems":8},"guarantees":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":4},"objections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string","minLength":1,"maxLength":200},"response":{"type":"string","minLength":1,"maxLength":600}},"required":["objection","response"]},"maxItems":3},"toneBoundaries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":5},"sellFramework":{"type":"object","properties":{"id":{"type":"string","enum":["sandler","spin","challenger","nepq","gap","straight_line","consultative","solution","value","inbound","custom"]},"overrides":{"type":"array","items":{"type":"object","properties":{"stageName":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","maxLength":300},"drafterRules":{"type":"array","items":{"type":"string","maxLength":300},"maxItems":12},"disallow":{"type":"array","items":{"type":"string","maxLength":60},"maxItems":8},"nextStageTrigger":{"type":"string","maxLength":300}},"required":["stageName"]},"maxItems":20},"customStages":{"type":"array","items":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":60},"goal":{"type":"string","minLength":1,"maxLength":300},"signals":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"maxItems":12,"default":[]},"drafterRules":{"type":"array","items":{"type":"string","minLength":1,"maxLength":300},"maxItems":12,"default":[]},"nextStageTrigger":{"type":"string","minLength":1,"maxLength":300},"disallow":{"type":"array","items":{"type":"string","minLength":1,"maxLength":60},"maxItems":8}},"required":["name","goal","nextStageTrigger"]},"maxItems":20},"customGuidance":{"type":"string","maxLength":2000},"objectionPriorityOverride":{"type":"array","items":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"maxItems":6}},"required":["id"]},"languages":{"type":"array","items":{"type":"string","enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th"]},"maxItems":16},"defaultLanguage":{"type":["string","null"],"enum":["en","es","pt-BR","fr","de","it","nl","hi","ja","ko","zh-CN","ar","tr","vi","pl","th",null]}}}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putCoachesSellFramework","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/niche-profile/extract-framework":{"post":{"tags":["Coach profile"],"summary":"Parse a coach's free-text sales-process description into a candidate custom framework for preview","description":"Turns a coach's description of how they sell into candidate framework stages you can preview. Nothing is saved. The coach confirms in the UI, which then calls the sell-framework endpoint. If fewer than two usable stages come back you get `ok: false` with a message, and the coach keeps their current framework.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractFrameworkRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractFrameworkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"payment required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCoachesNicheProfileExtractFramework","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/objection-playbook":{"get":{"tags":["Coach profile"],"summary":"Read the coach's objection playbook","description":"How the drafter should handle each objection bucket (price, timing, trust, fit, authority, smokescreen), plus the social proof it may cite. You get `null` before the coach has written one.\n\n**API key scopes:** `coach:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"type":["object","null"],"properties":{"overrides":{"type":"object","properties":{"price":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"timing":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"trust":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"fit":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"authority":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}},"smokescreen":{"type":"object","properties":{"mode":{"type":"string","enum":["default","custom"],"default":"default"},"customStrategy":{"type":"string","maxLength":600},"lastChangedAt":{"type":"string"}}}},"default":{}},"socialProofSources":{"type":"array","items":{"type":"string","maxLength":200},"maxItems":12,"default":[]},"importedPatterns":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"objectionType":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"pattern":{"type":"string","maxLength":400},"sampleResponse":{"type":"string","maxLength":600},"confidence":{"type":"number","minimum":0,"maximum":1},"sourceCount":{"type":"integer","minimum":0},"adopted":{"type":"boolean","default":false}},"required":["id","objectionType","pattern","sampleResponse","confidence","sourceCount"]},"maxItems":60,"default":[]}}}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getCoachesObjectionPlaybook","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Coach profile"],"summary":"Replace the coach's objection playbook","description":"Replaces the coach-written half of the playbook: overrides and social proof sources. Patterns learned from imported conversations are kept, so saving this form can't wipe an import that landed after the page loaded. You'll get a 409 if the playbook changed underneath you.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ObjectionPlaybook"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ObjectionPlaybook"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putCoachesObjectionPlaybook","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/post-call-settings":{"get":{"tags":["Coach profile"],"summary":"Read the coach's post-call preferences","description":"What happens after a call ends: reminders, automatic summaries, CRM sync, and how much detail to include. Unset fields come back as their defaults instead of nulls.\n\n**API key scopes:** `coach:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallSettings"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getCoachesPostCallSettings","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Coach profile"],"summary":"Update the coach's post-call preferences","description":"Replaces the post-call preferences. The response is the resolved settings, defaults included, so it matches what the pipeline will actually read.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallSettings"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallSettings"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putCoachesPostCallSettings","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/post-call-crm-mapping":{"get":{"tags":["Coach profile"],"summary":"Read the coach's post-call CRM field mapping","description":"Which Luca call fields land in which CRM fields, plus a `connected` flag telling you whether a CRM is hooked up at all. You can read the mapping before connecting a CRM.\n\n**API key scopes:** `coach:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallCrmMappingRead"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getCoachesPostCallCrmMapping","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Coach profile"],"summary":"Update the coach's post-call CRM field mapping","description":"Saves the field mapping. You'll get a 404 with `crm_not_connected` when there's no CRM to map into, so connect one first.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallCrmMapping"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallCrmMapping"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putCoachesPostCallCrmMapping","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/coaches/post-call-deal-sync":{"get":{"tags":["Coach profile"],"summary":"Read the coach's post-call CRM deal-stage sync config","description":"Which CRM deal stage each call outcome should move a deal to, plus a `connected` flag for whether a CRM is hooked up.\n\n**API key scopes:** `coach:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallDealSyncRead"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getCoachesPostCallDealSync","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Coach profile"],"summary":"Update the coach's post-call CRM deal-stage sync config","description":"Saves the outcome-to-deal-stage mapping. You'll get a 404 with `crm_not_connected` when no CRM is connected.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallDealSync"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PostCallDealSync"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putCoachesPostCallDealSync","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/analytics/call-intelligence":{"get":{"tags":["Analytics"],"summary":"Post-call intelligence: show rate, ratings, day-of-week, surprises","description":"Post-call patterns over a window: show rate, ratings, day-of-week effects, and the surprises worth a look.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","format":"date-time"},"required":false,"name":"start","in":"query","description":"Start of the time range, inclusive."},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"end","in":"query","description":"End of the time range, exclusive."},{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallIntelligenceResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsCallIntelligence"}},"/api/analytics/call-intelligence/calls":{"get":{"tags":["Analytics"],"summary":"Recent post-call summaries, most recent first","description":"The latest post-call summaries, most recent first.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":50},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecentCallSummariesResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsCallIntelligenceCalls"}},"/api/analytics/learning-insights":{"get":{"tags":["Analytics"],"summary":"Read-only rollup of agent-improvement signals from call feedback","description":"What call feedback suggests about improving the agents. It's read-only. Adopting a change happens under Learning.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","format":"date-time"},"required":false,"name":"start","in":"query","description":"Start of the time range, inclusive."},{"schema":{"type":"string","format":"date-time"},"required":false,"name":"end","in":"query","description":"End of the time range, exclusive."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearningInsightsResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsLearningInsights"}},"/api/analytics/crm-sync-health":{"get":{"tags":["Analytics"],"summary":"Aggregate CRM-sync health for the coach's call summaries","description":"How reliably call summaries are reaching the CRM, totalled across connections.\n\n**API key scopes:** `analytics:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSyncHealthResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsCrmSyncHealth","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/analytics/context":{"get":{"tags":["Analytics"],"summary":"Read safe PostHog analytics context","description":"The analytics context the app hands to PostHog. It holds identifiers that are safe to send to a third party, and nothing tenant-sensitive.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsContextResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getAnalyticsContext","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/analytics/funnel":{"get":{"tags":["Analytics"],"summary":"Read the coach's lead funnel for a period","description":"Lead counts at each funnel stage over a period. It's the shape most of the other analytics endpoints drill into.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsFunnelResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsFunnel"}},"/api/analytics/revenue":{"get":{"tags":["Analytics"],"summary":"Read the coach's AI-attributed revenue and plan ROI for a period","description":"Revenue attributed to Luca over a period, sat next to what the plan costs, as a return figure.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsRevenueResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsRevenue"}},"/api/analytics/speed-impact":{"get":{"tags":["Analytics"],"summary":"Read fast-vs-slow first-reply booking-rate impact for a period","description":"Booking rate on fast first replies against slow ones. It's the argument for keeping the review queue short.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsSpeedImpactResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsSpeedImpact"}},"/api/analytics/forecast":{"get":{"tags":["Analytics"],"summary":"Read a point-in-time pipeline revenue forecast","description":"A pipeline revenue forecast built from the leads and bookings that are open right now. It's a snapshot, not a series.\n\n**API key scopes:** `analytics:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsForecastResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsForecast","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/analytics/ghosted-leads":{"get":{"tags":["Analytics"],"summary":"Read ghosted-lead counts, recovery rate, and top conversation killers","description":"How many leads went quiet, how many came back, and the conversation patterns that usually show up right before a ghost.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsGhostedLeadsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsGhostedLeads"}},"/api/analytics/trust-score":{"get":{"tags":["Analytics"],"summary":"Read draft approval/edit/rejection rates and auto-send gate state","description":"How often the coach approves, edits, or rejects drafts, and where that leaves the auto-send gate. This is the number that decides whether auto-send can go on at all.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsTrustScoreResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsTrustScore"}},"/api/analytics/trends":{"get":{"tags":["Analytics"],"summary":"Read the coach's weekly metrics as a trend series","description":"The stored weekly rollup as a series. It takes a `weeks` count instead of a date window, because the table behind it is already bucketed by week.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":52,"default":12},"required":false,"name":"weeks","in":"query","description":"Number of weeks the report covers."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsTrendsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsTrends"}},"/api/analytics/lead-score/{leadId}":{"get":{"tags":["Analytics"],"summary":"Score one of the coach's leads against the trained predictive lead-scoring model","description":"Scores one lead against the trained model and shows which factors moved the score.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"leadId","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsLeadScoreResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsLeadScoreByLeadId"}},"/api/analytics/loss-reasons":{"get":{"tags":["Analytics"],"summary":"Read the category breakdown of automatic per-lead loss analyses for a period","description":"Why leads were lost over a period, grouped into categories from the automatic per-lead loss analyses.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsLossReasonsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsLossReasons"}},"/api/analytics/recommendations":{"get":{"tags":["Analytics"],"summary":"Read the coach's active prescriptive recommendations for a week","description":"The recommendations active for a week: what to change, and the evidence behind each one.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","format":"date"},"required":false,"name":"weekStart","in":"query","description":"The Monday of the week to report on."},{"schema":{"type":"string","enum":["true","false"]},"required":false,"name":"includeDismissed","in":"query","description":"Include records the coach has dismissed."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsRecommendationsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsRecommendations"}},"/api/analytics/content-attribution":{"get":{"tags":["Analytics"],"summary":"Read the per-content rollup (leads, qualified, booked, revenue) of attributed touches for a period","description":"Leads, qualified leads, bookings, and revenue traced back to each piece of content over a period.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsContentAttributionResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsContentAttribution"}},"/api/analytics/content-performance":{"get":{"tags":["Analytics"],"summary":"Read the per-post rollup (reach, engagement, leads, bookings, revenue) for a period","description":"Reach, engagement, and what came of it, post by post, over a period.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["this_week","this_month","last_week","last_month","last_30_days"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsContentPerformanceResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsContentPerformance"}},"/api/analytics/topic-performance":{"get":{"tags":["Analytics"],"summary":"Read the per-topic weekly rollup (engagement, leads, bookings, revenue) for a week","description":"The same rollup grouped by topic instead of by post, for one week.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","format":"date"},"required":false,"name":"weekStart","in":"query","description":"The Monday of the week to report on."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsTopicPerformanceResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsTopicPerformance"}},"/api/analytics/benchmarks":{"get":{"tags":["Analytics"],"summary":"Read the coach's cross-coach benchmark percentiles, if any","description":"Where this coach sits against comparable coaches, as percentiles. It stays empty until the coach opts in and there are enough peers to compare against.\n\n**API key scopes:** `analytics:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsBenchmarksResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsBenchmarks","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/analytics/benchmark-consent":{"get":{"tags":["Analytics"],"summary":"Read the coach's cross-coach benchmark opt-in state","description":"Whether the coach has opted into cross-coach benchmarking.\n\n**API key scopes:** `analytics:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenchmarkConsentResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsBenchmarkConsent","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Analytics"],"summary":"Set the coach's cross-coach benchmark opt-in state","description":"Turns benchmarking on or off. Opting out also stops this coach's data feeding anyone else's benchmarks.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenchmarkConsentUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BenchmarkConsentResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putAnalyticsBenchmarkConsent","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/analytics/objections":{"get":{"tags":["Analytics"],"summary":"Read the objection-bucket rollup over the review queue's signals","description":"The objections leads raised, bucketed by type, from the signals the review queue captured.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["7d","30d","90d"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ObjectionAnalyticsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsObjections"}},"/api/analytics/objections/{type}":{"get":{"tags":["Analytics"],"summary":"Read the per-conversation drilldown for one objection bucket","description":"The individual conversations behind one objection bucket, so you can trace a rollup number back to real messages.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["price","timing","trust","fit","authority","smokescreen"]},"required":true,"name":"type","in":"path","description":"The type this operation targets."},{"schema":{"type":"string","enum":["7d","30d","90d"]},"required":false,"name":"period","in":"query","description":"Reporting window the figures cover."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ObjectionDrilldownResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getAnalyticsObjectionsByType"}},"/api/privacy/agreements/history":{"get":{"tags":["Privacy"],"summary":"Read your recorded terms acceptances","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegalAgreementHistory"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"getPrivacyAgreementsHistory","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/privacy/agreements":{"get":{"tags":["Privacy"],"summary":"Read your current terms acceptance","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegalAgreementStatus"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"getPrivacyAgreements","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["Privacy"],"summary":"Accept the published terms for your own account","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegalAcceptanceRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LegalAgreementStatus"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postPrivacyAgreements","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/privacy/advertising":{"get":{"tags":["Privacy"],"summary":"Read your account advertising choice","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvertisingChoice"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"getPrivacyAdvertising","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Privacy"],"summary":"Change your account advertising choice","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvertisingChoiceUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvertisingChoice"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"putPrivacyAdvertising","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/copilot/chats":{"get":{"tags":["Copilot"],"summary":"List recent copilot chats for the session coach","description":"Ask Luca chats for the signed-in coach, newest first, with an optional search over titles. Archived chats are left out.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":120},"required":false,"name":"q","in":"query","description":"Free-text search term."},{"schema":{"type":"string","format":"uuid","description":"The first-message creation identity. Reusing it recovers the same owned chat; GET performs a read-only lookup of that identity."},"required":false,"description":"The first-message creation identity. Reusing it recovers the same owned chat; GET performs a read-only lookup of that identity.","name":"idempotency-key","in":"header"},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotChatListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getCopilotChats"},"post":{"tags":["Copilot"],"summary":"Create a persisted copilot chat after the first user message","description":"Creates the chat once the coach has actually said something, so a panel that's opened and abandoned leaves nothing behind. The title comes from the first message and can be renamed later.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid","description":"The first-message creation identity. Reusing it recovers the same owned chat; GET performs a read-only lookup of that identity."},"required":false,"description":"The first-message creation identity. Reusing it recovers the same owned chat; GET performs a read-only lookup of that identity.","name":"idempotency-key","in":"header"},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotChatCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotChat"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotChats"}},"/api/copilot/chats/{chatId}":{"patch":{"tags":["Copilot"],"summary":"Update copilot chat metadata","description":"Renames a chat. The transcript itself lives in the chat's Durable Object, not here.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"chatId","in":"path","description":"Identifier of the chat this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotChatPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotChat"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchCopilotChatsByChatId"},"delete":{"tags":["Copilot"],"summary":"Archive a copilot chat","description":"Archives the chat so it drops off the list. We keep the record and its transcript.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"chatId","in":"path","description":"Identifier of the chat this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteCopilotChatsByChatId"}},"/api/copilot/chats/{chatId}/token":{"post":{"tags":["Copilot"],"summary":"Mint a Cloudflare Think chat token","description":"Mints a short-lived token, also set as a cookie, that lets the browser talk straight to this chat's agent. It lives for one minute and is bound to one chat, so it can't be reused anywhere else.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"chatId","in":"path","description":"Identifier of the chat this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotChatTokenResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotChatsByChatIdToken"}},"/api/copilot/events":{"post":{"tags":["Copilot"],"summary":"Record safe client-side Copilot telemetry","description":"Forwards Ask Luca interaction telemetry from the browser into structured logs. The schema is an allowlist, which is what keeps chat content from arriving here.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotClientEvent"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotEvents","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/copilot/threads/{threadId}/actions":{"post":{"tags":["Copilot"],"summary":"Stage an action proposal for the coach to approve","description":"Ask Luca's own call. It stores a plan of catalog operations with a card, a diff, and side effects. Nothing runs until the coach confirms. Only a copilot turn on this thread may call it, and a retry within the turn returns the first proposal.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path","description":"Identifier of the thread this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalCreateRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposal"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotThreadsByThreadIdActions"},"get":{"tags":["Copilot"],"summary":"List the action proposals of a thread","description":"Every proposal staged in the thread, newest first.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path","description":"Identifier of the thread this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getCopilotThreadsByThreadIdActions"}},"/api/copilot/threads/{threadId}/actions/{actionId}":{"patch":{"tags":["Copilot"],"summary":"Edit the fields of a staged action proposal","description":"The coach's edits to a proposal card. Send the revision you saw and only the fields that changed. The proposal gets a new revision, so an approval of the older one is refused. You'll get a 409 with `revision_conflict` when the revision is stale.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path","description":"Identifier of the thread this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"actionId","in":"path","description":"Identifier of the action this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalAmendRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalAmendedResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchCopilotThreadsByThreadIdActionsByActionId"},"get":{"tags":["Copilot"],"summary":"Read the durable decision for an owned staged action","description":"Returns the coach's decision without changing the original transcript or dispatching the action.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path","description":"Identifier of the thread this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"actionId","in":"path","description":"Identifier of the action this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotActionStatusResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getCopilotThreadsByThreadIdActionsByActionId"}},"/api/copilot/threads/{threadId}/actions/{actionId}/confirm":{"post":{"tags":["Copilot"],"summary":"Confirm a staged copilot action proposal","description":"The coach's yes to an action Ask Luca staged. A proposed reply approves its review-queue entry and records a durable approval. A proposed rescue activates the rescue state. A plan proposal needs the `revision` the coach saw, and runs each step through its own route as the coach. You'll get a 409 if the proposal was already decided or its revision changed, and a 410 once it expired.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path","description":"Identifier of the thread this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"actionId","in":"path","description":"Identifier of the action this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalDecisionRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalConfirmResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotThreadsByThreadIdActionsByActionIdConfirm"}},"/api/copilot/threads/{threadId}/actions/{actionId}/retry":{"post":{"tags":["Copilot"],"summary":"Retry the steps of a plan proposal that did not succeed","description":"Runs again the steps of a plan proposal that ended short, failed, or stopped showing progress, as the coach who retries. Steps that succeeded stay as they are, and a step whose answer was unclear runs again only on a route with an idempotency key. A run that is still working is left alone. You'll get a 409 if the proposal is waiting for approval, already applied, or closed, or if the `revision` changed, and a 410 once it expired. Send the `revision` the coach saw.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path","description":"Identifier of the thread this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"actionId","in":"path","description":"Identifier of the action this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalRetryRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalRetriedResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotThreadsByThreadIdActionsByActionIdRetry"}},"/api/copilot/threads/{threadId}/actions/{actionId}/discard":{"post":{"tags":["Copilot"],"summary":"Discard a staged copilot action proposal","description":"The coach's no to a staged action. A proposed reply gets rejected in the review queue, a proposed rescue gets cancelled, and a plan proposal is closed without running. A plan proposal that ended short, failed, or stopped showing progress can be closed too; its step results stay on the card. You'll get a 409 if the proposal was already decided.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"threadId","in":"path","description":"Identifier of the thread this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"actionId","in":"path","description":"Identifier of the action this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotProposalDecisionRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotThreadsByThreadIdActionsByActionIdDiscard"}},"/api/copilot/usage":{"get":{"tags":["Copilot"],"summary":"Current-period copilot usage rollup","description":"Ask Luca consumption for the current billing period: included units used, units left in top-up packs, overage units and what they cost, and the overage cap in force. A coach who set their own cap keeps it. The tier default only fills in for someone who never did.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotUsageResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getCopilotUsage","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/copilot/settings":{"patch":{"tags":["Copilot"],"summary":"Update Ask Luca settings","description":"A merge patch of the coach's Ask Luca preferences. Send only what you're changing. Anything you leave out keeps its current value.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CopilotSettingsBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchCopilotSettings","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/copilot/packs/checkout":{"post":{"tags":["Copilot"],"summary":"Start checkout for an Ask Luca usage pack","description":"Opens a Stripe Checkout session for a top-up pack of Ask Luca usage, and returns the URL to send the coach to. The pack is only credited once Stripe reports the payment.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackCheckoutBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackCheckoutResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCopilotPacksCheckout","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/voice":{"get":{"tags":["Voice"],"summary":"List the coach's voice corpus entries","description":"The coach's own writing, which every draft is matched against. This corpus is what makes Luca sound like them.\n\n**API key scopes:** `voice:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["voice:read"]},{"bearerAuth":["voice:read"]}],"operationId":"getVoice","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["Voice"],"summary":"Append a voice corpus entry","description":"Adds one sample of the coach's writing to the corpus. It reaches the drafter at the next fingerprint refresh.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusEntry"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusAddResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postVoice","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/voice/profile":{"get":{"tags":["Voice"],"summary":"Read a non-verbatim summary of the coach's voice fingerprint","description":"A non-verbatim summary of the voice fingerprint: tone, sentence length, habits. It doesn't return the coach's original text. Use this instead of the corpus when you only need to describe the voice.\n\n**API key scopes:** `voice:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceProfileResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["voice:read"]},{"bearerAuth":["voice:read"]}],"operationId":"getVoiceProfile","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/voice/bulk":{"post":{"tags":["Voice"],"summary":"Append multiple voice corpus entries for one channel","description":"Adds many samples for one channel in a single request. This is the usual way to seed a corpus during setup.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusBulkAdd"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusBulkAddResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postVoiceBulk","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/voice/{id}":{"delete":{"tags":["Voice"],"summary":"Remove a voice corpus entry","description":"Removes one corpus entry. Drafts stop drawing on it after the next refresh.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the voice corpus entry this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusDeleteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteVoiceById"},"patch":{"tags":["Voice"],"summary":"Edit a voice sample","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the voice corpus entry this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCorpusUpdateResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"patchVoiceById"}},"/api/voice/refresh":{"post":{"tags":["Voice"],"summary":"Bump the voice fingerprint version","description":"Bumps the fingerprint version, which is what makes corpus edits visible to the drafter.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceFingerprintRefreshResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postVoiceRefresh","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/workspaces":{"get":{"tags":["Workspaces"],"summary":"List every workspace the caller belongs to, regardless of the active workspace header","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WorkspacesResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"getWorkspaces","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["Workspaces"],"summary":"Create or recover the caller's personal workspace","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateWorkspaceResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"workspace creation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postWorkspaces","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/status":{"get":{"tags":["Onboarding"],"summary":"Check onboarding completion gates","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStatusResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"getOnboardingStatus","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/answer":{"post":{"tags":["Onboarding"],"summary":"Save one discovery answer the moment it's given","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingAnswer"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingAnswerResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingAnswer","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/setup":{"post":{"tags":["Onboarding"],"summary":"Save the onboarding setup card, one tap at a time","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingSetup"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingSetupResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingSetup","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/attribution":{"post":{"tags":["Onboarding"],"summary":"Capture signup attribution once, on the first onboarding render","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingAttribution"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingAttributionResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingAttribution","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/step":{"post":{"tags":["Onboarding"],"summary":"Record the furthest wizard step reached, for exact-step resume","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStep"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStepResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingStep","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/connect-telegram":{"post":{"tags":["Onboarding"],"summary":"Connect a Telegram bot during onboarding","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectTelegram"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingConnectTelegramResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingConnectTelegram","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/instagram-preflight":{"post":{"tags":["Onboarding"],"summary":"Check an Instagram handle before sending the coach through OAuth","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramPreflight"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramPreflightResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingInstagramPreflight","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/channel-waitlist":{"post":{"tags":["Onboarding"],"summary":"Join a coming-soon channel waitlist","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingWaitlist"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingWaitlistResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingChannelWaitlist","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/voice-preview":{"post":{"tags":["Onboarding"],"summary":"Draft a voice-matched preview reply for the Try Luca step","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicePreview"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingVoicePreviewResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingVoicePreview","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/seed-voice-corpus":{"post":{"tags":["Onboarding"],"summary":"Seed the voice corpus from sample messages","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedVoiceCorpus"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingSeedCorpusResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingSeedVoiceCorpus","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/preferences":{"post":{"tags":["Onboarding"],"summary":"Set onboarding preferences","description":"autoSendEnabled sets the workspace master switch for AI DM auto-send. It leaves each channel account's own switch as it is.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingPreferences"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingPreferencesResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postOnboardingPreferences","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/onboarding/complete":{"post":{"tags":["Onboarding"],"summary":"Start the 7-day trial via a Stripe Checkout Session","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingComplete"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingCompleteResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postOnboardingComplete","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/cancellation/offer/accept":{"post":{"tags":["Cancellation"],"summary":"Accept the save offer the matrix surfaced for the reason","description":"Applies the accepted save: a discount coupon, a pause, a downgrade, or extra trial days. It claims the save cap before the Stripe action, so concurrent requests cannot redeem different offers for the same identity.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationOfferAcceptRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCancellationOfferAccept","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/cancellation/confirm":{"post":{"tags":["Cancellation"],"summary":"Execute the cancellation","description":"Cancels for real. It returns when access ends, whether a refund went out, and the deadline for exporting voice data. Inside the 72-hour renewal grace window it refunds and ends access now. Mid-pause it also ends now. Otherwise access runs to the end of the paid period.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationConfirmRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationConfirmResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCancellationConfirm","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/cancellation/reactivate":{"post":{"tags":["Cancellation"],"summary":"Un-cancel before period end, or reactivate after churn","description":"Un-cancels a subscription that's still inside its paid period, or restarts one after churn. Set `winback` to redeem the once-per-coach discount on the first month back. It's honored only from day 14 after churn, and only if no identity matching this coach has used it. Otherwise the reactivation just goes through at full price.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationReactivateRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationReactivateResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCancellationReactivate","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/cancellation/founder-call":{"post":{"tags":["Cancellation"],"summary":"Record that the coach clicked the founder-call link","description":"Records that the coach clicked through to book a call with a founder, and which step they clicked from. Nothing about the subscription changes.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationFounderCallRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCancellationFounderCall","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/cancellation/start":{"post":{"tags":["Cancellation"],"summary":"Open a cancellation-flow session","description":"Opens a flow session under a client-generated id. Every later step carries that id, so the survey answer, the offer shown, and the outcome all join into one record. It stays reachable when the coach is paused, past due, or already cancelled.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationStartRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCancellationStart","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/cancellation/context":{"get":{"tags":["Cancellation"],"summary":"Everything the cancellation flow UI needs in one read","description":"One read that renders the whole flow. It returns the plan, billing interval, and period end, what Luca has done for this coach, whether an open balance or a save cap turns offers off, any renewal-grace refund on the table, and the offers each reason leads with. The client never needs a second round trip to decide what to show.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationContextResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getCancellationContext","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/cancellation/survey":{"post":{"tags":["Cancellation"],"summary":"Record the cancellation reason (and optional free text)","description":"Stores the reason and any free text, and stamps the offer that reason leads with at the moment it's answered. Recording the offer here instead of on acceptance is what lets churn analytics name the offer a coach turned down.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationSurveyRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postCancellationSurvey","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/first-run":{"get":{"tags":["First run"],"summary":"First-session state and Day-1 checklist for the trial coach","description":"One read for everything the Getting Started view needs. That's first-session state, the Day-1 checklist, plan and trial dates, the coach's niche for personalized copy, the demo lead's name, sticky experiment variants, and any trial extension waiting to be claimed. It also backfills experiment assignments for a coach who signed up before a test shipped.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FirstRunStateResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getFirstRun","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/first-run/state":{"patch":{"tags":["First run"],"summary":"Transition the first-session state (dismiss, resume, complete)","description":"Moves the first-session state as the coach progresses, dismisses, or resumes. It only accepts states the coach is allowed to set.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FirstRunStateUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FirstRunStateUpdateResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchFirstRunState","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/first-run/checklist":{"patch":{"tags":["First run"],"summary":"Update one Day-1 checklist item's status","description":"Sets one checklist item's status and returns the whole checklist. Items that stand for something the server watches for can't be self-completed and return 403, so replaying this endpoint can't fake activation. An invalid transition returns 409.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChecklistItemUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChecklistItemUpdateResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchFirstRunChecklist","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/first-run/value":{"get":{"tags":["First run"],"summary":"Real-time trial value dashboard metrics","description":"Live counters for the trial value widget: what Luca has done for this coach since the trial started.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialValueDashboard"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getFirstRunValue","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/first-run/growth-template-copied":{"post":{"tags":["First run"],"summary":"Record that the coach took a growth story template","description":"Stamps the \"took a story template\" half of the low-usage extension gate. Luca can't see a story land on Instagram, so copying the template stands in for it. `firstCopy` is true only on the call that flipped the flag.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrowthTemplateCopiedResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postFirstRunGrowthTemplateCopied","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/first-run/pipeline-module-shown":{"post":{"tags":["First run"],"summary":"Record that the pipeline-building module reached this coach","description":"The exposure record for the pipeline-building module. Being assigned to the arm isn't the same as having seen it, so the analysis reads this flag instead of the assignment. `firstShown` is true only on the call that flipped it.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PipelineModuleShownResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postFirstRunPipelineModuleShown","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/first-run/extension/claim":{"post":{"tags":["First run"],"summary":"Claim the earned trial extension the daily sweep offered","description":"Grants the extra trial days the coach earned, on their own action instead of automatically. You'll get a 409 when there's no offer, when the actions gating it are unfinished, or when this trial was already extended. The usage-earned offer also applies a discount coupon when one is configured. A missing coupon costs the discount, not the days.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialExtensionClaimResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postFirstRunExtensionClaim","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/teach-luca":{"get":{"tags":["Teach Luca"],"summary":"Teach Luca panel state, with confirm-style prompts","description":"Everything the panel renders. That's which questions are answered, skipped, or still open, the next one to ask, and prompts pre-filled from the coach's own words. It also returns the example DM with the draft as it stands today.\n\n**API key scopes:** `learning:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeachLucaStateResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["learning:read"]},{"bearerAuth":["learning:read"]}],"operationId":"getTeachLuca","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/teach-luca/answer":{"post":{"tags":["Teach Luca"],"summary":"Answer one Teach Luca question and redraft the example","description":"Saves one answer and redrafts the stored example DM with the new profile, so the coach watches their reply change because of what they just said. The redraft is best-effort. If the model call fails, `exampleDraft` comes back null and the answer is still saved.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"oneOf":[{"type":"object","properties":{"key":{"type":"string","enum":["offer_and_price"]},"offer":{"type":"string","maxLength":600},"priceBand":{"type":"string","enum":["lt_500","500_2k","2k_5k","5k_plus","rather_not_say"]},"priceDetail":{"type":"string","maxLength":120}},"required":["key","offer","priceBand"]},{"type":"object","properties":{"key":{"type":"string","enum":["top_objections"]},"objections":{"type":"array","items":{"type":"object","properties":{"objection":{"type":"string","minLength":1,"maxLength":200},"response":{"type":"string","minLength":1,"maxLength":600}},"required":["objection","response"]},"minItems":1,"maxItems":3}},"required":["key","objections"]},{"type":"object","properties":{"key":{"type":"string","enum":["tone_boundaries"]},"boundaries":{"type":"array","items":{"type":"string","minLength":1,"maxLength":200},"minItems":1,"maxItems":5}},"required":["key","boundaries"]}]}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeachLucaAnswerResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postTeachLucaAnswer","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/teach-luca/skip":{"post":{"tags":["Teach Luca"],"summary":"Skip one Teach Luca question","description":"Marks one question skipped and moves to the next. `exampleDraft` is always null here, because a skip changes nothing the drafter reads and the example already on screen is still right.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeachLucaSkip"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeachLucaAnswerResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postTeachLucaSkip","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/capabilities":{"get":{"tags":["Capabilities"],"summary":"Describe public API capabilities for external clients","description":"What the calling credential can actually reach: the endpoints open to it, the scopes it holds, and its plan tier's limits. Read this once at startup instead of probing endpoints and waiting for a 403.\n\n**API key scopes:** `leads:read`, `conversations:read`, `bookings:read`, `campaigns:read`, `broadcasts:read`, `webhooks:read`, `integrations:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiCapabilitiesResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:read","conversations:read","bookings:read","campaigns:read","broadcasts:read","webhooks:read","integrations:read"]},{"bearerAuth":["leads:read","conversations:read","bookings:read","campaigns:read","broadcasts:read","webhooks:read","integrations:read"]}],"operationId":"getCapabilities","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/leads":{"get":{"tags":["Leads"],"summary":"List the coach's leads","description":"Cursor-paginated, most recently active first. Narrow it with `channel`, or search names and handles with `q`. Send `nextCursor` back as `cursor` for the next page. A key on the redacted data tier gets the structured fields only, so `displayName` and `externalUserId` come back blank.\n\n**API key scopes:** `leads:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"string","minLength":1},"required":false,"name":"q","in":"query","description":"Free-text search term."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:read"]},{"bearerAuth":["leads:read"]}],"operationId":"getLeads"},"post":{"tags":["Leads"],"summary":"Create or update a lead by external channel identity","description":"Upserts on `channel` plus `externalUserId`. Send the same identity twice and you update that lead instead of creating a second one. Emits `lead.created`, and `lead.stage_changed` too if the request moves the lead's stage.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadUpdateResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeads","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/leads/field-definitions":{"get":{"tags":["Leads"],"summary":"List custom lead field definitions","description":"The custom fields this workspace has defined, and the type each one accepts. Read it before you write `customFields` on a lead.\n\n**API key scopes:** `leads:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:read"]},{"bearerAuth":["leads:read"]}],"operationId":"getLeadsFieldDefinitions","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["Leads"],"summary":"Create or update a custom lead field definition","description":"Keyed by field name. A name that already exists updates that definition instead of adding a duplicate.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadFieldDefinitionUpsert"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsFieldDefinitions","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/leads/imports/preview":{"post":{"tags":["Leads"],"summary":"Preview a mapped CSV lead import","description":"A dry run. It shows the rows that would be created, updated, or skipped under the column mapping you sent, and writes nothing. Preview before every apply, because the mapping is the part that goes wrong.\n\n**API key scopes:** `leads:read`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadImport"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:read"]},{"bearerAuth":["leads:read"]}],"operationId":"postLeadsImportsPreview","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/leads/imports/apply":{"post":{"tags":["Leads"],"summary":"Apply a mapped CSV lead import","description":"Commits the import that `/api/leads/imports/preview` described, using the same mapping. `Idempotency-Key` is required here. Without it, a retried request would run the whole file twice.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadImport"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsImportsApply","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/leads/{id}/explain":{"get":{"tags":["Leads"],"summary":"Explain why a lead qualified the way it did","description":"Why the lead sits at its current score and stage: the signals the qualifier used, and how it weighed them. Read-only, and it won't re-run qualification.\n\n**API key scopes:** `leads:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadExplainResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:read"]},{"bearerAuth":["leads:read"]}],"operationId":"getLeadsByIdExplain"}},"/api/leads/{id}":{"get":{"tags":["Leads"],"summary":"Get a lead's full timeline and notes","description":"The whole lead: timeline, notes, consents, linked identities, and custom fields. A redacted-tier key gets the structured record with the verbatim identity content withheld.\n\n**API key scopes:** `leads:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadDetailResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:read"]},{"bearerAuth":["leads:read"]}],"operationId":"getLeadsById"},"patch":{"tags":["Leads"],"summary":"Update display name or tags","description":"Only `displayName` and `tags` are writable here. Stage, consents, and identities each move through their own endpoint, so every change lands in the audit log under its own action.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadUpdateResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"patchLeadsById"}},"/api/leads/{id}/draft":{"post":{"tags":["Leads"],"summary":"Draft a voice-matched reply for a lead and queue it for review","description":"Runs the drafter and queues the result as a pending draft in the review queue. This route never sends, regardless of the channel's auto-send setting: the draft waits for the coach to approve it. Drafting again replaces the pending draft from this route, and a new DM from the lead expires it.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadDraftRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadDraftResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"payment required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsByIdDraft"}},"/api/leads/{id}/identities":{"post":{"tags":["Leads"],"summary":"Attach a verified or claimed identity to a lead","description":"Links another channel handle to this lead. One person who messages you from both Instagram and WhatsApp stays one lead instead of two.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadIdentityCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsByIdIdentities"}},"/api/leads/{id}/consents":{"post":{"tags":["Leads"],"summary":"Grant explicit lead consent for a channel purpose","description":"Records explicit consent for one channel and one purpose. Outreach that needs consent stays blocked for that pair until this row exists.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadConsentGrant"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsByIdConsents"}},"/api/leads/{id}/consents/revoke":{"post":{"tags":["Leads"],"summary":"Revoke lead consent for a channel purpose","description":"Withdraws a consent you granted earlier for that channel and purpose.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadConsentRevoke"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsByIdConsentsRevoke"}},"/api/leads/{id}/cadence/pause":{"post":{"tags":["Leads"],"summary":"Pause (cancel) the lead's rescue cadence","description":"Cancels the lead's in-flight rescue cadence. The remaining touches are dropped, not deferred, so picking it back up means enrolling again.\n\n**API key scopes:** `cadences:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CadencePauseRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CadencePauseResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["cadences:write"]},{"bearerAuth":["cadences:write"]}],"operationId":"postLeadsByIdCadencePause"}},"/api/leads/{id}/notes":{"post":{"tags":["Leads"],"summary":"Append a coach note to a lead","description":"Appends a timestamped coach note to the lead's timeline.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadNoteCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadNoteCreateResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsByIdNotes"}},"/api/leads/{id}/notes/{noteId}":{"delete":{"tags":["Leads"],"summary":"Delete a coach note","description":"Removes one coach note and leaves the rest of the timeline alone.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"noteId","in":"path","description":"Identifier of the note this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadNoteDeleteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"deleteLeadsByIdNotesByNoteId"}},"/api/leads/{id}/drafting/pause":{"post":{"tags":["Leads"],"summary":"Pause everything Luca drafts or sends for one lead","description":"Stops DM reply drafts, follow-up cadences and campaign sends for this lead until the pause ends or the coach resumes. A draft in flight stops at its next step. Safety handling still runs: an opt-out is still handled, and a crisis message still reaches the coach as an urgent card that never auto-sends. Pausing again replaces the earlier pause. A timed pause ends by itself, and Luca then resumes the lead the way the resume endpoint does.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadDraftingPauseRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadDraftingPauseResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsByIdDraftingPause"}},"/api/leads/{id}/drafting/resume":{"post":{"tags":["Leads"],"summary":"Resume everything Luca drafts or sends for one lead","description":"Clears the pause and restarts the latest paused turn in each of the lead's conversations so Luca writes one draft over every unanswered message there. A turn still drafting when the pause cleared finishes paused and restarts too. A conversation is skipped when the coach already replied, Meta's 24 hour messaging window closed, or a newer turn took over. restartedTurnIds lists every turn that restarted, most recently paused first, and restartedTurnId is the first of them; skippedReason says why nothing restarted. Resuming a lead that is not paused succeeds.\n\n**API key scopes:** `leads:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadDraftingResumeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["leads:write"]},{"bearerAuth":["leads:write"]}],"operationId":"postLeadsByIdDraftingResume"}},"/api/insights":{"get":{"tags":["Insights"],"summary":"List the coach's proactive-insights feed","description":"The cursor-paginated proactive feed. You get an empty list when the coach has switched the in-app feed off, even though detection keeps running for the digest and push paths.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","enum":["unread","read","dismissed","actioned","expired"]},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightListResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getInsights"}},"/api/insights/unread-count":{"get":{"tags":["Insights"],"summary":"Read the coach's unread-insights badge count","description":"The badge count. It reads zero when the feed is disabled, which matches the list endpoint.\n\n**API key scopes:** `analytics:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InsightUnreadCountResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getInsightsUnreadCount","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/insights/{id}/read":{"post":{"tags":["Insights"],"summary":"Mark an insight as read","description":"Clears the insight from the unread badge count and returns the updated row. The insight itself stays in the feed.\n\n**API key scopes:** `insights:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the insight this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Insight"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["insights:write"]},{"bearerAuth":["insights:write"]}],"operationId":"postInsightsByIdRead"}},"/api/insights/{id}/dismiss":{"post":{"tags":["Insights"],"summary":"Dismiss an insight","description":"Takes the insight out of the open feed for good. Use it when the coach has decided the insight needs no response.\n\n**API key scopes:** `insights:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the insight this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Insight"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["insights:write"]},{"bearerAuth":["insights:write"]}],"operationId":"postInsightsByIdDismiss"}},"/api/insights/{id}/action":{"post":{"tags":["Insights"],"summary":"Mark an insight as actioned","description":"Records that the coach followed the insight's `actionRoute`. It's terminal, same as dismissing, so the insight leaves the open feed.\n\n**API key scopes:** `insights:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the insight this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Insight"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["insights:write"]},{"bearerAuth":["insights:write"]}],"operationId":"postInsightsByIdAction"}},"/api/insights/settings":{"get":{"tags":["Insights"],"summary":"Read the coach's alert-delivery settings","description":"The coach's alert-delivery settings. Before the first change, this returns the documented defaults without creating a database row.\n\n**API key scopes:** `analytics:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertSettingsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getInsightsSettings","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Insights"],"summary":"Merge-patch the coach's alert-delivery settings","description":"A merge patch. Send only what you're changing. Anything you leave out keeps its current value.\n\n**API key scopes:** `insights:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertSettingsPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AlertSettingsResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["insights:write"]},{"bearerAuth":["insights:write"]}],"operationId":"putInsightsSettings","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/provider-lab":{"get":{"tags":["Integrations"],"summary":"List dev-only Provider Lab scenarios","description":"Provider Lab scenarios you can use to exercise connector behavior. Development only.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderLabStatusResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getIntegrationsProviderLab","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/provider-lab/apply":{"post":{"tags":["Integrations"],"summary":"Apply a dev-only Provider Lab scenario","description":"Applies a Provider Lab scenario so a connector returns a failure or edge case you picked. Development only.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderLabApply"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderLabApplyResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postIntegrationsProviderLabApply","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/provider-lab/faults":{"post":{"tags":["Integrations"],"summary":"Arm a named dev-only Provider Lab fault","description":"Arms one scoped failure for the next matching operation. Development only.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderLabFaultRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderLabFaultResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postIntegrationsProviderLabFaults","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/provider-lab/reset":{"post":{"tags":["Integrations"],"summary":"Reset dev-only Provider Lab state","description":"Clears all Provider Lab state and puts connectors back to their real behavior. Development only.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderLabResetResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postIntegrationsProviderLabReset","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/connectors":{"get":{"tags":["Integrations"],"summary":"List automation connectors and CRM providers","description":"The catalog of automation connectors and CRM providers, and what each one supports. It's static metadata, so it's safe to cache.\n\n**API key scopes:** `integrations:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationConnectorsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:read"]},{"bearerAuth":["integrations:read"]}],"operationId":"getIntegrationsConnectors","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/crm/providers/{provider}/oauth-url":{"get":{"tags":["CRM"],"summary":"Create a CRM provider OAuth URL","description":"Builds the provider's OAuth authorization URL for this workspace. The redirect URI has to be one we allow, or the request is rejected.\n\n**API key scopes:** `integrations:write`.","parameters":[{"schema":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"required":true,"name":"provider","in":"path","description":"The provider this operation targets."},{"schema":{"type":"string","format":"uri"},"required":false,"name":"redirectUri","in":"query","description":"Where to send the browser once the provider flow finishes."},{"schema":{"type":"string","minLength":1},"required":false,"name":"locationId","in":"query","description":"Identifier of the location to read, at the provider."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmOAuthUrlResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"getIntegrationsCrmProvidersByProviderOauthUrl"}},"/api/integrations/crm/oauth/callback":{"post":{"tags":["CRM"],"summary":"Exchange a CRM OAuth code and store encrypted credentials","description":"Exchanges the OAuth code for tokens and stores them encrypted against this workspace. The code only works once.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmOAuthCallback"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmConnection"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmOauthCallback","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/crm/connections/{id}/disconnect":{"post":{"tags":["CRM"],"summary":"Disconnect a CRM account","description":"Disables this workspace's connection and clears its credentials. Saved mappings and event history remain available.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmConnection"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmConnectionsByIdDisconnect"}},"/api/integrations/crm/connections":{"get":{"tags":["CRM"],"summary":"List CRM connections","description":"The workspace's CRM connections, with the health of each one and when it last synced.\n\n**API key scopes:** `integrations:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmConnectionsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:read"]},{"bearerAuth":["integrations:read"]}],"operationId":"getIntegrationsCrmConnections","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["CRM"],"summary":"Create or update CRM connection","description":"Creates or updates the CRM connection for a provider. We verify the credentials before storing them, so a bad key fails here instead of at the first sync.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmConnectionCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmConnection"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmConnections","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/integrations/crm/connections/{id}/schema":{"get":{"tags":["CRM"],"summary":"Discover CRM provider schema","description":"Reads the objects and fields the connected CRM actually exposes. This is what field mapping works from.\n\n**API key scopes:** `integrations:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmProviderSchemaResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:read"]},{"bearerAuth":["integrations:read"]}],"operationId":"getIntegrationsCrmConnectionsByIdSchema"}},"/api/integrations/crm/connections/{id}/health":{"post":{"tags":["CRM"],"summary":"Probe CRM provider health","description":"Probes the provider live and updates the connection's stored health. It's how you tell a stale credential from a provider outage.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmHealth"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmConnectionsByIdHealth"}},"/api/integrations/crm/connections/{id}/webhooks/setup":{"post":{"tags":["CRM"],"summary":"Configure CRM provider webhook status","description":"Registers or repairs the webhook on the provider's side, so changes flow back to us instead of waiting for the next sync.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmWebhookSetup"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmWebhookStatus"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmConnectionsByIdWebhooksSetup"}},"/api/integrations/crm/connections/{id}/mappings/suggest":{"post":{"tags":["CRM"],"summary":"Suggest CRM field mappings","description":"Proposes a field mapping from the discovered schema. Nothing is applied yet. Confirm the mapping to make it real.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmFieldMappingsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmConnectionsByIdMappingsSuggest"}},"/api/integrations/crm/connections/{id}/mappings":{"put":{"tags":["CRM"],"summary":"Confirm CRM field mappings","description":"Saves the field mapping the connection will sync with. If a mapping would overwrite data in the CRM, the request has to confirm that explicitly.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmFieldMappingsConfirm"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmFieldMappingsResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"putIntegrationsCrmConnectionsByIdMappings"}},"/api/integrations/crm/connections/{id}/sync-runs":{"post":{"tags":["CRM"],"summary":"Create CRM sync preview","description":"A dry run previews mapped changes without writing to the CRM. Live sync is unavailable.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSyncRunCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSyncRun"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmConnectionsByIdSyncRuns"},"get":{"tags":["CRM"],"summary":"List CRM sync history","description":"Sync history for the connection, with per-run counts and errors.\n\n**API key scopes:** `integrations:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmSyncRunsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:read"]},{"bearerAuth":["integrations:read"]}],"operationId":"getIntegrationsCrmConnectionsByIdSyncRuns"}},"/api/integrations/crm/webhooks/{provider}":{"post":{"tags":["CRM"],"summary":"Record an idempotent CRM provider webhook","description":"Ingests a webhook from the provider. It's idempotent on the provider's event id, so a redelivery gets recorded once.\n\n**API key scopes:** `integrations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","enum":["gohighlevel","hubspot","activecampaign","salesforce","pipedrive"]},"required":true,"name":"provider","in":"path","description":"The provider this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmProviderWebhook"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmProviderWebhookResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:write"]},{"bearerAuth":["integrations:write"]}],"operationId":"postIntegrationsCrmWebhooksByProvider"}},"/api/integrations/events":{"get":{"tags":["Integrations"],"summary":"List integration event log","description":"Cursor-paginated log of integration activity: what we sent to a provider, and what came back.\n\n**API key scopes:** `integrations:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","enum":["webhook","zapier","make","crm","api","worker"]},"required":false,"name":"source","in":"query","description":"Return only records that arrived from this origin."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationEventsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["integrations:read"]},{"bearerAuth":["integrations:read"]}],"operationId":"getIntegrationsEvents"}},"/api/knowledge/sources":{"get":{"tags":["Knowledge"],"summary":"List connected knowledge sources","description":"The content sources the coach has connected, like Notion, Google Docs, a public website, or an Instagram bio, with the sync state of each one.\n\n**API key scopes:** `knowledge:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["knowledge:read"]},{"bearerAuth":["knowledge:read"]}],"operationId":"getKnowledgeSources","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["Knowledge"],"summary":"Connect a new knowledge source","description":"Registers a content source for the extraction pipeline to read. Sources start in `connected` status. The sync that produces suggestions runs on its own schedule, or on demand through the sync route.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceRow"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postKnowledgeSources","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/knowledge/sources/{id}":{"delete":{"tags":["Knowledge"],"summary":"Disconnect a knowledge source","description":"Deletes the source row. Its suggestions go with it through a foreign-key cascade, so anything still pending disappears. Values the coach already approved stay in the profile, because approval copies them there.\n\n**API key scopes:** `knowledge:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the knowledge source this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceDeleteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["knowledge:write"]},{"bearerAuth":["knowledge:write"]}],"operationId":"deleteKnowledgeSourcesById"}},"/api/knowledge/sources/{id}/sync":{"post":{"tags":["Knowledge"],"summary":"Request an on-demand sync for a knowledge source","description":"Queues a re-read of the source now, instead of waiting for the next scheduled sync. It returns as soon as the job is queued.\n\n**API key scopes:** `knowledge:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the knowledge source this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeSourceSyncResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["knowledge:write"]},{"bearerAuth":["knowledge:write"]}],"operationId":"postKnowledgeSourcesByIdSync"}},"/api/knowledge/suggestions":{"get":{"tags":["Knowledge"],"summary":"List profile suggestions produced from knowledge sources","description":"Field-level profile changes pulled out of connected sources, filterable by status. Nothing here has touched the coach profile yet.\n\n**API key scopes:** `knowledge:read`.","parameters":[{"schema":{"type":"string","enum":["pending","approved","rejected"]},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileSuggestionListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["knowledge:read"]},{"bearerAuth":["knowledge:read"]}],"operationId":"getKnowledgeSuggestions"}},"/api/knowledge/suggestions/{id}/approve":{"post":{"tags":["Knowledge"],"summary":"Approve a profile suggestion and apply it to the coach profile","description":"The human approval that lets ingested content reach the profile. It writes through the same path a direct profile edit uses, and re-checks the field against the allowlist instead of trusting the stored row. Approving a suggestion that's already resolved returns 409.\n\n**API key scopes:** `knowledge:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the suggestion this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileSuggestionResolveResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["knowledge:write"]},{"bearerAuth":["knowledge:write"]}],"operationId":"postKnowledgeSuggestionsByIdApprove"}},"/api/knowledge/suggestions/{id}/reject":{"post":{"tags":["Knowledge"],"summary":"Reject a profile suggestion","description":"Turns the suggestion down and leaves the profile alone. Rejecting one that's already resolved returns 409.\n\n**API key scopes:** `knowledge:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the suggestion this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProfileSuggestionResolveResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["knowledge:write"]},{"bearerAuth":["knowledge:write"]}],"operationId":"postKnowledgeSuggestionsByIdReject"}},"/api/webhook-events":{"get":{"tags":["Webhooks"],"summary":"List recent webhook events of one type","description":"Newest-first canonical events, in exactly the shape we deliver them (unique top-level id). If the workspace has no events of that type yet, you get the documented sample payload instead. This is the polling source platform integrations use for sample data, such as Zapier's performList.\n\n**API key scopes:** `webhooks:read`.","parameters":[{"schema":{"type":"string","enum":["lead.created","lead.updated","lead.qualified","lead.stage_changed","message.received","message.draft_created","message.sent","review.created","review.approved","review.rejected","booking.created","booking.updated","booking.cancelled","campaign.enrolled","campaign.completed","campaign.failed","broadcast.started","broadcast.completed","broadcast.paused","broadcast.failed","crm.sync_failed","integration.connection_health_changed"]},"required":true,"name":"type","in":"query","description":"Return only records of this type."},{"schema":{"type":"integer","minimum":1,"maximum":25,"default":3},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookEventsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:read"]},{"bearerAuth":["webhooks:read"]}],"operationId":"getWebhookEvents"}},"/api/webhook-subscriptions":{"get":{"tags":["Webhooks"],"summary":"List webhook subscriptions","description":"The workspace's webhook subscriptions, with the event types each one receives.\n\n**API key scopes:** `webhooks:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","enum":["true","false"],"default":"true"},"required":false,"name":"includeHealth","in":"query","description":"Include a live provider health check. It costs an extra upstream call."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:read"]},{"bearerAuth":["webhooks:read"]}],"operationId":"getWebhookSubscriptions"},"post":{"tags":["Webhooks"],"summary":"Create webhook subscription","description":"Subscribes a URL to one or more event types. The signing secret comes back once, so store it now. We check the target URL first and refuse private and loopback addresses.\n\n**API key scopes:** `webhooks:write`.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscription"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:write"]},{"bearerAuth":["webhooks:write"]}],"operationId":"postWebhookSubscriptions","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/webhook-subscriptions/{id}":{"patch":{"tags":["Webhooks"],"summary":"Update webhook subscription","description":"Changes the target URL, the event types, or the active flag. We re-check the URL on every change.\n\n**API key scopes:** `webhooks:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the webhook subscription this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionPublic"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:write"]},{"bearerAuth":["webhooks:write"]}],"operationId":"patchWebhookSubscriptionsById"},"delete":{"tags":["Webhooks"],"summary":"Delete webhook subscription","description":"A terminal soft delete. Delivery history stays queryable, the subscription stops receiving events, and repeating the delete still succeeds. That's the shape platform unsubscribe hooks like Zapier and Make expect.\n\n**API key scopes:** `webhooks:write`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the webhook subscription this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSubscriptionPublic"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:write"]},{"bearerAuth":["webhooks:write"]}],"operationId":"deleteWebhookSubscriptionsById"}},"/api/webhook-subscriptions/test-delivery":{"post":{"tags":["Webhooks"],"summary":"Queue a canonical test webhook event","description":"Queues a canonical test event to your subscriptions, so you can prove a receiver works without waiting for real activity.\n\n**API key scopes:** `webhooks:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookTestEvent"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookTestDeliveryResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:write"]},{"bearerAuth":["webhooks:write"]}],"operationId":"postWebhookSubscriptionsTestDelivery","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/webhook-subscriptions/deliveries":{"get":{"tags":["Webhooks"],"summary":"List webhook deliveries","description":"Delivery attempts with the response status of each one. Start here when you're working out what failed and why.\n\n**API key scopes:** `webhooks:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDeliveriesResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:read"]},{"bearerAuth":["webhooks:read"]}],"operationId":"getWebhookSubscriptionsDeliveries"}},"/api/webhook-subscriptions/signature-guide":{"get":{"tags":["Webhooks"],"summary":"Describe webhook HMAC verification","description":"The HMAC scheme we sign with, the headers to read, and an example that verifies a payload. Read this before you write a receiver.\n\n**API key scopes:** `webhooks:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookSignatureGuide"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:read"]},{"bearerAuth":["webhooks:read"]}],"operationId":"getWebhookSubscriptionsSignatureGuide","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/webhook-subscriptions/deliveries/{deliveryId}/replay":{"post":{"tags":["Webhooks"],"summary":"Replay one webhook delivery","description":"Re-sends one delivery to the subscription it was meant for.\n\n**API key scopes:** `webhooks:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"deliveryId","in":"path","description":"Identifier of the delivery this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookDelivery"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:write"]},{"bearerAuth":["webhooks:write"]}],"operationId":"postWebhookSubscriptionsDeliveriesByDeliveryIdReplay"}},"/api/webhook-subscriptions/events/{eventId}/replay":{"post":{"tags":["Webhooks"],"summary":"Replay one event to one or all matching active subscriptions","description":"Re-sends one event, either to a single subscription or to every active one that matches its type. Only events still inside the retention window can be replayed.\n\n**API key scopes:** `webhooks:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"eventId","in":"path","description":"Identifier of the event this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookReplayEvent"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookReplayResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:write"]},{"bearerAuth":["webhooks:write"]}],"operationId":"postWebhookSubscriptionsEventsByEventIdReplay"}},"/api/webhook-subscriptions/events/replay":{"post":{"tags":["Webhooks"],"summary":"Bulk replay events by type and time range","description":"Re-sends every event of a type inside a time range. This can be a big burst, so make sure the receiver is idempotent before you call it.\n\n**API key scopes:** `webhooks:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookBulkReplay"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookReplayResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["webhooks:write"]},{"bearerAuth":["webhooks:write"]}],"operationId":"postWebhookSubscriptionsEventsReplay","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/memory":{"get":{"tags":["Memory"],"summary":"List coach long-term memories","description":"Filter what Luca remembers by scope, lead, state, source, trust level, or a free-text search. Archived memories are left out unless you ask for them.\n\n**API key scopes:** `memory:read`.","parameters":[{"schema":{"type":"string","enum":["all","coach","lead"],"default":"all"},"required":false,"name":"scope","in":"query","description":"Which memory owner the result covers."},{"schema":{"type":"string","minLength":1,"maxLength":80},"required":false,"name":"source","in":"query","description":"Return only records that arrived from this origin."},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":false,"name":"q","in":"query","description":"Free-text search term."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"leadId","in":"query","description":"Return only records belonging to this lead."},{"schema":{"type":"string","enum":["all","active","archived"]},"required":false,"name":"archived","in":"query","description":"Which archive states to include."},{"schema":{"type":"string","enum":["active","archived","disputed","superseded","all"],"default":"active"},"required":false,"name":"state","in":"query","description":"Return only records in this lifecycle state."},{"schema":{"type":"string","enum":["manual","trusted_pipeline","inferred","disputed"]},"required":false,"name":"trustLevel","in":"query","description":"Return only records at this trust level."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["memory:read"]},{"bearerAuth":["memory:read"]}],"operationId":"getMemory"}},"/api/memory/{id}":{"patch":{"tags":["Memory"],"summary":"Update a long-term memory","description":"Edit a memory's content, confidence, metadata, reason, or evidence. Set `disputed` to flag a fact as wrong, `restore` to bring an archived one back, or `preferred` to make it win over conflicting memories. Provenance and trust fields belong to the server and can't be set here.\n\n**API key scopes:** `memory:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the memory entry this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryRow"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["memory:write"]},{"bearerAuth":["memory:write"]}],"operationId":"patchMemoryById"},"delete":{"tags":["Memory"],"summary":"Archive a long-term memory","description":"Archives the memory instead of erasing it, so Luca stops using the fact while the record and its provenance survive. Reverse it with a `restore` patch. A typed fact answers 409 `memory_fact_locked`: confirm or reject it instead.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the memory entry this operation targets."},{"schema":{"type":"string","format":"date-time"},"required":true,"name":"expectedUpdatedAt","in":"query","description":"The `expectedUpdatedAt` this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryDeleteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteMemoryById"}},"/api/memory/bulk":{"post":{"tags":["Memory"],"summary":"Archive or restore multiple long-term memories","description":"Archive or restore a list of memory ids in one call. The response says which ids were affected, so ids that no longer exist are just left out. If any id is a typed fact the call answers 409 `memory_fact_locked` and changes nothing.\n\n**API key scopes:** `memory:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryBulkRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoryBulkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["memory:write"]},{"bearerAuth":["memory:write"]}],"operationId":"postMemoryBulk","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/memory/learned":{"get":{"tags":["Memory"],"summary":"List what Luca learned","description":"Facts Luca read from the coach's own words that the coach has not confirmed or rejected yet, newest first. Each one carries the coach's words it came from and why Luca recorded it. Pass `nextCursor` back as `cursor` for the next page.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnedFactListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getMemoryLearned"}},"/api/memory/learned/{id}/confirm":{"post":{"tags":["Memory"],"summary":"Confirm a learned fact","description":"The coach confirms the fact. It replaces any other fact about the same thing, and a later automatic read never replaces it.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the learned fact this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnedFactDecisionResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postMemoryLearnedByIdConfirm"}},"/api/memory/learned/{id}/reject":{"post":{"tags":["Memory"],"summary":"Reject a learned fact","description":"The coach rejects the fact. Luca stops using it, and reading the same words again does not bring it back.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the learned fact this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LearnedFactDecisionResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postMemoryLearnedByIdReject"}},"/api/oauth-connections":{"get":{"tags":["OAuth connections"],"summary":"List the coach's connected agents (active OAuth connections)","description":"Every agent the coach has authorized over OAuth, newest first, with the scopes it holds and when it was last used. Revoked connections are left out.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthConnectionsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getOauthConnections","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/oauth-connections/{id}":{"delete":{"tags":["OAuth connections"],"summary":"Revoke a connected agent and kill its vended API key","description":"The kill switch for a connected agent. It marks the connection revoked and deletes the API key we vended it, so public API access stops right away. It also drops the stored consent, so the next authorize shows a real consent screen, and clears the refresh and access tokens.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path","description":"Identifier of the OAuth connection this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OauthConnectionRevokeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteOauthConnectionsById"}},"/api/mobile/devices":{"post":{"tags":["Mobile"],"summary":"Register or update a mobile push device","description":"Records the Expo push token for this device against the signed-in user. Registering the same device twice updates the existing row instead of adding another, so it's safe to send a token refresh on every launch. This one needs a user session, and an API key is rejected.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileDeviceRegistration"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileDeviceResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postMobileDevices","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/mobile/devices/{id}":{"delete":{"tags":["Mobile"],"summary":"Disable a mobile push device","description":"Turns push off for one device without deleting its history. A user can only disable their own devices.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the device this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileDeviceDeleteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteMobileDevicesById"}},"/api/mobile/preferences":{"get":{"tags":["Mobile"],"summary":"Read mobile notification preferences","description":"Which push notifications this user wants on their phone, plus quiet hours. This one needs a user session, and an API key is rejected.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileNotificationPreferencesResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getMobilePreferences","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"patch":{"tags":["Mobile"],"summary":"Update mobile notification preferences","description":"Updates only the preference fields you send. Push payloads carry routing metadata and nothing else, so changing these never changes how much lead content leaves the server.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileNotificationPreferencesPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MobileNotificationPreferencesResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchMobilePreferences","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings/providers":{"get":{"tags":["Booking providers"],"summary":"List booking provider capabilities and health","description":"Every booking provider Luca supports, what each one can do, and whether this coach's connection is healthy or needs reconnecting. The bookings settings screen renders from this.\n\n**API key scopes:** `bookings:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsProviders","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings/providers/{provider}/connection":{"post":{"tags":["Booking providers"],"summary":"Connect or reconnect a booking provider","description":"Stores the provider credentials, encrypted, and mints a webhook secret the provider signs its callbacks with. The secret comes back once, in this response, so capture it here. Calling it again on a connected provider replaces the credentials.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"required":true,"name":"provider","in":"path","description":"The provider this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderConnectionCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderConnectionResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postBookingsProvidersByProviderConnection"},"delete":{"tags":["Booking providers"],"summary":"Disconnect a booking provider","description":"Removes the credentials and cleans up what the provider holds on its side, like registered webhooks. If that remote cleanup fails we keep the connection and return 502, so you're never left with a half-torn-down provider.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"required":true,"name":"provider","in":"path","description":"The provider this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderConnectionResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteBookingsProvidersByProviderConnection"}},"/api/bookings/providers/{provider}":{"get":{"tags":["Booking providers"],"summary":"List booking provider event types and calendars","description":"The event types and calendars in the connected account. Use it to fill the pickers before saving a booking type or a calendar selection.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"]},"required":true,"name":"provider","in":"path","description":"The provider this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderMetadataResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsProvidersByProvider"}},"/api/bookings/types":{"get":{"tags":["Booking types"],"summary":"List managed booking types","description":"The call types the coach offers when Luca books through its own scheduler instead of an external provider.\n\n**API key scopes:** `bookings:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsTypes","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["Booking types"],"summary":"Create a managed booking type","description":"Defines a bookable call: how long it runs, where it happens, and how it looks to the lead. Give it a schedule next. A booking type with no schedule offers no slots.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsTypes","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings/types/{id}":{"patch":{"tags":["Booking types"],"summary":"Update a managed booking type","description":"Updates only the fields you send. Sending `location` replaces the whole location, because its shape depends on the type.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking type this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"patchBookingsTypesById"},"delete":{"tags":["Booking types"],"summary":"Delete a managed booking type","description":"Removes a booking type and returns what's left, so the settings screen can render straight from the response.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking type this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"deleteBookingsTypesById"}},"/api/bookings/types/{id}/schedule":{"get":{"tags":["Booking types"],"summary":"Read a booking type schedule","description":"The weekly rules and date-specific overrides that decide which slots this booking type offers.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking type this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingScheduleResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsTypesByIdSchedule"},"put":{"tags":["Booking types"],"summary":"Replace a booking type schedule","description":"A full replacement, not a patch. Send every rule and override you want to keep. Anything you leave out is dropped, which is also how you clear a day.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking type this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingScheduleReplace"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingScheduleResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"putBookingsTypesByIdSchedule"}},"/api/bookings/types/{id}/attendees":{"get":{"tags":["Booking types"],"summary":"List fixed booking type attendees","description":"The people invited to every call of this type, on top of the lead.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking type this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeAttendeeListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsTypesByIdAttendees"},"post":{"tags":["Booking types"],"summary":"Add a fixed booking type attendee","description":"Adds a standing attendee to this booking type, and returns the full attendee list.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking type this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeAttendeeCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeAttendeeListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsTypesByIdAttendees"}},"/api/bookings/types/{id}/attendees/{attendeeId}":{"delete":{"tags":["Booking types"],"summary":"Remove a fixed booking type attendee","description":"Removes a standing attendee and returns what's left.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking type this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"attendeeId","in":"path","description":"Identifier of the attendee this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingTypeAttendeeListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"deleteBookingsTypesByIdAttendeesByAttendeeId"}},"/api/bookings/calendars":{"get":{"tags":["Booking providers"],"summary":"List selected booking calendars","description":"The connected Google calendars Luca reads for conflicts, and which one it writes new events to.\n\n**API key scopes:** `bookings:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCalendarSelectionListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsCalendars","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"put":{"tags":["Booking providers"],"summary":"Select a booking calendar","description":"Adds or updates a calendar selection. The calendar has to exist in the connected Google account, and the one you mark as the destination has to be writable. A read-only calendar returns 400. You'll get a 409 when the Google connection needs attention.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCalendarSelection"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCalendarSelectionListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"putBookingsCalendars","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"delete":{"tags":["Booking providers"],"summary":"Remove a selected booking calendar","description":"Stops using a calendar for conflict checks or as the destination. The calendar itself is left alone in Google.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCalendarDelete"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCalendarSelectionListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"deleteBookingsCalendars","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings/managed-availability":{"get":{"tags":["Booking providers"],"summary":"List normalized availability for an active booking type","description":"Real bookable slots for one of Luca's own booking types, with the schedule applied and calendar conflicts already taken out. Times come back in the timezone you ask for.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookingTypeId","in":"query","description":"Identifier of the booking type whose availability to read."},{"schema":{"type":"string","minLength":1},"required":true,"name":"timezone","in":"query","description":"IANA time zone the returned times are expressed in."},{"schema":{"type":["string","null"],"format":"date-time"},"required":false,"name":"start","in":"query","description":"Start of the time range, inclusive."},{"schema":{"type":["string","null"],"format":"date-time"},"required":false,"name":"end","in":"query","description":"End of the time range, exclusive."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManagedBookingAvailabilityResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsManagedAvailability"}},"/api/bookings/availability":{"get":{"tags":["Bookings"],"summary":"Preview provider-backed booking availability","description":"Availability read live from an external booking provider, so you can preview a connection before leads see it. `end` has to be after `start`.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","enum":["manual","calendly","cal_com","google_calendar","iclosed","gohighlevel"],"default":"calendly"},"required":false,"name":"provider","in":"query","description":"Return only records from this provider."},{"schema":{"type":"string","minLength":1},"required":false,"name":"eventTypeId","in":"query","description":"Identifier of the event type, at the provider."},{"schema":{"type":"string","minLength":1},"required":false,"name":"calendarId","in":"query","description":"Identifier of the calendar to read, at the provider."},{"schema":{"type":"string","minLength":1,"default":"UTC"},"required":false,"name":"timezone","in":"query","description":"IANA time zone the returned times are expressed in."},{"schema":{"type":["string","null"],"format":"date-time"},"required":false,"name":"start","in":"query","description":"Start of the time range, inclusive."},{"schema":{"type":["string","null"],"format":"date-time"},"required":false,"name":"end","in":"query","description":"End of the time range, exclusive."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"leadId","in":"query","description":"Return only records belonging to this lead."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingAvailabilityResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsAvailability"}},"/api/bookings/{id}/outcome":{"get":{"tags":["Bookings"],"summary":"Read the current sales episode for a booking","description":"Where the sale stands on this booking: current status, the loss reason if there is one, and the version you'll send back when you correct it.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesEpisodeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsByIdOutcome"},"post":{"tags":["Bookings"],"summary":"Record or correct a booking's sales episode outcome","description":"Records what the call was worth: won, lost with a reason, or still open. Send an `Idempotency-Key` so a retried submit can't write twice. To correct an outcome, send the `expectedVersion` you read. A stale version returns 409 with the current one, so you can re-read and try again.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"schema":{"type":"string","minLength":1,"maxLength":200},"required":true,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesOutcomeCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesEpisodeResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsByIdOutcome"}},"/api/bookings/{id}/outcome/history":{"get":{"tags":["Bookings"],"summary":"Read append-only sales outcome history for a booking","description":"Every outcome ever recorded on this booking, in order. The log only appends, so a correction adds an event instead of rewriting the old one. That's what tells you who changed the outcome, and when.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesEpisodeHistoryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsByIdOutcomeHistory"}},"/api/bookings/outcome-reasons":{"get":{"tags":["Bookings"],"summary":"List active sales and booking outcome reasons","description":"The reasons a coach picks from when a sale is lost, or a call gets cancelled or no-showed. Covers the built-in reasons and the workspace's own. Archived ones don't appear.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","enum":["lost_sale","cancelled_call","no_show"],"default":"lost_sale"},"required":false,"name":"kind","in":"query","description":"Return only records of this kind."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReasonDefinitionsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsOutcomeReasons"},"post":{"tags":["Bookings"],"summary":"Create a workspace-specific sales or booking reason","description":"Adds a reason in the workspace's own wording, optionally scoped to one booking type. A code that's already taken returns 409.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReasonDefinitionCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReasonDefinitionResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsOutcomeReasons","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings/outcome-reasons/{id}":{"patch":{"tags":["Bookings"],"summary":"Rename, order, activate, or archive a workspace reason","description":"Renames a reason, reorders it, or archives it with `active: false`. Archiving only hides it from the picker. Outcomes already recorded against it keep it.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the outcome reason this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReasonDefinitionUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesReasonDefinitionResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"patchBookingsOutcomeReasonsById"}},"/api/bookings/{id}/recovery":{"get":{"tags":["Bookings"],"summary":"Read the current no-show recovery case","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingRecoveryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"description":"**API key scopes:** `bookings:read`.","operationId":"getBookingsByIdRecovery"}},"/api/bookings/{id}/recovery/stop":{"post":{"tags":["Bookings"],"summary":"Stop the observed no-show recovery case","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingRecoveryStop"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingRecoveryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"description":"**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","operationId":"postBookingsByIdRecoveryStop"}},"/api/bookings/{id}/guest-links":{"post":{"tags":["Bookings"],"summary":"Create revocable guest management links","description":"Mints revocable links that let a guest manage this booking without an account. It isn't available for providers that run their own rescheduling flow.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingGuestLinksCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingGuestLinksResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsByIdGuestLinks"},"delete":{"tags":["Bookings"],"summary":"Revoke guest management links","description":"Kills every outstanding guest link on the booking at once.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingGuestLinksRevokeResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"deleteBookingsByIdGuestLinks"}},"/api/bookings/provider-requests":{"post":{"tags":["Bookings"],"summary":"Book a call with the coach's provider","description":"Books an exact live slot from managed availability with the coach's calendar provider and invites the lead's email. The answer can still be pending while the provider confirms; read it again by id.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255},"required":true,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderRequestCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderRequestResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsProviderRequests"}},"/api/bookings/provider-requests/{id}":{"get":{"tags":["Bookings"],"summary":"Read a provider booking request","description":"Where a provider booking request stands. Pending answers turn into confirmed, handoff_required or failed once the provider replies.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the provider request this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderRequestResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsProviderRequestsById"}},"/api/bookings/links":{"post":{"tags":["Bookings"],"summary":"Send a lead a booking link","description":"DMs the lead the coach's message with a link to pick their own time. Luca follows up until the lead books, declines or the invitation expires.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255},"required":true,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingLinkCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingLinkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postBookingsLinks"}},"/api/bookings/links/{id}":{"get":{"tags":["Bookings"],"summary":"Read a sent booking link","description":"Whether the lead booked through the link, and when the call starts once they did.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the link this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingLinkResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getBookingsLinksById"}},"/api/bookings/lifecycle-attention":{"get":{"tags":["Bookings"],"summary":"List bookings that need a lifecycle decision","description":"Bookings where our record and the provider's disagree: a failed write-back, a suspected duplicate, a cancellation we never saw.\n\n**API key scopes:** `bookings:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingLifecycleAttentionListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsLifecycleAttention","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings/{id}/lifecycle-resolution":{"post":{"tags":["Bookings"],"summary":"Resolve a booking lifecycle conflict or missing attendance evidence","description":"Settles one lifecycle conflict. You can retry the provider sync, dismiss the duplicate, or accept our record as the right one.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingLifecycleResolutionCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsByIdLifecycleResolution"}},"/api/bookings/{id}/provider-sync/retry":{"post":{"tags":["Bookings"],"summary":"Retry this coach's failed booking provider write-back","description":"Retries a failed write-back to the booking provider. Only a retryable failure is accepted. A permanent one returns 409.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingProviderSyncRetryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookingsByIdProviderSyncRetry"}},"/api/bookings/needs-outcome":{"get":{"tags":["Bookings"],"summary":"Attended calls still needing a won/lost/not-a-fit outcome, with lead names","description":"Bookings whose call time has passed with no outcome recorded. It's the work list for closing the loop on revenue attribution.\n\n**API key scopes:** `bookings:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingNeedsOutcomeListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsNeedsOutcome","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings":{"get":{"tags":["Bookings"],"summary":"List bookings","description":"Cursor-paginated bookings, each with the lead it belongs to.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"schema":{"type":"string","minLength":1},"required":false,"name":"upcoming","in":"query","description":"Return only bookings that have not happened yet."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"leadId","in":"query","description":"Return only records belonging to this lead."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookings"},"post":{"tags":["Bookings"],"summary":"Create a booking for a lead","description":"Books a call for a lead you already have, against one of the workspace's active booking types. Both have to exist first. Emits `booking.created`.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"postBookings","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/bookings/{id}":{"patch":{"tags":["Bookings"],"summary":"Reschedule or update booking status","description":"Moves a booking to a new time or a new status. Emits `booking.updated`.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"patchBookingsById"},"delete":{"tags":["Bookings"],"summary":"Cancel a booking","description":"Cancels the booking here, and on the provider too where the provider supports it. Emits `booking.cancelled`.\n\n**API key scopes:** `bookings:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:write"]},{"bearerAuth":["bookings:write"]}],"operationId":"deleteBookingsById"},"get":{"tags":["Bookings"],"summary":"Read one booking","description":"One booking with its provider state, plus its outcome once the call has been closed out.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsById"}},"/api/bookings/{id}/brief":{"get":{"tags":["Bookings"],"summary":"Read the pre-call sales brief composed for a booking","description":"The pre-call brief Luca wrote for this booking: who the lead is, what they're after, and the objections to expect.\n\n**API key scopes:** `bookings:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingBriefResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["bookings:read"]},{"bearerAuth":["bookings:read"]}],"operationId":"getBookingsByIdBrief"}},"/api/call-events":{"get":{"tags":["Call events"],"summary":"List call events awaiting the coach's outcome/feedback","description":"The post-call queue: calls whose time has passed that still need the coach to say what happened. This drives the outcome prompt in the dashboard.\n\n**API key scopes:** `call_events:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:read"]},{"bearerAuth":["call_events:read"]}],"operationId":"getCallEvents","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/call-events/{id}":{"get":{"tags":["Call events"],"summary":"Read a single call event","description":"One call event with its outcome, rating, summary, and CRM sync state.\n\n**API key scopes:** `call_events:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the call event this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:read"]},{"bearerAuth":["call_events:read"]}],"operationId":"getCallEventsById"}},"/api/call-events/by-booking/{bookingId}":{"get":{"tags":["Call events"],"summary":"Read the call event for a booking (if one exists)","description":"Finds the call event attached to a booking. You'll get a 404 when the booking has no call event yet, which is normal for a call that hasn't happened.\n\n**API key scopes:** `call_events:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookingId","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:read"]},{"bearerAuth":["call_events:read"]}],"operationId":"getCallEventsByBookingByBookingId"}},"/api/call-events/by-lead/{leadId}":{"get":{"tags":["Call events"],"summary":"List every call event for a lead (call history), oldest call first","description":"The full call history for one lead, oldest first, so a second or third call reads in sequence.\n\n**API key scopes:** `call_events:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"leadId","in":"path","description":"Identifier of the lead this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:read"]},{"bearerAuth":["call_events:read"]}],"operationId":"getCallEventsByLeadByLeadId"}},"/api/call-events/backfill/{bookingId}":{"post":{"tags":["Call events"],"summary":"Create a call event for a past booking and generate its summary","description":"Creates a call event for a booking that predates automatic creation, then queues its summary. It only works on calls whose time has passed. A future booking returns 409, because there's no conversation to summarize and the summary would be made up. Safe to call twice: an existing call event comes back as is.\n\n**API key scopes:** `call_events:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"bookingId","in":"path","description":"Identifier of the booking this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:write"]},{"bearerAuth":["call_events:write"]}],"operationId":"postCallEventsBackfillByBookingId"}},"/api/call-events/{id}/feedback":{"post":{"tags":["Call events"],"summary":"Report a call's outcome, rating, and structured feedback","description":"The coach's report on how the call went. A `completed` or `no_show` outcome also records booking attendance, and a completed call queues its summary. A `no_show` can start recovery messages to the lead, so an API key needs the `queue_ops` grant to record one. Resubmitting the identical form is deduped. A correction, like a fixed rating or an added note, runs the learning loop again.\n\n**API key scopes:** `call_events:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the call event this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventFeedbackCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:write"]},{"bearerAuth":["call_events:write"]}],"operationId":"postCallEventsByIdFeedback"}},"/api/call-events/{id}/summary":{"post":{"tags":["Call events"],"summary":"Generate (or regenerate) the AI summary for a call event","description":"Queues a fresh summary and returns straight away. Poll the call event for the result. A summary that already reached the CRM is re-armed, so the new text updates the same note. Repeated clicks inside the same minute collapse into one model call.\n\n**API key scopes:** `call_events:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the call event this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallSummaryTriggerResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:write"]},{"bearerAuth":["call_events:write"]}],"operationId":"postCallEventsByIdSummary"},"put":{"tags":["Call events"],"summary":"Edit a call summary before it is pushed to the CRM","description":"Replaces the generated summary with the coach's own wording and pushes it. If the old text already reached the CRM, the push updates that same note instead of adding a second one.\n\n**API key scopes:** `call_events:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the call event this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallSummaryUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:write"]},{"bearerAuth":["call_events:write"]}],"operationId":"putCallEventsByIdSummary"}},"/api/call-events/{id}/push-to-crm":{"post":{"tags":["Call events"],"summary":"Push the current summary to the CRM now (skip the review wait)","description":"Sends the current summary to the CRM now, without waiting out the review window. Re-pushing updates the existing note.\n\n**API key scopes:** `call_events:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the call event this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallSummaryTriggerResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:write"]},{"bearerAuth":["call_events:write"]}],"operationId":"postCallEventsByIdPushToCrm"}},"/api/call-events/{id}/undo-outcome":{"post":{"tags":["Call events"],"summary":"Undo an attendance outcome within the allowed window","description":"Clears a mistaken attendance mark and puts the call back in the queue. The window is 48 hours from when the outcome was set, not from the last edit, so summary and CRM writes can't quietly extend it. You'll get a 400 once it's passed.\n\n**API key scopes:** `call_events:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the call event this operation targets."},{"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"string","enum":["none"]}]},"required":false,"name":"x-luca-expected-outcome-updated-at","in":"header","description":"The `x-luca-expected-outcome-updated-at` this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallEventResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["call_events:write"]},{"bearerAuth":["call_events:write"]}],"operationId":"postCallEventsByIdUndoOutcome"}},"/api/cadences/rescue":{"post":{"tags":["Cadences"],"summary":"Enroll silent leads into the rescue cadence","description":"Enrolls leads who've gone quiet into the rescue follow-up sequence. Luca drafts every touch. With auto-send off, each one still lands in the review queue first.\n\n**API key scopes:** `cadences:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RescueEnrollRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RescueEnrollResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"plan upgrade required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["cadences:write"]},{"bearerAuth":["cadences:write"]}],"operationId":"postCadencesRescue","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/broadcasts":{"get":{"tags":["Broadcasts"],"summary":"List broadcasts","description":"Cursor-paginated broadcasts with their current status.\n\n**API key scopes:** `broadcasts:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","enum":["draft","previewed","approved","running","paused","cancelled","completed","failed"]},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:read"]},{"bearerAuth":["broadcasts:read"]}],"operationId":"getBroadcasts"},"post":{"tags":["Broadcasts"],"summary":"Create a broadcast draft","description":"Creates a draft. Nothing sends and the recipient list isn't fixed until the broadcast is approved.\n\n**API key scopes:** `broadcasts:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:write"]},{"bearerAuth":["broadcasts:write"]}],"operationId":"postBroadcasts","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/broadcasts/{id}":{"get":{"tags":["Broadcasts"],"summary":"Get broadcast detail","description":"One broadcast with its segment, its message, and per-recipient progress.\n\n**API key scopes:** `broadcasts:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the broadcast this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:read"]},{"bearerAuth":["broadcasts:read"]}],"operationId":"getBroadcastsById"}},"/api/broadcasts/{id}/preview":{"post":{"tags":["Broadcasts"],"summary":"Refresh broadcast segment preview and sample messages","description":"Freezes who matches right now and renders the exact sample the coach can approve. Preview again after any audience or campaign change.\n\n**API key scopes:** `broadcasts:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the broadcast this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastPreview"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:write"]},{"bearerAuth":["broadcasts:write"]}],"operationId":"postBroadcastsByIdPreview"}},"/api/broadcasts/{id}/approve":{"post":{"tags":["Broadcasts"],"summary":"Approve a broadcast and snapshot recipients","description":"Approves the exact preview version the coach reviewed. If its audience, consent, account, or campaign changed, the request returns a conflict and requires a new preview.\n\n**API key scopes:** `broadcasts:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the broadcast this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastApprove"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:write"]},{"bearerAuth":["broadcasts:write"]}],"operationId":"postBroadcastsByIdApprove"}},"/api/broadcasts/{id}/launch":{"post":{"tags":["Broadcasts"],"summary":"Launch an approved broadcast","description":"Starts sending to the snapshotted recipients. Only an approved broadcast can launch, and the safety limits are checked again right here.\n\n**API key scopes:** `broadcasts:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the broadcast this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:write"]},{"bearerAuth":["broadcasts:write"]}],"operationId":"postBroadcastsByIdLaunch"}},"/api/broadcasts/{id}/pause":{"post":{"tags":["Broadcasts"],"summary":"Pause a running broadcast","description":"Stops a running broadcast. Queued messages are held. Anything already sent is gone. Emits `broadcast.paused`.\n\n**API key scopes:** `broadcasts:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the broadcast this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastControl"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:write"]},{"bearerAuth":["broadcasts:write"]}],"operationId":"postBroadcastsByIdPause"}},"/api/broadcasts/{id}/retry":{"post":{"tags":["Broadcasts"],"summary":"Retry failed broadcast recipients","description":"Sends again to the recipients whose delivery failed, and leaves the successful ones alone.\n\n**API key scopes:** `broadcasts:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the broadcast this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastRetry"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:write"]},{"bearerAuth":["broadcasts:write"]}],"operationId":"postBroadcastsByIdRetry"}},"/api/broadcasts/{id}/cancel":{"post":{"tags":["Broadcasts"],"summary":"Cancel a broadcast","description":"Cancels the broadcast. A draft is discarded, and a running one stops for good. If you want it back later, pause it instead.\n\n**API key scopes:** `broadcasts:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the broadcast this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastControl"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastDetail"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["broadcasts:write"]},{"bearerAuth":["broadcasts:write"]}],"operationId":"postBroadcastsByIdCancel"}},"/api/campaigns":{"get":{"tags":["Campaigns"],"summary":"List campaigns","description":"Cursor-paginated campaigns with their status and latest published version.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","enum":["draft","published","paused","archived"]},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaigns"},"post":{"tags":["Campaigns"],"summary":"Create a campaign draft","description":"Creates a draft. You can edit it freely, and it enrolls nobody until you publish it.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"payment required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaigns","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/campaigns/generate":{"post":{"tags":["Campaigns"],"summary":"Generate a campaign draft plan","description":"Builds a campaign plan from a brief with fixed rules, without a model. Nothing is saved. Create the draft from the plan, review it, and publish it yourself.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGenerate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignGenerateResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaignsGenerate","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/campaigns/comment-events":{"get":{"tags":["Campaigns"],"summary":"List recent comment campaign evaluations","description":"Latest filtered campaign evaluations with totals across every matching event, including suppressed comments and their reasons.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":false,"name":"campaignId","in":"query","description":"Return only records belonging to this campaign."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","enum":["matched","suppressed","blocked","pending_review","sent","failed","enrolled","replayed","resolved"]},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"schema":{"type":"string","minLength":1},"required":false,"name":"sourceType","in":"query","description":"Return only records of this source type."},{"schema":{"type":"string","enum":["valid","expired","missing_scope","unknown"]},"required":false,"name":"tokenState","in":"query","description":"Return only connections whose token is in this state."},{"schema":{"type":"string","enum":["green","yellow","red","unknown"]},"required":false,"name":"providerHealth","in":"query","description":"Return only connections at this health level."},{"schema":{"type":"string","minLength":1},"required":false,"name":"repairState","in":"query","description":"Return only connections in this repair state."},{"schema":{"type":"string","minLength":1,"maxLength":120},"required":false,"name":"q","in":"query","description":"Free-text search term."},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":50},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignCommentEventListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsCommentEvents"}},"/api/campaigns/{id}/analytics":{"get":{"tags":["Campaigns"],"summary":"Get campaign attribution and performance analytics","description":"Attribution and performance for one campaign over a window: what it sent, what it moved, and what it earned.\n\n**API key scopes:** `analytics:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"schema":{"type":"string","minLength":1},"required":false,"name":"since","in":"query","description":"Return only records changed at or after this point."},{"schema":{"type":"string","minLength":1},"required":false,"name":"until","in":"query","description":"Return only records changed at or before this point."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignAnalyticsResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["analytics:read"]},{"bearerAuth":["analytics:read"]}],"operationId":"getCampaignsByIdAnalytics"}},"/api/campaigns/{id}/provider-capabilities":{"get":{"tags":["Campaigns"],"summary":"Evaluate campaign provider capabilities","description":"Checks this campaign's steps against what the target channel can actually do. Run it before publishing, since publish runs the same check and will block you.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignProviderCapabilitiesResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsByIdProviderCapabilities"}},"/api/campaigns/{id}/enrollments":{"get":{"tags":["Campaigns"],"summary":"List campaign enrollments","description":"Cursor-paginated enrollments for the campaign, newest first, with each lead's position in it. Pass `nextCursor` back as `cursor` for the next page.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignEnrollmentListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsByIdEnrollments"},"post":{"tags":["Campaigns"],"summary":"Enroll a lead in the latest published campaign version","description":"Enrolls one lead into the campaign's latest published version. A campaign that isn't published (draft, paused or archived) can't take enrollments and answers 409 campaign_not_published.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignEnrollLead"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignEnrollmentResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaignsByIdEnrollments"}},"/api/campaigns/{id}/enrollments/{enrollmentId}/timeline":{"get":{"tags":["Campaigns"],"summary":"Get campaign enrollment timeline","description":"Every step one enrollment has been through, what got sent, and how the lead responded.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"enrollmentId","in":"path","description":"Identifier of the enrollment this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignEnrollmentTimelineResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsByIdEnrollmentsByEnrollmentIdTimeline"}},"/api/campaigns/{id}":{"get":{"tags":["Campaigns"],"summary":"Get campaign draft and latest published version","description":"The working draft next to the latest published version, so you can see what's live against what's being edited.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsById"},"delete":{"tags":["Campaigns"],"summary":"Delete a draft or archived campaign","description":"Deletes the campaign with its draft, versions, enrollments, and events. Sends it already made stay on record. A published or paused campaign may still have leads in flight, so archive it first.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteCampaignsById"}},"/api/campaigns/{id}/simulations":{"get":{"tags":["Campaigns"],"summary":"List campaign simulation runs","description":"Cursor-paginated simulation runs for this campaign, newest first. Pass `nextCursor` back as `cursor` for the next page.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSimulationListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsByIdSimulations"},"post":{"tags":["Campaigns"],"summary":"Run a campaign simulation without side effects","description":"Runs the campaign against sample leads and shows what it would have done. Nothing sends, and no enrollment state moves.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSimulationCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSimulationDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaignsByIdSimulations"}},"/api/campaigns/{id}/comment-simulation-suite":{"post":{"tags":["Campaigns"],"summary":"Run the required Instagram comment-to-DM simulation suite","description":"Runs the Instagram comment-to-DM suite. Any campaign that uses comment automation has to pass it before it can publish.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignCommentSimulationSuiteCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignCommentSimulationSuiteResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaignsByIdCommentSimulationSuite"}},"/api/campaigns/{id}/simulations/{simulationId}":{"get":{"tags":["Campaigns"],"summary":"Get a campaign simulation run with trace","description":"One simulation run with its full step-by-step trace.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"simulationId","in":"path","description":"Identifier of the simulation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignSimulationDetail"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsByIdSimulationsBySimulationId"}},"/api/campaigns/{id}/draft":{"patch":{"tags":["Campaigns"],"summary":"Autosave a campaign draft","description":"Autosave for the draft editor. If someone else edited in the meantime you'll get a 409, so nobody's work gets quietly overwritten.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDraftUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"patchCampaignsByIdDraft"}},"/api/campaigns/{id}/versions":{"get":{"tags":["Campaigns"],"summary":"List a campaign's published version history","description":"The campaign's published version history. Published versions can't change, so this is the record of what actually ran.\n\n**API key scopes:** `campaigns:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignVersionsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:read"]},{"bearerAuth":["campaigns:read"]}],"operationId":"getCampaignsByIdVersions"}},"/api/campaigns/{id}/status":{"post":{"tags":["Campaigns"],"summary":"Pause, resume, or archive a campaign","description":"Pauses, resumes, or archives the campaign. A transition that doesn't make sense is rejected instead of forced through.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStatusUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaignsByIdStatus"}},"/api/campaigns/{id}/duplicate":{"post":{"tags":["Campaigns"],"summary":"Duplicate a campaign into a fresh draft","description":"Copies the campaign into a fresh unpublished draft and leaves the original alone. A trialing coach at the trial campaign cap gets 402.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"402":{"description":"payment required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaignsByIdDuplicate"}},"/api/campaigns/{id}/publish":{"post":{"tags":["Campaigns"],"summary":"Publish a campaign draft as an immutable version","description":"Freezes the draft as a new version and points new enrollments at it. Published versions never change. A paused campaign stays paused until it is resumed, and an archived campaign can't be published. If the target provider can't do something the campaign needs, publish is blocked, so check `/provider-capabilities` first.\n\n**API key scopes:** `campaigns:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the campaign this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignPublishResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["campaigns:write"]},{"bearerAuth":["campaigns:write"]}],"operationId":"postCampaignsByIdPublish"}},"/api/billing/checkout":{"post":{"tags":["Billing"],"summary":"Create a Stripe Checkout Session","description":"Returns a Stripe Checkout URL for the tier you name. If the coach has no Stripe customer yet, this creates one and caches it on the coach row. Success and cancel URLs are forced back to the app origin, so you can't redirect a coach off-site.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingCheckoutResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postBillingCheckout","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/billing/portal":{"post":{"tags":["Billing"],"summary":"Create a Stripe Customer Portal session","description":"Returns a Stripe Customer Portal URL where the coach handles payment methods, invoices, and cancellation. The return URL is forced back to the app origin.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingPortalResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postBillingPortal","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/billing/subscription":{"get":{"tags":["Billing"],"summary":"Read the cached plan tier and status","description":"The plan tier, status, and billing period cached on the coach row, plus whether this workspace can be sold an annual plan. Stripe is still the source of truth. This is the mirror the app reads.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingSubscriptionResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getBillingSubscription","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/billing/message-packs/checkout":{"post":{"tags":["Billing"],"summary":"Start checkout for a message top-up pack","description":"Opens a Stripe Checkout session for a pack of extra messages on top of the plan's monthly pool, and returns the URL to send the coach to. The messages are only credited once Stripe reports the payment.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","maxLength":255},"required":false,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagePackCheckoutBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PackCheckoutResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postBillingMessagePacksCheckout"}},"/api/conversations/export":{"get":{"tags":["Conversations"],"summary":"Download the coach's full conversation history as JSON","description":"The workspace's full conversation history as one JSON download. It's built for backup and migration, not for polling.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationExportResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getConversationsExport","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/conversations":{"get":{"tags":["Conversations"],"summary":"List the coach's recent conversations","description":"Cursor-paginated, most recent activity first. channelAccountId filters one stored account row; channel and externalAccountId together include older bindings for the same provider account. Call the detail endpoint for messages.\n\n**API key scopes:** `conversations:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"channelAccountId","in":"query","description":"Identifier of the channel account this operation targets."},{"schema":{"type":"string","minLength":1},"required":false,"name":"externalAccountId","in":"query","description":"Identifier of the external account this operation targets."},{"schema":{"type":"string","minLength":1},"required":false,"name":"q","in":"query","description":"Free-text search term."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"leadId","in":"query","description":"Return only records belonging to this lead."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:read"]},{"bearerAuth":["conversations:read"]}],"operationId":"getConversations"}},"/api/conversations/summary":{"get":{"tags":["Conversations"],"summary":"Count visible conversations by channel","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationTotalsResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:read"]},{"bearerAuth":["conversations:read"]}],"description":"**API key scopes:** `conversations:read`.","operationId":"getConversationsSummary","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/conversations/{id}":{"get":{"tags":["Conversations"],"summary":"Get a conversation with messages and lead context","description":"One thread with its recent messages and the lead context Luca had when it drafted. Use `/messages` to page further back.\n\n**API key scopes:** `conversations:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetailResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:read"]},{"bearerAuth":["conversations:read"]}],"operationId":"getConversationsById"}},"/api/conversations/{id}/profile-refresh":{"post":{"tags":["Conversations"],"summary":"Refresh a conversation's lead profile photo","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationProfileRefreshResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:write"]},{"bearerAuth":["conversations:write"]}],"description":"**API key scopes:** `conversations:write`. You also need an `Idempotency-Key` header.","operationId":"postConversationsByIdProfileRefresh"}},"/api/conversations/{id}/read-marker":{"put":{"tags":["Conversations"],"summary":"Mark a conversation read for the signed-in user","description":"Moves the signed-in user's read marker to the message named by `upToMessageId`, so a message that arrived after the coach looked stays unread. Without a body it moves to the thread's newest inbound message. Each team member has their own marker. The marker never moves backwards, so repeating the call changes nothing.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationReadMarkerBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationReadMarkerResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"putConversationsByIdReadMarker"}},"/api/conversations/{id}/messages":{"get":{"tags":["Conversations"],"summary":"Load an older page of a conversation's messages","description":"Pages backward through a thread's history, for threads longer than the window the detail endpoint returns.\n\n**API key scopes:** `conversations:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"schema":{"type":"string","minLength":1},"required":false,"name":"before","in":"query","description":"Return only records created before this point."},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationMessagesResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:read"]},{"bearerAuth":["conversations:read"]}],"operationId":"getConversationsByIdMessages"}},"/api/conversations/{id}/messages/{messageId}/retry":{"post":{"tags":["Conversations"],"summary":"Retry the failed suffix of a partially sent message","description":"Queues only message parts that are known not to have reached the provider. Luca refuses the retry when provider acceptance is unknown.\n\n**API key scopes:** `conversations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"messageId","in":"path","description":"Identifier of the message this operation targets."},{"schema":{"type":"string","minLength":1,"maxLength":255},"required":true,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationPartialRetryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:write"]},{"bearerAuth":["conversations:write"]}],"operationId":"postConversationsByIdMessagesByMessageIdRetry"}},"/api/conversations/{id}/messages/{messageId}/media/{mediaId}/retry":{"post":{"tags":["Conversations"],"summary":"Retry a failed voice-note transcription","description":"Queues another transcription attempt for a voice note on a message in this conversation. The refusal names why a retry cannot run: one is already running, the limit is reached, or the original audio is gone.\n\n**API key scopes:** `conversations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"messageId","in":"path","description":"Identifier of the message this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"mediaId","in":"path","description":"Identifier of the media this operation targets."},{"schema":{"type":"string","minLength":1},"required":true,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"202":{"description":"accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewMediaRetryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:write"]},{"bearerAuth":["conversations:write"]}],"operationId":"postConversationsByIdMessagesByMessageIdMediaByMediaIdRetry"}},"/api/conversations/{id}/send-status":{"get":{"tags":["Conversations"],"summary":"Reconcile a manual reply without sending it again","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"schema":{"type":"string","minLength":1,"maxLength":255},"required":true,"name":"idempotencyKey","in":"query","description":"The `idempotencyKey` this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSendStatusResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:read"]},{"bearerAuth":["conversations:read"]}],"description":"**API key scopes:** `conversations:read`.","operationId":"getConversationsByIdSendStatus"}},"/api/conversations/{id}/send":{"post":{"tags":["Conversations"],"summary":"Manually send a message in a conversation","description":"Queues a coach-approved message for delivery on the lead's channel. Every send uses the durable outbound-content outbox and an Idempotency-Key.\n\n**API key scopes:** `conversations:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"schema":{"type":"string","minLength":1,"maxLength":255},"required":true,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSendBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSendResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:write"]},{"bearerAuth":["conversations:write"]}],"operationId":"postConversationsByIdSend"}},"/api/conversations/{id}/reply-failures/{failureId}/retry":{"post":{"tags":["Conversations"],"summary":"Send a failed manual reply again","description":"Sends the reply the coach wrote again, under the key it first went out with, so a repeat never reaches the lead twice. Only a failure that is safe to repeat can be retried. A failure that no longer applies is refused.\n\n**API key scopes:** `conversations:write`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"failureId","in":"path","description":"Identifier of the failure this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationSendResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:write"]},{"bearerAuth":["conversations:write"]}],"operationId":"postConversationsByIdReplyFailuresByFailureIdRetry"}},"/api/conversations/{id}/reply-failures/{failureId}/dismiss":{"post":{"tags":["Conversations"],"summary":"Dismiss a failed manual reply","description":"Closes a failed reply the coach is done with. It leaves the thread on every device. Dismissing twice changes nothing.\n\n**API key scopes:** `conversations:write`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the conversation this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"failureId","in":"path","description":"Identifier of the failure this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationReplyFailureDismissResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["conversations:write"]},{"bearerAuth":["conversations:write"]}],"operationId":"postConversationsByIdReplyFailuresByFailureIdDismiss"}},"/api/reports/morning":{"get":{"tags":["Reports"],"summary":"Morning digest: the last 24h of review-queue activity","description":"The last 24 hours of review-queue activity, shaped as the morning digest a coach reads to start the day.\n\n**API key scopes:** `reports:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MorningReportResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["reports:read"]},{"bearerAuth":["reports:read"]}],"operationId":"getReportsMorning","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/reports/scorecard":{"get":{"tags":["Reports"],"summary":"Trailing-7-day sales scorecard: calls, outcomes, drafts, hours saved","description":"The workspace scorecard: the headline numbers on how the setter is performing.\n\n**API key scopes:** `reports:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScorecardResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["reports:read"]},{"bearerAuth":["reports:read"]}],"operationId":"getReportsScorecard","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/review-queue":{"get":{"summary":"List review-queue items","tags":["Review queue"],"parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","enum":["pending","approved","rejected","sent","superseded","stale"]},"required":false,"name":"status","in":"query","description":"Return only records in this status."},{"schema":{"type":"string","enum":["faq","qualification","objection","scheduling","pricing-adjacent","other"]},"required":false,"name":"category","in":"query","description":"Return only records in this category."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"leadId","in":"query","description":"Return only records belonging to this lead."},{"schema":{"type":"string","enum":["priority","fifo"]},"required":false,"name":"order","in":"query","description":"Ordering applied to the page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewListResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:read"]},{"bearerAuth":["review_queue:read"]}],"description":"**API key scopes:** `review_queue:read`.","operationId":"getReviewQueue"}},"/api/review-queue/{id}/media/{mediaId}/retry":{"post":{"summary":"Retry failed voice-note transcription for review only","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"mediaId","in":"path","description":"Identifier of the media this operation targets."},{"schema":{"type":"string","minLength":1},"required":true,"name":"idempotency-key","in":"header","description":"Key that makes this mutation safe to retry. Replaying a key returns the original response with `Idempotency-Replayed: true` instead of acting twice."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"202":{"description":"accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewMediaRetryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"description":"**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","operationId":"postReviewQueueByIdMediaByMediaIdRetry"}},"/api/review-queue/sla":{"get":{"summary":"Speed-to-lead SLA stats over the last 30 days","tags":["Review queue"],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewSlaResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:read"]},{"bearerAuth":["review_queue:read"]}],"description":"**API key scopes:** `review_queue:read`.","operationId":"getReviewQueueSla","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/review-queue/summary":{"get":{"summary":"Pending count and newest pending drafts, without draft bodies","tags":["Review queue"],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewSummaryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:read"]},{"bearerAuth":["review_queue:read"]}],"description":"**API key scopes:** `review_queue:read`.","operationId":"getReviewQueueSummary","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/review-queue/drafting":{"get":{"summary":"Inbound turns Luca is still drafting a reply for","tags":["Review queue"],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewDraftingResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:read"]},{"bearerAuth":["review_queue:read"]}],"description":"**API key scopes:** `review_queue:read`.","operationId":"getReviewQueueDrafting","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/review-queue/changes":{"get":{"summary":"Ids that entered and left the pending queue since a version, with the pending and drafting counts","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"date-time"},"required":false,"name":"since","in":"query","description":"Return only records changed at or after this point."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewChangesResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:read"]},{"bearerAuth":["review_queue:read"]}],"description":"**API key scopes:** `review_queue:read`.","operationId":"getReviewQueueChanges"}},"/api/review-queue/drafting/{turnId}/cancel":{"post":{"summary":"Cancel the draft Luca is writing for one inbound turn","description":"Stops the run at its next step. The row stays on the drafting list for 24 hours with Retry and Dismiss. A queued draft that is still pending is taken back; an approved or sent one is not. Cancelling a turn that a cancel already stopped answers state cancelled.\n\n**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"turnId","in":"path","description":"Identifier of the turn this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftingCancelResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"operationId":"postReviewQueueDraftingByTurnIdCancel"}},"/api/review-queue/drafting/{turnId}/retry":{"post":{"summary":"Draft again for a cancelled, paused or failed turn","description":"Starts the turn again as the next attempt. Only the lead's latest turn in a conversation restarts. A turn restarts at most 3 times through retry and regenerate; after that the call fails with 409 drafting_retry_limit. Retrying a turn that is already drafting a restarted attempt answers that attempt.\n\n**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"turnId","in":"path","description":"Identifier of the turn this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"202":{"description":"accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftingRetryResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"operationId":"postReviewQueueDraftingByTurnIdRetry"}},"/api/review-queue/drafting/{turnId}/dismiss":{"post":{"summary":"Remove a cancelled, paused or failed turn from the drafting list","description":"Dismissing a turn that is already dismissed succeeds.\n\n**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"turnId","in":"path","description":"Identifier of the turn this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"204":{"description":"no content"},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"operationId":"postReviewQueueDraftingByTurnIdDismiss"}},"/api/review-queue/{id}/regenerate":{"post":{"summary":"Replace a pending draft by drafting its turn again","description":"Supersedes the pending draft and restarts the inbound turn it came from as the next attempt. An optional hint tells Luca what to change in the new draft. An approved or sent draft cannot be replaced. Regenerate and retry share a limit of 3 restarts per turn; after that the call fails with 409 drafting_retry_limit.\n\n**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRegenerateRequest"}}}},"responses":{"202":{"description":"accepted","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRegenerateResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"422":{"description":"unprocessable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"operationId":"postReviewQueueByIdRegenerate"}},"/api/review-queue/bulk-approve":{"post":{"summary":"Approve several review-queue items in one call","description":"Approves each draft as `POST /api/review-queue/{id}/approve` does, with no edit, and returns one outcome per id. A draft already handled, or not in your queue, is skipped; the rest still run.\n\n**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","tags":["Review queue"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewBulk"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewBulkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"operationId":"postReviewQueueBulkApprove","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/review-queue/bulk-reject":{"post":{"summary":"Reject several review-queue items in one call","description":"Rejects each draft as `POST /api/review-queue/{id}/reject` does, with no reason, and returns one outcome per id. A draft already handled, or not in your queue, is skipped; the rest still run.\n\n**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","tags":["Review queue"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewBulk"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewBulkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"operationId":"postReviewQueueBulkReject","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/review-queue/{id}/explain":{"get":{"summary":"Explain the signals behind a drafted reply","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DraftExplainResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:read"]},{"bearerAuth":["review_queue:read"]}],"description":"**API key scopes:** `review_queue:read`.","operationId":"getReviewQueueByIdExplain"}},"/api/review-queue/{id}/approve":{"post":{"summary":"Approve a review-queue item; optional final body override","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewApprove"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewResolveResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"description":"**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","operationId":"postReviewQueueByIdApprove"}},"/api/review-queue/{id}/reject":{"post":{"summary":"Reject a review-queue item; optional reason and note","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewReject"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewResolveResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"description":"**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","operationId":"postReviewQueueByIdReject"}},"/api/review-queue/{id}/restore":{"post":{"summary":"Restore a rejected review-queue item to pending","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewResolveResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"description":"**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","operationId":"postReviewQueueByIdRestore"}},"/api/review-queue/{id}/objection-variant":{"post":{"summary":"Record which objection-specialist variant the coach picked","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ObjectionVariantSelect"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewResolveResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:write"]},{"bearerAuth":["review_queue:write"]}],"description":"**API key scopes:** `review_queue:write`. You also need an `Idempotency-Key` header.","operationId":"postReviewQueueByIdObjectionVariant"}},"/api/review-queue/{id}/composer":{"get":{"summary":"Read messaging controls for a workspace review item","tags":["Review queue"],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the review queue item this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewComposerResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"501":{"description":"not implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["review_queue:read"]},{"bearerAuth":["review_queue:read"]}],"description":"**API key scopes:** `review_queue:read`.","operationId":"getReviewQueueByIdComposer"}},"/api/channels":{"get":{"tags":["Channels"],"summary":"List the coach's current channel accounts","description":"One current row per provider account, with its status and connection date. Older rows remain available by ID for history. Credentials never show up here.\n\n**API key scopes:** `channels:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["channels:read"]},{"bearerAuth":["channels:read"]}],"operationId":"getChannels","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["Channels"],"summary":"Connect a new channel account","description":"Closed on purpose. A channel account only gets created by finishing a verified provider flow, so posting credentials straight here always returns 400. Use the connect flow for that channel.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelAccountSummary"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postChannels","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/channels/catalog":{"get":{"tags":["Channels"],"summary":"List channels and whether they can be connected yet","description":"Every channel Luca knows about, and whether it's live yet. The UI uses this to show a coming-soon channel without pretending it can be connected. Availability is a per-channel flag, not a per-coach one.\n\n**API key scopes:** `channels:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelCatalogResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["channels:read"]},{"bearerAuth":["channels:read"]}],"operationId":"getChannelsCatalog","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/channels/features":{"get":{"tags":["Channels"],"summary":"List channel features and provider readiness requirements","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelFeatureCatalogResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["channels:read"]},{"bearerAuth":["channels:read"]}],"description":"**API key scopes:** `channels:read`.","operationId":"getChannelsFeatures","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/channels/{id}":{"get":{"tags":["Channels"],"summary":"Read a channel account with redacted credentials","description":"One channel account. Stored credentials never come back, in any form.\n\n**API key scopes:** `channels:read`.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelAccountSummary"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"501":{"description":"not implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["channels:read"]},{"bearerAuth":["channels:read"]}],"operationId":"getChannelsById"},"patch":{"tags":["Channels"],"summary":"Pause or resume a channel account","description":"Pauses a connected account or resumes an account the coach paused. Disconnect, reconnect, suspension, and credentials use their verified provider flows.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelPatchResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchChannelsById"},"delete":{"tags":["Channels"],"summary":"Disconnect a channel account","description":"Disables the account locally, deletes Instagram, Messenger, or Telegram channel history immediately, then cleans up the provider webhook with durable recovery. The account row remains for audit and reconnect.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelDeleteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteChannelsById"}},"/api/channels/{id}/auto-send":{"patch":{"tags":["Channels"],"summary":"Set AI DM auto-send for one channel account","description":"Controls Luca-drafted DM replies for this account. The account sends only while the workspace master switch (PATCH /api/settings/auto-send) is also on. Turning this switch on also turns the master on, which lets every other channel with its own switch on send too; the response reports the master. The master never changes this value. Campaign sends use a separate policy. A disabled switch puts drafts in review.\n\n**API key scopes:** `channels:write`. You also need an `Idempotency-Key` header.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelAiDmAutoSendPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelAiDmAutoSendResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["channels:write"]},{"bearerAuth":["channels:write"]}],"operationId":"patchChannelsByIdAutoSend"}},"/api/channels/{id}/remove":{"post":{"tags":["Channels"],"summary":"Remove a channel account","description":"Disconnects the account if it is still connected and hides it from the channel list after provider cleanup completes. Instagram, Messenger, and Telegram history is deleted at disconnect; WhatsApp history remains available.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postChannelsByIdRemove"}},"/api/channels/{id}/repair":{"post":{"tags":["Channels"],"summary":"Repair the provider webhook subscription and probe it","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelHealthResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"501":{"description":"not implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postChannelsByIdRepair"}},"/api/channels/{id}/health":{"post":{"tags":["Channels"],"summary":"Probe per-channel connectivity","description":"Calls the provider to check the stored credentials still work and the account is reachable. Use it when a coach says messages aren't arriving.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelHealthResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"501":{"description":"not implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postChannelsByIdHealth"}},"/api/channels/{id}/templates":{"get":{"tags":["Channels"],"summary":"List approved WhatsApp templates","description":"The WhatsApp message templates Meta has approved for this account. Outside the 24-hour customer service window, an approved template is the only thing WhatsApp will deliver.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppTemplatesResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"501":{"description":"not implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getChannelsByIdTemplates"}},"/api/channels/{id}/templates/sync":{"post":{"tags":["Channels"],"summary":"Refresh one WhatsApp template catalog","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppTemplateSyncResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"501":{"description":"not implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postChannelsByIdTemplatesSync"}},"/api/channels/{id}/templates/{templateId}/preview":{"post":{"tags":["Channels"],"summary":"Validate WhatsApp template bindings and build an exact preview","parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path","description":"Identifier of the channel this operation targets."},{"schema":{"type":"string","format":"uuid"},"required":true,"name":"templateId","in":"path","description":"Identifier of the template this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppTemplatePreviewRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppTemplatePreviewResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"501":{"description":"not implemented","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postChannelsByIdTemplatesByTemplateIdPreview"}},"/api/account-safety":{"get":{"tags":["Account safety"],"summary":"Per-channel safety overview","description":"One row per connected channel account, with the safety state Luca is working under: the rate-limit posture and when we last probed the account.\n\n**API key scopes:** `safety:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountSafetyOverviewResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["safety:read"]},{"bearerAuth":["safety:read"]}],"operationId":"getAccountSafety","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/usage":{"get":{"tags":["Usage"],"summary":"Current-month cost rollup","description":"Month-to-date model spend against the tier's budget, with the dollars remaining and an `overCap` flag. Pass `since` to roll up from a different start date.\n\n**API key scopes:** `usage:read`.","parameters":[{"schema":{"type":"string","minLength":1},"required":false,"name":"since","in":"query","description":"Return only records changed at or after this point."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["usage:read"]},{"bearerAuth":["usage:read"]}],"operationId":"getUsage"}},"/api/usage/messages":{"get":{"tags":["Usage"],"summary":"Read the month's message pool state","description":"The month's message pool: allowance, messages used, top-up pack bonus, and what's left. A coach still on trial economics is measured against the trial cap since the trial started, not against the monthly pool.\n\n**API key scopes:** `usage:read`.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessagePoolResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["usage:read"]},{"bearerAuth":["usage:read"]}],"operationId":"getUsageMessages","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/audit-log":{"get":{"tags":["Audit log"],"summary":"Cursor-paginated audit history","description":"The coach-visible audit trail, newest first. Filter by actor type, action, action prefix, or target. Cursor paging orders by creation time, so a page stays put while new entries land on top.\n\n**API key scopes:** `coach:read`.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"actorType","in":"query","description":"Return only entries recorded by this kind of actor."},{"schema":{"type":"string","minLength":1},"required":false,"name":"action","in":"query","description":"Return only entries recording this action."},{"schema":{"type":"string","minLength":1},"required":false,"name":"actionPrefix","in":"query","description":"Return only entries whose action starts with this prefix."},{"schema":{"type":"string","minLength":1},"required":false,"name":"targetType","in":"query","description":"Return only entries recorded against this kind of target."},{"schema":{"type":"string","minLength":1},"required":false,"name":"targetId","in":"query","description":"Return only entries recorded against this target."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditLogListResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]},{"apiKey":["coach:read"]},{"bearerAuth":["coach:read"]}],"operationId":"getAuditLog"}},"/api/debug/inbound-pipeline":{"get":{"tags":["Debug"],"summary":"List persisted inbound pipeline debug events","description":"Stored trace events from the inbound pipeline, for working out why a message routed, drafted, or stalled the way it did. Admin only, and a user session only. API keys get a 403.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"string","minLength":1},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"conversationId","in":"query","description":"Return only records in this conversation."},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"leadId","in":"query","description":"Return only records belonging to this lead."},{"schema":{"type":"string","minLength":1},"required":false,"name":"providerMessageId","in":"query","description":"Return only records carrying this provider-side message id."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundPipelineDebugResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"admin access required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getDebugInboundPipeline"}},"/api/inbound/activity":{"get":{"tags":["Channels"],"summary":"List recent inbound outcomes for the current workspace","description":"Coach-safe intake and suppression outcomes. Acceptance means queued for processing, not recipient delivery. Private payloads and provider identifiers are excluded.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","enum":["telegram","instagram","messenger","whatsapp"]},"required":false,"name":"channel","in":"query","description":"Return only records on this messaging channel."},{"schema":{"type":"string","minLength":1},"required":false,"name":"cursor","in":"query","description":"Opaque pagination cursor from the previous page. Omit it for the first page."},{"schema":{"type":"integer","minimum":1,"maximum":100},"required":false,"name":"limit","in":"query","description":"Maximum number of items to return on this page."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InboundActivityResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getInboundActivity"}},"/api/settings/developer/api-keys":{"get":{"tags":["API keys"],"summary":"List developer API keys","description":"Every key in the organization the caller is allowed to see. You also get the workspaces they can mint keys for, the scopes on offer, and whether they can manage keys at all. A member with narrow workspace access only sees keys confined to workspaces they can read. Key material never comes back here.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperApiKeysResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getSettingsDeveloperApiKeys","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]},"post":{"tags":["API keys"],"summary":"Create a developer API key","description":"Mints a key and returns the raw secret exactly once, with ready-to-run examples. A key can never carry more than the person minting it already holds, so we check each requested scope against the caller's permissions in every target workspace. Capability and data-sensitivity tiers default to least privilege when you leave them out.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperApiKeyCreate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperApiKeyCreateResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postSettingsDeveloperApiKeys","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/settings/developer/api-keys/{id}":{"patch":{"tags":["API keys"],"summary":"Update a developer API key","description":"Change a key's name, scopes, workspaces, or rate limit. Fields you leave out keep their current values, and the same permission check that gates creation applies to the new scopes.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path","description":"Identifier of the API key this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperApiKeyUpdate"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperApiKey"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchSettingsDeveloperApiKeysById"},"delete":{"tags":["API keys"],"summary":"Delete a developer API key","description":"Removes the key row for good. Revoking is usually better: it stops the key just as fast and leaves the history readable.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path","description":"Identifier of the API key this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperApiKey"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteSettingsDeveloperApiKeysById"}},"/api/settings/developer/api-keys/{id}/revoke":{"post":{"tags":["API keys"],"summary":"Revoke a developer API key","description":"Disables the key and stamps when it happened, keeping the row so the audit trail still resolves. The key stops authenticating right away.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path","description":"Identifier of the API key this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeveloperApiKey"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postSettingsDeveloperApiKeysByIdRevoke"}},"/api/settings/auto-send":{"patch":{"tags":["Settings"],"summary":"Set the workspace master switch for AI DM auto-send","description":"The master switch for Luca-drafted DM replies. Off, nothing auto-sends and every draft waits in review. On, each Telegram, Instagram, and Messenger account follows its own switch under /api/channels/{id}/auto-send, which this setting never changes. WhatsApp AI replies always stay in review. Safety holds and rejected drafts stay in review.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoSendPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoSendResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchSettingsAutoSend","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/settings/tool-belt":{"patch":{"tags":["Settings"],"summary":"Set an explicit tool-belt override for this coach","description":"Pins the tool belt on or off for this coach instead of following the rollout default. Only set it when you mean to override.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolBeltPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolBeltResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchSettingsToolBelt","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/settings/multi-part-drafts":{"patch":{"tags":["Settings"],"summary":"Set an explicit multi-part drafts override for this coach","description":"Pins multi-part drafts on or off for this coach instead of following the rollout default. Only set it when you mean to override.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MultiPartDraftsPatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MultiPartDraftsResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchSettingsMultiPartDrafts","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/settings/voice":{"patch":{"tags":["Settings"],"summary":"Update tone slider or bump voice fingerprint","description":"Moves the tone slider, bumps the voice fingerprint version, or both. The fingerprint version is the counter voice reads carry, so bumping it is how a caller says the coach's voice has changed.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicePatch"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceSettingsResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"patchSettingsVoice","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/sales/objections/import":{"post":{"tags":["Objections"],"summary":"Import historical sales conversations for objection extraction","description":"Hands a batch of past sales transcripts to the worker, which distills reusable objection-handling patterns from them. It returns as soon as the job is queued. Nothing here changes how Luca drafts until a pattern is adopted.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ObjectionImportRequest"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ObjectionImportResponse"}}}},"400":{"description":"validation failed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postSalesObjectionsImport","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/sales/objections/patterns":{"get":{"tags":["Objections"],"summary":"List objection patterns extracted from imported conversations","description":"The objection patterns the import produced, waiting for the coach to adopt or discard each one.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportedObjectionPatternListResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getSalesObjectionsPatterns","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/sales/objections/patterns/{id}/adopt":{"post":{"tags":["Objections"],"summary":"Adopt an imported pattern as a custom objection-bucket override","description":"Promotes an imported pattern into a custom override for its objection bucket, which is what makes it affect drafting. The override and the pattern flag move together, so a concurrent import can't half-apply it.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path","description":"Identifier of the pattern this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportedObjectionPatternAdoptResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"postSalesObjectionsPatternsByIdAdopt"}},"/api/sales/objections/patterns/{id}":{"delete":{"tags":["Objections"],"summary":"Discard an imported objection pattern","description":"Drops an imported pattern from the playbook. Deleting one that's already gone still succeeds, so a retried delete never fails.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","parameters":[{"schema":{"type":"string","minLength":1},"required":true,"name":"id","in":"path","description":"Identifier of the pattern this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportedObjectionPatternDeleteResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"deleteSalesObjectionsPatternsById"}},"/api/members":{"get":{"tags":["Team members"],"summary":"List workspace members and pending invitations","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MembersResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"getMembers","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/members/invite":{"post":{"tags":["Team members"],"summary":"Invite a new member to the workspace","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteMemberBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteMemberResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postMembersInvite","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}},"/api/members/{id}":{"patch":{"tags":["Team members"],"summary":"Update a member's role or permission overrides","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"Identifier of the member this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberBody"}}}},"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateMemberResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"patchMembersById"},"delete":{"tags":["Team members"],"summary":"Remove a member from the workspace","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"Identifier of the member this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"deleteMembersById"}},"/api/members/invitations/{id}/accept":{"post":{"tags":["Team members"],"summary":"Accept a workspace invitation","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"Identifier of the invitation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInvitationResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postMembersInvitationsByIdAccept"}},"/api/members/invitations/{id}/decline":{"post":{"tags":["Team members"],"summary":"Decline a workspace invitation","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"Identifier of the invitation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postMembersInvitationsByIdDecline"}},"/api/members/invitations/{id}/resend":{"post":{"tags":["Team members"],"summary":"Resend a pending invitation","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"Identifier of the invitation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"502":{"description":"upstream failure","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postMembersInvitationsByIdResend"}},"/api/members/invitations/{id}/revoke":{"post":{"tags":["Team members"],"summary":"Revoke a pending workspace invitation","parameters":[{"schema":{"type":"string"},"required":true,"name":"id","in":"path","description":"Identifier of the invitation this operation targets."},{"$ref":"#/components/parameters/LucaApiVersion"}],"responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OkResponse"}}}},"400":{"description":"bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"403":{"description":"forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"404":{"description":"not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"409":{"description":"conflict","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"410":{"description":"gone","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"500":{"description":"internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"503":{"description":"service unavailable","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"description":"**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","operationId":"postMembersInvitationsByIdRevoke"}},"/api/voice-fingerprint":{"get":{"tags":["Voice"],"summary":"Read the current voice fingerprint version","description":"A stub that always answers `0`. The live fingerprint version is the `voiceFingerprintVersion` field on `GET /v1/coaches/me`, so read it there.\n\n**Session-only.** This endpoint isn't on the API-key allowlist. An organization API key gets a 403 here, whatever scopes it holds.","responses":{"200":{"description":"ok","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceFingerprintRefreshResponse"}}}},"401":{"description":"unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}},"429":{"description":"rate limited","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorEnvelope"}}}}},"security":[{"sessionCookie":[]}],"operationId":"getVoiceFingerprint","parameters":[{"$ref":"#/components/parameters/LucaApiVersion"}]}}},"webhooks":{},"servers":[{"url":"https://api.setluca.com","description":"The Luca API"}]}