{"openapi":"3.1.0","info":{"title":"ZvonAI API","description":"Backend API for ZvonAI voice receptionist platform","version":"0.1.0"},"paths":{"/health":{"get":{"tags":["status"],"summary":"Health","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health/detailed":{"get":{"tags":["status"],"summary":"Health Detailed","operationId":"health_detailed_health_detailed_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemHealthResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/health/live":{"get":{"tags":["status"],"summary":"Liveness","operationId":"liveness_health_live_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/health/ready":{"get":{"tags":["status"],"summary":"Readiness","operationId":"readiness_health_ready_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/status":{"get":{"tags":["status"],"summary":"Public Status","description":"Public status payload — drives zvonai.ai/status and the dashboard widget.","operationId":"public_status_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusPageResponse"}}}}}}},"/status/incidents/{incident_id}":{"get":{"tags":["status"],"summary":"Get Incident","operationId":"get_incident_status_incidents__incident_id__get","parameters":[{"name":"incident_id","in":"path","required":true,"schema":{"type":"string","title":"Incident Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncidentDTO"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/status/subscribe":{"post":{"tags":["status"],"summary":"Subscribe","operationId":"subscribe_status_subscribe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscribeBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/status/confirm":{"get":{"tags":["status"],"summary":"Confirm Subscription","operationId":"confirm_subscription_status_confirm_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/status/unsubscribe":{"get":{"tags":["status"],"summary":"Unsubscribe","operationId":"unsubscribe_status_unsubscribe_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/incidents":{"get":{"tags":["admin"],"summary":"Admin Incidents","description":"Last 10 provider downtime and auto-fallback events from the audit log.","operationId":"admin_incidents_admin_incidents_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/AuditLogEntry"},"type":"array","title":"Response Admin Incidents Admin Incidents Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]},"post":{"tags":["status"],"summary":"Admin Create Incident","operationId":"admin_create_incident_admin_incidents_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncidentCreateBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncidentDTO"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/incidents/{incident_id}/updates":{"post":{"tags":["status"],"summary":"Admin Post Update","operationId":"admin_post_update_admin_incidents__incident_id__updates_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"incident_id","in":"path","required":true,"schema":{"type":"string","title":"Incident Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncidentUpdateBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncidentDTO"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/status/incidents":{"post":{"tags":["status"],"summary":"Ci Open Incident","description":"Open a status incident from CI (post-deploy gate failure).\n\nUsed by .github/workflows/ci.yaml when post-deploy synthetic call fails.\nThe deploy SHA is recorded so the incident can be correlated with the\nbad release for instant rollback targeting.","operationId":"ci_open_incident_internal_status_incidents_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CiIncidentBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IncidentDTO"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/status/deploy-event":{"post":{"tags":["status"],"summary":"Ci Deploy Event","description":"Record a successful deploy as a status-page event (low-noise).\n\nJust writes a structured log entry — these don't open incidents, they\ncorrelate with the next signal failure (so we can blame a deploy).","operationId":"ci_deploy_event_internal_status_deploy_event_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CiDeployEventBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/metrics":{"get":{"tags":["status"],"summary":"Metrics","operationId":"metrics_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/auth/register":{"post":{"tags":["auth"],"summary":"Register","description":"Register a new user (creates user without tenant - tenant assigned during onboarding).","operationId":"register_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserRegister"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/login":{"post":{"tags":["auth"],"summary":"Login","description":"Login and get access token.","operationId":"login_auth_login_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_auth_login_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/me":{"get":{"tags":["auth"],"summary":"Get Me","description":"Get current user info including subscription tier from tenant.","operationId":"get_me_auth_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/logout":{"post":{"tags":["auth"],"summary":"Logout","description":"Blacklist the current JWT so it can't be reused.","operationId":"logout_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/refresh":{"post":{"tags":["auth"],"summary":"Refresh Token","description":"Issue a new token and blacklist the old one.","operationId":"refresh_token_auth_refresh_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/change-password":{"post":{"tags":["auth"],"summary":"Change Password","description":"Change password.","operationId":"change_password_auth_change_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordChange"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/verify-password":{"post":{"tags":["auth"],"summary":"Verify Password Endpoint","description":"Re-authenticate: verify the user's password for sensitive actions (e.g., delete account).","operationId":"verify_password_endpoint_auth_verify_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/oauth/google/url":{"get":{"tags":["auth"],"summary":"Get Google Auth Url","description":"Return the Google OAuth consent URL.","operationId":"get_google_auth_url_auth_oauth_google_url_get","parameters":[{"name":"redirect_uri","in":"query","required":true,"schema":{"type":"string","title":"Redirect Uri"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleAuthUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/oauth/google":{"post":{"tags":["auth"],"summary":"Google Oauth Login","description":"Exchange Google authorization code for JWT token.","operationId":"google_oauth_login_auth_oauth_google_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleOAuthRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/2fa/challenge":{"post":{"tags":["auth"],"summary":"Two Factor Challenge","description":"Verify 2FA code and issue full access token.","operationId":"two_factor_challenge_auth_2fa_challenge_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TwoFactorChallengeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Token"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/forgot-password":{"post":{"tags":["auth"],"summary":"Forgot Password","description":"Send password reset email.","operationId":"forgot_password_auth_forgot_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ForgotPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/reset-password":{"post":{"tags":["auth"],"summary":"Reset Password","description":"Reset password using a valid reset token.","operationId":"reset_password_auth_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/verify-email":{"post":{"tags":["auth"],"summary":"Verify Email","description":"Verify email address using the token from the verification email.","operationId":"verify_email_auth_verify_email_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/verify-email-code":{"post":{"tags":["auth"],"summary":"Verify Email Code","description":"Verify email address using the 6-digit code sent to the user's inbox.\n\nRate-limited + per-code attempt counter: a 6-digit code is only 10^6\npossibilities, and this endpoint had NO limiter (audit 2026-07-08 A2) —\nbrute-forceable from distributed IPs. The Redis attempt counter is keyed\non the email so rotating IPs doesn't help: 5 wrong codes invalidates the\ncode and the user must request a fresh one.","operationId":"verify_email_code_auth_verify_email_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailCodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/resend-verification-by-email":{"post":{"tags":["auth"],"summary":"Resend Verification By Email","description":"Resend email verification code without requiring auth token (for post-registration flow).","operationId":"resend_verification_by_email_auth_resend_verification_by_email_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationByEmailRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/auth/resend-verification":{"post":{"tags":["auth"],"summary":"Resend Verification","description":"Resend email verification link (rate limited to 3 per 15 minutes).","operationId":"resend_verification_auth_resend_verification_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/onboarding/complete":{"post":{"tags":["onboarding"],"summary":"Complete Onboarding","description":"Complete onboarding: create tenant, provision number, optionally start Stripe checkout.\n\nConcurrent-submit guard (audit fix): Redis SET NX claim per user_id with\n60s TTL. Prevents duplicate tenant creation + double Telnyx purchase when\nthe dashboard double-submits (mobile double-tap, retry on 502 from Stripe).","operationId":"complete_onboarding_onboarding_complete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingCreate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/onboarding/scrape-faq":{"post":{"tags":["onboarding"],"summary":"Onboarding Scrape Faq","description":"Scrape FAQ from a website during onboarding (no tenant required).","operationId":"onboarding_scrape_faq_onboarding_scrape_faq_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingScrapeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingScrapeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/onboarding/request-number":{"post":{"tags":["onboarding"],"summary":"Request Phone Number","description":"Provision an additional Twilio number for an existing tenant.","operationId":"request_phone_number_onboarding_request_number_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneNumberRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/onboarding/status":{"get":{"tags":["onboarding"],"summary":"Get Onboarding Status","description":"Get current onboarding status for user.","operationId":"get_onboarding_status_onboarding_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/onboarding/forwarding-instructions":{"get":{"tags":["onboarding"],"summary":"Get Forwarding Instructions","description":"Get carrier-specific call forwarding instructions for the tenant's ZvonAI number.","operationId":"get_forwarding_instructions_onboarding_forwarding_instructions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/onboarding/verify-forwarding":{"post":{"tags":["onboarding"],"summary":"Verify Call Forwarding","description":"Place a test call to verify call forwarding reaches our voice engine.\n\nThe owner sets up forwarding on their carrier, then clicks \"Test\" in the UI.\nWe call their original number — if forwarding is set up correctly, the call\nreaches our voice engine and the AI greeting plays.","operationId":"verify_call_forwarding_onboarding_verify_forwarding_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyForwardingRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/onboarding/draft":{"get":{"tags":["onboarding"],"summary":"Get Onboarding Draft","description":"Load onboarding draft from server.","operationId":"get_onboarding_draft_onboarding_draft_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]},"put":{"tags":["onboarding"],"summary":"Save Onboarding Draft","description":"Persist onboarding draft to the server so progress survives across devices.\n\nHard-caps the JSON body at 64 KiB to prevent unauthenticated DB bloat —\npre-onboarding users can hit this endpoint and would otherwise be able to\nwrite unbounded JSON into users.onboarding_data.","operationId":"save_onboarding_draft_onboarding_draft_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SaveDraftRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/tenants/by-number/{phone_number}":{"get":{"tags":["tenants"],"summary":"Get Tenant By Number","description":"Get tenant config by assigned phone number.\n\nCalled by voice engine to load config when a call comes in.\n\nService-to-service only (X-Internal-Key): returns the full tenant config\n(system prompt, FAQ, transfer numbers, data sources). Must never be\nanonymously reachable — phone numbers are enumerable. See SECURITY_REVIEW_2026-06-18 H3.","operationId":"get_tenant_by_number_tenants_by_number__phone_number__get","parameters":[{"name":"phone_number","in":"path","required":true,"schema":{"type":"string","title":"Phone Number"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/":{"get":{"tags":["tenants"],"summary":"List Tenants","description":"List all tenants (admin only).","operationId":"list_tenants_tenants__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"skip","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/src__routers__tenants__TenantListResponse"},"title":"Response List Tenants Tenants  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tenants"],"summary":"Create Tenant","description":"Create a new tenant.","operationId":"create_tenant_tenants__post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/src__routers__tenants__TenantListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/nip-lookup":{"get":{"tags":["tenants"],"summary":"Nip Lookup","description":"Look up company data from GUS BIR by NIP.\n\nReturns 400 if NIP format is invalid, 404 if not in GUS,\n503 if GUS is unreachable.","operationId":"nip_lookup_tenants_nip_lookup_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"nip","in":"query","required":true,"schema":{"type":"string","description":"10-digit NIP number","title":"Nip"},"description":"10-digit NIP number"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NipLookupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}":{"get":{"tags":["tenants"],"summary":"Get Tenant","description":"Get full tenant config by ID.","operationId":"get_tenant_tenants__tenant_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["tenants"],"summary":"Update Tenant","description":"Update tenant settings.","operationId":"update_tenant_tenants__tenant_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/src__routers__tenants__TenantListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenants"],"summary":"Delete Tenant Account","description":"Delete tenant account and all associated data (GDPR Art. 17 - right to erasure).\n\nGuards:\n- Must own the tenant (or be admin)\n- Subscription must be cancelled or non-existent (can't delete while paying)\n- No outstanding invoices\n\nHard deletes: tenant profile, phone numbers, departments, calls, transcripts, usage.\nRetains (7 years, Polish tax law): invoices, payment records.","operationId":"delete_tenant_account_tenants__tenant_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteAccountRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/settings":{"get":{"tags":["tenants"],"summary":"Get Tenant Settings","description":"Get billing/quota and data-retention settings for a tenant.","operationId":"get_tenant_settings_tenants__tenant_id__settings_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["tenants"],"summary":"Update Tenant Settings","description":"Update billing/quota and data-retention settings.","operationId":"update_tenant_settings_tenants__tenant_id__settings_put","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/readiness":{"get":{"tags":["tenants"],"summary":"Get Tenant Readiness","description":"Go-live readiness checklist — what's done, what's left, and deep-links.\n\nSingle source of truth shared with the Zvon agent's check_readiness tool.","operationId":"get_tenant_readiness_tenants__tenant_id__readiness_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/go-live":{"post":{"tags":["tenants"],"summary":"Go Live","description":"Activate the AI to take real calls. Refuses if required setup is missing.","operationId":"go_live_tenants__tenant_id__go_live_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/verification-config":{"get":{"tags":["tenants"],"summary":"Get Verification Config","description":"Return the tenant's caller verification config (with defaults if not yet set).","operationId":"get_verification_config_tenants__tenant_id__verification_config_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["tenants"],"summary":"Update Verification Config","description":"Update caller verification config for a tenant.","operationId":"update_verification_config_tenants__tenant_id__verification_config_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationConfigUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/reminder-config":{"get":{"tags":["tenants"],"summary":"Get Reminder Config","description":"Return the tenant's appointment reminder config (with defaults if not yet set).","operationId":"get_reminder_config_tenants__tenant_id__reminder_config_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["tenants"],"summary":"Update Reminder Config","description":"Update appointment reminder config for a tenant.","operationId":"update_reminder_config_tenants__tenant_id__reminder_config_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderConfigUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/quota":{"get":{"tags":["tenants"],"summary":"Check Tenant Quota","description":"Check if tenant has quota to accept a NEW inbound call.\n\nCalled by voice engine at the TwiML layer before opening a media stream.\nCalls already in progress are never interrupted — quota is only checked\nat call START. If this returns allowed=False, voice engine plays a polite\nrejection TwiML and hangs up before any stream is opened.\n\ncaller_hash (optional, salted SHA-256 — never the raw number) enables the\nper-caller daily abuse cap: a single number can't burn the tenant's monthly\nquota by calling repeatedly. Enforced HERE (pre-answer) so the voice engine\ncan speak a polite message and forward to the business, not drop to silence.","operationId":"check_tenant_quota_tenants__tenant_id__quota_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"caller_hash","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caller Hash"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/QuotaResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/usage":{"get":{"tags":["tenants"],"summary":"Get Tenant Usage","description":"Get detailed usage breakdown for the dashboard.","operationId":"get_tenant_usage_tenants__tenant_id__usage_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/anomalies":{"get":{"tags":["tenants"],"summary":"Get Tenant Anomalies","description":"Return anomaly alerts for this tenant from the last 24 hours (max 5).\n\nOnly the tenant's own user may query this endpoint.","operationId":"get_tenant_anomalies_tenants__tenant_id__anomalies_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AnomalyEntry"},"title":"Response Get Tenant Anomalies Tenants  Tenant Id  Anomalies Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/usage/sms":{"post":{"tags":["tenants"],"summary":"Increment Sms Usage","description":"Increment tenant's SMS usage counter. Called by voice engine after sending SMS.","operationId":"increment_sms_usage_tenants__tenant_id__usage_sms_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SMSUsageIncrement"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/phone-numbers":{"post":{"tags":["tenants"],"summary":"Assign Phone Number","description":"Assign a phone number to a tenant.","operationId":"assign_phone_number_tenants__tenant_id__phone_numbers_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneNumberAssign"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["tenants"],"summary":"List Phone Numbers","description":"List all phone numbers assigned to this tenant.\n\nCalled by the owner's dashboard with their JWT — was previously gated\nbehind X-Internal-Key, which 422'd every dashboard load and (via the\noverview's Promise.all) blanked the whole panel including the quota\nwidget. Scoped to the caller's own tenant for isolation.","operationId":"list_phone_numbers_tenants__tenant_id__phone_numbers_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/phone-numbers/{phone_id}":{"patch":{"tags":["tenants"],"summary":"Update Phone Number","description":"Update phone number label or active status.","operationId":"update_phone_number_tenants__tenant_id__phone_numbers__phone_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneNumberUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenants"],"summary":"Delete Phone Number","description":"Remove an assigned phone number.","operationId":"delete_phone_number_tenants__tenant_id__phone_numbers__phone_id__delete","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/phone-numbers/request":{"post":{"tags":["tenants"],"summary":"Request Phone Number","description":"Request a new phone number (creates a pending audit log entry for admin review).","operationId":"request_phone_number_tenants__tenant_id__phone_numbers_request_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneNumberRequestBody"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/phone-numbers/provision":{"post":{"tags":["tenants"],"summary":"Provision Phone Number","description":"Instantly provision a new Polish phone number for a Business+ tenant.","operationId":"provision_phone_number_tenants__tenant_id__phone_numbers_provision_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/departments":{"get":{"tags":["tenants"],"summary":"List Departments","description":"List all departments for a tenant.","operationId":"list_departments_tenants__tenant_id__departments_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DepartmentResponse"},"title":"Response List Departments Tenants  Tenant Id  Departments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tenants"],"summary":"Add Department","description":"Add a department to a tenant.","operationId":"add_department_tenants__tenant_id__departments_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/departments/{department_id}":{"patch":{"tags":["tenants"],"summary":"Update Department","description":"Update a department.","operationId":"update_department_tenants__tenant_id__departments__department_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"department_id","in":"path","required":true,"schema":{"type":"string","title":"Department Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DepartmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenants"],"summary":"Delete Department","description":"Delete a department.","operationId":"delete_department_tenants__tenant_id__departments__department_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"department_id","in":"path","required":true,"schema":{"type":"string","title":"Department Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/export":{"get":{"tags":["tenants"],"summary":"Export Tenant Data","description":"Export all tenant data (GDPR Art. 20 - right to data portability).\n\nReturns complete JSON export of tenant's data including:\n- Profile information\n- Call history and transcripts\n- Usage statistics\n- Configuration settings","operationId":"export_tenant_data_tenants__tenant_id__export_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataExportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/undelete":{"post":{"tags":["tenants"],"summary":"Undelete Tenant Account","description":"Restore a tenant account that is in the 30-day delete grace period.\n\nRequires admin role OR the original owner whose user record still\nreferences this tenant_id. Phone numbers were released to the provider\non delete (audit fix #50), so the owner needs to reprovision via\n/onboarding/request-number — that's a deliberate UX choice to avoid\nleaving paid Telnyx numbers attached to dormant accounts.","operationId":"undelete_tenant_account_tenants__tenant_id__undelete_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calls/active":{"get":{"tags":["tenants"],"summary":"Get Active Calls","description":"Get current active calls count for a tenant. Called by voice engine pre-call.","operationId":"get_active_calls_tenants__tenant_id__calls_active_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calls/active/increment":{"post":{"tags":["tenants"],"summary":"Increment Active Calls","description":"Atomically increment calls_active when a call starts.\n\nGating depends on the tenant's overage opt-in:\n  - TRIALING, or PAID without overage_enabled → atomically gated. The\n    WHERE clause blocks any concurrent call past concurrent_calls_limit;\n    the loser gets `accepted=False` and the voice engine plays \"all lines\n    busy\". No silent card charge.\n  - PAID with overage_enabled → always increment; calls beyond the limit\n    are flagged is_overage=True. These calls draw from the normal monthly\n    minute quota like any other call — there is NO separate per-minute\n    overage charge (that double-counted minutes; removed 2026-06-11).\n\nReturns:\n    accepted: bool          — False when the concurrent limit is hit and\n                              the extra simultaneous call is not opted into\n    calls_active: int       — the post-increment count (or pre if rejected)\n    limit: int              — the plan's concurrent calls limit\n    is_overage: bool        — True when this call exceeded the concurrent\n                              limit (analytics only; not billed separately)","operationId":"increment_active_calls_tenants__tenant_id__calls_active_increment_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calls/active/decrement":{"post":{"tags":["tenants"],"summary":"Decrement Active Calls","description":"Atomically decrement calls_active when a call ends. Called by voice engine.","operationId":"decrement_active_calls_tenants__tenant_id__calls_active_decrement_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calls/overage":{"post":{"tags":["tenants"],"summary":"Record Call Overage","description":"Record overage minutes from a concurrent-overage call. Called by voice engine at call end.\n\nAtomically adds minutes to overage_minutes counter. Month-end cron bills at 3 PLN/min.","operationId":"record_call_overage_tenants__tenant_id__calls_overage_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OverageRecordRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/security-events":{"post":{"tags":["tenants"],"summary":"Log Security Event","description":"Log a security event from voice engine (social engineering, prompt injection).","operationId":"log_security_event_tenants__tenant_id__security_events_post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SecurityEventCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calendar":{"get":{"tags":["tenants"],"summary":"Get Calendar Status","description":"Get calendar integration status for a tenant.\n\nOwner-only: leaks the connected Google account email otherwise.\nSee SECURITY_REVIEW_2026-06-18 M2.","operationId":"get_calendar_status_tenants__tenant_id__calendar_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenants"],"summary":"Disconnect Calendar","description":"Disconnect calendar integration (remove stored tokens).\n\nOwner-only: prevents an anonymous request from wiping any tenant's calendar\nintegration. See SECURITY_REVIEW_2026-06-18 H6.","operationId":"disconnect_calendar_tenants__tenant_id__calendar_delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calendar/connect":{"post":{"tags":["tenants"],"summary":"Initiate Calendar Connect","description":"Start OAuth flow — returns auth URL for the client to redirect to.\n\nOwner-only: this is the front half of the token-hijack chain (H1) — it\nbuilds the OAuth URL with state=tenant_id. See SECURITY_REVIEW_2026-06-18 M2.","operationId":"initiate_calendar_connect_tenants__tenant_id__calendar_connect_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calendar/callback":{"post":{"tags":["tenants"],"summary":"Handle Calendar Callback","description":"Exchange OAuth code for tokens and store them.\n\nOwner-only: without this gate an attacker could POST their own OAuth code to\na victim tenant and have ZvonAI store the attacker's calendar tokens (or\nredirect the victim's tokens elsewhere) — patient bookings would flow to the\nattacker's calendar. See SECURITY_REVIEW_2026-06-18 H1.","operationId":"handle_calendar_callback_tenants__tenant_id__calendar_callback_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarCallbackRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/payment-config":{"get":{"tags":["tenants"],"summary":"Get Payment Config","description":"Return the payment configuration for a tenant.","operationId":"get_payment_config_tenants__tenant_id__payment_config_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["tenants"],"summary":"Update Payment Config","description":"Create or update the payment configuration for a tenant.","operationId":"update_payment_config_tenants__tenant_id__payment_config_put","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentConfigUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/data-sources":{"get":{"tags":["tenants"],"summary":"List Data Sources","description":"List all data sources for a tenant.","operationId":"list_data_sources_tenants__tenant_id__data_sources_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DataSourceResponse"},"title":"Response List Data Sources Tenants  Tenant Id  Data Sources Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tenants"],"summary":"Create Data Source","description":"Create a new data source for a tenant. Requires Business plan or higher.","operationId":"create_data_source_tenants__tenant_id__data_sources_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSourceCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/data-sources/{source_id}":{"patch":{"tags":["tenants"],"summary":"Update Data Source","description":"Update a data source.","operationId":"update_data_source_tenants__tenant_id__data_sources__source_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSourceUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSourceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenants"],"summary":"Delete Data Source","description":"Delete a data source.","operationId":"delete_data_source_tenants__tenant_id__data_sources__source_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/data-sources/{source_id}/consent":{"get":{"tags":["tenants"],"summary":"Get Data Source Consent","description":"Return latest consent for this source, or null if owner hasn't given any.\nUsed by the dashboard to know whether to show the modal or proceed.","operationId":"get_data_source_consent_tenants__tenant_id__data_sources__source_id__consent_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tenants"],"summary":"Post Data Source Consent","description":"Record owner consent for AI processing of sensitive data on this source.\n\nAppend-only — every call inserts a new row. Captures IP + user-agent +\npinned terms/privacy versions for non-repudiation. Owner re-consents\nif previously-unseen sensitive columns appear in a later fetch.","operationId":"post_data_source_consent_tenants__tenant_id__data_sources__source_id__consent_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/consent/legal-basis-options":{"get":{"tags":["tenants"],"summary":"Get Consent Legal Basis Options","description":"List the plain-language legal-basis options for the consent modal.","operationId":"get_consent_legal_basis_options_tenants__tenant_id__consent_legal_basis_options_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"locale","in":"query","required":false,"schema":{"type":"string","default":"pl","title":"Locale"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/data-sources/{source_id}/test":{"post":{"tags":["tenants"],"summary":"Test Data Source","description":"Test the connection to a Google Sheet by reading its first row.","operationId":"test_data_source_tenants__tenant_id__data_sources__source_id__test_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/data-sources/{source_id}/sync":{"post":{"tags":["tenants"],"summary":"Sync Data Source","description":"Trigger an immediate manual sync for one data source.\n\nAlso (re-)registers the Google Drive push notification watch channel.\nReturns {success, row_count, last_synced_at}.","operationId":"sync_data_source_tenants__tenant_id__data_sources__source_id__sync_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/data-sources/{source_id}/sync-status":{"get":{"tags":["tenants"],"summary":"Get Sync Status","description":"Return sync status for a data source.\n\nResponse: {last_synced_at: ISO str | null, row_count: int | null, is_stale: bool}\nis_stale = True when last sync was >5 minutes ago or never synced.","operationId":"get_sync_status_tenants__tenant_id__data_sources__source_id__sync_status_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/data-sources/import-excel":{"post":{"tags":["tenants"],"summary":"Import Excel","description":"Parse an uploaded .xlsx file and return a preview + detected column names.\n\nThe parsed rows are stored in Redis under a temporary import key (TTL 30d).\nThe caller should then POST /data-sources with type='excel_imported' and the\nreturned import_id to create a permanent data source backed by the cached rows.","operationId":"import_excel_tenants__tenant_id__data_sources_import_excel_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_excel_tenants__tenant_id__data_sources_import_excel_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/clients/lookup":{"get":{"tags":["tenants"],"summary":"Clients Lookup","description":"Verify a caller against the tenant's client records (voice engine, internal).\n\nTHE identity check behind verify_caller: a match here means the calling\nnumber appears in records the business itself maintains — an appointment\nthey booked, or a row in the business's client sheet/Excel. An impersonator\nwould have to be calling FROM the client's own number.\n\nMatched against, in order:\n  1. appointments.patient_phone (any non-cancelled appointment)\n  2. cached data-source rows (phone-synonym columns), same normalisation\n     the sheet tooling uses (+48/0048 stripped, 9-digit national compare)\n\nReturns 200 {\"name\": ..., \"matched_in\": ...} on match, 404 when unknown.\nNever returns case data — verification yields identity only; data flows\nthrough search_client_data with its own redaction rules.\n\nNOTE: this endpoint existed only as a voice-engine CLIENT until 2026-07-09\n— every call 404'd, so verified=true was unreachable and Business+ tenants\ncould never answer case-status questions. (Journey audit fix.)","operationId":"clients_lookup_tenants__tenant_id__clients_lookup_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"phone","in":"query","required":true,"schema":{"type":"string","description":"Caller phone number (raw, from telephony)","title":"Phone"},"description":"Caller phone number (raw, from telephony)"},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/callers":{"get":{"tags":["tenants"],"summary":"Crm Lookup Caller","description":"Look up a caller's CRM profile and call stats by phone number.","operationId":"crm_lookup_caller_tenants__tenant_id__crm_callers_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"phone","in":"query","required":true,"schema":{"type":"string","description":"Caller phone number","title":"Phone"},"description":"Caller phone number"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/callers/export":{"get":{"tags":["tenants"],"summary":"Crm Export Callers Csv","description":"GDPR-safe CSV export: phone_hash + name only (no raw phone numbers).","operationId":"crm_export_callers_csv_tenants__tenant_id__crm_callers_export_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/callers/list":{"get":{"tags":["tenants"],"summary":"Crm List Callers","description":"List all caller profiles for this tenant, optionally filtered by name.","operationId":"crm_list_callers_tenants__tenant_id__crm_callers_list_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"search","in":"query","required":false,"schema":{"type":"string","description":"Search by name","default":"","title":"Search"},"description":"Search by name"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/callers/history":{"get":{"tags":["tenants"],"summary":"Crm Get Call History","description":"Get the last N calls for a caller.\n\nThe dashboard only holds `phone_hash` (raw numbers are never sent to the\nclient for RODO reasons), so we match on the indexed `caller_number_hash`.\nThe voice engine, which has the raw number, may pass `phone` instead.","operationId":"crm_get_call_history_tenants__tenant_id__crm_callers_history_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"phone","in":"query","required":false,"schema":{"type":"string","description":"Caller phone number (raw)","default":"","title":"Phone"},"description":"Caller phone number (raw)"},{"name":"phone_hash","in":"query","required":false,"schema":{"type":"string","description":"Salted SHA-256 of the caller number","default":"","title":"Phone Hash"},"description":"Salted SHA-256 of the caller number"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/callers/notes":{"post":{"tags":["tenants"],"summary":"Crm Add Caller Note","description":"Add a note to a caller's CRM profile.","operationId":"crm_add_caller_note_tenants__tenant_id__crm_callers_notes_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallerNoteRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/callers/name":{"put":{"tags":["tenants"],"summary":"Crm Update Caller Name","description":"Set or update the caller's display name.\n\nAccepts either `phone_hash` (from the dashboard, which never holds raw\nnumbers) or `phone_number` (from the voice engine). Profiles are keyed by\nhash, so a hash from the list lookup updates the existing row directly.","operationId":"crm_update_caller_name_tenants__tenant_id__crm_callers_name_put","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallerNameRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/callers/{phone_hash}":{"delete":{"tags":["tenants"],"summary":"Crm Delete Caller Profile","description":"GDPR Art. 17 — Delete caller profile and notes. Call records are retained (legitimate interest).","operationId":"crm_delete_caller_profile_tenants__tenant_id__crm_callers__phone_hash__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"phone_hash","in":"path","required":true,"schema":{"type":"string","title":"Phone Hash"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/config":{"get":{"tags":["tenants"],"summary":"Get Crm Config","description":"Return current external CRM integration config (api_key masked).","operationId":"get_crm_config_tenants__tenant_id__crm_config_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["tenants"],"summary":"Save Crm Config","description":"Save external CRM integration settings.","operationId":"save_crm_config_tenants__tenant_id__crm_config_put","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CrmConfigRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/test":{"post":{"tags":["tenants"],"summary":"Test Crm Connection","description":"Test the external CRM connection using saved credentials.","operationId":"test_crm_connection_tenants__tenant_id__crm_test_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/specialists":{"get":{"tags":["tenants"],"summary":"Get Crm Specialists","description":"Return specialists/doctors from the connected CRM (used by dashboard wizard).","operationId":"get_crm_specialists_tenants__tenant_id__crm_specialists_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/crm/services":{"get":{"tags":["tenants"],"summary":"Get Crm Services","description":"Return services/treatments from the connected CRM (used by dashboard wizard).","operationId":"get_crm_services_tenants__tenant_id__crm_services_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"specialist_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Specialist Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/context":{"get":{"tags":["tenants"],"summary":"Get Tenant Context","description":"Return the full business context the AI agent needs at call start.\n\nIncludes greeting, FAQ, business hours, policies, voice config, and\ndata sources where ai_access=true and is_active=true.\n\nService-to-service only (X-Internal-Key): this dumps system prompt + FAQ +\nimported data-source rows (may contain customer/patient lists), so it must\nnever be anonymously reachable. See SECURITY_REVIEW_2026-06-18 H2.","operationId":"get_tenant_context_tenants__tenant_id__context_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calendar/appointments":{"get":{"tags":["tenants"],"summary":"List Appointments","description":"List appointments for a date range (default: current week).","operationId":"list_appointments_tenants__tenant_id__calendar_appointments_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD (default: start of current week)","title":"From Date"},"description":"ISO date YYYY-MM-DD (default: start of current week)"},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date YYYY-MM-DD (default: end of current week)","title":"To Date"},"description":"ISO date YYYY-MM-DD (default: end of current week)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AppointmentResponse"},"title":"Response List Appointments Tenants  Tenant Id  Calendar Appointments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["tenants"],"summary":"Create Appointment","description":"Create a new appointment.","operationId":"create_appointment_tenants__tenant_id__calendar_appointments_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/calendar/appointments/{appointment_id}":{"patch":{"tags":["tenants"],"summary":"Update Appointment","description":"Update appointment status, reschedule, or edit notes.","operationId":"update_appointment_tenants__tenant_id__calendar_appointments__appointment_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"appointment_id","in":"path","required":true,"schema":{"type":"string","title":"Appointment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["tenants"],"summary":"Cancel Appointment","description":"Cancel an appointment (sets status=cancelled, does not delete the row).","operationId":"cancel_appointment_tenants__tenant_id__calendar_appointments__appointment_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"appointment_id","in":"path","required":true,"schema":{"type":"string","title":"Appointment Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/test-call":{"post":{"tags":["tenants"],"summary":"Initiate Test Call","description":"Place an outbound call to the pro's phone to demo their own AI receptionist.\n\nZvonAI calls the pro from the shared number. When they answer, the voice\nengine streams their own AI configuration — same experience as a real patient\ncalling. Available on trial and all paid tiers.\n\nRate limited: 1 call per hour, 3 per day per tenant.","operationId":"initiate_test_call_tenants__tenant_id__test_call_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestCallRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestCallResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/polish-invoices":{"get":{"tags":["tenants"],"summary":"List Polish Invoices","description":"List Polish iFirma invoices for a tenant, newest first.","operationId":"list_polish_invoices_tenants__tenant_id__polish_invoices_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolishInvoiceListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/polish-invoices/{invoice_id}/pdf":{"get":{"tags":["tenants"],"summary":"Download Polish Invoice Pdf","description":"Stream a Polish invoice PDF straight from iFirma. Tenant-scoped.\n\nWe don't cache the PDF locally — iFirma is the source of truth and\ntenants download Faktury infrequently (once a month for the bookkeeper).","operationId":"download_polish_invoice_pdf_tenants__tenant_id__polish_invoices__invoice_id__pdf_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/":{"post":{"tags":["calls"],"summary":"Create Call","description":"Record a new call (called by voice engine at call start).","operationId":"create_call_calls__post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}":{"patch":{"tags":["calls"],"summary":"Update Call","description":"Update call record (called by voice engine at call end).","operationId":"update_call_calls__call_id__patch","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["calls"],"summary":"Get Call","description":"Get full call details including transcript (gated by plan).\n\nAdmins (tenant_id is null) may open any call — the /admin/calls drawer needs\nthis; the tenant scope still applies to every non-admin. (Audit 2026-06-19\nadmin-call-drawer.)","operationId":"get_call_calls__call_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/by-sid/{twilio_call_sid}":{"patch":{"tags":["calls"],"summary":"Update Call By Sid","description":"Update call by Twilio SID (convenience for voice engine).","operationId":"update_call_by_sid_calls_by_sid__twilio_call_sid__patch","parameters":[{"name":"twilio_call_sid","in":"path","required":true,"schema":{"type":"string","title":"Twilio Call Sid"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}/transcript":{"post":{"tags":["calls"],"summary":"Add Transcript","description":"Add transcript to a call (called by voice engine after call).\n\nIdempotent: voice-engine retry on 5xx must not 500 the second call with\nUNIQUE violation on call_id. If a transcript row already exists we\nupdate it in place and return 200.","operationId":"add_transcript_calls__call_id__transcript_post","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TranscriptCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}/usage":{"post":{"tags":["calls"],"summary":"Record Call Usage","description":"Record per-call cost breakdown (called by voice engine after call ends).\n\nAccepts both the legacy fields (stt_duration_seconds, tts_chars, etc.) and the\npreferred per-provider fields (elevenlabs_chars, deepgram_seconds, gemini_tokens,\ntwilio_minutes). Per-provider fields take precedence when non-zero.","operationId":"record_call_usage_calls__call_id__usage_post","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallUsageCreate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/tenant/{tenant_id}":{"get":{"tags":["calls"],"summary":"List Calls For Tenant","description":"List calls for a tenant (dashboard).","operationId":"list_calls_for_tenant_calls_tenant__tenant_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CallResponse"},"title":"Response List Calls For Tenant Calls Tenant  Tenant Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/search":{"get":{"tags":["calls"],"summary":"Search Calls","description":"Search calls with filters (Pro+ plan).\n\nAudit A5/47: q parameter does ILIKE match across summary, summary_pl,\nand outcome. Postgres full-text (with pg_trgm + GIN index) would scale\nbetter — deferred until call volume justifies the index cost.","operationId":"search_calls_calls_search_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date To"}},{"name":"phone_number","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"}},{"name":"q","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"description":"Full-text query — matches summary, summary_pl, outcome","title":"Q"},"description":"Full-text query — matches summary, summary_pl, outcome"},{"name":"callback_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Callback Only"}},{"name":"callback_unresolved","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Callback Unresolved"}},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls":{"get":{"tags":["calls"],"summary":"List Calls","description":"List calls for a tenant, optionally filtered by caller phone number.\n\nUsed by the privacy dashboard to search for a specific caller's data, and\nby the digest \"Zobacz rozmowy do sprawdzenia\" link (filter=errors) to show\ncalls where the AI promised something that failed (audit 2026-06-30).","operationId":"list_calls_calls_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"query","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"caller_phone","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caller Phone"}},{"name":"filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"'errors' = only calls with a broken promise, 'callbacks' = pending callbacks","title":"Filter"},"description":"'errors' = only calls with a broken promise, 'callbacks' = pending callbacks"},{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/stats/monthly":{"get":{"tags":["calls"],"summary":"Get Monthly Stats","description":"Monthly aggregate stats for the call summary view.\n\nUngated: these are the tenant's OWN basic call counts (like the funnel\nendpoint), not a premium analytics feature. Gating it behind business_insights\nblanked the summary page + dashboard stat cards for Solo/Trial. Ownership is\nstill enforced via current_user.tenant_id below.","operationId":"get_monthly_stats_calls_stats_monthly_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"month","in":"query","required":false,"schema":{"type":"string","description":"YYYY-MM format, defaults to current month","title":"Month"},"description":"YYYY-MM format, defaults to current month"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MonthlyCallStats"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/export/csv":{"get":{"tags":["calls"],"summary":"Export Calls Csv","description":"Export calls as CSV (Business+ plan). No raw transcripts per RODO.","operationId":"export_calls_csv_calls_export_csv_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"date_from","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date From"}},{"name":"date_to","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Date To"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}/recording":{"get":{"tags":["calls"],"summary":"Proxy Call Recording","description":"Stream the Twilio recording for a call.\n\nProxies audio from Twilio so raw credentials are never exposed to the frontend.\nRequires: caller's tenant must own the call and recording_available must be true.","operationId":"proxy_call_recording_calls__call_id__recording_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/tenant/{tenant_id}/stats":{"get":{"tags":["calls"],"summary":"Get Call Stats","description":"Get call statistics for a tenant (dashboard home stat cards).\n\nUngated (same reasoning as /stats/monthly): the tenant's own call counts,\nneeded by the dashboard home for every tier. Ownership enforced below.","operationId":"get_call_stats_calls_tenant__tenant_id__stats_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallStats"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/tenant/{tenant_id}/funnel":{"get":{"tags":["calls"],"summary":"Get Call Funnel","description":"Outcome funnel for the dashboard. Available on every plan — the funnel\nIS the product (we run the reception, we don't take messages). Revenue\nestimation only fires when avg_appointment_value_grosze is configured.","operationId":"get_call_funnel_calls_tenant__tenant_id__funnel_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"range","in":"query","required":false,"schema":{"type":"string","pattern":"^(today|7d|30d|month)$","default":"month","title":"Range"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallFunnel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}/callback-resolved":{"post":{"tags":["calls"],"summary":"Resolve Callback","description":"Mark a callback request as resolved.","operationId":"resolve_callback_calls__call_id__callback_resolved_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallbackResolveResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}/note":{"patch":{"tags":["calls"],"summary":"Update Team Note","description":"Add or update a team note on a call (Business+ plan).","operationId":"update_team_note_calls__call_id__note_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamNoteUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}/flag":{"post":{"tags":["calls"],"summary":"Flag Call","description":"Flag a call as problematic. Creates a MissedQuestion entry for AI improvement review.","operationId":"flag_call_calls__call_id__flag_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallFlagRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallFlagResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/data/by-phone/{phone_number}":{"delete":{"tags":["calls"],"summary":"Delete Caller Data","description":"GDPR Art. 17 — Right to erasure for a specific caller.\n\nHard-deletes transcripts, redacts caller_number, clears summary/sentiment,\nand tags the call record with 'gdpr_deleted'.","operationId":"delete_caller_data_calls_data_by_phone__phone_number__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"phone_number","in":"path","required":true,"schema":{"type":"string","title":"Phone Number"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/{call_id}/data":{"delete":{"tags":["calls"],"summary":"Delete Call Data","description":"GDPR Art. 17 — Right to erasure for a single call record (tenant self-service).\n\nRedacts: transcript turns → sentinel string, audio_url → None, summary → None,\n         caller_number → \"REDACTED\".\nKeeps:   duration_seconds, outcome, sentiment_score, called_at / started_at\n         (anonymised metadata for billing and audit trail).\nLogs:    AuditLog entry with action=\"gdpr_art17_request\".","operationId":"delete_call_data_calls__call_id__data_delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallDataDeleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/calls/by-caller":{"delete":{"tags":["calls"],"summary":"Wipe Calls By Caller","description":"GDPR Art. 17 — Right to erasure for all calls from a given caller.\n\nNormalizes E.164, then redacts transcript turns, summary, and caller_number\nacross all matching calls for this tenant.","operationId":"wipe_calls_by_caller_calls_by_caller_delete","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ByCallerWipeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ByCallerWipeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/calls/tenant/{tenant_id}/stream":{"get":{"tags":["calls"],"summary":"Call Stream","description":"Server-Sent Events stream for live call updates.\n\nDashboard subscribes to this to get real-time call feed without polling.\nAuth via auth_token cookie ONLY in production (query token leaks into\naccess logs / proxies). The query param is allowed in dev so EventSource\nintegrations that can't set cookies still work.","operationId":"call_stream_calls_tenant__tenant_id__stream_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}},{"name":"auth_token","in":"cookie","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/checkout/top-up":{"post":{"tags":["billing"],"summary":"Create Top Up Checkout","description":"Create Stripe Checkout Session for credit top-up (minutes or SMS).\n\nFlexible top-up: user specifies resource type and quantity.\nPrice: 4,50 PLN/min, 0,50 PLN/SMS.","operationId":"create_top_up_checkout_billing_checkout_top_up_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/checkout/subscribe":{"post":{"tags":["billing"],"summary":"Create Subscribe Checkout","description":"Create Stripe Checkout Session for a new subscription with 14-day trial.\n\nSCA/3DS is handled automatically by Stripe Checkout.\nIdempotency key prevents duplicate sessions on retried requests.","operationId":"create_subscribe_checkout_billing_checkout_subscribe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscribeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/upgrade":{"post":{"tags":["billing"],"summary":"Upgrade Subscription","description":"Change subscription plan (upgrade or downgrade).\n\nUpgrade (higher tier): immediate proration — user pays the difference now.\nDowngrade (lower tier): scheduled at period end — no proration, change\ntakes effect at the start of the next billing cycle.\n\nDelegates to services.plan_change.change_plan — the single source of truth\nshared with the Zvon agent's change_plan tool.","operationId":"upgrade_subscription_billing_upgrade_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpgradeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpgradeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/portal":{"post":{"tags":["billing"],"summary":"Create Billing Portal","description":"Create a Stripe Customer Portal session.\n\nAllows the customer to: update payment method, cancel subscription,\nview past invoices, and switch plans.\n\nAnnual-in-commitment customers get a restricted session: card update\nallowed, cancellation/downgrade disabled. Cancellation requests must\ngo through /billing/request-cancellation which emails admin.","operationId":"create_billing_portal_billing_portal_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/request-cancellation":{"post":{"tags":["billing"],"summary":"Request Cancellation","description":"Request cancellation for annual customers in their commitment window.\n\nThese customers cannot self-cancel via Stripe Portal (the portal is locked\ndown for them). They submit a request here, which:\n1. Creates a SupportTicket of category=billing, severity=high\n2. Emails the admin team with the customer's reason and contact info\n3. Returns the ticket ID so the customer can reference it\n\nAdmin reviews the request manually and either:\n- Schedules cancel-at-commitment-end via Stripe (most common)\n- Negotiates early termination + fee\n- Reaches out to retain them","operationId":"request_cancellation_billing_request_cancellation_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancellationRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/cancellation-eligibility":{"get":{"tags":["billing"],"summary":"Cancellation Eligibility","description":"Tell the dashboard whether the customer can self-cancel or must request.\n\nUsed by the cancel-flow UI to decide which modal to show.","operationId":"cancellation_eligibility_billing_cancellation_eligibility_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/subscription":{"get":{"tags":["billing"],"summary":"Get Subscription","description":"Return current subscription state for the tenant dashboard.","operationId":"get_subscription_billing_subscription_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/cancel":{"post":{"tags":["billing"],"summary":"Cancel Subscription","description":"Schedule subscription cancellation at the end of the current billing period.\n\nService remains active until period_end. No immediate interruption.","operationId":"cancel_subscription_billing_cancel_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/reactivate":{"post":{"tags":["billing"],"summary":"Reactivate Subscription","description":"Undo a scheduled cancellation — subscription continues as normal.","operationId":"reactivate_subscription_billing_reactivate_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/payment-methods":{"get":{"tags":["billing"],"summary":"List Payment Methods","description":"Return all saved cards for the tenant plus the current default.","operationId":"list_payment_methods_billing_payment_methods_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentMethodsResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/payment-methods/setup":{"post":{"tags":["billing"],"summary":"Create Setup Intent","description":"Create a Stripe SetupIntent so the frontend can securely collect a new card.\n\nThe card is attached to the customer without charging it. After setup, the\nfrontend calls /payment-methods/{id}/set-default to activate the card.","operationId":"create_setup_intent_billing_payment_methods_setup_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/payment-methods/{payment_method_id}/set-default":{"post":{"tags":["billing"],"summary":"Set Default Payment Method","description":"Set a card as the default payment method for future invoices.\n\nThe card must already be attached to the customer (via SetupIntent or Checkout).","operationId":"set_default_payment_method_billing_payment_methods__payment_method_id__set_default_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"payment_method_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Method Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/payment-methods/{payment_method_id}":{"delete":{"tags":["billing"],"summary":"Remove Payment Method","description":"Remove a saved card.\n\nBLOCKED if the card is the current default AND there is an active subscription\nwith no other card on file. This prevents payment failures.\nThe user must add a new card and set it as default before removing the old one.","operationId":"remove_payment_method_billing_payment_methods__payment_method_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"payment_method_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Method Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/retention-offer":{"post":{"tags":["billing"],"summary":"Apply Retention Offer","description":"Apply a one-time 50%-off coupon to retain a cancelling subscriber.\n\nRules:\n- Subscription must be active (not already cancelled)\n- Offer can only be used ONCE per tenant (retention_offer_used flag)\n- Applies a Stripe coupon giving 50% off for the next billing cycle\n- Does NOT cancel the subscription","operationId":"apply_retention_offer_billing_retention_offer_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/plans":{"get":{"tags":["billing"],"summary":"List Plans","description":"Return subscription plan catalogue and top-up pricing.","operationId":"list_plans_billing_plans_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/billing/usage":{"get":{"tags":["billing"],"summary":"Get Usage","description":"Return current-month usage and quota for the authenticated tenant.","operationId":"get_usage_billing_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/quota/check":{"post":{"tags":["billing"],"summary":"Check Quota","description":"Check if the current tenant is allowed to make calls (used by voice engine).","operationId":"check_quota_billing_quota_check_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/invoices":{"get":{"tags":["billing"],"summary":"List Invoices","description":"Return recent Stripe invoices for the tenant.\n\nReturns up to `limit` invoices ordered newest-first. Each invoice\nincludes amount, status, due date, and a hosted PDF download URL.","operationId":"list_invoices_billing_invoices_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":12,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/billing/sms-topup":{"post":{"tags":["billing"],"summary":"Create Sms Topup Checkout","description":"Create Stripe Checkout Session for a 100-SMS pack at 50 PLN.\n\nOn checkout.session.completed, the webhook increments `sms_purchased` by 100.\nIdempotency key: tenant_id + timestamp (minute precision to allow retries).","operationId":"create_sms_topup_checkout_billing_sms_topup_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SMSTopUpRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/billing/topup/session":{"post":{"tags":["billing"],"summary":"Create Topup Session By Pack","description":"Create Stripe Checkout Session for a predefined top-up pack.\n\nAccepts a pack_id from TOPUP_PACKS. Uses a pre-created Stripe price ID\nif configured in settings (for clean invoice line items); falls back to\ninline price_data so the endpoint works before Stripe products are set up.\n\nMetadata carries pack_id, resource_type, and quantity so the webhook\nhandler can credit the correct amount regardless of which path was taken.","operationId":"create_topup_session_by_pack_billing_topup_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpPackRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/consents/{tenant_id}/grant":{"post":{"tags":["consents"],"summary":"Grant Consent","description":"Record user consent (GDPR Art. 7).\n\nController must be able to demonstrate that data subject has consented.\nWe record:\n- What they consented to (consent_type + consent_text)\n- When they consented (granted_at)\n- How they consented (consent_method)\n- Where they consented from (ip_address + user_agent)","operationId":"grant_consent_consents__tenant_id__grant_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantConsentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consents/{tenant_id}/revoke/{consent_type}":{"post":{"tags":["consents"],"summary":"Revoke Consent","description":"Revoke consent (GDPR Art. 7(3) - right to withdraw consent).\n\n\"The data subject shall have the right to withdraw his or her consent\nat any time. The withdrawal of consent shall not affect the lawfulness\nof processing based on consent before its withdrawal.\"","operationId":"revoke_consent_consents__tenant_id__revoke__consent_type__post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"consent_type","in":"path","required":true,"schema":{"type":"string","title":"Consent Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consents/{tenant_id}/status":{"get":{"tags":["consents"],"summary":"Get Consent Status","description":"Get current consent status for all consent types.\n\nReturns which consents are currently active (granted and not revoked).\n\nOwner-only: otherwise anyone could enumerate tenant UUIDs and read each\ntenant's consent matrix. See SECURITY_REVIEW_2026-06-18 M2.","operationId":"get_consent_status_consents__tenant_id__status_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consents/{tenant_id}/history":{"get":{"tags":["consents"],"summary":"Get Consent History","description":"Get consent history for audit purposes (paginated).\n\nShows all consent grants and revocations with timestamps.","operationId":"get_consent_history_consents__tenant_id__history_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":500,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consents/{tenant_id}/all":{"delete":{"tags":["consents"],"summary":"Revoke All Consents","description":"Revoke all consents (used when account is deleted).\n\nRequires explicit confirmation.","operationId":"revoke_all_consents_consents__tenant_id__all_delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"confirm","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Confirm"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consents/caller":{"post":{"tags":["consents"],"summary":"Log Caller Consent","description":"Log that an inbound caller was informed of AI handling (EU AI Act Art. 50).\n\nService-to-service only (X-Internal-Key): the voice engine calls this at call\nstart. Otherwise anyone could forge Art. 50 audit records under any tenant.\nSee SECURITY_REVIEW_2026-06-18 M2.\n\nThe caller's phone number must be pre-hashed (SHA-256) by the caller before\nsending to this endpoint — raw phone numbers must never be stored here.\nEach call creates a new consent record (immutable audit log).","operationId":"log_caller_consent_consents_caller_post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallerConsentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallerConsentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consents/caller/{phone_hash}":{"get":{"tags":["consents"],"summary":"Get Caller Consent","description":"Retrieve the most recent consent record for a hashed caller number.\n\nReturns 404 if no consent has ever been logged for this hash.\n\nService-to-service only (X-Internal-Key): the phone hash is an unsalted\nSHA-256 of an E.164 number (brute-forceable across the PL mobile space), so\nan anonymous caller could confirm \"did this number call any clinic\" and\nrecover the tenant_id. See SECURITY_REVIEW_2026-06-18 M2.","operationId":"get_caller_consent_consents_caller__phone_hash__get","parameters":[{"name":"phone_hash","in":"path","required":true,"schema":{"type":"string","title":"Phone Hash"}},{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallerConsentDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/consents/voice-cloning":{"post":{"tags":["consents"],"summary":"Record Voice Cloning Consent","description":"Record acceptance of ElevenLabs voice cloning terms (GDPR Art. 7).\n\nMust be called before uploading a voice sample. Records who consented,\nfrom which IP, and with which client, for audit purposes.","operationId":"record_voice_cloning_consent_consents_voice_cloning_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCloningConsentRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCloningConsentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/consents/voice-cloning/{tenant_id}":{"get":{"tags":["consents"],"summary":"Get Voice Cloning Consent","description":"Retrieve the most recent voice cloning consent for a tenant.\n\nReturns 404 if no consent has been recorded.","operationId":"get_voice_cloning_consent_consents_voice_cloning__tenant_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceCloningConsentDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/privacy/template":{"get":{"tags":["privacy"],"summary":"Get Privacy Template","description":"Return a GDPR-compliant privacy notice template (PL + EN) for this tenant.\n\nIncludes the tenant's business name, contact email, retention periods,\nand caller rights — ready to display on website or reception area.","operationId":"get_privacy_template_privacy_template_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivacyTemplate"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/privacy/tenants/{tenant_id}/notice":{"get":{"tags":["privacy"],"summary":"Get Tenant Privacy Notice","description":"Return a rendered privacy notice for a specific tenant.\n\nValues are filled in from the tenant record:\n- tenant name\n- transcript_retention_days (default 90)\n- contact_phone (tenant.phone)\n\nIntended to be shown to callers at reception or on the tenant's website.","operationId":"get_tenant_privacy_notice_privacy_tenants__tenant_id__notice_get","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","pattern":"^(pl|en)$","default":"pl","title":"Lang"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PrivacyNoticeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/privacy/dpa/{tenant_id}":{"get":{"tags":["privacy"],"summary":"Generate Dpa","description":"Generate a Data Processing Agreement (Umowa Powierzenia) for the tenant.","operationId":"generate_dpa_privacy_dpa__tenant_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DPAResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/privacy/sub-processors":{"get":{"tags":["privacy"],"summary":"List Sub Processors","description":"Public endpoint: list all sub-processors used by ZvonAI.","operationId":"list_sub_processors_privacy_sub_processors_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubProcessorListResponse"}}}}}}},"/compliance/ai-act-register":{"get":{"tags":["compliance"],"summary":"Get Ai Act Register","description":"Return the formal EU AI Act system registration document.\n\nPublic endpoint — no auth required. Per Art. 50 (renumbered from 52\nin the final regulation), limited-risk AI systems that interact with\nnatural persons must disclose they are AI. Transparency obligations\napply from 2026-08-02. Risk level: LIMITED (not high-risk under Annex III).","operationId":"get_ai_act_register_compliance_ai_act_register_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AIActRegister"}}}}}}},"/compliance/admin/summary":{"get":{"tags":["compliance"],"summary":"Get Compliance Summary","description":"Live compliance posture for the admin Compliance Center.\n\nAggregates real data from existing tables — consents, DSAR support tickets,\nsub-processor register, retention AuditLog — so the admin can see (and print)\nthe current posture at a glance. Read-only; every number is live.","operationId":"get_compliance_summary_compliance_admin_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComplianceSummary"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/data-subject/request":{"post":{"tags":["data-subject"],"summary":"Submit Data Subject Request","description":"Public, rate-limited endpoint where a caller exercises GDPR rights.\n\nNo authentication: data subjects don't have ZvonAI accounts. We rate\nlimit aggressively to deter abuse and do not echo back any record\ncontents — the admin processes the request out-of-band.","operationId":"submit_data_subject_request_data_subject_request_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSubjectRequestPayload"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataSubjectRequestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/sms/opt-out/{code}":{"get":{"tags":["sms-opt-out"],"summary":"Sms Opt Out Confirm","description":"Render the confirmation page. Side-effect-free (GET).","operationId":"sms_opt_out_confirm_sms_opt_out__code__get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["sms-opt-out"],"summary":"Sms Opt Out Confirmed","description":"Record the opt-out after explicit confirmation. Idempotent.","operationId":"sms_opt_out_confirmed_sms_opt_out__code__post","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/twilio/call-status":{"post":{"tags":["webhooks"],"summary":"Twilio Call Status","description":"Handle Twilio call status updates.\n\nConfigure in Twilio console: Status Callback URL = https://api.zvonai.ai/webhooks/twilio/call-status","operationId":"twilio_call_status_webhooks_twilio_call_status_post","parameters":[{"name":"x-twilio-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Twilio-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/twilio/recording-status":{"post":{"tags":["webhooks"],"summary":"Twilio Recording Status","description":"Handle Twilio RecordingStatusCallback.\n\nTwilio fires this when a recording is ready (RecordingStatus=completed).\nConfigure in Twilio console: RecordingStatusCallback = https://api.zvonai.ai/webhooks/twilio/recording-status\n\nValidates the Twilio signature, then stores recording metadata on the call record.","operationId":"twilio_recording_status_webhooks_twilio_recording_status_post","parameters":[{"name":"x-twilio-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Twilio-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/twilio/transcription":{"post":{"tags":["webhooks"],"summary":"Twilio Transcription","description":"Handle Twilio transcription webhooks (if using Twilio transcription).","operationId":"twilio_transcription_webhooks_twilio_transcription_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/webhooks/twilio/inbound-sms":{"post":{"tags":["webhooks"],"summary":"Twilio Inbound Sms","description":"Handle inbound SMS replies — primarily STOP/START for opt-out (RODO Art. 7(3),\nPL UKE). Returns empty TwiML; we send our own confirmation SMS so the wording is\ncontrolled and localised.\n\nConfigure in Twilio console: Messaging → A message comes in →\nhttps://api.zvonai.ai/webhooks/twilio/inbound-sms","operationId":"twilio_inbound_sms_webhooks_twilio_inbound_sms_post","parameters":[{"name":"x-twilio-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Twilio-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/stripe":{"post":{"tags":["webhooks"],"summary":"Stripe Webhook","description":"Handle Stripe webhook events.\n\nConfigure in Stripe dashboard: Webhook URL = https://api.zvonai.ai/webhooks/stripe\nEvents to listen for:\n- customer.subscription.created\n- customer.subscription.updated\n- customer.subscription.deleted\n- customer.subscription.trial_will_end\n- invoice.paid\n- invoice.payment_failed\n- checkout.session.completed\n- checkout.session.expired\n- charge.dispute.created\n- payment_intent.requires_action","operationId":"stripe_webhook_webhooks_stripe_post","parameters":[{"name":"Stripe-Signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/autopay":{"post":{"tags":["webhooks"],"summary":"Autopay Webhook","description":"Handle Autopay payment notifications.\n\nConfigure in Autopay panel: Notification URL = https://api.zvonai.ai/webhooks/autopay","operationId":"autopay_webhook_webhooks_autopay_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutopayNotification"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/przelewy24":{"post":{"tags":["webhooks"],"summary":"Przelewy24 Webhook","description":"Handle Przelewy24 payment notifications.","operationId":"przelewy24_webhook_webhooks_przelewy24_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/webhooks/sync/google/{tenant_id}/{source_id}":{"post":{"tags":["webhooks"],"summary":"Google Drive Webhook","description":"Receive Google Drive push notifications for spreadsheet changes.\n\nGoogle headers:\n  X-Goog-Channel-ID      — our channel UUID\n  X-Goog-Resource-State  — sync | add | update | remove | trash\n  X-Goog-Channel-Token   — our secret token (verification)\n  X-Goog-Resource-ID     — Drive resource identifier\n\nReturns 200 immediately (required by Google); cache refresh is async.","operationId":"google_drive_webhook_webhooks_sync_google__tenant_id___source_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}},{"name":"x-goog-channel-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Goog-Channel-Id"}},{"name":"x-goog-resource-state","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Goog-Resource-State"}},{"name":"x-goog-channel-token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Goog-Channel-Token"}},{"name":"x-goog-resource-id","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Goog-Resource-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/sync/msgraph/{tenant_id}/{source_id}":{"post":{"tags":["webhooks"],"summary":"Msgraph Webhook","description":"Receive Microsoft Graph change notifications for OneDrive/Excel.\n\nMS Graph sends a POST with validationToken on subscription creation —\nwe echo it back as plain text. On real notifications: body.value[].changeType.","operationId":"msgraph_webhook_webhooks_sync_msgraph__tenant_id___source_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}},{"name":"validationToken","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validationtoken"}}],"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/sync/hubspot/{tenant_id}":{"post":{"tags":["webhooks"],"summary":"Hubspot Webhook","description":"Receive HubSpot CRM change events.\n\nVerifies HMAC-SHA256 signature using stored HubSpot app secret (in Redis).\nTriggers cache refresh for HubSpot-type data sources on contact changes.","operationId":"hubspot_webhook_webhooks_sync_hubspot__tenant_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"x-hubspot-signature-v3","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Hubspot-Signature-V3"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/sync/pipedrive/{tenant_id}":{"post":{"tags":["webhooks"],"summary":"Pipedrive Webhook","description":"Receive Pipedrive CRM change events.\n\nVerifies X-Pipedrive-Signature (HMAC-SHA256) using stored Redis secret.\nTriggers cache refresh for Pipedrive-type data sources on person changes.","operationId":"pipedrive_webhook_webhooks_sync_pipedrive__tenant_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"x-pipedrive-signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Pipedrive-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/webhooks/sendgrid/events":{"post":{"tags":["webhooks"],"summary":"Sendgrid Event Webhook","description":"Handle SendGrid Event Webhook (bounce, dropped, spam, unsubscribe, etc).\n\nConfigure in SendGrid: Settings → Mail Settings → Event Webhook\nPOST URL: https://api.zvonai.ai/webhooks/sendgrid/events\nVerification key (ECDSA P-256 public key) lives in GCP Secret Manager\nas zvonai-sendgrid-webhook-key. If missing, this endpoint refuses to\nprocess events (503) — accepting unverified events would let anyone\nwith the URL forge bounce/spam/unsubscribe events.","operationId":"sendgrid_event_webhook_webhooks_sendgrid_events_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/voices/":{"get":{"tags":["voices"],"summary":"List Voices","description":"List Polish voices from ElevenLabs shared library.\n\nResults cached in Redis for 24h. Falls back to curated list if ElevenLabs\nis unavailable or API key not configured. Filter by gender: ?gender=female|male","operationId":"list_voices_voices__get","parameters":[{"name":"gender","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gender"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/VoiceOption"},"title":"Response List Voices Voices  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/voices/{voice_id}":{"get":{"tags":["voices"],"summary":"Get Voice","description":"Get a specific voice by ID. Checks curated list then ElevenLabs.","operationId":"get_voice_voices__voice_id__get","parameters":[{"name":"voice_id","in":"path","required":true,"schema":{"type":"string","title":"Voice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceOption"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/voices/tenant/{tenant_id}":{"patch":{"tags":["voices"],"summary":"Update Tenant Voice","description":"Update tenant's selected voice. User must belong to the tenant.","operationId":"update_tenant_voice_voices_tenant__tenant_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceSelect"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Tenant Voice Voices Tenant  Tenant Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/voices/preview":{"post":{"tags":["voices"],"summary":"Preview Voice","description":"Generate a TTS preview for a given voice.\n\nReturns base64-encoded MP3 audio. Auth required (any logged-in tenant user).\nText defaults to the standard Polish greeting if not provided.","operationId":"preview_voice_voices_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicePreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicePreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/voices/clone":{"post":{"tags":["voices"],"summary":"Clone Voice","description":"Clone a custom voice via ElevenLabs. Enterprise plan only.\n\nAccepts a WAV/MP3/M4A audio sample (max 10 MB).","operationId":"clone_voice_voices_clone_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_clone_voice_voices_clone_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CloneVoiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/voices/clone/{voice_id}":{"delete":{"tags":["voices"],"summary":"Delete Cloned Voice","description":"Delete a cloned voice from ElevenLabs and remove it from tenant config.","operationId":"delete_cloned_voice_voices_clone__voice_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"voice_id","in":"path","required":true,"schema":{"type":"string","title":"Voice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/voices/test-greeting":{"post":{"tags":["voices"],"summary":"Test Greeting","description":"Generate TTS preview using the tenant's configured greeting text.\n\nAuth required. Uses the tenant's current greeting as the TTS input.","operationId":"test_greeting_voices_test_greeting_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestGreetingRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicePreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/overview":{"get":{"tags":["admin"],"summary":"Admin Overview","description":"Platform-wide summary for the admin dashboard.","operationId":"admin_overview_admin_overview_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminOverviewResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/tenants":{"get":{"tags":["admin"],"summary":"List Tenants","description":"Paginated tenant list with filters.","operationId":"list_tenants_admin_tenants_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"search","in":"query","required":false,"schema":{"type":"string","default":"","title":"Search"}},{"name":"tier","in":"query","required":false,"schema":{"type":"string","default":"","title":"Tier"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"","title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/src__routers__admin__TenantListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/signup-sources":{"get":{"tags":["admin"],"summary":"Signup Source Breakdown","description":"Breakdown of signup_source values across all users with a tenant.","operationId":"signup_source_breakdown_admin_signup_sources_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SignupSourceBreakdown"},"type":"array","title":"Response Signup Source Breakdown Admin Signup Sources Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/calls":{"get":{"tags":["admin"],"summary":"List All Calls","description":"Paginated call list across all tenants.","operationId":"list_all_calls_admin_calls_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"status","in":"query","required":false,"schema":{"type":"string","default":"","title":"Status"}},{"name":"tenant_id","in":"query","required":false,"schema":{"type":"string","default":"","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCallsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/demo-calls":{"get":{"tags":["admin"],"summary":"List Demo Calls","description":"Demo call log — all calls to the ZvonAI demo number, newest first.","operationId":"list_demo_calls_admin_demo_calls_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoCallsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/demo-calls/{call_id}":{"get":{"tags":["admin"],"summary":"Get Demo Call","description":"Full demo call detail including transcript.","operationId":"get_demo_call_admin_demo_calls__call_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoCallDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/costs":{"get":{"tags":["admin"],"summary":"Cost Summary","description":"Platform cost and revenue breakdown.","operationId":"cost_summary_admin_costs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CostSummaryResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/tenants/{tenant_id}":{"get":{"tags":["admin"],"summary":"Get Tenant Detail","description":"Full tenant detail for the admin drill-in page. Combines core record\nfields, billing-address fields and a fresh health snapshot in one round-trip\nso the page renders without a waterfall.","operationId":"get_tenant_detail_admin_tenants__tenant_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Update Tenant Tier","description":"Set a tenant's subscription tier. Admin only.","operationId":"update_tenant_tier_admin_tenants__tenant_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantTierUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantTierResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/critical-signals":{"get":{"tags":["admin"],"summary":"Critical Signals","description":"Aggregated 'what needs my attention' signals for the overview page.\nOne round-trip; each signal carries a drill-in href and severity.\nIntentionally read-only — no triggers, no side effects.","operationId":"critical_signals_admin_critical_signals_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CriticalSignalsResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/stripe-events":{"get":{"tags":["admin"],"summary":"List Stripe Events","description":"List Stripe webhook events processed (idempotency table). Confirms\nevery Stripe event we acknowledged. If something's missing here that\nStripe shows as delivered, we lost it.","operationId":"list_stripe_events_admin_stripe_events_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Event Type"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StripeEventsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/webhooks/health":{"get":{"tags":["admin"],"summary":"Webhook Health","description":"Webhook delivery health across providers. Stripe pulls from the\nprocessed_events table (DB-backed dedup). Others (SendGrid, Twilio,\nTelnyx) don't have DB tables yet — they show 'unknown' with a hint\npointing at Cloud Logging until we add structured tables (P5+).","operationId":"webhook_health_admin_webhooks_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookHealthResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/overage":{"get":{"tags":["admin"],"summary":"Tenant Overage Overview","description":"Tenants near/over their minute quota + their overage consent state.\n\nThe follow-up surface for minute overage (task #19): sales/support see who\nis approaching the limit (default ≥80% used), who is already accruing paid\noverage minutes, and exactly when/how each tenant consented (or opted out)\n— so every overage invoice line is defensible and outreach happens BEFORE\nthe invoice surprises anyone. Sorted by usage_pct descending.","operationId":"tenant_overage_overview_admin_overage_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"threshold_pct","in":"query","required":false,"schema":{"type":"number","default":80.0,"title":"Threshold Pct"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantOverageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/quotas":{"get":{"tags":["admin"],"summary":"Provider Quotas","description":"Aggregated provider balance/quota check. Each provider is one HTTP\ncall done in parallel; total round-trip is the slowest provider's\nresponse time (typically 1-3 seconds). Read-only — no side effects.","operationId":"provider_quotas_admin_quotas_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProviderQuotasResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/consents":{"get":{"tags":["admin"],"summary":"List Consents","description":"List GDPR consent records (Art. 7 proof of consent). Filterable by\nconsent_type (call_recording, analytics, marketing, sms_notifications)\nand granted status. Includes type_counts for the filter UI.","operationId":"list_consents_admin_consents_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"consent_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consent Type"}},{"name":"granted_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Granted Only"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/scheduler/jobs":{"get":{"tags":["admin"],"summary":"List Scheduler Jobs","description":"Live status of every APScheduler job. Used by /admin/scheduler to\ncatch the silent-job-drop pattern that bit us on 2026-06-09 — when a\nstale Redis-persisted reference fails to reconstitute, newly added\njobs may never register and the cron simply never fires. This endpoint\nreads scheduler.get_jobs() directly (not the boot log) so it always\nreflects reality.","operationId":"list_scheduler_jobs_admin_scheduler_jobs_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SchedulerStatusResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/polish-invoices/{invoice_id}/retry":{"post":{"tags":["admin"],"summary":"Retry Polish Invoice","description":"Manually re-run iFirma issuance for a stuck or errored invoice.\nReturns 'already_issued' if the row has an ifirma_id (no-op).\nOtherwise clears error_message and queues a background re-attempt\nvia the same code path the Stripe webhook uses.","operationId":"retry_polish_invoice_admin_polish_invoices__invoice_id__retry_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"invoice_id","in":"path","required":true,"schema":{"type":"string","title":"Invoice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PolishInvoiceRetryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/polish-invoices":{"get":{"tags":["admin"],"summary":"List Admin Polish Invoices","description":"List Polish iFirma invoices across all tenants (admin view).\nFilters: tenant_id (single tenant), only_errored (rows with non-null\nerror_message OR no ifirma_id past 5 minutes since creation).","operationId":"list_admin_polish_invoices_admin_polish_invoices_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},{"name":"only_errored","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Only Errored"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPolishInvoicesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tenant_id}/health":{"get":{"tags":["admin"],"summary":"Tenant Health","description":"Per-tenant health snapshot.","operationId":"tenant_health_admin_tenants__tenant_id__health_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantHealthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/audit-log":{"get":{"tags":["admin"],"summary":"List Audit Log","description":"Paginated admin audit log.","operationId":"list_audit_log_admin_audit_log_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuditLogResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/uptime":{"get":{"tags":["admin"],"summary":"Admin Uptime","description":"Check live status of all external provider dependencies.","operationId":"admin_uptime_admin_uptime_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UptimeResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/alert/pod-restart":{"post":{"tags":["admin"],"summary":"Pod Restart Alert","description":"Called by Cloud Run on service restart. Logs and alerts ops.\n\nService-to-service only (X-Internal-Key): without it, anyone could write\nAuditLog rows and fire ops alerts (audit poisoning + pager spam). Matches\nthe internal-key convention used by /internal/* routes.\nSee SECURITY_REVIEW_2026-06-18 M3.","operationId":"pod_restart_alert_admin_alert_pod_restart_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PodRestartRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/alerts/stream-token":{"post":{"tags":["admin"],"summary":"Mint Alerts Stream Token","description":"Mint a short-lived (60s), single-purpose token for the alerts SSE.\n\nEventSource can't send Authorization headers, so the URL carries a token —\na 24h full JWT in the URL leaks into access logs/history. This scopes the\nleak to a 60-second purpose-locked token. (Audit 2026-06-19 JWT-in-URL.)","operationId":"mint_alerts_stream_token_admin_alerts_stream_token_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/alerts/stream":{"get":{"tags":["admin"],"summary":"Alerts Stream","description":"Stream admin alerts via Server-Sent Events from the admin:alerts Redis channel.\nAccepts `?token=<jwt>` for EventSource compatibility (see helper above).","operationId":"alerts_stream_admin_alerts_stream_get","parameters":[{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/alerts/test":{"post":{"tags":["admin"],"summary":"Publish Test Alert","description":"Publish a test alert to the admin:alerts channel. Only available in debug mode.","operationId":"publish_test_alert_admin_alerts_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestAlertRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/tenants/{tenant_id}/seed-data-sources":{"post":{"tags":["admin"],"summary":"Admin Seed Data Sources","description":"Seed data sources for a business-tier-or-higher tenant. Admin only.","operationId":"admin_seed_data_sources_admin_tenants__tenant_id__seed_data_sources_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminDataSourceCreate"},"title":"Sources"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tenant_id}/assign-number":{"post":{"tags":["admin"],"summary":"Assign Dedicated Number","description":"Assign a dedicated phone number to a tenant.\n\nAtomic: deactivates any prior active number on this tenant before adding the new one,\nso the tenant always has at most one active row. Validates E.164 phone format.","operationId":"assign_dedicated_number_admin_tenants__tenant_id__assign_number_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignNumberRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/phone-numbers":{"get":{"tags":["admin"],"summary":"List Phone Inventory","description":"All provisioned phone numbers across all tenants.","operationId":"list_phone_inventory_admin_phone_numbers_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"provider","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"}},{"name":"is_active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneInventoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/phone-numbers/{phone_id}":{"delete":{"tags":["admin"],"summary":"Admin Release Phone Number","description":"Manually release a phone number (admin override).","operationId":"admin_release_phone_number_admin_phone_numbers__phone_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/phone-numbers/reprovision/{tenant_id}":{"post":{"tags":["admin"],"summary":"Admin Reprovision Phone Number","description":"Manually trigger provisioning for a tenant.\n\nIdempotency: if the tenant already has an active dedicated number, this is a\nno-op unless `force=true` is set. Without this guard a double-click would\npurchase a second number — guaranteed double-charge.\n\nReal provisioning errors (cap exceeded, address missing, provider auth) are\nsurfaced to the admin instead of being collapsed into a generic 400.","operationId":"admin_reprovision_phone_number_admin_phone_numbers_reprovision__tenant_id__post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReprovisionRequest","default":{"force":false}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/voice-engine/stats":{"get":{"tags":["admin"],"summary":"Voice Engine Stats","description":"Real-time voice engine stats for admin monitoring dashboard.","operationId":"voice_engine_stats_admin_voice_engine_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceEngineStats"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/voice-engine/latency":{"get":{"tags":["admin"],"summary":"Latency Timeseries","description":"P50/P95/P99 latency by hour for the last N hours (default 24, max 168/7 days).","operationId":"latency_timeseries_admin_voice_engine_latency_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"hours","in":"query","required":false,"schema":{"type":"integer","maximum":168,"minimum":1,"default":24,"title":"Hours"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/LatencyDataPoint"},"title":"Response Latency Timeseries Admin Voice Engine Latency Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users":{"get":{"tags":["admin"],"summary":"List Users","description":"Paginated user list with plan, auth method, and signup info.","operationId":"list_users_admin_users_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"search","in":"query","required":false,"schema":{"type":"string","default":"","title":"Search"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUsersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/users/{user_id}":{"patch":{"tags":["admin"],"summary":"Admin Update User","description":"Admin: update user account flags (verify, activate/deactivate).","operationId":"admin_update_user_admin_users__user_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUpdateUserRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/notifications/broadcast":{"post":{"tags":["admin"],"summary":"Broadcast Notification","description":"Send an in-app notification (and optional email) to one or all tenants.\nAdmin-only. Supports targeting: all, trialing, active, plan:<tier>, or a single tenant.","operationId":"broadcast_notification_admin_notifications_broadcast_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastNotificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BroadcastNotificationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/notifications/history":{"get":{"tags":["admin"],"summary":"List Recent Notifications","description":"List the most recent in-app notifications across all tenants (admin view).\nTranslates to the admin's own locale when the row carries an i18n key (newer\nrows); legacy rows fall back to their stored text.","operationId":"list_recent_notifications_admin_notifications_history_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","default":"pl","title":"Lang"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Recent Notifications Admin Notifications History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tenant_id}/extend-trial":{"post":{"tags":["admin"],"summary":"Extend Trial","description":"Extend a tenant's trial period by N days (admin only).","operationId":"extend_trial_admin_tenants__tenant_id__extend_trial_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialExtensionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TrialExtensionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/tenants/{tenant_id}/reset-onboarding":{"delete":{"tags":["admin"],"summary":"Reset Onboarding","description":"Delete a tenant and unlink all users so they can re-do onboarding.\n\nDESTRUCTIVE + irreversible: cascades delete all phone_numbers, departments,\netc. Requires ?confirm=<business_name> echo to guard against misclicks, and\nwrites an audit-log row. (Audit 2026-06-19 admin reset-onboarding.)","operationId":"reset_onboarding_admin_tenants__tenant_id__reset_onboarding_delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"confirm","in":"query","required":false,"schema":{"type":"string","description":"Must equal the tenant's business_name to proceed","default":"","title":"Confirm"},"description":"Must equal the tenant's business_name to proceed"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/internal/reset-user-onboarding":{"post":{"tags":["admin"],"summary":"Internal Reset User Onboarding","description":"Reset onboarding for a user by email. Requires X-Internal-Key header.","operationId":"internal_reset_user_onboarding_admin_internal_reset_user_onboarding_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/internal/cache/lookup":{"post":{"tags":["internal-cache"],"summary":"Cache Lookup","description":"Search the semantic cache for a similar question.\n\nEmbeds the question and searches for cached entries with\ncosine similarity >= 0.92 for the given tenant.","operationId":"cache_lookup_internal_cache_lookup_post","parameters":[{"name":"x-internal-key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheLookupRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheLookupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/cache/store":{"post":{"tags":["internal-cache"],"summary":"Cache Store","description":"Store a new question-answer pair in the semantic cache.","operationId":"cache_store_internal_cache_store_post","parameters":[{"name":"x-internal-key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheStoreRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheStoreResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/cache/invalidate/{tenant_id}":{"post":{"tags":["internal-cache"],"summary":"Cache Invalidate","description":"Clear all cache entries for a tenant (e.g. after FAQ update).","operationId":"cache_invalidate_internal_cache_invalidate__tenant_id__post","parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"x-internal-key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CacheInvalidateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/integration-error":{"post":{"tags":["internal"],"summary":"Report Integration Error","description":"Receive integration failure report from voice engine.\n\nRecords the error and fires alerts for critical issues.","operationId":"report_integration_error_internal_integration_error_post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationErrorReport"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/internal/transfer-failed":{"post":{"tags":["internal"],"summary":"Report Transfer Failed","description":"Voice-engine reports that a transfer-to-human attempt ended without\na successful bridge. We:\n\n  1. Look up the originating Call → tenant\n  2. If tenant has owner_sms_phone + sms_on_missed_transfer → send SMS\n  3. Bump in-app notification (bell icon) so owner sees it on next login\n\nBest-effort; never fails the voice-engine path. Errors logged + return\n{received: True} regardless so the voice-engine doesn't retry-loop.","operationId":"report_transfer_failed_internal_transfer_failed_post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferFailedReport"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/upload":{"post":{"tags":["knowledge"],"summary":"Upload Document","description":"Upload a PDF/TXT/DOCX file for RAG. Chunks and embeds in background.\n\nReturns immediately with status=processing and text_preview of first 500 chars.\nPoll GET /documents until status=ready.","operationId":"upload_document_tenants__tenant_id__knowledge_upload_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_tenants__tenant_id__knowledge_upload_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/documents/{document_id}/replace":{"put":{"tags":["knowledge"],"summary":"Replace Document","description":"Replace an existing document atomically.\n\nDeletes old chunks, re-processes new file under the same document ID.","operationId":"replace_document_tenants__tenant_id__knowledge_documents__document_id__replace_put","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_replace_document_tenants__tenant_id__knowledge_documents__document_id__replace_put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/documents/{document_id}/retry":{"post":{"tags":["knowledge"],"summary":"Retry Document","description":"Re-process a failed/stuck document from its stored text — no re-upload.\n\nUses the persisted full_text, so embedding (or FAQ extraction) is retried\nwithout the original file. Safe to call on a 'failed' or stuck 'processing'\ndocument.","operationId":"retry_document_tenants__tenant_id__knowledge_documents__document_id__retry_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/documents/{document_id}/versions":{"get":{"tags":["knowledge"],"summary":"List Document Versions","description":"List prior versions of a document (snapshots taken on each replace).","operationId":"list_document_versions_tenants__tenant_id__knowledge_documents__document_id__versions_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentVersionResponse"},"title":"Response List Document Versions Tenants  Tenant Id  Knowledge Documents  Document Id  Versions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/documents/{document_id}/apply-faq":{"post":{"tags":["knowledge"],"summary":"Apply Extracted Faq","description":"Merge this document's extracted Q&A pairs into the tenant's FAQ.\n\nCalled by dashboard after user previews and confirms the extracted pairs.\nOnly merges pairs not already present (does not overwrite existing FAQ keys).","operationId":"apply_extracted_faq_tenants__tenant_id__knowledge_documents__document_id__apply_faq_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/documents":{"get":{"tags":["knowledge"],"summary":"List Documents","description":"List all uploaded knowledge base documents for this tenant.","operationId":"list_documents_tenants__tenant_id__knowledge_documents_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DocumentResponse"},"title":"Response List Documents Tenants  Tenant Id  Knowledge Documents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/documents/{document_id}":{"delete":{"tags":["knowledge"],"summary":"Delete Document","description":"Delete a document and all its chunks/embeddings.","operationId":"delete_document_tenants__tenant_id__knowledge_documents__document_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/query":{"post":{"tags":["knowledge"],"summary":"Query Knowledge","description":"Vector search for relevant knowledge chunks. Used by voice engine at call time.\n\nEmbeds the query, runs cosine similarity search via pgvector (~5ms).\nNo LLM invoked — pure database lookup. No rechunking.","operationId":"query_knowledge_tenants__tenant_id__knowledge_query_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/QueryRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/QueryResult"},"title":"Response Query Knowledge Tenants  Tenant Id  Knowledge Query Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/limits":{"get":{"tags":["knowledge"],"summary":"Get Document Limits","description":"Return current usage vs plan limits for document storage.","operationId":"get_document_limits_tenants__tenant_id__knowledge_limits_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/knowledge/faq/export":{"get":{"tags":["knowledge"],"summary":"Export Faq","description":"Export the tenant FAQ as JSON or CSV.\n\nReturns all Q&A pairs from tenant.faq.\nAccessible to all plan tiers (FAQ is a core feature).","operationId":"export_faq_tenants__tenant_id__knowledge_faq_export_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(json|csv)$","default":"json","title":"Format"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/brand":{"get":{"tags":["brand"],"summary":"Get Brand Config","description":"Get the brand configuration for this tenant.","operationId":"get_brand_config_tenants__tenant_id__brand_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["brand"],"summary":"Update Brand Config","description":"Create or update the brand configuration.","operationId":"update_brand_config_tenants__tenant_id__brand_put","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandConfigUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BrandConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/brand/logo":{"post":{"tags":["brand"],"summary":"Upload Logo","description":"Upload a brand logo (PNG/JPG/SVG/WebP, max 2MB).\n\nStored as base64 data URI for MVP. Production will use GCS bucket.","operationId":"upload_logo_tenants__tenant_id__brand_logo_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_logo_tenants__tenant_id__brand_logo_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["brand"],"summary":"Delete Logo","description":"Remove the brand logo.","operationId":"delete_logo_tenants__tenant_id__brand_logo_delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/waitlist/join":{"post":{"tags":["waitlist"],"summary":"Join Waitlist","operationId":"join_waitlist_waitlist_join_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistJoinRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistJoinResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/waitlist/position/{phone}":{"get":{"tags":["waitlist"],"summary":"Get Position","operationId":"get_position_waitlist_position__phone__get","parameters":[{"name":"phone","in":"path","required":true,"schema":{"type":"string","title":"Phone"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistPositionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/waitlist/email/{phone}":{"patch":{"tags":["waitlist"],"summary":"Add Email","operationId":"add_email_waitlist_email__phone__patch","parameters":[{"name":"phone","in":"path","required":true,"schema":{"type":"string","title":"Phone"}},{"name":"email","in":"query","required":true,"schema":{"type":"string","title":"Email"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/waitlist/demo-lead":{"post":{"tags":["waitlist"],"summary":"Demo Lead","description":"Soft email-only lead from the landing personalized-demo widget.\n\nUpserts into the SAME Brevo waitlist list (Brevo dedupes by email — no phone\nkey, so repeat plays never 409). Tagged so Martyna can tell demo leads from\nfull waitlist signups. The full waitlist (with phone) still uses /join.\n\nRODO: marketing contact requires consent. We only add to the marketing list and\nfire the automation when the user gave consent (the widget shows the consent line\n+ privacy-policy link). Consent + timestamp are recorded on the Brevo contact.","operationId":"demo_lead_waitlist_demo_lead_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoLeadRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/waitlist/survey":{"post":{"tags":["waitlist"],"summary":"Submit Survey","description":"Store survey answers from Martyna's Google Form questionnaire.\n\nCalled by Google Forms webhook (via Apps Script) or directly from the\nwaitlist confirmation page. Enriches the lead record for Martyna's outreach.","operationId":"submit_survey_waitlist_survey_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistSurveyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/waitlist/survey-by-email":{"post":{"tags":["waitlist"],"summary":"Submit Survey By Email","description":"Store survey answers matched by email.\n\nUsed by Google Forms Apps Script webhook. If the email is already on the waitlist,\nthe survey data is merged in. If not found, a new entry is created from the survey\ndata so Google Forms respondents always appear in the admin dashboard.","operationId":"submit_survey_by_email_waitlist_survey_by_email_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistSurveyByEmailRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/waitlist/admin/stats":{"get":{"tags":["waitlist"],"summary":"Get Stats","description":"Public stats endpoint — returns total waitlist count for the landing page counter.","operationId":"get_stats_waitlist_admin_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/waitlist/nurture/process":{"post":{"tags":["waitlist"],"summary":"Process Nurture","description":"Triggered by Cloud Scheduler every hour. Sends due nurture emails.\n\nX-Internal-Key required (audit 2026-07-08 A6 — this was completely\nunauthenticated: anyone could trigger unlimited nurture email blasts).\nCloud Scheduler must send the header.","operationId":"process_nurture_waitlist_nurture_process_post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/waitlist/entries":{"get":{"tags":["admin","waitlist"],"summary":"List Waitlist Entries","description":"Paginated waitlist entries with filters.","operationId":"list_waitlist_entries_admin_waitlist_entries_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"tier","in":"query","required":false,"schema":{"type":"string","default":"","title":"Tier"}},{"name":"city","in":"query","required":false,"schema":{"type":"string","default":"","title":"City"}},{"name":"business_type","in":"query","required":false,"schema":{"type":"string","default":"","title":"Business Type"}},{"name":"date_from","in":"query","required":false,"schema":{"type":"string","description":"ISO date string YYYY-MM-DD","default":"","title":"Date From"},"description":"ISO date string YYYY-MM-DD"},{"name":"date_to","in":"query","required":false,"schema":{"type":"string","description":"ISO date string YYYY-MM-DD","default":"","title":"Date To"},"description":"ISO date string YYYY-MM-DD"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistEntriesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/waitlist/stats":{"get":{"tags":["admin","waitlist"],"summary":"Waitlist Stats","description":"Waitlist summary statistics.","operationId":"waitlist_stats_admin_waitlist_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WaitlistStatsResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/waitlist/export":{"get":{"tags":["admin","waitlist"],"summary":"Export Waitlist","description":"Export all waitlist entries as CSV.","operationId":"export_waitlist_admin_waitlist_export_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/waitlist/entries/{entry_id}/notes":{"patch":{"tags":["admin","waitlist"],"summary":"Update Entry Notes","description":"Update admin notes on a waitlist entry.","operationId":"update_entry_notes_admin_waitlist_entries__entry_id__notes_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","title":"Entry Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotesUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/waitlist/notify/{entry_id}":{"post":{"tags":["admin","waitlist"],"summary":"Mark Notified","description":"Mark a waitlist entry as notified (manual outreach tracking).","operationId":"mark_notified_admin_waitlist_notify__entry_id__post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"entry_id","in":"path","required":true,"schema":{"type":"string","title":"Entry Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/waitlist/referral-leaderboard":{"get":{"tags":["admin","waitlist"],"summary":"Referral Leaderboard","description":"Top referrers by referral count.","operationId":"referral_leaderboard_admin_waitlist_referral_leaderboard_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralLeaderboardResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/contact":{"post":{"tags":["contact"],"summary":"Submit Contact","description":"Forward a contact form submission to hello@zvonai.ai.","operationId":"submit_contact_contact_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/support/ticket":{"post":{"tags":["support"],"summary":"Create Ticket","description":"Create a support ticket with optional screenshot upload.","operationId":"create_ticket_support_ticket_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_ticket_support_ticket_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/support/my-tickets":{"get":{"tags":["support"],"summary":"List My Tickets","description":"List all tickets submitted by the current user.","operationId":"list_my_tickets_support_my_tickets_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/TicketOut"},"type":"array","title":"Response List My Tickets Support My Tickets Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/support/admin/tickets":{"get":{"tags":["support"],"summary":"Admin List Tickets","description":"List all support tickets (admin only).","operationId":"admin_list_tickets_support_admin_tickets_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TicketOut"},"title":"Response Admin List Tickets Support Admin Tickets Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/support/admin/tickets/stats":{"get":{"tags":["support"],"summary":"Admin Ticket Stats","description":"Get ticket stats for admin dashboard.","operationId":"admin_ticket_stats_support_admin_tickets_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/support/admin/tickets/{ticket_id}":{"patch":{"tags":["support"],"summary":"Admin Update Ticket","description":"Update ticket status or add admin response.","operationId":"admin_update_ticket_support_admin_tickets__ticket_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"ticket_id","in":"path","required":true,"schema":{"type":"string","title":"Ticket Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTicketUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/support/admin/tickets/{ticket_id}/attachment":{"get":{"tags":["support"],"summary":"Admin Get Attachment","description":"Download ticket attachment — image or PDF (admin only).\n\nAuth via `?token=` query param, NOT the Bearer header: this URL is used\ndirectly in <img src> / window.open, which cannot set Authorization headers.\nWe resolve + admin-check the token manually. (Previously this used\nDepends(require_admin), so the querystring token was ignored → every\nscreenshot/PDF view 401'd. Real E2E bug.)","operationId":"admin_get_attachment_support_admin_tickets__ticket_id__attachment_get","parameters":[{"name":"ticket_id","in":"path","required":true,"schema":{"type":"string","title":"Ticket Id"}},{"name":"token","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/sales-demo/founding-status":{"get":{"tags":["sales-demo"],"summary":"Founding Status","description":"Live founding-cohort status for the admin banner — how many of the founding\n(1-month-free) spots remain. Real count from Stripe, updates as leads redeem.","operationId":"founding_status_admin_sales_demo_founding_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/sales-demo/calculate":{"post":{"tags":["sales-demo"],"summary":"Calculate Roi","description":"Calculate ROI for a prospect. Does not persist — call /save to store.","operationId":"calculate_roi_admin_sales_demo_calculate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesDemoInput"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ROIResult"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/sales-demo/save":{"post":{"tags":["sales-demo"],"summary":"Save Lead","description":"Calculate ROI and save the lead to the DB.","operationId":"save_lead_admin_sales_demo_save_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesDemoInput"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SalesDemoLeadOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/sales-demo/send":{"post":{"tags":["sales-demo"],"summary":"Send To Client","description":"Send the ROI presentation to the client's email as branded HTML + PDF attachment.","operationId":"send_to_client_admin_sales_demo_send_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendDemoRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/sales-demo/pdf/{lead_id}":{"get":{"tags":["sales-demo"],"summary":"Download Pdf","description":"Download the ROI one-pager as PDF.","operationId":"download_pdf_admin_sales_demo_pdf__lead_id__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"lead_id","in":"path","required":true,"schema":{"type":"string","title":"Lead Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/sales-demo/leads":{"get":{"tags":["sales-demo"],"summary":"List Leads","description":"List all generated proposals, newest first.","operationId":"list_leads_admin_sales_demo_leads_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SalesDemoLeadOut"},"type":"array","title":"Response List Leads Admin Sales Demo Leads Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/internal/demo/follow-up-email":{"post":{"tags":["internal-demo"],"summary":"Send Demo Followup Email","description":"Send a branded follow-up email to a demo caller who expressed interest.","operationId":"send_demo_followup_email_internal_demo_follow_up_email_post","parameters":[{"name":"x-internal-key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoFollowUpRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Send Demo Followup Email Internal Demo Follow Up Email Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/integrations":{"get":{"tags":["calendar"],"summary":"List Calendar Integrations","description":"List all calendar integrations for a tenant.","operationId":"list_calendar_integrations_api_v1_tenants__tenant_id__calendar_integrations_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CalendarIntegrationResponse"},"title":"Response List Calendar Integrations Api V1 Tenants  Tenant Id  Calendar Integrations Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/connect/{provider}":{"get":{"tags":["calendar"],"summary":"Start Calendar Oauth","description":"Generate an OAuth authorization URL and store state in Redis.","operationId":"start_calendar_oauth_api_v1_tenants__tenant_id__calendar_connect__provider__get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/calendar/callback/{provider}":{"get":{"tags":["calendar"],"summary":"Calendar Oauth Callback","description":"Handle the OAuth redirect.  Exchanges code, stores tokens, redirects to dashboard.","operationId":"calendar_oauth_callback_api_v1_calendar_callback__provider__get","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}},{"name":"code","in":"query","required":true,"schema":{"type":"string","title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","title":"State"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/connect/apple":{"post":{"tags":["calendar"],"summary":"Connect Apple Calendar","description":"Connect an Apple iCloud calendar via app-specific password (CalDAV).","operationId":"connect_apple_calendar_api_v1_tenants__tenant_id__calendar_connect_apple_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppleConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppleConnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/{provider}/calendars":{"get":{"tags":["calendar"],"summary":"Get Available Calendars","description":"Fetch the user's current calendar list from the provider using stored tokens.","operationId":"get_available_calendars_api_v1_tenants__tenant_id__calendar__provider__calendars_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CalendarEntry"},"title":"Response Get Available Calendars Api V1 Tenants  Tenant Id  Calendar  Provider  Calendars Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/{provider}/selected":{"patch":{"tags":["calendar"],"summary":"Update Selected Calendars","description":"Update which calendars to sync for a provider integration.","operationId":"update_selected_calendars_api_v1_tenants__tenant_id__calendar__provider__selected_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectedCalendarsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/{provider}":{"delete":{"tags":["calendar"],"summary":"Disconnect Calendar","description":"Soft-disconnect: clear tokens and mark status as 'disconnected'.","operationId":"disconnect_calendar_api_v1_tenants__tenant_id__calendar__provider__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/google/watch":{"post":{"tags":["calendar"],"summary":"Register Google Webhook","description":"Register a Google Calendar push notification channel (expires in 7 days).","operationId":"register_google_webhook_api_v1_tenants__tenant_id__calendar_google_watch_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/calendar/outlook/subscribe":{"post":{"tags":["calendar"],"summary":"Register Outlook Subscription","description":"Create a Microsoft Graph change notification subscription (expires in 3 days).","operationId":"register_outlook_subscription_api_v1_tenants__tenant_id__calendar_outlook_subscribe_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/blocked-times":{"get":{"tags":["blocked-times"],"summary":"List Blocked Times","description":"List blocked time windows for a tenant, optionally filtered by date range.","operationId":"list_blocked_times_tenants__tenant_id__blocked_times_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD — start of range (inclusive)","title":"From Date"},"description":"YYYY-MM-DD — start of range (inclusive)"},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD — end of range (inclusive, end of day)","title":"To Date"},"description":"YYYY-MM-DD — end of range (inclusive, end of day)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/BlockedTimeResponse"},"title":"Response List Blocked Times Tenants  Tenant Id  Blocked Times Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["blocked-times"],"summary":"Create Blocked Time","description":"Create a blocked time window (one-off or recurring).","operationId":"create_blocked_time_tenants__tenant_id__blocked_times_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockedTimeCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlockedTimeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/blocked-times/{blocked_time_id}":{"delete":{"tags":["blocked-times"],"summary":"Delete Blocked Time","description":"Delete a blocked time window.","operationId":"delete_blocked_time_tenants__tenant_id__blocked_times__blocked_time_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"blocked_time_id","in":"path","required":true,"schema":{"type":"string","title":"Blocked Time Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/missed-questions":{"get":{"tags":["missed-questions"],"summary":"List Missed Questions","description":"List missed questions for current user's tenant, sorted by occurrence_count desc.","operationId":"list_missed_questions_missed_questions_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"resolved","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Resolved"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MissedQuestionOut"},"title":"Response List Missed Questions Missed Questions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["missed-questions"],"summary":"Create Missed Question","description":"Record a missed question (called by voice engine via internal API key).","operationId":"create_missed_question_missed_questions_post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissedQuestionCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissedQuestionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/missed-questions/{question_id}/resolve":{"patch":{"tags":["missed-questions"],"summary":"Resolve Missed Question","description":"Mark a missed question as resolved.","operationId":"resolve_missed_question_missed_questions__question_id__resolve_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"question_id","in":"path","required":true,"schema":{"type":"string","title":"Question Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/missed-questions/{question_id}/apply-as-faq":{"post":{"tags":["missed-questions"],"summary":"Apply Missed Question As Faq","description":"Close the loop: add this missed question + the owner's answer to the tenant\nFAQ, AND mark the question resolved — atomically. After this, the voice agent\nanswers it from FAQ on the next call (no more \"I don't have that information\").\n\nAlso resolves any OTHER open missed questions with the same question_text so the\nlist stays clean.","operationId":"apply_missed_question_as_faq_missed_questions__question_id__apply_as_faq_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"question_id","in":"path","required":true,"schema":{"type":"string","title":"Question Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyAsFaqRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/missed-questions/stats":{"get":{"tags":["missed-questions"],"summary":"Get Missed Questions Stats","description":"Summary stats: total unresolved, top 5 by frequency, this week count.","operationId":"get_missed_questions_stats_missed_questions_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MissedQuestionsStats"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/missed-questions/suggestions":{"get":{"tags":["missed-questions"],"summary":"Get Faq Suggestions","description":"Generate FAQ answer suggestions for the most frequent unresolved missed questions.","operationId":"get_faq_suggestions_missed_questions_suggestions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/FaqSuggestion"},"type":"array","title":"Response Get Faq Suggestions Missed Questions Suggestions Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/guidance":{"get":{"tags":["guidance"],"summary":"List Rules","operationId":"list_rules_guidance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/GuidanceRuleOut"},"type":"array","title":"Response List Rules Guidance Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]},"post":{"tags":["guidance"],"summary":"Create Rule","operationId":"create_rule_guidance_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuidanceRuleCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuidanceRuleOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/guidance/{rule_id}":{"patch":{"tags":["guidance"],"summary":"Update Rule","operationId":"update_rule_guidance__rule_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","title":"Rule Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuidanceRuleUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GuidanceRuleOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["guidance"],"summary":"Delete Rule","operationId":"delete_rule_guidance__rule_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"rule_id","in":"path","required":true,"schema":{"type":"string","title":"Rule Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/tenants/{tenant_id}/scrape-faq":{"post":{"tags":["faq-scraper"],"summary":"Scrape Faq","description":"Scrape tenant's website and extract FAQ pairs for voice script seeding.","operationId":"scrape_faq_tenants__tenant_id__scrape_faq_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrapeFAQRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrapeFAQResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/voicemail-notification":{"post":{"tags":["voicemail"],"summary":"Voicemail Notification","description":"Record voicemail metadata and email the tenant.","operationId":"voicemail_notification_voicemail_notification_post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicemailNotification"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/notifications":{"get":{"tags":["notifications"],"summary":"List Notifications","description":"List notifications visible to the current user, newest first.\n\nA user sees notifications for their own tenant. Admins ALSO see\nplatform-level notifications (is_admin=True, e.g. new support tickets),\neven if they have no tenant of their own.","operationId":"list_notifications_api_v1_notifications_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"skip","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Skip"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Unread Only"}},{"name":"lang","in":"query","required":false,"schema":{"type":"string","default":"pl","title":"Lang"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/notifications/{notification_id}/read":{"patch":{"tags":["notifications"],"summary":"Mark Notification Read","description":"Mark a single notification as read.","operationId":"mark_notification_read_api_v1_notifications__notification_id__read_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/notifications/mark-all-read":{"post":{"tags":["notifications"],"summary":"Mark All Read","description":"Mark all visible notifications as read.","operationId":"mark_all_read_api_v1_notifications_mark_all_read_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/api/v1/notifications/{notification_id}":{"delete":{"tags":["notifications"],"summary":"Delete Notification","description":"Delete a single notification.","operationId":"delete_notification_api_v1_notifications__notification_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"notification_id","in":"path","required":true,"schema":{"type":"string","title":"Notification Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/notifications/unsubscribe":{"get":{"tags":["notifications"],"summary":"Unsubscribe Email","description":"Public, HMAC-verified one-click unsubscribe from a transactional/digest email.","operationId":"unsubscribe_email_api_v1_notifications_unsubscribe_get","parameters":[{"name":"type","in":"query","required":true,"schema":{"type":"string","title":"Type"}},{"name":"tid","in":"query","required":true,"schema":{"type":"string","title":"Tid"}},{"name":"sig","in":"query","required":true,"schema":{"type":"string","title":"Sig"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/script-templates":{"get":{"tags":["script-templates"],"summary":"List Templates","operationId":"list_templates_script_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ScriptTemplateOut"},"type":"array","title":"Response List Templates Script Templates Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]},"post":{"tags":["script-templates"],"summary":"Create Template","description":"Save current greeting+FAQ as a named template.","operationId":"create_template_script_templates_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScriptTemplateCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScriptTemplateOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/script-templates/{template_id}/apply":{"post":{"tags":["script-templates"],"summary":"Apply Template","description":"Apply a saved template to the tenant's active configuration.","operationId":"apply_template_script_templates__template_id__apply_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Apply Template Script Templates  Template Id  Apply Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/script-templates/{template_id}":{"delete":{"tags":["script-templates"],"summary":"Delete Template","operationId":"delete_template_script_templates__template_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/coupons":{"get":{"tags":["admin"],"summary":"List Coupons","description":"List all internal test coupons from Stripe.","operationId":"list_coupons_admin_coupons_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CouponListResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]},"post":{"tags":["admin"],"summary":"Create Coupon","description":"Create a 100% off Stripe coupon + promo code for internal testing.","operationId":"create_coupon_admin_coupons_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCouponRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CouponResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/admin/coupons/{coupon_id}":{"delete":{"tags":["admin"],"summary":"Revoke Coupon","description":"Permanently delete a coupon and deactivate all its promo codes.","operationId":"revoke_coupon_admin_coupons__coupon_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"coupon_id","in":"path","required":true,"schema":{"type":"string","title":"Coupon Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/coupons/{coupon_id}/deactivate":{"patch":{"tags":["admin"],"summary":"Deactivate Coupon","description":"Deactivate promo codes without deleting the coupon (keeps audit record).","operationId":"deactivate_coupon_admin_coupons__coupon_id__deactivate_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"coupon_id","in":"path","required":true,"schema":{"type":"string","title":"Coupon Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/coupons/{coupon_id}/redemptions":{"get":{"tags":["admin"],"summary":"Get Coupon Redemptions","description":"List customers who redeemed a specific coupon.","operationId":"get_coupon_redemptions_admin_coupons__coupon_id__redemptions_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"coupon_id","in":"path","required":true,"schema":{"type":"string","title":"Coupon Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedemptionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/follow-ups":{"get":{"tags":["follow-ups"],"summary":"List Follow Ups","operationId":"list_follow_ups_follow_ups_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/FollowUpOut"},"title":"Response List Follow Ups Follow Ups Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["follow-ups"],"summary":"Create Follow Up","operationId":"create_follow_up_follow_ups_post","parameters":[{"name":"X-Internal-Key","in":"header","required":true,"schema":{"type":"string","title":"X-Internal-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowUpCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowUpOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/follow-ups/{follow_up_id}":{"patch":{"tags":["follow-ups"],"summary":"Update Follow Up","operationId":"update_follow_up_follow_ups__follow_up_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"follow_up_id","in":"path","required":true,"schema":{"type":"string","title":"Follow Up Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowUpUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowUpOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/follow-ups/stats":{"get":{"tags":["follow-ups"],"summary":"Get Follow Up Stats","operationId":"get_follow_up_stats_follow_ups_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FollowUpStats"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/referrals/my-link":{"get":{"tags":["referrals"],"summary":"Get Or Create Referral Link","description":"Get or create the current user's referral link.","operationId":"get_or_create_referral_link_referrals_my_link_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReferralLinkResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/referrals/my-referrals":{"get":{"tags":["referrals"],"summary":"Get My Referrals","description":"Get the user's referral link + list of people they've referred.","operationId":"get_my_referrals_referrals_my_referrals_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MyReferralsResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/referrals/validate/{code}":{"get":{"tags":["referrals"],"summary":"Validate Referral Code","description":"Validate a referral code (public, called by landing page).","operationId":"validate_referral_code_referrals_validate__code__get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateCodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/referrals":{"get":{"tags":["admin"],"summary":"Admin List Referrals","description":"Admin view: all referrals with fraud flags.","operationId":"admin_list_referrals_admin_referrals_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminReferralListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/referrals/{referral_id}":{"patch":{"tags":["admin"],"summary":"Admin Update Referral","description":"Admin: manually update referral status or add note.","operationId":"admin_update_referral_admin_referrals__referral_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"referral_id","in":"path","required":true,"schema":{"type":"string","title":"Referral Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminUpdateReferral"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/developer/api-keys":{"get":{"tags":["developer"],"summary":"List Api Keys","operationId":"list_api_keys_developer_api_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/ApiKeyOut"},"type":"array","title":"Response List Api Keys Developer Api Keys Get"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]},"post":{"tags":["developer"],"summary":"Create Api Key","operationId":"create_api_key_developer_api_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreate"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyCreated"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/developer/api-keys/{key_id}":{"delete":{"tags":["developer"],"summary":"Revoke Api Key","operationId":"revoke_api_key_developer_api_keys__key_id__delete","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/developer/scopes":{"get":{"tags":["developer"],"summary":"List Scopes","description":"The scopes a key may hold (for the settings UI).","operationId":"list_scopes_developer_scopes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/admin/developer/api-keys":{"get":{"tags":["admin"],"summary":"Admin List Api Keys","operationId":"admin_list_api_keys_admin_developer_api_keys_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AdminApiKeyOut"},"title":"Response Admin List Api Keys Admin Developer Api Keys Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/developer/api-keys/{key_id}/revoke":{"post":{"tags":["admin"],"summary":"Admin Revoke Api Key","operationId":"admin_revoke_api_key_admin_developer_api_keys__key_id__revoke_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"key_id","in":"path","required":true,"schema":{"type":"string","title":"Key Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/developer/summary":{"get":{"tags":["admin"],"summary":"Admin Developer Summary","description":"Platform-wide developer stats for the admin overview strip.","operationId":"admin_developer_summary_admin_developer_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/v1/calls":{"get":{"tags":["developer-api-v1"],"summary":"List Calls","description":"List the tenant's calls, newest first. Scope: calls:read.","operationId":"list_calls_v1_calls_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallListOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/calls/{call_id}":{"get":{"tags":["developer-api-v1"],"summary":"Get Call","description":"Fetch one call by id (tenant-scoped). Scope: calls:read.","operationId":"get_call_v1_calls__call_id__get","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/appointments":{"get":{"tags":["developer-api-v1"],"summary":"List Appointments","description":"List the tenant's appointments, newest first. Scope: appointments:read.","operationId":"list_appointments_v1_appointments_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AppointmentListOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v1/analytics":{"get":{"tags":["developer-api-v1"],"summary":"Analytics","description":"Aggregate call metrics for the last N days. Scope: analytics:read.","operationId":"analytics_v1_analytics_get","parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/affiliates/validate/{code}":{"get":{"tags":["affiliates"],"summary":"Validate Affiliate Code","description":"Public — called by the landing / register page to validate an influencer code.","operationId":"validate_affiliate_code_affiliates_validate__code__get","parameters":[{"name":"code","in":"path","required":true,"schema":{"type":"string","title":"Code"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidateAffiliateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/affiliates/apply":{"post":{"tags":["affiliates"],"summary":"Apply To Program","description":"Public — the /partnerzy landing form. Creates a PENDING affiliate for admin\nreview; NOT active until an admin activates it (payout gate). No code issued yet.\nRequires acceptance of the Regulamin Programu Partnerskiego — a cash-commission\nprogram needs a recorded, versioned agreement (KC art. 60/77²/384 + eIDAS).","operationId":"apply_to_program_affiliates_apply_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateApplyRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/affiliates/portal/{token}":{"get":{"tags":["affiliates"],"summary":"Affiliate Portal","description":"Public, token-authed self-serve portal for an approved affiliate. The token\nis unguessable (secrets.token_urlsafe) and emailed on activation — affiliates\naren't Users, so this magic-link is how they see their code, share link,\nconversions and earnings without an account.","operationId":"affiliate_portal_affiliates_portal__token__get","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/affiliates/portal/{token}/accept-terms":{"post":{"tags":["affiliates"],"summary":"Portal Accept Terms","description":"Affiliate re-accepts the terms after an admin rate change cleared the\nprevious acceptance. Records timestamp + IP + the SERVER-side terms version\n(never client-supplied) and re-snapshots the accepted rate from the current\npayout fields — the snapshot is what commission computation trusts.","operationId":"portal_accept_terms_affiliates_portal__token__accept_terms_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/affiliates/portal/{token}/payout-details":{"post":{"tags":["affiliates"],"summary":"Portal Submit Payout Details","description":"Affiliate submits tax/payout identity (business status, NIP, IBAN) — the\nprecondition for any cash payout (golden rule #4: no cash without identity).","operationId":"portal_submit_payout_details_affiliates_portal__token__payout_details_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutDetailsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/affiliates":{"get":{"tags":["admin"],"summary":"Admin List Affiliates","operationId":"admin_list_affiliates_admin_affiliates_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AffiliateOut"},"title":"Response Admin List Affiliates Admin Affiliates Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Admin Create Affiliate","operationId":"admin_create_affiliate_admin_affiliates_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/affiliates/{affiliate_id}/status":{"patch":{"tags":["admin"],"summary":"Admin Set Status","operationId":"admin_set_status_admin_affiliates__affiliate_id__status_patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"affiliate_id","in":"path","required":true,"schema":{"type":"string","title":"Affiliate Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusChange"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/affiliates/{affiliate_id}":{"patch":{"tags":["admin"],"summary":"Admin Edit Affiliate","operationId":"admin_edit_affiliate_admin_affiliates__affiliate_id__patch","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"affiliate_id","in":"path","required":true,"schema":{"type":"string","title":"Affiliate Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateEdit"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AffiliateOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/affiliates/conversions":{"get":{"tags":["admin"],"summary":"Admin List Conversions","operationId":"admin_list_conversions_admin_affiliates_conversions_get","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ConversionOut"},"title":"Response Admin List Conversions Admin Affiliates Conversions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/affiliates/conversions/{conversion_id}/mark-paid":{"post":{"tags":["admin"],"summary":"Admin Mark Paid","operationId":"admin_mark_paid_admin_affiliates_conversions__conversion_id__mark_paid_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"conversion_id","in":"path","required":true,"schema":{"type":"string","title":"Conversion Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkPaidRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/affiliates/{affiliate_id}/resend-activation":{"post":{"tags":["admin"],"summary":"Admin Resend Activation","description":"Re-send the activation email (code + share link + portal magic link) to an\nACTIVE affiliate — for lost emails. Best-effort like the original send.","operationId":"admin_resend_activation_admin_affiliates__affiliate_id__resend_activation_post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"affiliate_id","in":"path","required":true,"schema":{"type":"string","title":"Affiliate Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/newsletter/subscribe":{"post":{"tags":["newsletter"],"summary":"Subscribe","operationId":"subscribe_newsletter_subscribe_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NewsletterSubscribeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/preview/greeting":{"post":{"tags":["preview"],"summary":"Preview Greeting","description":"Generate TTS audio preview of a greeting message.\n\nReturns base64-encoded MP3 audio that can be played in the browser.\nResults are cached for 1 hour (same text + voice = same audio).","operationId":"preview_greeting_preview_greeting_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GreetingPreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GreetingPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/preview/conversation":{"post":{"tags":["preview"],"summary":"Preview Conversation","description":"Generate a simulated conversation preview.\n\nCreates a short scenario: AI greeting → caller asks question → AI answers.\nOnly the AI turns have audio (caller turns are text-only for display).","operationId":"preview_conversation_preview_conversation_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationPreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/preview/greeting/{tenant_id}":{"post":{"tags":["preview"],"summary":"Preview Tenant Greeting","description":"Preview the tenant's current configured greeting.","operationId":"preview_tenant_greeting_preview_greeting__tenant_id__post","security":[{"OAuth2PasswordBearerOrCookie":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GreetingPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/preview/verticals":{"get":{"tags":["preview","public"],"summary":"List Demo Verticals","description":"Vertical ids the public demo supports (for the widget picker to stay in sync).","operationId":"list_demo_verticals_preview_verticals_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"items":{"type":"string"},"type":"array"},"type":"object","title":"Response List Demo Verticals Preview Verticals Get"}}}}}}},"/preview/public-greeting":{"post":{"tags":["preview","public"],"summary":"Public Greeting","description":"Synthesize a personalized Polish greeting for the landing-page demo widget.\n\nGreeting text is built server-side from a fixed per-vertical template — the\nclient only supplies a business name (sanitized) and a vertical id.","operationId":"public_greeting_preview_public_greeting_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGreetingRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicGreetingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/preview/greeting-audio":{"get":{"tags":["preview","public"],"summary":"Greeting Audio","description":"Stream the personalized greeting as an MP3 — used by the 'Posłuchaj ponownie'\nlink in the lead-confirmation email. No file is stored: the audio is regenerated\nserver-side from the same (name, vertical, voice) and served from cache. Nothing\nto retain or delete (RODO-friendly).","operationId":"greeting_audio_preview_greeting_audio_get","parameters":[{"name":"name","in":"query","required":true,"schema":{"type":"string","title":"Name"}},{"name":"vertical","in":"query","required":false,"schema":{"type":"string","default":"other","title":"Vertical"}},{"name":"voice","in":"query","required":false,"schema":{"type":"string","default":"female","title":"Voice"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/onboarding/auto-configure":{"post":{"tags":["onboarding"],"summary":"Auto Configure","description":"Auto-fill business configuration from Google Places + website.\n\nReturns pre-filled data that the user reviews and confirms.\nNothing is saved automatically — the user must explicitly apply.","operationId":"auto_configure_onboarding_auto_configure_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoConfigureRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutoConfigureResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/agent/chat":{"post":{"tags":["agent"],"summary":"Agent Chat","description":"Conversational AI setup agent — streaming SSE responses.\n\nThe agent knows the tenant's full context (plan, config state, vertical)\nand can execute actions (add FAQ, update hours, auto-configure, etc.)","operationId":"agent_chat_agent_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/agent/history":{"get":{"tags":["agent"],"summary":"Get Agent History","description":"Get conversation history for the current tenant (for UI reload).","operationId":"get_agent_history_agent_history_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]},"delete":{"tags":["agent"],"summary":"Clear Agent History","description":"Clear conversation history for the current tenant.","operationId":"clear_agent_history_agent_history_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/2fa/status":{"get":{"tags":["two-factor"],"summary":"Get 2Fa Status","description":"Check if 2FA is enabled for the current user.","operationId":"get_2fa_status_auth_2fa_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponse"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/2fa/setup":{"post":{"tags":["two-factor"],"summary":"Setup 2Fa","description":"Generate TOTP secret and QR code, or set up email-based 2FA. Does NOT enable until /verify.","operationId":"setup_2fa_auth_2fa_setup_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupRequest","default":{"method":"app"}}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/2fa/verify":{"post":{"tags":["two-factor"],"summary":"Verify And Enable 2Fa","description":"Confirm the first TOTP code to activate 2FA. Returns backup codes.","operationId":"verify_and_enable_2fa_auth_2fa_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/2fa/disable":{"post":{"tags":["two-factor"],"summary":"Disable 2Fa","description":"Disable 2FA. Requires a valid TOTP code or backup code.","operationId":"disable_2fa_auth_2fa_disable_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisableRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}},"/auth/2fa/regenerate-backup-codes":{"post":{"tags":["two-factor"],"summary":"Regenerate Backup Codes","description":"Regenerate backup codes. Requires a valid TOTP code.","operationId":"regenerate_backup_codes_auth_2fa_regenerate_backup_codes_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"OAuth2PasswordBearerOrCookie":[]}]}}},"components":{"schemas":{"AIActRegister":{"properties":{"system_name":{"type":"string","title":"System Name"},"provider":{"type":"string","title":"Provider"},"version":{"type":"string","title":"Version"},"risk_level":{"type":"string","title":"Risk Level"},"risk_classification_article":{"type":"string","title":"Risk Classification Article"},"intended_use":{"type":"string","title":"Intended Use"},"data_processed":{"items":{"type":"string"},"type":"array","title":"Data Processed"},"human_oversight_measures":{"items":{"type":"string"},"type":"array","title":"Human Oversight Measures"},"transparency_obligations":{"items":{"type":"string"},"type":"array","title":"Transparency Obligations"},"art52_disclosure_text_pl":{"type":"string","title":"Art52 Disclosure Text Pl"},"art52_disclosure_text_en":{"type":"string","title":"Art52 Disclosure Text En"},"art50_disclosure_text_pl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Art50 Disclosure Text Pl"},"art50_disclosure_text_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Art50 Disclosure Text En"},"registration_date":{"type":"string","title":"Registration Date"},"last_updated":{"type":"string","title":"Last Updated"},"transparency_obligations_apply_from":{"type":"string","title":"Transparency Obligations Apply From","default":"2026-08-02"}},"type":"object","required":["system_name","provider","version","risk_level","risk_classification_article","intended_use","data_processed","human_oversight_measures","transparency_obligations","art52_disclosure_text_pl","art52_disclosure_text_en","registration_date","last_updated"],"title":"AIActRegister"},"AdminApiKeyOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Name"},"name":{"type":"string","title":"Name"},"key_prefix":{"type":"string","title":"Key Prefix"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"revoked":{"type":"boolean","title":"Revoked"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","tenant_id","tenant_name","name","key_prefix","scopes","last_used_at","revoked","created_at"],"title":"AdminApiKeyOut"},"AdminCallEntry":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"caller_number":{"type":"string","title":"Caller Number"},"called_number":{"type":"string","title":"Called Number"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"status":{"type":"string","title":"Status"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"latency_avg_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Avg Ms"},"cost_cents":{"type":"integer","title":"Cost Cents"}},"type":"object","required":["id","tenant_id","tenant_name","caller_number","called_number","started_at","duration_seconds","status","outcome","sentiment","latency_avg_ms","cost_cents"],"title":"AdminCallEntry"},"AdminCallsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AdminCallEntry"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"AdminCallsResponse"},"AdminDataSourceCreate":{"properties":{"name":{"type":"string","title":"Name"},"purpose":{"type":"string","title":"Purpose"},"sheet_id":{"type":"string","title":"Sheet Id"},"sheet_name":{"type":"string","title":"Sheet Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"ai_access":{"type":"boolean","title":"Ai Access","default":true},"department_scope":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Department Scope"},"cross_reference_allowed":{"type":"boolean","title":"Cross Reference Allowed","default":true}},"type":"object","required":["name","purpose","sheet_id","sheet_name"],"title":"AdminDataSourceCreate"},"AdminOverviewResponse":{"properties":{"total_tenants":{"type":"integer","title":"Total Tenants"},"active_tenants":{"type":"integer","title":"Active Tenants"},"total_calls_today":{"type":"integer","title":"Total Calls Today"},"total_calls_this_month":{"type":"integer","title":"Total Calls This Month"},"system_health":{"$ref":"#/components/schemas/SystemHealth"},"revenue_this_month_pln":{"type":"integer","title":"Revenue This Month Pln"},"top_tenants_by_calls":{"items":{"$ref":"#/components/schemas/TopTenantEntry"},"type":"array","title":"Top Tenants By Calls"}},"type":"object","required":["total_tenants","active_tenants","total_calls_today","total_calls_this_month","system_health","revenue_this_month_pln","top_tenants_by_calls"],"title":"AdminOverviewResponse"},"AdminPolishInvoiceItem":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"stripe_invoice_id":{"type":"string","title":"Stripe Invoice Id"},"ifirma_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ifirma Id"},"ifirma_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ifirma Number"},"invoice_kind":{"type":"string","title":"Invoice Kind"},"amount_grosze":{"type":"integer","title":"Amount Grosze"},"issued_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Issued At"},"email_sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Email Sent At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","tenant_id","tenant_name","stripe_invoice_id","ifirma_id","ifirma_number","invoice_kind","amount_grosze","issued_at","email_sent_at","error_message","created_at"],"title":"AdminPolishInvoiceItem"},"AdminPolishInvoicesResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AdminPolishInvoiceItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"AdminPolishInvoicesResponse"},"AdminReferralItem":{"properties":{"id":{"type":"string","title":"Id"},"referrer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referrer Email"},"invitee_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invitee Email"},"referral_code":{"type":"string","title":"Referral Code"},"status":{"type":"string","title":"Status"},"fraud_score":{"type":"integer","title":"Fraud Score"},"fraud_flags":{"items":{},"type":"array","title":"Fraud Flags"},"reward_amount_pln":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Reward Amount Pln"},"created_at":{"type":"string","title":"Created At"},"qualified_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qualified At"},"rewarded_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rewarded At"},"admin_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Note"}},"type":"object","required":["id","referrer_email","invitee_email","referral_code","status","fraud_score","fraud_flags","reward_amount_pln","created_at","qualified_at","rewarded_at","admin_note"],"title":"AdminReferralItem"},"AdminReferralListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AdminReferralItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"stats":{"additionalProperties":true,"type":"object","title":"Stats"}},"type":"object","required":["items","total","stats"],"title":"AdminReferralListResponse"},"AdminTicketUpdate":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"admin_response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Response"}},"type":"object","title":"AdminTicketUpdate"},"AdminUpdateReferral":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"admin_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Note"}},"type":"object","title":"AdminUpdateReferral"},"AdminUpdateUserRequest":{"properties":{"is_verified":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Verified"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"AdminUpdateUserRequest"},"AdminUserItem":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"full_name":{"type":"string","title":"Full Name"},"role":{"type":"string","title":"Role"},"is_active":{"type":"boolean","title":"Is Active"},"is_verified":{"type":"boolean","title":"Is Verified"},"auth_method":{"type":"string","title":"Auth Method"},"has_tenant":{"type":"boolean","title":"Has Tenant"},"tenant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Name"},"subscription_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Tier"},"subscription_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Status"},"signup_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signup Source"},"utm_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Source"},"utm_campaign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Campaign"},"last_login_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Login At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","email","full_name","role","is_active","is_verified","auth_method","has_tenant","tenant_name","subscription_tier","subscription_status","signup_source","utm_source","utm_campaign","last_login_at","created_at"],"title":"AdminUserItem"},"AdminUsersResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AdminUserItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"AdminUsersResponse"},"AffiliateApplyRequest":{"properties":{"display_name":{"type":"string","title":"Display Name"},"email":{"type":"string","format":"email","title":"Email"},"channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"accept_terms":{"type":"boolean","title":"Accept Terms","default":false},"terms_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Terms Version"}},"type":"object","required":["display_name","email"],"title":"AffiliateApplyRequest"},"AffiliateCreate":{"properties":{"display_name":{"type":"string","title":"Display Name"},"email":{"type":"string","format":"email","title":"Email"},"channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"},"code":{"type":"string","title":"Code"},"discount_desc":{"type":"string","title":"Discount Desc","default":"pierwszy miesiąc gratis"},"stripe_promotion_code_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Promotion Code Id"},"payout_type":{"type":"string","title":"Payout Type","default":"percent"},"payout_value":{"type":"integer","title":"Payout Value","default":20},"payout_months":{"type":"integer","title":"Payout Months","default":1},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","required":["display_name","email","code"],"title":"AffiliateCreate"},"AffiliateEdit":{"properties":{"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"display_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"},"channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"},"discount_desc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discount Desc"},"stripe_promotion_code_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Promotion Code Id"},"payout_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Type"},"payout_value":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Payout Value"},"payout_months":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Payout Months"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","title":"AffiliateEdit","description":"Editable fields for an existing affiliate — lets an admin promote a pending\napplied record (code \"PENDING-<email>\") to a real, shareable code and set\npayout terms, closing the apply→activate gap (previously the applicant record\ncouldn't be cleanly activated and admins had to create a duplicate)."},"AffiliateOut":{"properties":{"id":{"type":"string","title":"Id"},"code":{"type":"string","title":"Code"},"display_name":{"type":"string","title":"Display Name"},"email":{"type":"string","title":"Email"},"channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"},"status":{"type":"string","title":"Status"},"discount_desc":{"type":"string","title":"Discount Desc"},"payout_type":{"type":"string","title":"Payout Type"},"payout_value":{"type":"integer","title":"Payout Value"},"signups":{"type":"integer","title":"Signups"},"qualified":{"type":"integer","title":"Qualified"},"paid_out":{"type":"integer","title":"Paid Out"},"owed_grosze":{"type":"integer","title":"Owed Grosze"},"created_at":{"type":"string","title":"Created At"},"portal_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Portal Token"},"stripe_promotion_code_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Promotion Code Id"},"terms_accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Terms Accepted At"},"payout_details_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Details At"},"business_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Status"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"tax_country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Country"}},"type":"object","required":["id","code","display_name","email","channel","status","discount_desc","payout_type","payout_value","signups","qualified","paid_out","owed_grosze","created_at"],"title":"AffiliateOut"},"AnalyticsOut":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"total_calls":{"type":"integer","title":"Total Calls"},"completed_calls":{"type":"integer","title":"Completed Calls"},"booked_appointments":{"type":"integer","title":"Booked Appointments"},"transferred_calls":{"type":"integer","title":"Transferred Calls"},"avg_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Duration Seconds"}},"type":"object","required":["period_days","total_calls","completed_calls","booked_appointments","transferred_calls","avg_duration_seconds"],"title":"AnalyticsOut"},"AnomalyEntry":{"properties":{"id":{"type":"string","title":"Id"},"anomaly":{"type":"string","title":"Anomaly"},"value":{"title":"Value"},"detected_at":{"type":"string","title":"Detected At"}},"type":"object","required":["id","anomaly","value","detected_at"],"title":"AnomalyEntry"},"ApiKeyCreate":{"properties":{"name":{"type":"string","title":"Name"},"scopes":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Scopes"}},"type":"object","required":["name"],"title":"ApiKeyCreate"},"ApiKeyCreated":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"key_prefix":{"type":"string","title":"Key Prefix"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"created_at":{"type":"string","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"revoked":{"type":"boolean","title":"Revoked"},"key":{"type":"string","title":"Key"}},"type":"object","required":["id","name","key_prefix","scopes","created_at","last_used_at","revoked","key"],"title":"ApiKeyCreated"},"ApiKeyOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"key_prefix":{"type":"string","title":"Key Prefix"},"scopes":{"items":{"type":"string"},"type":"array","title":"Scopes"},"created_at":{"type":"string","title":"Created At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"},"revoked":{"type":"boolean","title":"Revoked"}},"type":"object","required":["id","name","key_prefix","scopes","created_at","last_used_at","revoked"],"title":"ApiKeyOut"},"AppleConnectRequest":{"properties":{"apple_id":{"type":"string","title":"Apple Id"},"app_password":{"type":"string","title":"App Password"}},"type":"object","required":["apple_id","app_password"],"title":"AppleConnectRequest"},"AppleConnectResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"calendars":{"items":{"$ref":"#/components/schemas/CalendarEntry"},"type":"array","title":"Calendars"}},"type":"object","required":["success","calendars"],"title":"AppleConnectResponse"},"ApplyAsFaqRequest":{"properties":{"answer":{"type":"string","title":"Answer"}},"type":"object","required":["answer"],"title":"ApplyAsFaqRequest"},"AppointmentCreate":{"properties":{"patient_name":{"type":"string","title":"Patient Name"},"patient_phone":{"type":"string","title":"Patient Phone"},"patient_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Email"},"service_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Type"},"start_time":{"type":"string","title":"Start Time"},"end_time":{"type":"string","title":"End Time"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"department_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Department Id"}},"type":"object","required":["patient_name","patient_phone","start_time","end_time"],"title":"AppointmentCreate"},"AppointmentListOut":{"properties":{"data":{"items":{"$ref":"#/components/schemas/AppointmentOut"},"type":"array","title":"Data"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["data","limit","offset","has_more"],"title":"AppointmentListOut"},"AppointmentOut":{"properties":{"id":{"type":"string","title":"Id"},"created_at":{"type":"string","title":"Created At"},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Time"},"status":{"type":"string","title":"Status"},"service_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Type"},"patient_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Name"}},"type":"object","required":["id","created_at","start_time","status","service_type","patient_name"],"title":"AppointmentOut"},"AppointmentResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"patient_name":{"type":"string","title":"Patient Name"},"patient_phone":{"type":"string","title":"Patient Phone"},"patient_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Patient Email"},"service_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Type"},"start_time":{"type":"string","title":"Start Time"},"end_time":{"type":"string","title":"End Time"},"status":{"type":"string","title":"Status"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"department_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Department Id"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"external_calendar":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Calendar"},"booked_via":{"type":"string","title":"Booked Via"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","tenant_id","patient_name","patient_phone","patient_email","service_type","start_time","end_time","status","notes","department_id","external_id","external_calendar","booked_via","created_at","updated_at"],"title":"AppointmentResponse"},"AppointmentUpdate":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Time"},"end_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Time"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"}},"type":"object","title":"AppointmentUpdate"},"AssignNumberRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number"},"twilio_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Twilio Sid"},"label":{"type":"string","title":"Label","default":"Główna linia"},"replace_shared":{"type":"boolean","title":"Replace Shared","default":true}},"type":"object","required":["phone_number"],"title":"AssignNumberRequest"},"AuditLogEntry":{"properties":{"id":{"type":"string","title":"Id"},"admin_id":{"type":"string","title":"Admin Id"},"action":{"type":"string","title":"Action"},"resource_type":{"type":"string","title":"Resource Type"},"resource_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Id"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","admin_id","action","resource_type","resource_id","details","ip_address","created_at"],"title":"AuditLogEntry"},"AuditLogResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/AuditLogEntry"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"AuditLogResponse"},"AuthUrlResponse":{"properties":{"auth_url":{"type":"string","title":"Auth Url"}},"type":"object","required":["auth_url"],"title":"AuthUrlResponse"},"AutoConfigureRequest":{"properties":{"business_name":{"type":"string","title":"Business Name"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"},"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url"},"nip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nip"}},"type":"object","required":["business_name"],"title":"AutoConfigureRequest"},"AutoConfigureResponse":{"properties":{"business_name":{"type":"string","title":"Business Name"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"vertical":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vertical"},"business_hours":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Business Hours"},"greeting_suggestion":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting Suggestion"},"faq_suggestions":{"items":{"$ref":"#/components/schemas/SuggestedFAQ"},"type":"array","title":"Faq Suggestions","default":[]},"voice_recommendation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Recommendation"},"google_maps_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Google Maps Url"},"rating":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rating"},"reviews_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reviews Count"},"confidence":{"type":"number","title":"Confidence","default":0.0},"source":{"type":"string","title":"Source","default":"manual"}},"type":"object","required":["business_name"],"title":"AutoConfigureResponse"},"AutopayNotification":{"properties":{"transactionId":{"type":"string","title":"Transactionid"},"orderId":{"type":"string","title":"Orderid"},"amount":{"type":"integer","title":"Amount"},"currency":{"type":"string","title":"Currency"},"status":{"type":"string","title":"Status"},"paymentMethod":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paymentmethod"},"signature":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signature"}},"type":"object","required":["transactionId","orderId","amount","currency","status"],"title":"AutopayNotification","description":"Autopay payment notification."},"BlockedTimeCreate":{"properties":{"title":{"type":"string","title":"Title"},"start_time":{"type":"string","title":"Start Time"},"end_time":{"type":"string","title":"End Time"},"recurrence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence","default":"none"},"recurrence_end_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence End Date"}},"type":"object","required":["title","start_time","end_time"],"title":"BlockedTimeCreate"},"BlockedTimeResponse":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"recurrence":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recurrence"},"recurrence_end_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Recurrence End Date"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","title","start_time","end_time","recurrence","recurrence_end_date","created_at"],"title":"BlockedTimeResponse"},"Body_clone_voice_voices_clone_post":{"properties":{"voice_name":{"type":"string","title":"Voice Name"},"audio_file":{"type":"string","contentMediaType":"application/octet-stream","title":"Audio File"}},"type":"object","required":["voice_name","audio_file"],"title":"Body_clone_voice_voices_clone_post"},"Body_create_ticket_support_ticket_post":{"properties":{"category":{"type":"string","title":"Category"},"severity":{"type":"string","title":"Severity"},"subject":{"type":"string","title":"Subject"},"description":{"type":"string","title":"Description"},"email":{"type":"string","title":"Email","default":""},"tenant_id":{"type":"string","title":"Tenant Id","default":""},"screenshot":{"anyOf":[{"type":"string","contentMediaType":"application/octet-stream"},{"type":"null"}],"title":"Screenshot"}},"type":"object","required":["category","severity","subject","description"],"title":"Body_create_ticket_support_ticket_post"},"Body_import_excel_tenants__tenant_id__data_sources_import_excel_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_excel_tenants__tenant_id__data_sources_import_excel_post"},"Body_login_auth_login_post":{"properties":{"grant_type":{"anyOf":[{"type":"string","pattern":"^password$"},{"type":"null"}],"title":"Grant Type"},"username":{"type":"string","title":"Username"},"password":{"type":"string","format":"password","title":"Password"},"scope":{"type":"string","title":"Scope","default":""},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"format":"password","title":"Client Secret"}},"type":"object","required":["username","password"],"title":"Body_login_auth_login_post"},"Body_replace_document_tenants__tenant_id__knowledge_documents__document_id__replace_put":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_replace_document_tenants__tenant_id__knowledge_documents__document_id__replace_put"},"Body_upload_document_tenants__tenant_id__knowledge_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_document_tenants__tenant_id__knowledge_upload_post"},"Body_upload_logo_tenants__tenant_id__brand_logo_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_logo_tenants__tenant_id__brand_logo_post"},"BrandConfigResponse":{"properties":{"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"primary_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Color"},"secondary_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Secondary Color"},"brand_voice_tone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brand Voice Tone"},"communication_guidelines":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Communication Guidelines"},"greeting_style":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting Style"},"forbidden_phrases":{"items":{"type":"string"},"type":"array","title":"Forbidden Phrases","default":[]},"preferred_phrases":{"items":{"type":"string"},"type":"array","title":"Preferred Phrases","default":[]}},"type":"object","title":"BrandConfigResponse"},"BrandConfigUpdate":{"properties":{"primary_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Color"},"secondary_color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Secondary Color"},"brand_voice_tone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brand Voice Tone"},"communication_guidelines":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Communication Guidelines"},"greeting_style":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting Style"},"forbidden_phrases":{"items":{"type":"string"},"type":"array","title":"Forbidden Phrases","default":[]},"preferred_phrases":{"items":{"type":"string"},"type":"array","title":"Preferred Phrases","default":[]}},"type":"object","title":"BrandConfigUpdate"},"BroadcastNotificationRequest":{"properties":{"type":{"type":"string","title":"Type","default":"admin"},"title":{"type":"string","title":"Title"},"message":{"type":"string","title":"Message"},"action_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Url"},"action_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Label"},"send_email":{"type":"boolean","title":"Send Email","default":false},"target":{"type":"string","title":"Target","default":"all"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"confirm_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Confirm Count"}},"type":"object","required":["title","message"],"title":"BroadcastNotificationRequest"},"BroadcastNotificationResponse":{"properties":{"sent_in_app":{"type":"integer","title":"Sent In App"},"sent_email":{"type":"integer","title":"Sent Email"},"skipped":{"type":"integer","title":"Skipped"}},"type":"object","required":["sent_in_app","sent_email","skipped"],"title":"BroadcastNotificationResponse"},"BusinessInfo":{"properties":{"hours":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hours"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"services":{"items":{"type":"string"},"type":"array","title":"Services","default":[]}},"type":"object","title":"BusinessInfo"},"ByCallerWipeRequest":{"properties":{"caller_number":{"type":"string","title":"Caller Number"}},"type":"object","required":["caller_number"],"title":"ByCallerWipeRequest"},"ByCallerWipeResponse":{"properties":{"wiped_calls":{"type":"integer","title":"Wiped Calls"},"caller_number":{"type":"string","title":"Caller Number"}},"type":"object","required":["wiped_calls","caller_number"],"title":"ByCallerWipeResponse"},"CacheInvalidateResponse":{"properties":{"deleted":{"type":"integer","title":"Deleted"}},"type":"object","required":["deleted"],"title":"CacheInvalidateResponse"},"CacheLookupRequest":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"question":{"type":"string","title":"Question"}},"type":"object","required":["tenant_id","question"],"title":"CacheLookupRequest"},"CacheLookupResponse":{"properties":{"hit":{"type":"boolean","title":"Hit"},"answer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Answer"},"cache_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cache Id"}},"type":"object","required":["hit"],"title":"CacheLookupResponse"},"CacheStoreRequest":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"}},"type":"object","required":["tenant_id","question","answer"],"title":"CacheStoreRequest"},"CacheStoreResponse":{"properties":{"id":{"type":"string","title":"Id"}},"type":"object","required":["id"],"title":"CacheStoreResponse"},"CalendarCallbackRequest":{"properties":{"code":{"type":"string","title":"Code"},"redirect_uri":{"type":"string","title":"Redirect Uri"}},"type":"object","required":["code","redirect_uri"],"title":"CalendarCallbackRequest"},"CalendarConfigResponse":{"properties":{"provider":{"type":"string","title":"Provider"},"config":{"additionalProperties":true,"type":"object","title":"Config"}},"type":"object","required":["provider","config"],"title":"CalendarConfigResponse"},"CalendarConnectRequest":{"properties":{"provider":{"type":"string","title":"Provider","default":"google"},"redirect_uri":{"type":"string","title":"Redirect Uri"}},"type":"object","required":["redirect_uri"],"title":"CalendarConnectRequest"},"CalendarEntry":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"color":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Color"},"primary":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Primary"}},"type":"object","required":["id","name"],"title":"CalendarEntry"},"CalendarIntegrationResponse":{"properties":{"id":{"type":"string","title":"Id"},"provider":{"type":"string","title":"Provider"},"calendar_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Email"},"calendar_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Name"},"status":{"type":"string","title":"Status"},"selected_calendar_ids":{"items":{},"type":"array","title":"Selected Calendar Ids"},"auto_sync":{"type":"boolean","title":"Auto Sync"},"is_primary":{"type":"boolean","title":"Is Primary"},"last_synced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Synced At"}},"type":"object","required":["id","provider","calendar_email","calendar_name","status","selected_calendar_ids","auto_sync","is_primary","last_synced_at"],"title":"CalendarIntegrationResponse"},"CallCreate":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"twilio_call_sid":{"type":"string","title":"Twilio Call Sid"},"twilio_stream_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Twilio Stream Sid"},"caller_number":{"type":"string","title":"Caller Number"},"called_number":{"type":"string","title":"Called Number"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"is_demo":{"type":"boolean","title":"Is Demo","default":false},"is_test":{"type":"boolean","title":"Is Test","default":false}},"type":"object","required":["tenant_id","twilio_call_sid","caller_number","called_number","started_at"],"title":"CallCreate","description":"Called by voice engine when a call starts."},"CallDataDeleteResponse":{"properties":{"status":{"type":"string","title":"Status"},"call_id":{"type":"string","title":"Call Id"},"deleted_at":{"type":"string","title":"Deleted At"},"retained":{"items":{"type":"string"},"type":"array","title":"Retained","default":["duration","outcome","timestamps"]}},"type":"object","required":["status","call_id","deleted_at"],"title":"CallDataDeleteResponse"},"CallDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"twilio_call_sid":{"type":"string","title":"Twilio Call Sid"},"caller_number":{"type":"string","title":"Caller Number"},"called_number":{"type":"string","title":"Called Number"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"billing_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Billing Minutes"},"status":{"type":"string","title":"Status"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"transferred_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transferred To"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"summary_pl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Pl"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"},"callback_requested":{"type":"boolean","title":"Callback Requested","default":false},"callback_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Message"},"callback_resolved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Callback Resolved At"},"message_left":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Left"},"recording_available":{"type":"boolean","title":"Recording Available","default":false},"recording_duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recording Duration Seconds"},"had_error":{"type":"boolean","title":"Had Error","default":false},"latency_avg_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Avg Ms"},"latency_p95_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency P95 Ms"},"interruptions_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Interruptions Count"},"tool_calls_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Calls Count"},"tool_error_count":{"type":"integer","title":"Tool Error Count","default":0},"failed_promises":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Failed Promises"},"stt_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Stt Cost Cents"},"llm_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Llm Cost Cents"},"tts_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tts Cost Cents"},"twilio_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Twilio Cost Cents"},"transcript_turns":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Transcript Turns"},"team_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Note"},"recording_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recording Sid"}},"type":"object","required":["id","tenant_id","twilio_call_sid","caller_number","called_number","started_at","ended_at","duration_seconds","status","outcome","transferred_to","summary","sentiment","tags","transcript_turns"],"title":"CallDetailResponse"},"CallFlagRequest":{"properties":{"reason":{"type":"string","title":"Reason","default":""}},"type":"object","title":"CallFlagRequest"},"CallFlagResponse":{"properties":{"call_id":{"type":"string","title":"Call Id"},"flagged":{"type":"boolean","title":"Flagged"}},"type":"object","required":["call_id","flagged"],"title":"CallFlagResponse"},"CallFunnel":{"properties":{"range_label":{"type":"string","title":"Range Label"},"range_start":{"type":"string","format":"date-time","title":"Range Start"},"total_calls":{"type":"integer","title":"Total Calls"},"booked":{"type":"integer","title":"Booked"},"faq_resolved":{"type":"integer","title":"Faq Resolved"},"escalated":{"type":"integer","title":"Escalated"},"failed":{"type":"integer","title":"Failed"},"other":{"type":"integer","title":"Other"},"estimated_revenue_grosze":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimated Revenue Grosze"},"avg_appointment_value_grosze":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Avg Appointment Value Grosze"}},"type":"object","required":["range_label","range_start","total_calls","booked","faq_resolved","escalated","failed","other","estimated_revenue_grosze","avg_appointment_value_grosze"],"title":"CallFunnel"},"CallListOut":{"properties":{"data":{"items":{"$ref":"#/components/schemas/CallOut"},"type":"array","title":"Data"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["data","limit","offset","has_more"],"title":"CallListOut"},"CallListResponse":{"properties":{"calls":{"items":{"$ref":"#/components/schemas/CallResponse"},"type":"array","title":"Calls"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["calls","total"],"title":"CallListResponse"},"CallOut":{"properties":{"id":{"type":"string","title":"Id"},"created_at":{"type":"string","title":"Created At"},"caller_number":{"type":"string","title":"Caller Number"},"direction":{"type":"string","title":"Direction"},"status":{"type":"string","title":"Status"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"had_error":{"type":"boolean","title":"Had Error"}},"type":"object","required":["id","created_at","caller_number","direction","status","outcome","duration_seconds","sentiment","summary","had_error"],"title":"CallOut"},"CallResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"twilio_call_sid":{"type":"string","title":"Twilio Call Sid"},"caller_number":{"type":"string","title":"Caller Number"},"called_number":{"type":"string","title":"Called Number"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"billing_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Billing Minutes"},"status":{"type":"string","title":"Status"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"transferred_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transferred To"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"summary_pl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Pl"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags"},"callback_requested":{"type":"boolean","title":"Callback Requested","default":false},"callback_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Message"},"callback_resolved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Callback Resolved At"},"message_left":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Left"},"recording_available":{"type":"boolean","title":"Recording Available","default":false},"recording_duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recording Duration Seconds"},"had_error":{"type":"boolean","title":"Had Error","default":false}},"type":"object","required":["id","tenant_id","twilio_call_sid","caller_number","called_number","started_at","ended_at","duration_seconds","status","outcome","transferred_to","summary","sentiment","tags"],"title":"CallResponse"},"CallStats":{"properties":{"total_calls":{"type":"integer","title":"Total Calls"},"total_minutes":{"type":"integer","title":"Total Minutes"},"avg_duration_seconds":{"type":"number","title":"Avg Duration Seconds"},"completed_calls":{"type":"integer","title":"Completed Calls"},"transferred_calls":{"type":"integer","title":"Transferred Calls"},"failed_calls":{"type":"integer","title":"Failed Calls"},"top_outcomes":{"additionalProperties":{"type":"integer"},"type":"object","title":"Top Outcomes"},"sentiment_breakdown":{"additionalProperties":{"type":"integer"},"type":"object","title":"Sentiment Breakdown"}},"type":"object","required":["total_calls","total_minutes","avg_duration_seconds","completed_calls","transferred_calls","failed_calls","top_outcomes","sentiment_breakdown"],"title":"CallStats"},"CallUpdate":{"properties":{"ended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Ended At"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"transferred_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transferred To"},"latency_avg_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Avg Ms"},"latency_p95_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency P95 Ms"},"interruptions_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Interruptions Count"},"tool_calls_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Calls Count"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"summary_pl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Pl"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Tags"},"callback_requested":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Callback Requested"},"callback_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Callback Message"},"message_left":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Left"},"had_error":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Had Error"},"tool_error_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tool Error Count"},"failed_promises":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Failed Promises"},"recording_consent":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Recording Consent"}},"type":"object","title":"CallUpdate","description":"Called by voice engine when a call ends or consent is logged."},"CallUsageCreate":{"properties":{"stt_duration_seconds":{"type":"integer","title":"Stt Duration Seconds","default":0},"llm_input_tokens":{"type":"integer","title":"Llm Input Tokens","default":0},"llm_output_tokens":{"type":"integer","title":"Llm Output Tokens","default":0},"tts_chars":{"type":"integer","title":"Tts Chars","default":0},"twilio_duration_seconds":{"type":"integer","title":"Twilio Duration Seconds","default":0},"elevenlabs_chars":{"type":"integer","title":"Elevenlabs Chars","default":0},"deepgram_seconds":{"type":"integer","title":"Deepgram Seconds","default":0},"gemini_tokens":{"type":"integer","title":"Gemini Tokens","default":0},"twilio_minutes":{"type":"number","title":"Twilio Minutes","default":0.0}},"type":"object","title":"CallUsageCreate"},"CallUsageResponse":{"properties":{"call_id":{"type":"string","title":"Call Id"},"stt_duration_seconds":{"type":"integer","title":"Stt Duration Seconds"},"stt_cost_cents":{"type":"integer","title":"Stt Cost Cents"},"llm_input_tokens":{"type":"integer","title":"Llm Input Tokens"},"llm_output_tokens":{"type":"integer","title":"Llm Output Tokens"},"llm_cost_cents":{"type":"integer","title":"Llm Cost Cents"},"tts_chars":{"type":"integer","title":"Tts Chars"},"tts_cost_cents":{"type":"integer","title":"Tts Cost Cents"},"twilio_duration_seconds":{"type":"integer","title":"Twilio Duration Seconds"},"twilio_cost_cents":{"type":"integer","title":"Twilio Cost Cents"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"}},"type":"object","required":["call_id","stt_duration_seconds","stt_cost_cents","llm_input_tokens","llm_output_tokens","llm_cost_cents","tts_chars","tts_cost_cents","twilio_duration_seconds","twilio_cost_cents","total_cost_cents"],"title":"CallUsageResponse"},"CallbackResolveResponse":{"properties":{"call_id":{"type":"string","title":"Call Id"},"resolved_at":{"type":"string","format":"date-time","title":"Resolved At"}},"type":"object","required":["call_id","resolved_at"],"title":"CallbackResolveResponse"},"CallerConsentDetailResponse":{"properties":{"consent_id":{"type":"string","title":"Consent Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"consent_type":{"type":"string","title":"Consent Type"},"logged_at":{"type":"string","title":"Logged At"}},"type":"object","required":["consent_id","tenant_id","consent_type","logged_at"],"title":"CallerConsentDetailResponse"},"CallerConsentRequest":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"caller_phone_hash":{"type":"string","title":"Caller Phone Hash"},"consent_type":{"type":"string","title":"Consent Type"}},"type":"object","required":["tenant_id","caller_phone_hash","consent_type"],"title":"CallerConsentRequest"},"CallerConsentResponse":{"properties":{"consent_id":{"type":"string","title":"Consent Id"},"logged_at":{"type":"string","title":"Logged At"}},"type":"object","required":["consent_id","logged_at"],"title":"CallerConsentResponse"},"CallerNameRequest":{"properties":{"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"phone_hash":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Hash"},"name":{"type":"string","title":"Name"}},"type":"object","required":["name"],"title":"CallerNameRequest"},"CallerNoteRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number"},"note":{"type":"string","title":"Note"}},"type":"object","required":["phone_number","note"],"title":"CallerNoteRequest"},"CancellationRequest":{"properties":{"reason":{"type":"string","title":"Reason"},"requested_at_period_end":{"type":"boolean","title":"Requested At Period End","default":true},"early_termination":{"type":"boolean","title":"Early Termination","default":false}},"type":"object","required":["reason"],"title":"CancellationRequest"},"ChatRequest":{"properties":{"message":{"type":"string","title":"Message"},"locale":{"type":"string","title":"Locale","default":"pl"}},"type":"object","required":["message"],"title":"ChatRequest"},"CheckoutResponse":{"properties":{"checkout_url":{"type":"string","title":"Checkout Url"},"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["checkout_url","session_id"],"title":"CheckoutResponse"},"CiDeployEventBody":{"properties":{"service":{"type":"string","title":"Service"},"deploy_sha":{"type":"string","title":"Deploy Sha"},"revision":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revision"}},"type":"object","required":["service","deploy_sha"],"title":"CiDeployEventBody"},"CiIncidentBody":{"properties":{"title":{"type":"string","title":"Title"},"severity":{"type":"string","title":"Severity","default":"major_outage"},"affected_components":{"items":{"type":"string"},"type":"array","title":"Affected Components"},"message_pl":{"type":"string","title":"Message Pl"},"message_en":{"type":"string","title":"Message En"},"deploy_sha":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deploy Sha"},"auto_opened":{"type":"boolean","title":"Auto Opened","default":true}},"type":"object","required":["title","affected_components","message_pl","message_en"],"title":"CiIncidentBody"},"CloneVoiceResponse":{"properties":{"voice_id":{"type":"string","title":"Voice Id"},"status":{"type":"string","title":"Status"},"name":{"type":"string","title":"Name"}},"type":"object","required":["voice_id","status","name"],"title":"CloneVoiceResponse"},"ComplianceSignal":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"status":{"type":"string","title":"Status"},"detail":{"type":"string","title":"Detail"},"params":{"additionalProperties":true,"type":"object","title":"Params","default":{}}},"type":"object","required":["key","label","status","detail"],"title":"ComplianceSignal"},"ComplianceSummary":{"properties":{"generated_at":{"type":"string","title":"Generated At"},"ai_act_applies_from":{"type":"string","title":"Ai Act Applies From","default":"2026-08-02"},"signals":{"items":{"$ref":"#/components/schemas/ComplianceSignal"},"type":"array","title":"Signals"},"consent_total":{"type":"integer","title":"Consent Total"},"dsar_open":{"type":"integer","title":"Dsar Open"},"dsar_oldest_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Dsar Oldest Days"},"sub_processor_count":{"type":"integer","title":"Sub Processor Count"},"retention_last_run":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Retention Last Run"}},"type":"object","required":["generated_at","signals","consent_total","dsar_open","dsar_oldest_days","sub_processor_count","retention_last_run"],"title":"ComplianceSummary"},"ComponentHealthResponse":{"properties":{"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Ms"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["name","status"],"title":"ComponentHealthResponse"},"ComponentUptimeDTO":{"properties":{"component":{"type":"string","title":"Component"},"days":{"items":{"$ref":"#/components/schemas/UptimeDayDTO"},"type":"array","title":"Days"}},"type":"object","required":["component","days"],"title":"ComponentUptimeDTO"},"ConsentRecord":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Name"},"consent_type":{"type":"string","title":"Consent Type"},"granted":{"type":"boolean","title":"Granted"},"granted_at":{"type":"string","format":"date-time","title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Revoked At"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"}},"type":"object","required":["id","tenant_id","tenant_name","consent_type","granted","granted_at","revoked_at","ip_address"],"title":"ConsentRecord"},"ConsentRequest":{"properties":{"legal_basis_code":{"type":"string","title":"Legal Basis Code"},"sensitive_columns_detected":{"items":{"type":"string"},"type":"array","title":"Sensitive Columns Detected"},"locale":{"type":"string","title":"Locale","default":"pl"}},"type":"object","required":["legal_basis_code","sensitive_columns_detected"],"title":"ConsentRequest"},"ConsentResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"consent_type":{"type":"string","title":"Consent Type"},"granted":{"type":"boolean","title":"Granted"},"granted_at":{"type":"string","title":"Granted At"},"revoked_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Revoked At"},"consent_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consent Method"}},"type":"object","required":["id","tenant_id","consent_type","granted","granted_at","revoked_at","consent_method"],"title":"ConsentResponse","description":"Consent record response."},"ConsentStatusResponse":{"properties":{"call_recording":{"type":"boolean","title":"Call Recording"},"analytics":{"type":"boolean","title":"Analytics"},"marketing":{"type":"boolean","title":"Marketing"},"sms_notifications":{"type":"boolean","title":"Sms Notifications"}},"type":"object","required":["call_recording","analytics","marketing","sms_notifications"],"title":"ConsentStatusResponse","description":"Current consent status for all types."},"ConsentsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ConsentRecord"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"type_counts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Type Counts"}},"type":"object","required":["items","total","type_counts"],"title":"ConsentsResponse"},"ContactRequest":{"properties":{"name":{"type":"string","title":"Name"},"email":{"type":"string","format":"email","title":"Email"},"reason":{"type":"string","title":"Reason"},"message":{"type":"string","title":"Message"},"language":{"type":"string","title":"Language","default":"pl"}},"type":"object","required":["name","email","reason","message"],"title":"ContactRequest"},"ConversationPreviewRequest":{"properties":{"greeting":{"type":"string","title":"Greeting"},"faq_question":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Faq Question"},"faq_answer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Faq Answer"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id"}},"type":"object","required":["greeting"],"title":"ConversationPreviewRequest"},"ConversationPreviewResponse":{"properties":{"turns":{"items":{"$ref":"#/components/schemas/ConversationTurn"},"type":"array","title":"Turns"},"total_duration_estimate_ms":{"type":"integer","title":"Total Duration Estimate Ms"}},"type":"object","required":["turns","total_duration_estimate_ms"],"title":"ConversationPreviewResponse"},"ConversationTurn":{"properties":{"role":{"type":"string","title":"Role"},"text":{"type":"string","title":"Text"},"audio_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio Base64"}},"type":"object","required":["role","text"],"title":"ConversationTurn"},"ConversionOut":{"properties":{"id":{"type":"string","title":"Id"},"affiliate_code":{"type":"string","title":"Affiliate Code"},"invitee_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invitee Email"},"status":{"type":"string","title":"Status"},"commission_grosze":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Commission Grosze"},"eligible_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eligible At"},"paid_out_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Paid Out At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","affiliate_code","invitee_email","status","commission_grosze","eligible_at","paid_out_at","created_at"],"title":"ConversionOut"},"CostBreakdown":{"properties":{"stt_cost_cents":{"type":"integer","title":"Stt Cost Cents"},"llm_cost_cents":{"type":"integer","title":"Llm Cost Cents"},"tts_cost_cents":{"type":"integer","title":"Tts Cost Cents"},"twilio_cost_cents":{"type":"integer","title":"Twilio Cost Cents"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"}},"type":"object","required":["stt_cost_cents","llm_cost_cents","tts_cost_cents","twilio_cost_cents","total_cost_cents"],"title":"CostBreakdown"},"CostSummaryResponse":{"properties":{"today":{"$ref":"#/components/schemas/CostBreakdown"},"this_month":{"$ref":"#/components/schemas/CostBreakdown"},"revenue_this_month_grosze":{"type":"integer","title":"Revenue This Month Grosze"},"margin_pct":{"type":"number","title":"Margin Pct"},"calls_today":{"type":"integer","title":"Calls Today"},"calls_this_month":{"type":"integer","title":"Calls This Month"},"avg_cost_per_call_cents":{"type":"number","title":"Avg Cost Per Call Cents"},"top_cost_tenants":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Top Cost Tenants"}},"type":"object","required":["today","this_month","revenue_this_month_grosze","margin_pct","calls_today","calls_this_month","avg_cost_per_call_cents","top_cost_tenants"],"title":"CostSummaryResponse"},"CouponListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/CouponResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"CouponListResponse"},"CouponResponse":{"properties":{"id":{"type":"string","title":"Id"},"promo_code":{"type":"string","title":"Promo Code"},"plan":{"type":"string","title":"Plan"},"percent_off":{"type":"integer","title":"Percent Off"},"duration_months":{"type":"integer","title":"Duration Months"},"max_redemptions":{"type":"integer","title":"Max Redemptions"},"times_redeemed":{"type":"integer","title":"Times Redeemed"},"active":{"type":"boolean","title":"Active"},"created_at":{"type":"string","title":"Created At"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"coupon_type":{"type":"string","title":"Coupon Type","default":"one_time"}},"type":"object","required":["id","promo_code","plan","percent_off","duration_months","max_redemptions","times_redeemed","active","created_at"],"title":"CouponResponse"},"CreateCheckoutRequest":{"properties":{"resource_type":{"type":"string","title":"Resource Type"},"quantity":{"type":"integer","title":"Quantity"},"success_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Success Url"},"cancel_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancel Url"}},"type":"object","required":["resource_type","quantity"],"title":"CreateCheckoutRequest"},"CreateCouponRequest":{"properties":{"plan":{"type":"string","title":"Plan"},"duration_months":{"type":"integer","title":"Duration Months","default":1},"max_redemptions":{"type":"integer","title":"Max Redemptions","default":1},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"coupon_type":{"type":"string","title":"Coupon Type","default":"one_time"}},"type":"object","required":["plan"],"title":"CreateCouponRequest"},"CriticalSignal":{"properties":{"key":{"type":"string","title":"Key"},"severity":{"type":"string","title":"Severity"},"label":{"type":"string","title":"Label"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"href":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Href"},"count":{"type":"integer","title":"Count","default":0},"params":{"additionalProperties":true,"type":"object","title":"Params","default":{}}},"type":"object","required":["key","severity","label"],"title":"CriticalSignal","description":"One operator-actionable signal. Severity drives row color on the\noverview triage panel: critical=red, warning=amber, info=gray, ok=emerald."},"CriticalSignalsResponse":{"properties":{"signals":{"items":{"$ref":"#/components/schemas/CriticalSignal"},"type":"array","title":"Signals"},"fetched_at":{"type":"string","format":"date-time","title":"Fetched At"}},"type":"object","required":["signals","fetched_at"],"title":"CriticalSignalsResponse"},"CrmConfigRequest":{"properties":{"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"api_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Key"},"api_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Url"}},"type":"object","title":"CrmConfigRequest"},"DPAResponse":{"properties":{"text":{"type":"string","title":"Text"},"tenant_name":{"type":"string","title":"Tenant Name"},"generated_at":{"type":"string","title":"Generated At"},"sub_processors":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sub Processors"}},"type":"object","required":["text","tenant_name","generated_at","sub_processors"],"title":"DPAResponse"},"DataExportResponse":{"properties":{"tenant":{"additionalProperties":true,"type":"object","title":"Tenant"},"phone_numbers":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Phone Numbers"},"departments":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Departments"},"calls":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Calls"},"usage_summary":{"additionalProperties":true,"type":"object","title":"Usage Summary"},"exported_at":{"type":"string","title":"Exported At"}},"type":"object","required":["tenant","phone_numbers","departments","calls","usage_summary","exported_at"],"title":"DataExportResponse","description":"GDPR Art. 20 - Data portability response."},"DataSourceCreate":{"properties":{"name":{"type":"string","title":"Name"},"purpose":{"type":"string","title":"Purpose"},"type":{"type":"string","title":"Type","default":"google_sheets"},"sheet_id":{"type":"string","title":"Sheet Id","default":""},"sheet_name":{"type":"string","title":"Sheet Name","default":"Sheet1"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"ai_access":{"type":"boolean","title":"Ai Access","default":true},"department_scope":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Department Scope"},"cross_reference_allowed":{"type":"boolean","title":"Cross Reference Allowed","default":true},"import_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Import Id"}},"type":"object","required":["name","purpose"],"title":"DataSourceCreate"},"DataSourceResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"purpose":{"type":"string","title":"Purpose"},"type":{"type":"string","title":"Type"},"sheet_id":{"type":"string","title":"Sheet Id"},"sheet_name":{"type":"string","title":"Sheet Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"ai_access":{"type":"boolean","title":"Ai Access"},"is_active":{"type":"boolean","title":"Is Active"},"department_scope":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Department Scope"},"cross_reference_allowed":{"type":"boolean","title":"Cross Reference Allowed"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","purpose","type","sheet_id","sheet_name","description","ai_access","is_active","department_scope","cross_reference_allowed","created_at"],"title":"DataSourceResponse"},"DataSourceUpdate":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"purpose":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Purpose"},"sheet_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sheet Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"ai_access":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ai Access"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"department_scope":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Department Scope"},"cross_reference_allowed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Cross Reference Allowed"}},"type":"object","title":"DataSourceUpdate"},"DataSubjectRequestPayload":{"properties":{"tenant_id":{"type":"string","maxLength":64,"minLength":8,"title":"Tenant Id"},"phone":{"type":"string","maxLength":20,"minLength":4,"title":"Phone"},"request_type":{"type":"string","enum":["access","rectification","erasure","restriction","objection"],"title":"Request Type"},"description":{"type":"string","maxLength":2000,"title":"Description","default":""},"contact_email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Contact Email"}},"type":"object","required":["tenant_id","phone","request_type"],"title":"DataSubjectRequestPayload"},"DataSubjectRequestResponse":{"properties":{"ticket_id":{"type":"string","title":"Ticket Id"},"status":{"type":"string","title":"Status"},"message_pl":{"type":"string","title":"Message Pl"},"message_en":{"type":"string","title":"Message En"}},"type":"object","required":["ticket_id","status","message_pl","message_en"],"title":"DataSubjectRequestResponse"},"DeleteAccountRequest":{"properties":{"confirm":{"type":"boolean","title":"Confirm"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["confirm"],"title":"DeleteAccountRequest","description":"Confirmation required for account deletion."},"DemoCallDetail":{"properties":{"id":{"type":"string","title":"Id"},"caller_number":{"type":"string","title":"Caller Number"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"status":{"type":"string","title":"Status"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"summary_pl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Pl"},"callback_requested":{"type":"boolean","title":"Callback Requested"},"follow_up_needed":{"type":"boolean","title":"Follow Up Needed"},"had_error":{"type":"boolean","title":"Had Error"},"transcript_turns":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Transcript Turns"},"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"demo_survey":{"anyOf":[{"$ref":"#/components/schemas/DemoSurvey"},{"type":"null"}]}},"type":"object","required":["id","caller_number","started_at","duration_seconds","status","outcome","sentiment","summary_pl","callback_requested","follow_up_needed","had_error","transcript_turns","summary"],"title":"DemoCallDetail"},"DemoCallEntry":{"properties":{"id":{"type":"string","title":"Id"},"caller_number":{"type":"string","title":"Caller Number"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"status":{"type":"string","title":"Status"},"outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outcome"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"summary_pl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary Pl"},"callback_requested":{"type":"boolean","title":"Callback Requested"},"follow_up_needed":{"type":"boolean","title":"Follow Up Needed"},"had_error":{"type":"boolean","title":"Had Error"}},"type":"object","required":["id","caller_number","started_at","duration_seconds","status","outcome","sentiment","summary_pl","callback_requested","follow_up_needed","had_error"],"title":"DemoCallEntry"},"DemoCallsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DemoCallEntry"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"DemoCallsResponse"},"DemoFollowUpRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"name":{"type":"string","title":"Name","default":""},"caller_number":{"type":"string","title":"Caller Number","default":""}},"type":"object","required":["email"],"title":"DemoFollowUpRequest"},"DemoLeadRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"business_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Type"},"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice","default":"female"},"utm_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Source","default":"web_demo"},"consent":{"type":"boolean","title":"Consent","default":false}},"type":"object","required":["email"],"title":"DemoLeadRequest"},"DemoSurvey":{"properties":{"business_type":{"type":"string","title":"Business Type","default":""},"calls_per_week":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Calls Per Week"},"pain_point":{"type":"string","title":"Pain Point","default":""},"recommended_plan":{"type":"string","title":"Recommended Plan","default":"unknown"},"interest_level":{"type":"string","title":"Interest Level","default":"unknown"},"objections_raised":{"items":{"type":"string"},"type":"array","title":"Objections Raised","default":[]},"sms_sent":{"type":"boolean","title":"Sms Sent","default":false},"email_sent":{"type":"boolean","title":"Email Sent","default":false},"language":{"type":"string","title":"Language","default":"pl"}},"type":"object","title":"DemoSurvey"},"DepartmentCreate":{"properties":{"name":{"type":"string","title":"Name"},"phone":{"type":"string","title":"Phone"},"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords","default":[]},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"priority":{"type":"integer","title":"Priority","default":0},"is_default":{"type":"boolean","title":"Is Default","default":false},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"voicemail_enabled":{"type":"boolean","title":"Voicemail Enabled","default":false},"voicemail_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voicemail Message"},"calendar_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Id"}},"type":"object","required":["name","phone"],"title":"DepartmentCreate"},"DepartmentResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"phone":{"type":"string","title":"Phone"},"keywords":{"items":{"type":"string"},"type":"array","title":"Keywords"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"voicemail_enabled":{"type":"boolean","title":"Voicemail Enabled"},"voicemail_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voicemail Message"},"priority":{"type":"integer","title":"Priority"},"is_default":{"type":"boolean","title":"Is Default"},"calendar_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Id"},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["id","name","phone","keywords","description","business_hours","voicemail_enabled","voicemail_message","priority","is_default"],"title":"DepartmentResponse"},"DisableRequest":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"DisableRequest"},"DocumentResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"file_type":{"type":"string","title":"File Type"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"chunk_count":{"type":"integer","title":"Chunk Count"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","title":"Created At"},"text_preview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text Preview"},"extracted_faq":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Extracted Faq"},"error_detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Detail"},"version":{"type":"integer","title":"Version","default":1}},"type":"object","required":["id","name","file_type","file_size_bytes","chunk_count","status","created_at"],"title":"DocumentResponse"},"DocumentVersionResponse":{"properties":{"version":{"type":"integer","title":"Version"},"name":{"type":"string","title":"Name"},"file_type":{"type":"string","title":"File Type"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"chunk_count":{"type":"integer","title":"Chunk Count"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["version","name","file_type","file_size_bytes","chunk_count","created_at"],"title":"DocumentVersionResponse"},"FAQItem":{"properties":{"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"},"source_url":{"type":"string","title":"Source Url"}},"type":"object","required":["question","answer","source_url"],"title":"FAQItem"},"FaqSuggestion":{"properties":{"question":{"type":"string","title":"Question"},"suggested_answer":{"type":"string","title":"Suggested Answer"},"occurrence_count":{"type":"integer","title":"Occurrence Count"},"missed_question_id":{"type":"string","title":"Missed Question Id"},"confidence":{"type":"number","title":"Confidence"}},"type":"object","required":["question","suggested_answer","occurrence_count","missed_question_id","confidence"],"title":"FaqSuggestion"},"FollowUpCreate":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Id"},"title":{"type":"string","title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"priority":{"type":"string","title":"Priority","default":"normal"}},"type":"object","required":["tenant_id","title"],"title":"FollowUpCreate"},"FollowUpOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Id"},"title":{"type":"string","title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"status":{"type":"string","title":"Status"},"priority":{"type":"string","title":"Priority"},"due_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Due Date"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"}},"type":"object","required":["id","tenant_id","call_id","title","description","status","priority","due_date","created_at","completed_at"],"title":"FollowUpOut"},"FollowUpStats":{"properties":{"total_open":{"type":"integer","title":"Total Open"},"high_priority":{"type":"integer","title":"High Priority"}},"type":"object","required":["total_open","high_priority"],"title":"FollowUpStats"},"FollowUpUpdate":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"priority":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Priority"},"due_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Due Date"}},"type":"object","title":"FollowUpUpdate"},"ForgotPasswordRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"ForgotPasswordRequest"},"GoogleAuthUrlResponse":{"properties":{"auth_url":{"type":"string","title":"Auth Url"}},"type":"object","required":["auth_url"],"title":"GoogleAuthUrlResponse"},"GoogleOAuthRequest":{"properties":{"code":{"type":"string","title":"Code"},"redirect_uri":{"type":"string","title":"Redirect Uri"},"referral_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referral Code"},"affiliate_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Affiliate Code"}},"type":"object","required":["code","redirect_uri"],"title":"GoogleOAuthRequest"},"GrantConsentRequest":{"properties":{"consent_type":{"type":"string","title":"Consent Type"},"consent_text":{"type":"string","title":"Consent Text"},"consent_method":{"type":"string","title":"Consent Method","default":"web_form"}},"type":"object","required":["consent_type","consent_text"],"title":"GrantConsentRequest","description":"Request to grant consent."},"GreetingPreviewRequest":{"properties":{"text":{"type":"string","title":"Text"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id"}},"type":"object","required":["text"],"title":"GreetingPreviewRequest"},"GreetingPreviewResponse":{"properties":{"audio_base64":{"type":"string","title":"Audio Base64"},"voice_id":{"type":"string","title":"Voice Id"},"duration_estimate_ms":{"type":"integer","title":"Duration Estimate Ms"},"cached":{"type":"boolean","title":"Cached"}},"type":"object","required":["audio_base64","voice_id","duration_estimate_ms","cached"],"title":"GreetingPreviewResponse"},"GuidanceRuleCreate":{"properties":{"category":{"type":"string","title":"Category"},"rule_text":{"type":"string","title":"Rule Text"},"is_active":{"type":"boolean","title":"Is Active","default":true},"priority":{"type":"integer","title":"Priority","default":0}},"type":"object","required":["category","rule_text"],"title":"GuidanceRuleCreate"},"GuidanceRuleOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"category":{"type":"string","title":"Category"},"rule_text":{"type":"string","title":"Rule Text"},"is_active":{"type":"boolean","title":"Is Active"},"priority":{"type":"integer","title":"Priority"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","tenant_id","category","rule_text","is_active","priority","created_at"],"title":"GuidanceRuleOut"},"GuidanceRuleUpdate":{"properties":{"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"rule_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rule Text"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"priority":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Priority"}},"type":"object","title":"GuidanceRuleUpdate"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"IncidentCreateBody":{"properties":{"title":{"type":"string","title":"Title"},"severity":{"type":"string","title":"Severity"},"affected_components":{"items":{"type":"string"},"type":"array","title":"Affected Components"},"message_pl":{"type":"string","title":"Message Pl"},"message_en":{"type":"string","title":"Message En"}},"type":"object","required":["title","severity","affected_components","message_pl","message_en"],"title":"IncidentCreateBody"},"IncidentDTO":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"severity":{"type":"string","title":"Severity"},"status":{"type":"string","title":"Status"},"affected_components":{"items":{"type":"string"},"type":"array","title":"Affected Components"},"started_at":{"type":"string","format":"date-time","title":"Started At"},"resolved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resolved At"},"auto_opened":{"type":"boolean","title":"Auto Opened"},"deploy_sha":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deploy Sha"},"updates":{"items":{"$ref":"#/components/schemas/IncidentUpdateDTO"},"type":"array","title":"Updates"}},"type":"object","required":["id","title","severity","status","affected_components","started_at","resolved_at","auto_opened","deploy_sha","updates"],"title":"IncidentDTO"},"IncidentUpdateBody":{"properties":{"status":{"type":"string","title":"Status"},"message_pl":{"type":"string","title":"Message Pl"},"message_en":{"type":"string","title":"Message En"}},"type":"object","required":["status","message_pl","message_en"],"title":"IncidentUpdateBody"},"IncidentUpdateDTO":{"properties":{"id":{"type":"string","title":"Id"},"status":{"type":"string","title":"Status"},"message_pl":{"type":"string","title":"Message Pl"},"message_en":{"type":"string","title":"Message En"},"posted_by":{"type":"string","title":"Posted By"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","status","message_pl","message_en","posted_by","created_at"],"title":"IncidentUpdateDTO"},"IntegrationErrorReport":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"integration":{"type":"string","title":"Integration"},"error":{"type":"string","title":"Error"},"level":{"type":"string","title":"Level","default":"error"},"call_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Sid"}},"type":"object","required":["tenant_id","integration","error"],"title":"IntegrationErrorReport"},"LatencyDataPoint":{"properties":{"hour":{"type":"string","title":"Hour"},"p50_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P50 Ms"},"p95_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P95 Ms"},"p99_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"P99 Ms"},"call_count":{"type":"integer","title":"Call Count"}},"type":"object","required":["hour","p50_ms","p95_ms","p99_ms","call_count"],"title":"LatencyDataPoint"},"MarkPaidRequest":{"properties":{"payout_reference":{"type":"string","title":"Payout Reference"}},"type":"object","required":["payout_reference"],"title":"MarkPaidRequest"},"MissedQuestionCreate":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Id"},"question_text":{"type":"string","title":"Question Text"},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["tenant_id","question_text","reason"],"title":"MissedQuestionCreate"},"MissedQuestionOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Id"},"question_text":{"type":"string","title":"Question Text"},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context"},"reason":{"type":"string","title":"Reason"},"occurrence_count":{"type":"integer","title":"Occurrence Count"},"resolved":{"type":"boolean","title":"Resolved"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","tenant_id","call_id","question_text","context","reason","occurrence_count","resolved","created_at"],"title":"MissedQuestionOut"},"MissedQuestionsStats":{"properties":{"total_unresolved":{"type":"integer","title":"Total Unresolved"},"this_week_count":{"type":"integer","title":"This Week Count"},"top_questions":{"items":{"$ref":"#/components/schemas/MissedQuestionOut"},"type":"array","title":"Top Questions"}},"type":"object","required":["total_unresolved","this_week_count","top_questions"],"title":"MissedQuestionsStats"},"MonthlyCallStats":{"properties":{"month":{"type":"string","title":"Month"},"total_calls":{"type":"integer","title":"Total Calls"},"total_minutes":{"type":"integer","title":"Total Minutes"},"callbacks_pending":{"type":"integer","title":"Callbacks Pending"},"callbacks_resolved":{"type":"integer","title":"Callbacks Resolved"},"top_outcomes":{"additionalProperties":{"type":"integer"},"type":"object","title":"Top Outcomes"},"comparison_last_month_percent":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Comparison Last Month Percent"}},"type":"object","required":["month","total_calls","total_minutes","callbacks_pending","callbacks_resolved","top_outcomes","comparison_last_month_percent"],"title":"MonthlyCallStats"},"MyReferralItem":{"properties":{"invitee_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invitee Email"},"status":{"type":"string","title":"Status"},"signed_up_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signed Up At"},"rewarded_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rewarded At"},"reward_amount_pln":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Reward Amount Pln"}},"type":"object","required":["invitee_email","status","signed_up_at","rewarded_at","reward_amount_pln"],"title":"MyReferralItem"},"MyReferralsResponse":{"properties":{"referral_code":{"type":"string","title":"Referral Code"},"referral_url":{"type":"string","title":"Referral Url"},"stats":{"$ref":"#/components/schemas/ReferralLinkResponse"},"referrals":{"items":{"$ref":"#/components/schemas/MyReferralItem"},"type":"array","title":"Referrals"}},"type":"object","required":["referral_code","referral_url","stats","referrals"],"title":"MyReferralsResponse"},"NewsletterSubscribeRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"source":{"type":"string","title":"Source","default":"samuelikem.com"}},"type":"object","required":["email"],"title":"NewsletterSubscribeRequest"},"NipLookupResponse":{"properties":{"nip":{"type":"string","title":"Nip"},"regon":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Regon"},"krs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Krs"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"legal_form":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Form"},"registered_address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Registered Address"},"pkd_main_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pkd Main Code"}},"type":"object","required":["nip","regon","krs","business_name","legal_form","registered_address","pkd_main_code"],"title":"NipLookupResponse"},"NotesUpdateRequest":{"properties":{"notes":{"type":"string","title":"Notes"}},"type":"object","required":["notes"],"title":"NotesUpdateRequest"},"NotificationListResponse":{"properties":{"notifications":{"items":{"$ref":"#/components/schemas/NotificationResponse"},"type":"array","title":"Notifications"},"total":{"type":"integer","title":"Total"},"unread_count":{"type":"integer","title":"Unread Count"}},"type":"object","required":["notifications","total","unread_count"],"title":"NotificationListResponse"},"NotificationResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"type":{"type":"string","title":"Type"},"title":{"type":"string","title":"Title"},"message":{"type":"string","title":"Message"},"read":{"type":"boolean","title":"Read"},"action_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Url"},"action_label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Action Label"},"metadata_json":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Metadata Json"}},"type":"object","required":["id","created_at","type","title","message","read"],"title":"NotificationResponse"},"NotifyResponse":{"properties":{"id":{"type":"string","title":"Id"},"is_notified":{"type":"boolean","title":"Is Notified"},"notified_at":{"type":"string","title":"Notified At"}},"type":"object","required":["id","is_notified","notified_at"],"title":"NotifyResponse"},"OnboardingCreate":{"properties":{"business_name":{"type":"string","title":"Business Name"},"vertical":{"type":"string","title":"Vertical"},"greeting":{"type":"string","title":"Greeting"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"faq":{"additionalProperties":{"type":"string"},"type":"object","title":"Faq","default":{}},"business_hours":{"additionalProperties":{"type":"string"},"type":"object","title":"Business Hours","default":{}},"nip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nip"},"plan":{"type":"string","title":"Plan","default":"trial"},"heard_about":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Heard About"},"promo_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Promo Code"},"minute_overage_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Minute Overage Enabled"},"caller_verification_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Caller Verification Enabled"},"invoice_street":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Street"},"invoice_postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Postal Code"},"invoice_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice City"},"invoice_country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Country Code"},"accountant_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accountant Email"}},"type":"object","required":["business_name","vertical","greeting"],"title":"OnboardingCreate","description":"Data collected during onboarding wizard."},"OnboardingResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"type":"string","title":"Business Name"},"message":{"type":"string","title":"Message"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"plan":{"type":"string","title":"Plan"},"checkout_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Checkout Url"},"is_trial":{"type":"boolean","title":"Is Trial","default":false},"checkout_failed":{"type":"boolean","title":"Checkout Failed","default":false}},"type":"object","required":["tenant_id","business_name","message","plan"],"title":"OnboardingResponse"},"OnboardingScrapeItem":{"properties":{"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"},"answer_missing":{"type":"boolean","title":"Answer Missing","default":false}},"type":"object","required":["question","answer"],"title":"OnboardingScrapeItem"},"OnboardingScrapeRequest":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"OnboardingScrapeRequest"},"OnboardingScrapeResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/OnboardingScrapeItem"},"type":"array","title":"Items"},"questions_only":{"type":"boolean","title":"Questions Only","default":false}},"type":"object","required":["items"],"title":"OnboardingScrapeResponse"},"OverageRecordRequest":{"properties":{"minutes":{"type":"integer","title":"Minutes"}},"type":"object","required":["minutes"],"title":"OverageRecordRequest"},"PasswordChange":{"properties":{"current_password":{"type":"string","title":"Current Password"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["current_password","new_password"],"title":"PasswordChange"},"PaymentConfigResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"require_deposit":{"type":"boolean","title":"Require Deposit"},"deposit_amount_grosze":{"type":"integer","title":"Deposit Amount Grosze"},"payment_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Url"},"hold_minutes":{"type":"integer","title":"Hold Minutes","default":30}},"type":"object","required":["enabled","provider","config","require_deposit","deposit_amount_grosze"],"title":"PaymentConfigResponse"},"PaymentConfigUpdate":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"require_deposit":{"type":"boolean","title":"Require Deposit","default":false},"deposit_amount_pln":{"type":"number","title":"Deposit Amount Pln","default":0.0},"payment_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Url"},"hold_minutes":{"type":"integer","title":"Hold Minutes","default":30},"config":{"additionalProperties":true,"type":"object","title":"Config","default":{}}},"type":"object","required":["enabled"],"title":"PaymentConfigUpdate"},"PaymentMethodItem":{"properties":{"id":{"type":"string","title":"Id"},"brand":{"type":"string","title":"Brand"},"last4":{"type":"string","title":"Last4"},"exp_month":{"type":"integer","title":"Exp Month"},"exp_year":{"type":"integer","title":"Exp Year"},"is_default":{"type":"boolean","title":"Is Default"}},"type":"object","required":["id","brand","last4","exp_month","exp_year","is_default"],"title":"PaymentMethodItem"},"PaymentMethodsResponse":{"properties":{"payment_methods":{"items":{"$ref":"#/components/schemas/PaymentMethodItem"},"type":"array","title":"Payment Methods"},"default_payment_method_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Payment Method Id"}},"type":"object","required":["payment_methods","default_payment_method_id"],"title":"PaymentMethodsResponse"},"PayoutDetailsRequest":{"properties":{"business_status":{"type":"string","title":"Business Status"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"iban":{"type":"string","title":"Iban"},"tax_country":{"type":"string","title":"Tax Country","default":"PL"}},"type":"object","required":["business_status","iban"],"title":"PayoutDetailsRequest"},"PhoneInventoryEntry":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"phone_number":{"type":"string","title":"Phone Number"},"provider":{"type":"string","title":"Provider"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","tenant_id","business_name","phone_number","provider","label","is_active","created_at"],"title":"PhoneInventoryEntry"},"PhoneInventoryResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/PhoneInventoryEntry"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"PhoneInventoryResponse"},"PhoneNumberAssign":{"properties":{"phone_number":{"type":"string","title":"Phone Number"},"twilio_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Twilio Sid"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","required":["phone_number"],"title":"PhoneNumberAssign"},"PhoneNumberRequest":{"properties":{"country":{"type":"string","title":"Country","default":"PL"},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"}},"type":"object","title":"PhoneNumberRequest","description":"Request to provision an additional phone number."},"PhoneNumberRequestBody":{"properties":{"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"preferred_area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Area Code"}},"type":"object","title":"PhoneNumberRequestBody"},"PhoneNumberUpdate":{"properties":{"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"}},"type":"object","title":"PhoneNumberUpdate"},"PodRestartRequest":{"properties":{"service_name":{"type":"string","title":"Service Name"}},"type":"object","required":["service_name"],"title":"PodRestartRequest"},"PolicyConfigResponse":{"properties":{"cancellation_allowed":{"type":"boolean","title":"Cancellation Allowed"},"cancellation_min_hours":{"type":"integer","title":"Cancellation Min Hours"},"cancellation_fee":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Fee"},"cancellation_blocked_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Blocked Message"},"reschedule_allowed":{"type":"boolean","title":"Reschedule Allowed"},"reschedule_min_hours":{"type":"integer","title":"Reschedule Min Hours"},"max_reschedules":{"type":"integer","title":"Max Reschedules"},"reschedule_blocked_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reschedule Blocked Message"},"default_appointment_duration":{"type":"integer","title":"Default Appointment Duration"}},"type":"object","required":["cancellation_allowed","cancellation_min_hours","cancellation_fee","cancellation_blocked_message","reschedule_allowed","reschedule_min_hours","max_reschedules","reschedule_blocked_message","default_appointment_duration"],"title":"PolicyConfigResponse"},"PolishInvoiceItem":{"properties":{"id":{"type":"string","title":"Id"},"stripe_invoice_id":{"type":"string","title":"Stripe Invoice Id"},"ifirma_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ifirma Id"},"ifirma_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ifirma Number"},"invoice_kind":{"type":"string","title":"Invoice Kind"},"amount_pln":{"type":"string","title":"Amount Pln"},"issued_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Issued At"},"email_sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email Sent At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"has_pdf":{"type":"boolean","title":"Has Pdf"}},"type":"object","required":["id","stripe_invoice_id","ifirma_id","ifirma_number","invoice_kind","amount_pln","issued_at","email_sent_at","error_message","has_pdf"],"title":"PolishInvoiceItem"},"PolishInvoiceListResponse":{"properties":{"invoices":{"items":{"$ref":"#/components/schemas/PolishInvoiceItem"},"type":"array","title":"Invoices"}},"type":"object","required":["invoices"],"title":"PolishInvoiceListResponse"},"PolishInvoiceRetryResponse":{"properties":{"invoice_id":{"type":"string","title":"Invoice Id"},"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"}},"type":"object","required":["invoice_id","status","message"],"title":"PolishInvoiceRetryResponse"},"PortalConversion":{"properties":{"status":{"type":"string","title":"Status"},"commission_pln":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Commission Pln"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["status","commission_pln","created_at"],"title":"PortalConversion"},"PortalPayoutDetails":{"properties":{"business_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Status"},"company_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company Name"},"tax_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Id"},"iban":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Iban"},"tax_country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tax Country"}},"type":"object","title":"PortalPayoutDetails"},"PortalRequest":{"properties":{"return_url":{"type":"string","title":"Return Url"}},"type":"object","required":["return_url"],"title":"PortalRequest"},"PortalResponse":{"properties":{"display_name":{"type":"string","title":"Display Name"},"code":{"type":"string","title":"Code"},"status":{"type":"string","title":"Status"},"discount_desc":{"type":"string","title":"Discount Desc"},"commission_desc":{"type":"string","title":"Commission Desc"},"share_url":{"type":"string","title":"Share Url"},"signups":{"type":"integer","title":"Signups"},"qualified":{"type":"integer","title":"Qualified"},"paid_out":{"type":"integer","title":"Paid Out"},"earned_pln":{"type":"number","title":"Earned Pln"},"pending_pln":{"type":"number","title":"Pending Pln"},"conversions":{"items":{"$ref":"#/components/schemas/PortalConversion"},"type":"array","title":"Conversions"},"terms_accepted":{"type":"boolean","title":"Terms Accepted","default":true},"payout_details_submitted":{"type":"boolean","title":"Payout Details Submitted","default":false},"payout_details":{"anyOf":[{"$ref":"#/components/schemas/PortalPayoutDetails"},{"type":"null"}]}},"type":"object","required":["display_name","code","status","discount_desc","commission_desc","share_url","signups","qualified","paid_out","earned_pln","pending_pln","conversions"],"title":"PortalResponse"},"PrivacyNoticeResponse":{"properties":{"lang":{"type":"string","title":"Lang"},"text":{"type":"string","title":"Text"},"tenant_name":{"type":"string","title":"Tenant Name"},"generated_at":{"type":"string","title":"Generated At"}},"type":"object","required":["lang","text","tenant_name","generated_at"],"title":"PrivacyNoticeResponse"},"PrivacyTemplate":{"properties":{"tenant_business_name":{"type":"string","title":"Tenant Business Name"},"tenant_contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Contact Email"},"template_pl":{"type":"string","title":"Template Pl"},"template_en":{"type":"string","title":"Template En"},"transcript_retention_days":{"type":"integer","title":"Transcript Retention Days"},"audio_retention_days":{"type":"integer","title":"Audio Retention Days"}},"type":"object","required":["tenant_business_name","tenant_contact_email","template_pl","template_en","transcript_retention_days","audio_retention_days"],"title":"PrivacyTemplate"},"ProviderQuota":{"properties":{"provider":{"type":"string","title":"Provider"},"label":{"type":"string","title":"Label"},"severity":{"type":"string","title":"Severity"},"used":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Used"},"total":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Total"},"remaining":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Remaining"},"unit":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unit"},"pct_used":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pct Used"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"last_checked":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Checked"}},"type":"object","required":["provider","label","severity"],"title":"ProviderQuota"},"ProviderQuotasResponse":{"properties":{"providers":{"items":{"$ref":"#/components/schemas/ProviderQuota"},"type":"array","title":"Providers"},"fetched_at":{"type":"string","format":"date-time","title":"Fetched At"}},"type":"object","required":["providers","fetched_at"],"title":"ProviderQuotasResponse"},"ProviderStatus":{"properties":{"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"latency_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latency Ms"}},"type":"object","required":["name","status","latency_ms"],"title":"ProviderStatus"},"PublicGreetingRequest":{"properties":{"business_name":{"type":"string","maxLength":80,"minLength":1,"title":"Business Name"},"vertical":{"type":"string","maxLength":40,"minLength":1,"title":"Vertical"},"voice":{"type":"string","pattern":"^(female|male)$","title":"Voice","default":"female"}},"type":"object","required":["business_name","vertical"],"title":"PublicGreetingRequest"},"PublicGreetingResponse":{"properties":{"audio_base64":{"type":"string","title":"Audio Base64"},"greeting_text":{"type":"string","title":"Greeting Text"},"vertical":{"type":"string","title":"Vertical"},"duration_estimate_ms":{"type":"integer","title":"Duration Estimate Ms"},"cached":{"type":"boolean","title":"Cached"}},"type":"object","required":["audio_base64","greeting_text","vertical","duration_estimate_ms","cached"],"title":"PublicGreetingResponse"},"QueryRequest":{"properties":{"query":{"type":"string","title":"Query"},"top_k":{"type":"integer","title":"Top K","default":3}},"type":"object","required":["query"],"title":"QueryRequest"},"QueryResult":{"properties":{"chunk_text":{"type":"string","title":"Chunk Text"},"similarity":{"type":"number","title":"Similarity"},"document_name":{"type":"string","title":"Document Name"}},"type":"object","required":["chunk_text","similarity","document_name"],"title":"QueryResult"},"QuotaResponse":{"properties":{"allowed":{"type":"boolean","title":"Allowed"},"minutes_remaining":{"type":"integer","title":"Minutes Remaining"},"sms_remaining":{"type":"integer","title":"Sms Remaining"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"calls_active":{"type":"integer","title":"Calls Active","default":0},"concurrent_limit":{"type":"integer","title":"Concurrent Limit","default":1}},"type":"object","required":["allowed","minutes_remaining","sms_remaining"],"title":"QuotaResponse"},"ROIResult":{"properties":{"missed_calls_per_month":{"type":"integer","title":"Missed Calls Per Month"},"revenue_lost_per_month_pln":{"type":"number","title":"Revenue Lost Per Month Pln"},"labor_cost_per_month_pln":{"type":"number","title":"Labor Cost Per Month Pln"},"total_cost_per_month_pln":{"type":"number","title":"Total Cost Per Month Pln"},"zvonai_cost_per_month_pln":{"type":"number","title":"Zvonai Cost Per Month Pln"},"monthly_savings_pln":{"type":"number","title":"Monthly Savings Pln"},"annual_savings_pln":{"type":"number","title":"Annual Savings Pln"},"payback_months":{"type":"number","title":"Payback Months"},"calls_recovered_percent":{"type":"integer","title":"Calls Recovered Percent"},"recommended_plan":{"type":"string","title":"Recommended Plan"},"recommended_plan_name":{"type":"string","title":"Recommended Plan Name"},"pain_headline":{"type":"string","title":"Pain Headline"},"pain_stat":{"type":"string","title":"Pain Stat"},"industry_name":{"type":"string","title":"Industry Name"},"story_scenario":{"type":"string","title":"Story Scenario"},"story_lost":{"type":"string","title":"Story Lost"},"story_after":{"type":"string","title":"Story After"},"story_insight":{"type":"string","title":"Story Insight"}},"type":"object","required":["missed_calls_per_month","revenue_lost_per_month_pln","labor_cost_per_month_pln","total_cost_per_month_pln","zvonai_cost_per_month_pln","monthly_savings_pln","annual_savings_pln","payback_months","calls_recovered_percent","recommended_plan","recommended_plan_name","pain_headline","pain_stat","industry_name","story_scenario","story_lost","story_after","story_insight"],"title":"ROIResult"},"RedemptionItem":{"properties":{"customer_id":{"type":"string","title":"Customer Id"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"redeemed_at":{"type":"string","title":"Redeemed At"},"subscription_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Id"}},"type":"object","required":["customer_id","customer_email","customer_name","redeemed_at","subscription_id"],"title":"RedemptionItem"},"RedemptionsResponse":{"properties":{"coupon_id":{"type":"string","title":"Coupon Id"},"items":{"items":{"$ref":"#/components/schemas/RedemptionItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["coupon_id","items","total"],"title":"RedemptionsResponse"},"ReferralLeaderboardEntry":{"properties":{"id":{"type":"string","title":"Id"},"phone":{"type":"string","title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"referral_code":{"type":"string","title":"Referral Code"},"referral_count":{"type":"integer","title":"Referral Count"},"tier":{"type":"string","title":"Tier"},"position":{"type":"integer","title":"Position"}},"type":"object","required":["id","phone","email","business_name","referral_code","referral_count","tier","position"],"title":"ReferralLeaderboardEntry"},"ReferralLeaderboardResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ReferralLeaderboardEntry"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"ReferralLeaderboardResponse"},"ReferralLinkResponse":{"properties":{"referral_code":{"type":"string","title":"Referral Code"},"referral_url":{"type":"string","title":"Referral Url"},"total_referrals":{"type":"integer","title":"Total Referrals"},"successful_referrals":{"type":"integer","title":"Successful Referrals"},"total_rewards_earned_pln":{"type":"number","title":"Total Rewards Earned Pln"},"max_referrals":{"type":"integer","title":"Max Referrals"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["referral_code","referral_url","total_referrals","successful_referrals","total_rewards_earned_pln","max_referrals","is_active"],"title":"ReferralLinkResponse"},"ReminderConfigResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"channels":{"items":{"type":"string"},"type":"array","title":"Channels"},"timing":{"items":{"type":"integer"},"type":"array","title":"Timing"},"booking_confirmation":{"type":"boolean","title":"Booking Confirmation"},"cancellation_notice":{"type":"boolean","title":"Cancellation Notice"},"custom_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Message"}},"type":"object","required":["enabled","channels","timing","booking_confirmation","cancellation_notice","custom_message"],"title":"ReminderConfigResponse"},"ReminderConfigUpdate":{"properties":{"enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Enabled"},"channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Channels"},"timing":{"anyOf":[{"items":{"type":"integer"},"type":"array"},{"type":"null"}],"title":"Timing"},"booking_confirmation":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Booking Confirmation"},"cancellation_notice":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Cancellation Notice"},"custom_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Message"}},"type":"object","title":"ReminderConfigUpdate"},"ReprovisionRequest":{"properties":{"force":{"type":"boolean","title":"Force","default":false}},"type":"object","title":"ReprovisionRequest"},"ResendVerificationByEmailRequest":{"properties":{"email":{"type":"string","title":"Email"}},"type":"object","required":["email"],"title":"ResendVerificationByEmailRequest"},"ResetPasswordRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"token":{"type":"string","title":"Token"},"new_password":{"type":"string","title":"New Password"}},"type":"object","required":["email","token","new_password"],"title":"ResetPasswordRequest"},"RoutingConfigResponse":{"properties":{"departments":{"items":{"$ref":"#/components/schemas/DepartmentResponse"},"type":"array","title":"Departments"},"default_department_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Default Department Id"},"transfer_message_template":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transfer Message Template"},"busy_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Busy Message"},"outside_hours_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outside Hours Message"},"enable_voicemail":{"type":"boolean","title":"Enable Voicemail"},"max_transfer_attempts":{"type":"integer","title":"Max Transfer Attempts"},"transfer_timeout_seconds":{"type":"integer","title":"Transfer Timeout Seconds"}},"type":"object","required":["departments","default_department_id","transfer_message_template","busy_message","outside_hours_message","enable_voicemail","max_transfer_attempts","transfer_timeout_seconds"],"title":"RoutingConfigResponse"},"SMSConfigResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"provider":{"type":"string","title":"Provider"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"send_booking_confirmation":{"type":"boolean","title":"Send Booking Confirmation"},"send_cancellation_notice":{"type":"boolean","title":"Send Cancellation Notice"}},"type":"object","required":["enabled","provider","config","send_booking_confirmation","send_cancellation_notice"],"title":"SMSConfigResponse"},"SMSTopUpRequest":{"properties":{"success_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Success Url"},"cancel_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancel Url"}},"type":"object","title":"SMSTopUpRequest"},"SMSUsageIncrement":{"properties":{"count":{"type":"integer","title":"Count","default":1}},"type":"object","title":"SMSUsageIncrement"},"SalesDemoInput":{"properties":{"company_name":{"type":"string","title":"Company Name"},"contact_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Name"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"industry":{"type":"string","enum":["dental","medical","legal","beauty","aesthetic","physio","veterinary","psychology","realestate","auto","fitness","solar","hospitality","other"],"title":"Industry"},"employees_on_phones":{"type":"integer","title":"Employees On Phones"},"hourly_labor_cost_pln":{"type":"number","title":"Hourly Labor Cost Pln"},"missed_calls_per_week":{"type":"integer","title":"Missed Calls Per Week"},"avg_call_value_pln":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Call Value Pln"}},"type":"object","required":["company_name","industry","employees_on_phones","hourly_labor_cost_pln","missed_calls_per_week"],"title":"SalesDemoInput"},"SalesDemoLeadOut":{"properties":{"id":{"type":"string","title":"Id"},"company_name":{"type":"string","title":"Company Name"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"contact_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Name"},"industry":{"type":"string","title":"Industry"},"input_data":{"additionalProperties":true,"type":"object","title":"Input Data"},"roi_result":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Roi Result"},"recommended_plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recommended Plan"},"pdf_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pdf Url"},"sent_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Sent At"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","company_name","contact_email","contact_name","industry","input_data","roi_result","recommended_plan","pdf_url","sent_at","status","created_at"],"title":"SalesDemoLeadOut"},"SaveDraftRequest":{"properties":{"step":{"type":"integer","title":"Step"},"data":{"additionalProperties":true,"type":"object","title":"Data"}},"type":"object","required":["step","data"],"title":"SaveDraftRequest"},"SchedulerJobInfo":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"next_run_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Next Run Time"},"trigger":{"type":"string","title":"Trigger"},"pending":{"type":"boolean","title":"Pending"},"coalesce":{"type":"boolean","title":"Coalesce"},"misfire_grace_time":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Misfire Grace Time"}},"type":"object","required":["id","name","next_run_time","trigger","pending","coalesce","misfire_grace_time"],"title":"SchedulerJobInfo"},"SchedulerStatusResponse":{"properties":{"running":{"type":"boolean","title":"Running"},"timezone":{"type":"string","title":"Timezone"},"job_count":{"type":"integer","title":"Job Count"},"jobs":{"items":{"$ref":"#/components/schemas/SchedulerJobInfo"},"type":"array","title":"Jobs"}},"type":"object","required":["running","timezone","job_count","jobs"],"title":"SchedulerStatusResponse"},"ScrapeFAQRequest":{"properties":{"url":{"type":"string","maxLength":2083,"minLength":1,"format":"uri","title":"Url"}},"type":"object","required":["url"],"title":"ScrapeFAQRequest"},"ScrapeFAQResponse":{"properties":{"questions":{"items":{"$ref":"#/components/schemas/FAQItem"},"type":"array","title":"Questions"},"business_info":{"$ref":"#/components/schemas/BusinessInfo"}},"type":"object","required":["questions","business_info"],"title":"ScrapeFAQResponse"},"ScriptTemplateCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"greeting":{"type":"string","minLength":1,"title":"Greeting"},"greeting_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting En"},"faq":{"additionalProperties":true,"type":"object","title":"Faq"},"faq_en":{"additionalProperties":true,"type":"object","title":"Faq En"}},"type":"object","required":["name","greeting"],"title":"ScriptTemplateCreate"},"ScriptTemplateOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"greeting":{"type":"string","title":"Greeting"},"greeting_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting En"},"faq":{"additionalProperties":true,"type":"object","title":"Faq"},"faq_en":{"additionalProperties":true,"type":"object","title":"Faq En"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","name","greeting","greeting_en","faq","faq_en","created_at","updated_at"],"title":"ScriptTemplateOut"},"SecurityEventCreate":{"properties":{"event_type":{"type":"string","title":"Event Type"},"severity":{"type":"string","title":"Severity"},"reason":{"type":"string","title":"Reason"},"confidence":{"type":"number","title":"Confidence"},"caller_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caller Number"},"text_sample":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Text Sample"}},"type":"object","required":["event_type","severity","reason","confidence"],"title":"SecurityEventCreate"},"SelectedCalendarsRequest":{"properties":{"selected_calendar_ids":{"items":{"type":"string"},"type":"array","title":"Selected Calendar Ids"}},"type":"object","required":["selected_calendar_ids"],"title":"SelectedCalendarsRequest"},"SendDemoRequest":{"properties":{"lead_id":{"type":"string","title":"Lead Id"},"contact_email":{"type":"string","title":"Contact Email"}},"type":"object","required":["lead_id","contact_email"],"title":"SendDemoRequest"},"SetupRequest":{"properties":{"method":{"type":"string","title":"Method","default":"app"}},"type":"object","title":"SetupRequest"},"SetupResponse":{"properties":{"secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Secret"},"qr_code_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qr Code Base64"},"otpauth_uri":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Otpauth Uri"},"method":{"type":"string","title":"Method"}},"type":"object","required":["method"],"title":"SetupResponse"},"SignupSourceBreakdown":{"properties":{"source":{"type":"string","title":"Source"},"count":{"type":"integer","title":"Count"},"percentage":{"type":"number","title":"Percentage"}},"type":"object","required":["source","count","percentage"],"title":"SignupSourceBreakdown"},"StatusChange":{"properties":{"status":{"type":"string","title":"Status"}},"type":"object","required":["status"],"title":"StatusChange"},"StatusComponentDTO":{"properties":{"name":{"type":"string","title":"Name"},"label_pl":{"type":"string","title":"Label Pl"},"label_en":{"type":"string","title":"Label En"},"status":{"type":"string","title":"Status"},"latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Latency Ms"}},"type":"object","required":["name","label_pl","label_en","status"],"title":"StatusComponentDTO"},"StatusGroupDTO":{"properties":{"key":{"type":"string","title":"Key"},"label_pl":{"type":"string","title":"Label Pl"},"label_en":{"type":"string","title":"Label En"},"status":{"type":"string","title":"Status"},"components":{"items":{"$ref":"#/components/schemas/StatusComponentDTO"},"type":"array","title":"Components"}},"type":"object","required":["key","label_pl","label_en","status","components"],"title":"StatusGroupDTO"},"StatusPageResponse":{"properties":{"overall_status":{"type":"string","title":"Overall Status"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"},"groups":{"items":{"$ref":"#/components/schemas/StatusGroupDTO"},"type":"array","title":"Groups"},"active_incidents":{"items":{"$ref":"#/components/schemas/IncidentDTO"},"type":"array","title":"Active Incidents"},"recent_incidents":{"items":{"$ref":"#/components/schemas/IncidentDTO"},"type":"array","title":"Recent Incidents"},"uptime_90d":{"items":{"$ref":"#/components/schemas/ComponentUptimeDTO"},"type":"array","title":"Uptime 90D"}},"type":"object","required":["overall_status","timestamp","groups","active_incidents","recent_incidents","uptime_90d"],"title":"StatusPageResponse"},"StatusResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Method"},"has_backup_codes":{"type":"boolean","title":"Has Backup Codes"}},"type":"object","required":["enabled","has_backup_codes"],"title":"StatusResponse"},"StripeEventItem":{"properties":{"id":{"type":"string","title":"Id"},"event_id":{"type":"string","title":"Event Id"},"event_type":{"type":"string","title":"Event Type"},"processed_at":{"type":"string","format":"date-time","title":"Processed At"}},"type":"object","required":["id","event_id","event_type","processed_at"],"title":"StripeEventItem"},"StripeEventsResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/StripeEventItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"type_counts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Type Counts"}},"type":"object","required":["items","total","type_counts"],"title":"StripeEventsResponse"},"SubProcessorListResponse":{"properties":{"sub_processors":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sub Processors"},"last_updated":{"type":"string","title":"Last Updated"}},"type":"object","required":["sub_processors","last_updated"],"title":"SubProcessorListResponse"},"SubscribeBody":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"locale":{"type":"string","title":"Locale","default":"pl"}},"type":"object","required":["email"],"title":"SubscribeBody"},"SubscribeRequest":{"properties":{"plan":{"type":"string","title":"Plan"},"billing_cycle":{"type":"string","title":"Billing Cycle","default":"monthly"},"success_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Success Url"},"cancel_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancel Url"},"promo_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Promo Code"}},"type":"object","required":["plan"],"title":"SubscribeRequest"},"SubscriptionResponse":{"properties":{"tier":{"type":"string","title":"Tier"},"status":{"type":"string","title":"Status"},"trial_ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Ends At"},"period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Period End"},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End"},"next_invoice_amount_pln":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Invoice Amount Pln"},"retention_offer_used":{"type":"boolean","title":"Retention Offer Used","default":false},"number_release_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Number Release Date"},"billing_cycle":{"type":"string","title":"Billing Cycle","default":"monthly"},"commitment_type":{"type":"string","title":"Commitment Type","default":"monthly"},"commitment_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Commitment End"},"past_due_since":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Past Due Since"},"suspended_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Suspended At"}},"type":"object","required":["tier","status","trial_ends_at","period_end","cancel_at_period_end","next_invoice_amount_pln"],"title":"SubscriptionResponse"},"SuggestedFAQ":{"properties":{"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"}},"type":"object","required":["question","answer"],"title":"SuggestedFAQ"},"SystemHealth":{"properties":{"api":{"type":"string","title":"Api"},"voice_engine":{"type":"string","title":"Voice Engine"},"db":{"type":"string","title":"Db"}},"type":"object","required":["api","voice_engine","db"],"title":"SystemHealth"},"SystemHealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"components":{"items":{"$ref":"#/components/schemas/ComponentHealthResponse"},"type":"array","title":"Components"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"}},"type":"object","required":["status","components","timestamp"],"title":"SystemHealthResponse"},"TeamNoteResponse":{"properties":{"call_id":{"type":"string","title":"Call Id"},"team_note":{"type":"string","title":"Team Note"}},"type":"object","required":["call_id","team_note"],"title":"TeamNoteResponse"},"TeamNoteUpdate":{"properties":{"note":{"type":"string","title":"Note"}},"type":"object","required":["note"],"title":"TeamNoteUpdate"},"TenantConfigResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_name":{"type":"string","title":"Business Name"},"vertical":{"type":"string","title":"Vertical"},"language":{"type":"string","title":"Language"},"timezone":{"type":"string","title":"Timezone","default":"Europe/Warsaw"},"supported_languages":{"items":{"type":"string"},"type":"array","title":"Supported Languages"},"greeting":{"type":"string","title":"Greeting"},"greeting_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting En"},"call_disclaimer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Disclaimer"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id"},"voice_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Voice Config"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"faq":{"additionalProperties":true,"type":"object","title":"Faq"},"faq_en":{"additionalProperties":true,"type":"object","title":"Faq En"},"business_hours":{"additionalProperties":true,"type":"object","title":"Business Hours"},"transfer_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transfer Number"},"transfer_on_frustration":{"type":"boolean","title":"Transfer On Frustration","default":true},"allowed_transfer_numbers":{"items":{"type":"string"},"type":"array","title":"Allowed Transfer Numbers","default":[]},"vacation_mode":{"type":"boolean","title":"Vacation Mode"},"vacation_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation From"},"vacation_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation Until"},"vacation_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation Message"},"vacation_allow_faq":{"type":"boolean","title":"Vacation Allow Faq","default":true},"vacation_allow_booking_after":{"type":"boolean","title":"Vacation Allow Booking After","default":true},"vacation_forward_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation Forward Number"},"calendar":{"$ref":"#/components/schemas/CalendarConfigResponse"},"payment":{"$ref":"#/components/schemas/PaymentConfigResponse"},"sms":{"$ref":"#/components/schemas/SMSConfigResponse"},"routing":{"$ref":"#/components/schemas/RoutingConfigResponse"},"policy":{"$ref":"#/components/schemas/PolicyConfigResponse"},"subscription_tier":{"type":"string","title":"Subscription Tier","default":"trialing"},"subscription_status":{"type":"string","title":"Subscription Status","default":"active"},"branding_opt_out":{"type":"boolean","title":"Branding Opt Out","default":false},"recording_consent_required":{"type":"boolean","title":"Recording Consent Required","default":true},"owner_sms_alerts_enabled":{"type":"boolean","title":"Owner Sms Alerts Enabled","default":false},"owner_sms_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Sms Phone"},"sms_on_missed_transfer":{"type":"boolean","title":"Sms On Missed Transfer","default":true},"sms_on_after_hours":{"type":"boolean","title":"Sms On After Hours","default":true},"sms_on_unanswered":{"type":"boolean","title":"Sms On Unanswered","default":true},"sms_on_cancellation":{"type":"boolean","title":"Sms On Cancellation","default":false},"sms_on_booking":{"type":"boolean","title":"Sms On Booking","default":false},"sms_on_urgent_message":{"type":"boolean","title":"Sms On Urgent Message","default":true},"email_on_message_left":{"type":"boolean","title":"Email On Message Left","default":true},"invoice_street":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Street"},"invoice_postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Postal Code"},"invoice_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice City"},"invoice_country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Country Code","default":"PL"},"accountant_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accountant Email"},"nip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nip"},"regon":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Regon"},"krs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Krs"},"legal_form":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Form"},"avg_appointment_value_grosze":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Avg Appointment Value Grosze"},"services":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Services","default":[]},"data_sources":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Data Sources","default":[]},"crm_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Crm Config"}},"type":"object","required":["id","business_name","vertical","language","supported_languages","greeting","greeting_en","system_prompt","voice_id","voice_config","address","phone","email","website","faq","faq_en","business_hours","transfer_number","vacation_mode","vacation_from","vacation_until","vacation_message","calendar","payment","sms","routing","policy"],"title":"TenantConfigResponse","description":"Full tenant config for voice engine."},"TenantCreate":{"properties":{"business_name":{"type":"string","title":"Business Name"},"vertical":{"type":"string","title":"Vertical"},"greeting":{"type":"string","title":"Greeting"},"language":{"type":"string","title":"Language","default":"pl"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"faq":{"additionalProperties":true,"type":"object","title":"Faq","default":{}},"business_hours":{"additionalProperties":true,"type":"object","title":"Business Hours","default":{}}},"type":"object","required":["business_name","vertical","greeting"],"title":"TenantCreate"},"TenantDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_name":{"type":"string","title":"Business Name"},"vertical":{"type":"string","title":"Vertical"},"subscription_tier":{"type":"string","title":"Subscription Tier"},"subscription_status":{"type":"string","title":"Subscription Status"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"trial_ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Ends At"},"nip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nip"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"invoice_street":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Street"},"invoice_postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Postal Code"},"invoice_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice City"},"invoice_country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Country Code"},"accountant_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accountant Email"},"minutes_limit":{"type":"integer","title":"Minutes Limit"},"minutes_purchased":{"type":"integer","title":"Minutes Purchased"},"minutes_used_this_month":{"type":"integer","title":"Minutes Used This Month"},"sms_limit":{"type":"integer","title":"Sms Limit"},"sms_purchased":{"type":"integer","title":"Sms Purchased"},"sms_used_this_month":{"type":"integer","title":"Sms Used This Month"},"health":{"$ref":"#/components/schemas/TenantHealthResponse"}},"type":"object","required":["id","business_name","vertical","subscription_tier","subscription_status","is_active","created_at","trial_ends_at","nip","address","phone","email","invoice_street","invoice_postal_code","invoice_city","invoice_country_code","accountant_email","minutes_limit","minutes_purchased","minutes_used_this_month","sms_limit","sms_purchased","sms_used_this_month","health"],"title":"TenantDetailResponse","description":"Full tenant detail for admin drill-in (P2). Reuses TenantHealthResponse\nfields but adds the contact + billing fields the operator needs to debug."},"TenantHealthResponse":{"properties":{"calls_today":{"type":"integer","title":"Calls Today"},"errors_today":{"type":"integer","title":"Errors Today"},"avg_latency_ms":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Latency Ms"},"minutes_remaining":{"type":"integer","title":"Minutes Remaining"},"last_call_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Call At"},"active_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Active Number"}},"type":"object","required":["calls_today","errors_today","avg_latency_ms","minutes_remaining","last_call_at","active_number"],"title":"TenantHealthResponse"},"TenantListItem":{"properties":{"id":{"type":"string","title":"Id"},"business_name":{"type":"string","title":"Business Name"},"vertical":{"type":"string","title":"Vertical"},"subscription_tier":{"type":"string","title":"Subscription Tier"},"subscription_status":{"type":"string","title":"Subscription Status"},"is_active":{"type":"boolean","title":"Is Active"},"calls_today":{"type":"integer","title":"Calls Today"},"minutes_used":{"type":"integer","title":"Minutes Used"},"minutes_limit":{"type":"integer","title":"Minutes Limit"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"signup_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signup Source"}},"type":"object","required":["id","business_name","vertical","subscription_tier","subscription_status","is_active","calls_today","minutes_used","minutes_limit","created_at"],"title":"TenantListItem"},"TenantOverageResponse":{"properties":{"tenants":{"items":{"$ref":"#/components/schemas/TenantOverageRow"},"type":"array","title":"Tenants"},"total_overage_minutes":{"type":"integer","title":"Total Overage Minutes"},"total_overage_pln":{"type":"number","title":"Total Overage Pln"}},"type":"object","required":["tenants","total_overage_minutes","total_overage_pln"],"title":"TenantOverageResponse"},"TenantOverageRow":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"type":"string","title":"Business Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"subscription_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Tier"},"minutes_limit":{"type":"integer","title":"Minutes Limit"},"minutes_purchased":{"type":"integer","title":"Minutes Purchased"},"minutes_used_this_month":{"type":"integer","title":"Minutes Used This Month"},"usage_pct":{"type":"number","title":"Usage Pct"},"overage_minutes":{"type":"integer","title":"Overage Minutes"},"overage_cost_pln":{"type":"number","title":"Overage Cost Pln"},"minute_overage_enabled":{"type":"boolean","title":"Minute Overage Enabled"},"minute_overage_consent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Minute Overage Consent At"},"minute_overage_consent_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Minute Overage Consent Source"},"minute_overage_opted_out_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Minute Overage Opted Out At"}},"type":"object","required":["tenant_id","business_name","email","subscription_tier","minutes_limit","minutes_purchased","minutes_used_this_month","usage_pct","overage_minutes","overage_cost_pln","minute_overage_enabled","minute_overage_consent_at","minute_overage_consent_source","minute_overage_opted_out_at"],"title":"TenantOverageRow"},"TenantSettingsResponse":{"properties":{"auto_topup_enabled":{"type":"boolean","title":"Auto Topup Enabled"},"auto_topup_threshold_minutes":{"type":"integer","title":"Auto Topup Threshold Minutes"},"overage_enabled":{"type":"boolean","title":"Overage Enabled"},"minute_overage_enabled":{"type":"boolean","title":"Minute Overage Enabled","default":false},"minute_overage_consent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Minute Overage Consent At"},"minute_overage_consent_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Minute Overage Consent Source"},"call_disclaimer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Disclaimer"},"audio_retention_days":{"type":"integer","title":"Audio Retention Days"},"transcript_retention_days":{"type":"integer","title":"Transcript Retention Days"},"digest_frequency":{"type":"string","title":"Digest Frequency"},"callback_alerts_enabled":{"type":"boolean","title":"Callback Alerts Enabled"},"daily_digest_enabled":{"type":"boolean","title":"Daily Digest Enabled"},"notification_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notification Email"},"subscription_tier":{"type":"string","title":"Subscription Tier"},"branding_opt_out":{"type":"boolean","title":"Branding Opt Out"},"owner_sms_alerts_enabled":{"type":"boolean","title":"Owner Sms Alerts Enabled"},"owner_sms_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Sms Phone"},"sms_on_missed_transfer":{"type":"boolean","title":"Sms On Missed Transfer"},"sms_on_after_hours":{"type":"boolean","title":"Sms On After Hours"},"sms_on_unanswered":{"type":"boolean","title":"Sms On Unanswered"},"sms_on_cancellation":{"type":"boolean","title":"Sms On Cancellation"},"sms_on_booking":{"type":"boolean","title":"Sms On Booking"},"sms_on_urgent_message":{"type":"boolean","title":"Sms On Urgent Message"},"email_on_message_left":{"type":"boolean","title":"Email On Message Left"}},"type":"object","required":["auto_topup_enabled","auto_topup_threshold_minutes","overage_enabled","audio_retention_days","transcript_retention_days","digest_frequency","callback_alerts_enabled","daily_digest_enabled","subscription_tier","branding_opt_out","owner_sms_alerts_enabled","sms_on_missed_transfer","sms_on_after_hours","sms_on_unanswered","sms_on_cancellation","sms_on_booking","sms_on_urgent_message","email_on_message_left"],"title":"TenantSettingsResponse"},"TenantSettingsUpdate":{"properties":{"auto_topup_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Topup Enabled"},"auto_topup_threshold_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Auto Topup Threshold Minutes"},"overage_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Overage Enabled"},"minute_overage_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Minute Overage Enabled"},"call_disclaimer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Disclaimer"},"audio_retention_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Audio Retention Days"},"transcript_retention_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Transcript Retention Days"},"digest_frequency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Digest Frequency"},"callback_alerts_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Callback Alerts Enabled"},"daily_digest_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Daily Digest Enabled"},"notification_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notification Email"},"branding_opt_out":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Branding Opt Out"},"owner_sms_alerts_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Owner Sms Alerts Enabled"},"owner_sms_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Sms Phone"},"sms_on_missed_transfer":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sms On Missed Transfer"},"sms_on_after_hours":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sms On After Hours"},"sms_on_unanswered":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sms On Unanswered"},"sms_on_cancellation":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sms On Cancellation"},"sms_on_booking":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sms On Booking"},"sms_on_urgent_message":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sms On Urgent Message"},"email_on_message_left":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email On Message Left"}},"type":"object","title":"TenantSettingsUpdate","description":"Partial settings update — billing/quota, retention, notification, and SMS alert fields."},"TenantTierResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_name":{"type":"string","title":"Business Name"},"subscription_tier":{"type":"string","title":"Subscription Tier"}},"type":"object","required":["id","business_name","subscription_tier"],"title":"TenantTierResponse"},"TenantTierUpdate":{"properties":{"subscription_tier":{"type":"string","title":"Subscription Tier"}},"type":"object","required":["subscription_tier"],"title":"TenantTierUpdate"},"TenantUpdate":{"properties":{"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"vertical":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vertical"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"greeting_en":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting En"},"call_disclaimer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Disclaimer"},"system_prompt":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"System Prompt"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"faq":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Faq"},"faq_en":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Faq En"},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"transfer_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transfer Number"},"supported_languages":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Supported Languages"},"vacation_mode":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Vacation Mode"},"vacation_from":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation From"},"vacation_until":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation Until"},"vacation_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation Message"},"vacation_allow_faq":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Vacation Allow Faq"},"vacation_allow_booking_after":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Vacation Allow Booking After"},"vacation_forward_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vacation Forward Number"},"cancellation_allowed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Cancellation Allowed"},"cancellation_min_hours":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Cancellation Min Hours"},"cancellation_fee":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Fee"},"cancellation_blocked_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancellation Blocked Message"},"reschedule_allowed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Reschedule Allowed"},"reschedule_min_hours":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Reschedule Min Hours"},"max_reschedules":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Reschedules"},"reschedule_blocked_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reschedule Blocked Message"},"services":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Services"},"transfer_message_template":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transfer Message Template"},"busy_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Busy Message"},"outside_hours_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Outside Hours Message"},"transfer_on_frustration":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Transfer On Frustration"},"allowed_transfer_numbers":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Transfer Numbers"},"auto_topup_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Auto Topup Enabled"},"auto_topup_threshold_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Auto Topup Threshold Minutes"},"subscription_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Status"},"nip":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Nip"},"regon":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Regon"},"krs":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Krs"},"legal_form":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Form"},"registered_address":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Registered Address"},"pkd_main_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pkd Main Code"},"invoice_street":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Street"},"invoice_postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Postal Code"},"invoice_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice City"},"invoice_country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Country Code"},"accountant_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accountant Email"},"avg_appointment_value_grosze":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Avg Appointment Value Grosze"}},"type":"object","title":"TenantUpdate"},"TestAlertRequest":{"properties":{"type":{"type":"string","title":"Type","default":"anomaly"},"severity":{"type":"string","title":"Severity","default":"warning"},"title":{"type":"string","title":"Title","default":"Test alert"},"message":{"type":"string","title":"Message","default":"This is a test alert from the admin panel"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},"type":"object","title":"TestAlertRequest"},"TestCallRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number"}},"type":"object","required":["phone_number"],"title":"TestCallRequest"},"TestCallResponse":{"properties":{"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"},"call_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Sid"}},"type":"object","required":["status","message"],"title":"TestCallResponse"},"TestGreetingRequest":{"properties":{"voice_id":{"type":"string","title":"Voice Id"}},"type":"object","required":["voice_id"],"title":"TestGreetingRequest"},"TicketOut":{"properties":{"id":{"type":"string","title":"Id"},"category":{"type":"string","title":"Category"},"severity":{"type":"string","title":"Severity"},"subject":{"type":"string","title":"Subject"},"description":{"type":"string","title":"Description"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"status":{"type":"string","title":"Status"},"has_attachment":{"type":"boolean","title":"Has Attachment"},"attachment_mime":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attachment Mime"},"admin_response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Admin Response"},"resolved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resolved At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","category","severity","subject","description","email","tenant_id","status","has_attachment","attachment_mime","admin_response","resolved_at","created_at"],"title":"TicketOut"},"Token":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"requires_2fa":{"type":"boolean","title":"Requires 2Fa","default":false},"two_factor_method":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Two Factor Method"},"temp_token":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Temp Token"}},"type":"object","required":["access_token"],"title":"Token"},"TopTenantEntry":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"calls_today":{"type":"integer","title":"Calls Today"}},"type":"object","required":["tenant_id","name","calls_today"],"title":"TopTenantEntry"},"TopUpPackRequest":{"properties":{"pack_id":{"type":"string","title":"Pack Id"},"success_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Success Url"},"cancel_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Cancel Url"}},"type":"object","required":["pack_id"],"title":"TopUpPackRequest"},"TranscriptCreate":{"properties":{"turns":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Turns"},"audio_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio Url"}},"type":"object","required":["turns"],"title":"TranscriptCreate"},"TransferFailedReport":{"properties":{"call_sid":{"type":"string","title":"Call Sid"},"dial_status":{"type":"string","title":"Dial Status"},"dialed_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Dialed To"}},"type":"object","required":["call_sid","dial_status"],"title":"TransferFailedReport","description":"Voice-engine reports a transfer-to-human bridge ended without\nconnecting (no-answer / busy / failed / canceled). We use this to\nSMS the owner so they know they missed a customer in real time."},"TrialExtensionRequest":{"properties":{"days":{"type":"integer","title":"Days"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["days"],"title":"TrialExtensionRequest"},"TrialExtensionResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"new_trial_ends_at":{"type":"string","title":"New Trial Ends At"},"days_added":{"type":"integer","title":"Days Added"}},"type":"object","required":["tenant_id","new_trial_ends_at","days_added"],"title":"TrialExtensionResponse"},"TwoFactorChallengeRequest":{"properties":{"temp_token":{"type":"string","title":"Temp Token"},"code":{"type":"string","title":"Code"}},"type":"object","required":["temp_token","code"],"title":"TwoFactorChallengeRequest"},"UpgradeRequest":{"properties":{"plan":{"type":"string","title":"Plan"},"billing_cycle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Cycle"}},"type":"object","required":["plan"],"title":"UpgradeRequest"},"UpgradeResponse":{"properties":{"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"},"effective":{"type":"string","title":"Effective"},"documents_locked":{"type":"boolean","title":"Documents Locked","default":false}},"type":"object","required":["status","message","effective"],"title":"UpgradeResponse"},"UptimeDayDTO":{"properties":{"date":{"type":"string","title":"Date"},"status":{"type":"string","title":"Status"},"uptime_percent":{"type":"number","title":"Uptime Percent"},"incident_count":{"type":"integer","title":"Incident Count"}},"type":"object","required":["date","status","uptime_percent","incident_count"],"title":"UptimeDayDTO"},"UptimeResponse":{"properties":{"checked_at":{"type":"string","format":"date-time","title":"Checked At"},"providers":{"items":{"$ref":"#/components/schemas/ProviderStatus"},"type":"array","title":"Providers"},"all_operational":{"type":"boolean","title":"All Operational"}},"type":"object","required":["checked_at","providers","all_operational"],"title":"UptimeResponse"},"UsageResponse":{"properties":{"minutes_used":{"type":"integer","title":"Minutes Used"},"minutes_limit":{"type":"integer","title":"Minutes Limit"},"minutes_purchased":{"type":"integer","title":"Minutes Purchased"},"minutes_remaining":{"type":"integer","title":"Minutes Remaining"},"minutes_pct":{"type":"number","title":"Minutes Pct"},"overage_minutes":{"type":"integer","title":"Overage Minutes","default":0},"overage_rate_pln":{"type":"number","title":"Overage Rate Pln","default":3.0},"sms_used":{"type":"integer","title":"Sms Used"},"sms_limit":{"type":"integer","title":"Sms Limit"},"sms_purchased":{"type":"integer","title":"Sms Purchased"},"sms_remaining":{"type":"integer","title":"Sms Remaining"},"sms_pct":{"type":"number","title":"Sms Pct"},"concurrent_calls_limit":{"type":"integer","title":"Concurrent Calls Limit"},"supported_languages":{"items":{"type":"string"},"type":"array","title":"Supported Languages"},"subscription_tier":{"type":"string","title":"Subscription Tier"},"subscription_status":{"type":"string","title":"Subscription Status"},"warning_level":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Warning Level"},"vertical":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vertical"}},"type":"object","required":["minutes_used","minutes_limit","minutes_purchased","minutes_remaining","minutes_pct","sms_used","sms_limit","sms_purchased","sms_remaining","sms_pct","concurrent_calls_limit","supported_languages","subscription_tier","subscription_status","warning_level"],"title":"UsageResponse","description":"Full usage stats for dashboard display.\n\noverage_minutes is exposed so the dashboard meter matches what Stripe\nbills at month-end. Previously only minutes_used appeared in this\nresponse, so a tenant who used 800 minutes on a 600-minute plan saw\n\"133% used\" without knowing the 200 overage minutes would be billed\nseparately."},"UserRegister":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"password":{"type":"string","title":"Password"},"full_name":{"type":"string","title":"Full Name"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"referral_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referral Code"},"affiliate_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Affiliate Code"},"signup_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Signup Source"},"utm_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Source"},"utm_medium":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Medium"},"utm_campaign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Campaign"},"terms_accepted":{"type":"boolean","title":"Terms Accepted"}},"type":"object","required":["email","password","full_name","terms_accepted"],"title":"UserRegister"},"UserResponse":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"full_name":{"type":"string","title":"Full Name"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"role":{"type":"string","title":"Role"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"is_verified":{"type":"boolean","title":"Is Verified"},"subscription_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Tier"},"subscription_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Status"},"subscription_canceled_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Canceled At"}},"type":"object","required":["id","email","full_name","phone","role","tenant_id","is_verified"],"title":"UserResponse"},"ValidateAffiliateResponse":{"properties":{"valid":{"type":"boolean","title":"Valid"},"partner_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Partner Name"},"discount_desc":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Discount Desc"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["valid"],"title":"ValidateAffiliateResponse"},"ValidateCodeResponse":{"properties":{"valid":{"type":"boolean","title":"Valid"},"referrer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referrer Name"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["valid"],"title":"ValidateCodeResponse"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerificationConfigResponse":{"properties":{"mode":{"type":"string","title":"Mode"},"phone_match_required":{"type":"boolean","title":"Phone Match Required"},"pin_enabled":{"type":"boolean","title":"Pin Enabled"},"pin_field_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pin Field Name"},"custom_question":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Question"},"sensitive_data_topics":{"items":{"type":"string"},"type":"array","title":"Sensitive Data Topics"},"allow_third_party_booking":{"type":"boolean","title":"Allow Third Party Booking"},"failed_attempts_limit":{"type":"integer","title":"Failed Attempts Limit"},"lockout_minutes":{"type":"integer","title":"Lockout Minutes"}},"type":"object","required":["mode","phone_match_required","pin_enabled","pin_field_name","custom_question","sensitive_data_topics","allow_third_party_booking","failed_attempts_limit","lockout_minutes"],"title":"VerificationConfigResponse"},"VerificationConfigUpdate":{"properties":{"mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mode"},"phone_match_required":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Phone Match Required"},"pin_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Pin Enabled"},"pin_field_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pin Field Name"},"custom_question":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Custom Question"},"sensitive_data_topics":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sensitive Data Topics"},"allow_third_party_booking":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Allow Third Party Booking"},"failed_attempts_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Failed Attempts Limit"},"lockout_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Lockout Minutes"}},"type":"object","title":"VerificationConfigUpdate"},"VerifyEmailCodeRequest":{"properties":{"email":{"type":"string","title":"Email"},"code":{"type":"string","title":"Code"}},"type":"object","required":["email","code"],"title":"VerifyEmailCodeRequest"},"VerifyEmailRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"VerifyEmailRequest"},"VerifyForwardingRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number"}},"type":"object","required":["phone_number"],"title":"VerifyForwardingRequest","description":"Request to verify call forwarding works."},"VerifyPasswordRequest":{"properties":{"password":{"type":"string","title":"Password"}},"type":"object","required":["password"],"title":"VerifyPasswordRequest"},"VerifyRequest":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"VerifyRequest"},"VerifyResponse":{"properties":{"backup_codes":{"items":{"type":"string"},"type":"array","title":"Backup Codes"}},"type":"object","required":["backup_codes"],"title":"VerifyResponse"},"VoiceCloningConsentDetailResponse":{"properties":{"consent_id":{"type":"string","title":"Consent Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"consented_by_email":{"type":"string","title":"Consented By Email"},"consented_at":{"type":"string","title":"Consented At"}},"type":"object","required":["consent_id","tenant_id","consented_by_email","consented_at"],"title":"VoiceCloningConsentDetailResponse"},"VoiceCloningConsentRequest":{"properties":{"consented_by_email":{"type":"string","format":"email","title":"Consented By Email"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Agent"}},"type":"object","required":["consented_by_email"],"title":"VoiceCloningConsentRequest"},"VoiceCloningConsentResponse":{"properties":{"consent_id":{"type":"string","title":"Consent Id"},"consented_at":{"type":"string","title":"Consented At"}},"type":"object","required":["consent_id","consented_at"],"title":"VoiceCloningConsentResponse"},"VoiceEngineStats":{"properties":{"active_calls_total":{"type":"integer","title":"Active Calls Total"},"failed_calls_last_hour":{"type":"integer","title":"Failed Calls Last Hour"},"total_calls_last_hour":{"type":"integer","title":"Total Calls Last Hour"},"success_rate_percent":{"type":"number","title":"Success Rate Percent"},"avg_duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Duration Seconds"}},"type":"object","required":["active_calls_total","failed_calls_last_hour","total_calls_last_hour","success_rate_percent","avg_duration_seconds"],"title":"VoiceEngineStats"},"VoiceOption":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"gender":{"type":"string","title":"Gender"},"style":{"type":"string","title":"Style"},"preview_url":{"type":"string","title":"Preview Url"},"language":{"type":"string","title":"Language","default":"pl"}},"type":"object","required":["id","name","gender","style","preview_url"],"title":"VoiceOption"},"VoicePreviewRequest":{"properties":{"voice_id":{"type":"string","title":"Voice Id"},"text":{"type":"string","maxLength":200,"title":"Text","default":"Dzień dobry, tu asystent AI. W czym mogę pomóc?"}},"type":"object","required":["voice_id"],"title":"VoicePreviewRequest"},"VoicePreviewResponse":{"properties":{"audio_b64":{"type":"string","title":"Audio B64"},"content_type":{"type":"string","title":"Content Type","default":"audio/mpeg"}},"type":"object","required":["audio_b64"],"title":"VoicePreviewResponse"},"VoiceSelect":{"properties":{"voice_id":{"type":"string","title":"Voice Id"}},"type":"object","required":["voice_id"],"title":"VoiceSelect"},"VoicemailNotification":{"properties":{"call_sid":{"type":"string","title":"Call Sid"},"recording_url":{"type":"string","title":"Recording Url"},"recording_sid":{"type":"string","title":"Recording Sid"},"duration":{"type":"integer","title":"Duration"}},"type":"object","required":["call_sid","recording_url","recording_sid","duration"],"title":"VoicemailNotification"},"WaitlistEntriesResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/WaitlistEntryResponse"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"WaitlistEntriesResponse"},"WaitlistEntryResponse":{"properties":{"id":{"type":"string","title":"Id"},"phone":{"type":"string","title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"business_type":{"type":"string","title":"Business Type"},"city":{"type":"string","title":"City"},"missed_calls_per_week":{"type":"string","title":"Missed Calls Per Week"},"position":{"type":"integer","title":"Position"},"referral_code":{"type":"string","title":"Referral Code"},"referred_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referred By"},"referral_count":{"type":"integer","title":"Referral Count"},"tier":{"type":"string","title":"Tier"},"opt_in_product_updates":{"type":"boolean","title":"Opt In Product Updates"},"opt_in_marketing":{"type":"boolean","title":"Opt In Marketing"},"is_notified":{"type":"boolean","title":"Is Notified"},"email_status":{"type":"string","title":"Email Status"},"brevo_contact_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Brevo Contact Id"},"utm_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Source"},"utm_medium":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Medium"},"utm_campaign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Campaign"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"converted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Converted At"},"last_email_sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Email Sent At"},"email_opens":{"type":"integer","title":"Email Opens"},"email_clicks":{"type":"integer","title":"Email Clicks"},"created_at":{"type":"string","title":"Created At"},"survey_industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Survey Industry"},"survey_unanswered_calls":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Survey Unanswered Calls"},"survey_hardest_hours":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Survey Hardest Hours"},"survey_key_feature":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Survey Key Feature"},"survey_ai_concern":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Survey Ai Concern"},"survey_completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Survey Completed At"}},"type":"object","required":["id","phone","email","business_name","business_type","city","missed_calls_per_week","position","referral_code","referred_by","referral_count","tier","opt_in_product_updates","opt_in_marketing","is_notified","email_status","brevo_contact_id","utm_source","utm_medium","utm_campaign","notes","converted_at","last_email_sent_at","email_opens","email_clicks","created_at","survey_industry","survey_unanswered_calls","survey_hardest_hours","survey_key_feature","survey_ai_concern","survey_completed_at"],"title":"WaitlistEntryResponse"},"WaitlistJoinRequest":{"properties":{"phone":{"type":"string","title":"Phone"},"business_type":{"type":"string","title":"Business Type"},"city":{"type":"string","title":"City"},"missed_calls_per_week":{"type":"string","title":"Missed Calls Per Week"},"referral_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referral Code"},"opt_in_product_updates":{"type":"boolean","title":"Opt In Product Updates","default":true},"opt_in_marketing":{"type":"boolean","title":"Opt In Marketing","default":false},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"utm_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Source"},"utm_medium":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Medium"},"utm_campaign":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Utm Campaign"}},"type":"object","required":["phone","business_type","city","missed_calls_per_week"],"title":"WaitlistJoinRequest"},"WaitlistJoinResponse":{"properties":{"position":{"type":"integer","title":"Position"},"referral_code":{"type":"string","title":"Referral Code"},"tier":{"type":"string","title":"Tier"},"total_waitlist":{"type":"integer","title":"Total Waitlist"}},"type":"object","required":["position","referral_code","tier","total_waitlist"],"title":"WaitlistJoinResponse"},"WaitlistPositionResponse":{"properties":{"position":{"type":"integer","title":"Position"},"referral_code":{"type":"string","title":"Referral Code"},"referral_count":{"type":"integer","title":"Referral Count"},"tier":{"type":"string","title":"Tier"},"total_waitlist":{"type":"integer","title":"Total Waitlist"}},"type":"object","required":["position","referral_code","referral_count","tier","total_waitlist"],"title":"WaitlistPositionResponse"},"WaitlistStatsResponse":{"properties":{"total":{"type":"integer","title":"Total"},"by_tier":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Tier"},"by_city":{"additionalProperties":{"type":"integer"},"type":"object","title":"By City"},"by_business_type":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Business Type"},"conversion_rate":{"type":"number","title":"Conversion Rate"},"avg_referrals":{"type":"number","title":"Avg Referrals"},"total_notified":{"type":"integer","title":"Total Notified"},"total_with_email":{"type":"integer","title":"Total With Email"}},"type":"object","required":["total","by_tier","by_city","by_business_type","conversion_rate","avg_referrals","total_notified","total_with_email"],"title":"WaitlistStatsResponse"},"WaitlistSurveyByEmailRequest":{"properties":{"email":{"type":"string","title":"Email"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"unanswered_calls":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unanswered Calls"},"hardest_hours":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hardest Hours"},"key_feature":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key Feature"},"ai_concern":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Concern"}},"type":"object","required":["email"],"title":"WaitlistSurveyByEmailRequest"},"WaitlistSurveyRequest":{"properties":{"phone":{"type":"string","title":"Phone"},"industry":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Industry"},"unanswered_calls":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Unanswered Calls"},"hardest_hours":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hardest Hours"},"key_feature":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Key Feature"},"ai_concern":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Concern"}},"type":"object","required":["phone"],"title":"WaitlistSurveyRequest"},"WebhookHealthResponse":{"properties":{"signals":{"items":{"$ref":"#/components/schemas/WebhookHealthSignal"},"type":"array","title":"Signals"},"fetched_at":{"type":"string","format":"date-time","title":"Fetched At"}},"type":"object","required":["signals","fetched_at"],"title":"WebhookHealthResponse"},"WebhookHealthSignal":{"properties":{"provider":{"type":"string","title":"Provider"},"severity":{"type":"string","title":"Severity"},"label":{"type":"string","title":"Label"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"delivered_24h":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Delivered 24H"},"errors_24h":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Errors 24H"},"last_seen":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Seen"}},"type":"object","required":["provider","severity","label"],"title":"WebhookHealthSignal"},"src__routers__admin__TenantListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/TenantListItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"TenantListResponse"},"src__routers__tenants__TenantListResponse":{"properties":{"id":{"type":"string","title":"Id"},"business_name":{"type":"string","title":"Business Name"},"vertical":{"type":"string","title":"Vertical"},"is_active":{"type":"boolean","title":"Is Active"},"subscription_tier":{"type":"string","title":"Subscription Tier"},"minutes_used_this_month":{"type":"integer","title":"Minutes Used This Month"},"phone_numbers":{"items":{"type":"string"},"type":"array","title":"Phone Numbers"}},"type":"object","required":["id","business_name","vertical","is_active","subscription_tier","minutes_used_this_month","phone_numbers"],"title":"TenantListResponse"}},"securitySchemes":{"OAuth2PasswordBearerOrCookie":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"/auth/login"}}}}}}