{"openapi":"3.1.0","info":{"title":"ilna-api","version":"0.1.0"},"paths":{"/api/v1/auth/signup":{"post":{"tags":["auth"],"summary":"Signup","description":"Create a new tenant + user + owner membership, then return tokens.","operationId":"signup_api_v1_auth_signup_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SignUpRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/login":{"post":{"tags":["auth"],"summary":"Login","description":"Password login, returns access & refresh tokens for the user's default tenant.","operationId":"login_api_v1_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/refresh":{"post":{"tags":["auth"],"summary":"Refresh Token","description":"Given a valid refresh token, return a new access + refresh token pair.\n\nAccepts refresh token from either:\n1. HTTP-only cookie (preferred, more secure)\n2. Request body (backwards compatibility)","operationId":"refresh_token_api_v1_auth_refresh_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/RefreshRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/logout":{"post":{"tags":["auth"],"summary":"Logout","description":"Clear the refresh token cookie and revoke session, effectively logging out.","operationId":"logout_api_v1_auth_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Logout Api V1 Auth Logout Post"}}}}}}},"/api/v1/auth/onboarding-complete":{"post":{"tags":["auth"],"summary":"Onboarding Complete","description":"Generate a one-time token for onboarding → portal handoff.","operationId":"onboarding_complete_api_v1_auth_onboarding_complete_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingCompleteResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/exchange-onboarding-token":{"post":{"tags":["auth"],"summary":"Exchange Onboarding Token","description":"Exchange a one-time onboarding token for access and refresh tokens.","operationId":"exchange_onboarding_token_api_v1_auth_exchange_onboarding_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingTokenExchangeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/whoami":{"get":{"tags":["auth"],"summary":"Whoami","description":"Return the current user's identity and membership in the specified tenant.","operationId":"whoami_api_v1_tenants__tenant_id__whoami_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"X-Tenant-ID","in":"header","required":true,"schema":{"type":"string","title":"X-Tenant-Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhoAmIResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/users/me":{"get":{"tags":["auth"],"summary":"Get Current User","description":"Get the current authenticated user's profile.","operationId":"get_current_user_api_v1_users_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfileResponse"}}}}},"security":[{"HTTPBearer":[]}]},"patch":{"tags":["auth"],"summary":"Update Current User","description":"Update the current authenticated user's profile.\n\nOnly fields provided in the request body will be updated.\nCurrently supports updating: name","operationId":"update_current_user_api_v1_users_me_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserProfileRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/exchange-impersonation-code":{"post":{"tags":["auth"],"summary":"Exchange Impersonation Code","description":"Exchange a one-time impersonation code for a short-lived access token.\n\nThe code is valid for 60 seconds and can only be used once.\nNo refresh token is issued — the session ends when the 30-min token expires.","operationId":"exchange_impersonation_code_api_v1_auth_exchange_impersonation_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationCodeExchangeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImpersonationCodeExchangeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/verify-email":{"post":{"tags":["auth"],"summary":"Verify Email","description":"Verify email address using token from verification email.","operationId":"verify_email_api_v1_auth_verify_email_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/resend-verification":{"post":{"tags":["auth"],"summary":"Resend Verification","description":"Resend verification email to an unverified user.","operationId":"resend_verification_api_v1_auth_resend_verification_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/change-unverified-email":{"post":{"tags":["auth"],"summary":"Change Unverified Email","description":"Change email for an unverified user.\n\nAllows users who signed up with a typo in their email to correct it\nbefore verifying. Only works if email is not yet verified.","operationId":"change_unverified_email_api_v1_auth_change_unverified_email_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeUnverifiedEmailRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyEmailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/verification-status":{"get":{"tags":["auth"],"summary":"Get Verification Status","description":"Check if an email has been verified.\n\nPublic endpoint - no authentication required.\nUsed by frontend to check verification status before allowing certain actions.","operationId":"get_verification_status_api_v1_auth_verification_status_get","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","title":"Email"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__auth__VerificationStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/send-verification-code":{"post":{"tags":["auth"],"summary":"Send Verification Code","description":"Send a 6-digit verification code to the user's email.\n\nCode expires after 5 minutes. Rate limited to prevent abuse.","operationId":"send_verification_code_api_v1_auth_send_verification_code_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendCodeResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/verify-code":{"post":{"tags":["auth"],"summary":"Verify Code","description":"Verify the 6-digit code and mark email as verified.\n\nReturns success if code is valid and not expired.","operationId":"verify_code_api_v1_auth_verify_code_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyCodeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyCodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/password-reset-request":{"post":{"tags":["auth"],"summary":"Password Reset Request","description":"Request a password reset email (ILN-364).\n\nAccepts email address and sends reset link if account exists.\nRate limited per email to prevent abuse.\nResponse is generic to prevent email enumeration.\n\nSecurity features:\n- 48-byte reset token (~312 bits entropy)\n- Per-email rate limiting (5/hour)\n- Anti-enumeration (generic response)\n- Device fingerprinting for audit trail","operationId":"password_reset_request_api_v1_auth_password_reset_request_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResetRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/reset-password":{"post":{"tags":["auth"],"summary":"Reset Password","description":"Reset password using token from email (ILN-364).\n\nValidates reset token and updates user password.\nInvalidates all refresh tokens to force re-login on all devices.\nStores used token in Redis for replay protection.\n\nSecurity features:\n- Single-use tokens\n- Token expiry validation\n- Invalidate all sessions after reset\n- Store used tokens (7-day Redis TTL)\n- Audit logging with device info","operationId":"reset_password_api_v1_auth_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PasswordResetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/change-password":{"post":{"tags":["auth"],"summary":"Change Password","description":"Change password for authenticated user (ILN-364).\n\nRequires current password for verification.\nInvalidates all existing tokens and issues fresh ones for the current session.\n\nSecurity features:\n- Current password verification\n- Password strength validation (8 chars, 3 of 4 categories)\n- Invalidate all sessions after change while keeping current session active\n- Audit logging with device info","operationId":"change_password_api_v1_auth_change_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/subscription":{"get":{"tags":["billing"],"summary":"Get Subscription","description":"Get current subscription details.\n\nReturns plan info, billing status, and feature limits for the current tenant.\nUsed by the portal billing page to display subscription status.","operationId":"get_subscription_api_v1_billing_subscription_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionDetailsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/portal-session":{"post":{"tags":["billing"],"summary":"Create Portal Session","description":"Create Stripe Billing Portal session for subscription management.\n\nOpens Stripe's hosted portal where users can:\n- Update payment methods\n- View invoices and billing history\n- Upgrade/downgrade subscription\n- Cancel subscription\n\nStill the right destination for payment methods and invoice history, which\nilna deliberately does not reimplement. Cancel, resume and plan change now\nhave in-app endpoints below (ILN-766) so the customer does not have to leave\nilna — and, more to the point, so a plan change goes through our own\ncurrency and location rules rather than Stripe's generic plan picker, which\nknows nothing about additional-location add-ons.\n\nRequires the tenant to have a Stripe customer ID.","operationId":"create_portal_session_api_v1_billing_portal_session_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingPortalResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/checkout-session":{"post":{"tags":["billing"],"summary":"Create Checkout Session","description":"Create a Stripe Checkout session for demo tenants upgrading to a paid plan.\n\nDemo tenants have no Stripe customer ID, so the billing portal endpoint fails.\nThis endpoint creates a fresh checkout session for them to enter payment details\nand activate their subscription. Returns to the billing page on success or cancel.\n\nWorks for any tenant regardless of current subscription status.","operationId":"create_checkout_session_api_v1_billing_checkout_session_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/subscription/cancel":{"post":{"tags":["billing"],"summary":"Cancel Subscription","description":"Cancel the tenant's subscription, at period end by default.\n\nIn-app rather than a redirect to Stripe's hosted portal (ILN-766). The\nportal remains the place to manage payment methods and invoices.","operationId":"cancel_subscription_api_v1_billing_subscription_cancel_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelSubscriptionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/subscription/resume":{"post":{"tags":["billing"],"summary":"Resume Subscription","description":"Undo a pending cancellation, while the period is still running.","operationId":"resume_subscription_api_v1_billing_subscription_resume_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionStateResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/subscription/change":{"post":{"tags":["billing"],"summary":"Change Subscription","description":"Change the plan and/or the number of locations.\n\nRefuses a target that cannot be billed — a plan not sold in this\nsubscription's currency, or one with no configured Stripe price — rather\nthan attempting it and surfacing an opaque Stripe error.","operationId":"change_subscription_api_v1_billing_subscription_change_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeSubscriptionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeSubscriptionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/subscription/preview":{"post":{"tags":["billing"],"summary":"Preview Subscription Change","description":"What `/billing/subscription/change` with the same body would bill.\n\nWrites nothing. The portal shows this before the customer confirms.","operationId":"preview_subscription_change_api_v1_billing_subscription_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeSubscriptionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreviewSubscriptionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/invoices":{"get":{"tags":["billing"],"summary":"List Invoices","description":"List recent Stripe invoices for the tenant's subscription.\n\nReturns invoice history with links to hosted invoice pages and PDF downloads.\nRequires owner or admin role.","operationId":"list_invoices_api_v1_billing_invoices_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":5,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvoicesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/billing/payout-info":{"get":{"tags":["billing"],"summary":"Get Payout Info","description":"Get payout schedule and balance for tenant's Stripe Connect account.\n\nReturns available/pending balance and payout schedule configuration.\nRequires owner or admin role and an active Stripe Connect account.","operationId":"get_payout_info_api_v1_billing_payout_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutInfoResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/billing/recommended-plan":{"get":{"tags":["billing"],"summary":"Get Recommended Plan","description":"Suggest the cheapest new-grid plan that covers the tenant's average monthly usage.\n\nAnalyzes the past 3 months of voice and message usage, then walks the new\n9-plan grid from cheapest to most expensive to find the first plan that\ncovers the average usage. Used by the migration banner to suggest a plan.","operationId":"get_recommended_plan_api_v1_billing_recommended_plan_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecommendedPlanResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/bookings":{"get":{"tags":["bookings"],"summary":"List Bookings","description":"List bookings for tenant with optional filtering.\n\nArgs:\n    membership: Current membership from JWT token\n    session: Async database session\n    status: Optional status filter (pending, confirmed, etc.)\n    from_date: Optional start date filter\n    to_date: Optional end date filter\n    limit: Max results to return\n\nReturns:\n    Bookings list with counts","operationId":"list_bookings_api_v1_bookings_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To Date"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}},{"name":"team_member_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-547: filter by team member","title":"Team Member Id"},"description":"ILN-547: filter by team member"},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["bookings"],"summary":"Create Booking","description":"Create a new booking.\n\nArgs:\n    request: Booking creation data\n    membership: Current membership\n    session: Async database session\n\nReturns:\n    Created booking\n\nRaises:\n    400: If validation fails","operationId":"create_booking_api_v1_bookings_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateBookingRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/availability":{"get":{"tags":["bookings"],"summary":"Get Availability","description":"Get available appointment slots for the tenant.\n\nAggregates busy periods from:\n- Internal bookings\n- Connected calendars (Google, Calendly, etc.)\n\nApplies:\n- Buffer times between appointments\n- Blackout dates (holidays, maintenance)\n- Business hours restrictions\n\nArgs:\n    membership: Current membership from JWT token\n    session: Async database session\n    start_date: Start of date range to check\n    end_date: End of date range to check\n    duration_minutes: Required appointment duration (default 30)\n    staff_id: Optional staff member to filter by\n\nReturns:\n    Available time slots","operationId":"get_availability_api_v1_availability_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start_date","in":"query","required":true,"schema":{"type":"string","format":"date-time","description":"Start of date range (ISO 8601)","title":"Start Date"},"description":"Start of date range (ISO 8601)"},{"name":"end_date","in":"query","required":true,"schema":{"type":"string","format":"date-time","description":"End of date range (ISO 8601)","title":"End Date"},"description":"End of date range (ISO 8601)"},{"name":"duration_minutes","in":"query","required":false,"schema":{"type":"integer","maximum":480,"minimum":15,"description":"Required slot duration","default":30,"title":"Duration Minutes"},"description":"Required slot duration"},{"name":"team_member_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-547: optional team member filter","title":"Team Member Id"},"description":"ILN-547: optional team member filter"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AvailabilityResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bookings/export":{"get":{"tags":["bookings"],"summary":"Export Bookings","description":"Export bookings as CSV or PDF. Limit 1000 rows.","operationId":"export_bookings_api_v1_bookings_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To Date"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(csv|pdf)$","default":"csv","title":"Format"}},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bookings/{booking_id}":{"get":{"tags":["bookings"],"summary":"Get Booking","description":"Get a specific booking by ID.\n\nArgs:\n    booking_id: Booking ID\n    membership: Current membership\n    session: Async database session\n\nReturns:\n    Booking details\n\nRaises:\n    404: If booking not found","operationId":"get_booking_api_v1_bookings__booking_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"booking_id","in":"path","required":true,"schema":{"type":"string","title":"Booking Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["bookings"],"summary":"Update Booking","description":"Update a booking (status, notes).\n\nArgs:\n    booking_id: Booking ID\n    request: Update data\n    membership: Current membership\n    session: Async database session\n\nReturns:\n    Updated booking\n\nRaises:\n    404: If booking not found","operationId":"update_booking_api_v1_bookings__booking_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"booking_id","in":"path","required":true,"schema":{"type":"string","title":"Booking Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBookingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["bookings"],"summary":"Delete Booking","description":"Delete a booking.\n\nArgs:\n    booking_id: Booking ID\n    membership: Current membership\n    session: Async database session\n\nRaises:\n    404: If booking not found","operationId":"delete_booking_api_v1_bookings__booking_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"booking_id","in":"path","required":true,"schema":{"type":"string","title":"Booking Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/appointments":{"get":{"tags":["bookings"],"summary":"List Appointments","description":"List appointments for tenant with optional date filtering.\n\nArgs:\n    membership: Current membership\n    session: Async database session\n    from_date: Optional start date filter\n    to_date: Optional end date filter\n    limit: Max results\n\nReturns:\n    List of appointments","operationId":"list_appointments_api_v1_appointments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To Date"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AppointmentResponse"},"title":"Response List Appointments Api V1 Appointments Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers":{"get":{"tags":["customers"],"summary":"List Customers","description":"List customers for the tenant with optional search and status filter.","operationId":"list_customers_api_v1_portal_customers_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Search"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(all|lead|new|active|returning|dormant|archived|inactive|vip)$"},{"type":"null"}],"description":"Lifecycle status. Legacy values vip/inactive still accepted (ILN-721).","title":"Status"},"description":"Lifecycle status. Legacy values vip/inactive still accepted (ILN-721)."},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","description":"Include archived patients (excluded by default)","default":false,"title":"Include Archived"},"description":"Include archived patients (excluded by default)"},{"name":"language","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":5},{"type":"null"}],"description":"Filter by preferred_language (e.g. en, ar)","title":"Language"},"description":"Filter by preferred_language (e.g. en, ar)"},{"name":"min_conversations","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":1},{"type":"null"}],"description":"Minimum conversation count","title":"Min Conversations"},"description":"Minimum conversation count"},{"name":"last_active_after","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date — only customers active after this date","title":"Last Active After"},"description":"ISO date — only customers active after this date"},{"name":"last_active_before","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ISO date — only customers active before this date","title":"Last Active Before"},"description":"ISO date — only customers active before this date"},{"name":"practitioner_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"description":"Filter by assigned practitioner (ILN-721)","title":"Practitioner Id"},"description":"Filter by assigned practitioner (ILN-721)"},{"name":"tag","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"description":"Filter by a single tag (ILN-721)","title":"Tag"},"description":"Filter by a single tag (ILN-721)"},{"name":"has_upcoming","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"true = has a future appointment; false = has none. Omitted means no filter (ILN-721).","title":"Has Upcoming"},"description":"true = has a future appointment; false = has none. Omitted means no filter (ILN-721)."},{"name":"alert_severity","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Only patients carrying a LIVE manual alert at this severity or higher. Screening-derived alerts are excluded: they are computed per-patient at read time and cannot be filtered in SQL.","title":"Alert Severity"},"description":"Only patients carrying a LIVE manual alert at this severity or higher. Screening-derived alerts are excluded: they are computed per-patient at read time and cannot be filtered in SQL."},{"name":"outstanding_intake","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"description":"true = has an upcoming appointment with no intake submitted against it (ILN-721).","title":"Outstanding Intake"},"description":"true = has an upcoming appointment with no intake submitted against it (ILN-721)."},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Page Size"}},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__customers__CustomerListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["customers"],"summary":"Create Customer","description":"Manually create a patient (ILN-721).\n\nPhone is the identity key (``uq_customers_tenant_phone``). A duplicate\nreturns 409 with the existing id rather than a raw constraint error, so the\nUI can offer \"open the existing record\" instead of a dead end.","operationId":"create_customer_api_v1_portal_customers_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/export":{"get":{"tags":["customers"],"summary":"Export Customers","description":"Export customers as CSV or PDF. Limit 1000 rows.","operationId":"export_customers_api_v1_portal_customers_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Search"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(all|lead|new|active|returning|dormant|archived|inactive|vip)$"},{"type":"null"}],"title":"Status"}},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Archived"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(csv|pdf)$","default":"csv","title":"Format"}},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/duplicates":{"get":{"tags":["customers"],"summary":"List Duplicate Candidates","description":"Propose possible duplicate patients for staff review (ILN-723).\n\nRead-only and non-destructive: this endpoint never merges anything. The\ndecision is always a person's, because a wrong merge blends two people's\nmedical histories.","operationId":"list_duplicate_candidates_api_v1_portal_customers_duplicates_get","security":[{"HTTPBearer":[]}],"parameters":[{"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/DuplicatesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/merge":{"post":{"tags":["customers"],"summary":"Merge Customer","description":"Merge `loser_id` into `customer_id`, which survives (ILN-723).\n\nGated on PATIENTS_ARCHIVE as well as write: a merge archives a record and\nmoves every one of its clinical references, which is strictly more\nconsequential than editing a field.","operationId":"merge_customer_api_v1_portal_customers__customer_id__merge_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MergeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}":{"get":{"tags":["customers"],"summary":"Get Customer","description":"Get detailed customer profile with stats.","operationId":"get_customer_api_v1_portal_customers__customer_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["customers"],"summary":"Update Customer","description":"Edit a customer's profile (ILN-684 — the page was read-only). Manual edits\nare authoritative: they overwrite, with the old value kept in\nmeta[\"profile_history\"] like intake corrections.","operationId":"update_customer_api_v1_portal_customers__customer_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerProfileUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/consent/{channel}":{"put":{"tags":["customers"],"summary":"Set Customer Consent","description":"Record consent, or a refusal, for one channel (ILN-823).\n\nIts own endpoint rather than a field on the patient PATCH, because consent\nis not a value — it is an EVENT, and the event needs provenance. A generic\nfield write cannot say who recorded it or how it was obtained, and \"the\nsystem had a true in a JSON column\" is not a defence if anybody ever asks.\n\nMatters most for voice: an automated call needs consent recorded\nspecifically for calls, since an unprompted AI call is regulated separately\nfrom a text and inheriting a messaging opt-in would be the practice's\nliability. Without this endpoint a voice campaign reaches nobody, which is\ncorrect but useless.\n\nIdempotent by overwrite: recording the same answer twice refreshes the\ntimestamp and the actor, which is what a second conversation with the\npatient actually means.","operationId":"set_customer_consent_api_v1_portal_customers__customer_id__consent__channel__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"channel","in":"path","required":true,"schema":{"type":"string","title":"Channel"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/archive":{"post":{"tags":["customers"],"summary":"Archive Customer","description":"Archive a patient (ILN-721).\n\nSoft and reversible — the row is retained in full. Archiving is NOT\ndeletion: appointment and billing history stay intact, the record simply\ndrops out of default list views. Deletion of patient data belongs to the\nGDPR path (``/gdpr``), not here.","operationId":"archive_customer_api_v1_portal_customers__customer_id__archive_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/restore":{"post":{"tags":["customers"],"summary":"Restore Customer","description":"Restore an archived patient (ILN-721).\n\nClears ``archived_at`` and releases the status pin so the row rejoins\nautomatic derivation — restoring to a stale \"archived\" status would leave\nit invisible in the default view it was just restored into.","operationId":"restore_customer_api_v1_portal_customers__customer_id__restore_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/conversations":{"get":{"tags":["customers"],"summary":"Get Customer Conversations","description":"Get recent conversations for a customer.","operationId":"get_customer_conversations_api_v1_portal_customers__customer_id__conversations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"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/app__api__customers__ConversationsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/media":{"get":{"tags":["customers"],"summary":"Get Customer Media","description":"Get paginated media attachments across all conversations for a customer.","operationId":"get_customer_media_api_v1_portal_customers__customer_id__media_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"media_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Media Type"}},{"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/MediaListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/activity":{"get":{"tags":["customers"],"summary":"Get Customer Activity","description":"Audit trail for one patient (ILN-722) — the Activity Log tab.\n\nAnswers \"who changed this record, when, and from what to what\". Old/new\nvalues are stored encrypted and decrypted here, so this endpoint is a PHI\nread: when ILN-722's second pass lands role scopes, this is where\nview-clinical gets enforced, and `include_values=False` already returns the\nmetadata-only shape that a caller without it should see.","operationId":"get_customer_activity_api_v1_portal_customers__customer_id__activity_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"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/PatientAuditResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/alerts":{"get":{"tags":["customers"],"summary":"Get Customer Alerts","description":"Alerts for a patient, most severe first (ILN-723).\n\nReadable on plain customers:read, unlike documents. Alerts are the one place\nwhere withholding everything from front desk would defeat the feature: \"unpaid\nbalance\", \"do not contact\" and \"wheelchair access needed\" exist FOR reception.\nClinical alerts are filtered out for roles without clinical read, and the\nresponse says so via `clinical_withheld`.","operationId":"get_customer_alerts_api_v1_portal_customers__customer_id__alerts_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Archived"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientAlertsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["customers"],"summary":"Create Customer Alert","description":"Raise a manual alert on a patient.\n\nA CLINICAL alert type requires clinical write: recording \"allergy: penicillin\"\nis a clinical assertion, and a role that may not read the chart must not be\nable to add to it. Operational types need only customers:write, so reception\ncan flag an unpaid balance.","operationId":"create_customer_alert_api_v1_portal_customers__customer_id__alerts_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientAlertCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientAlertOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/alerts/{alert_id}/acknowledge":{"post":{"tags":["customers"],"summary":"Acknowledge Customer Alert","description":"Record that a human has SEEN this alert. Does NOT clear it.\n\nOnly needs customers:read — acknowledging is not editing the record, and\nrequiring write would stop reception from confirming they read an alert\naddressed to them.","operationId":"acknowledge_customer_alert_api_v1_portal_customers__customer_id__alerts__alert_id__acknowledge_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"alert_id","in":"path","required":true,"schema":{"type":"string","title":"Alert Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientAlertOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/alerts/{alert_id}":{"delete":{"tags":["customers"],"summary":"Archive Customer Alert","description":"ARCHIVE an alert. Never deletes it (ILN-722 archive-only).\n\nAn alert that was raised and later withdrawn is part of the record of what\nstaff knew and when.","operationId":"archive_customer_alert_api_v1_portal_customers__customer_id__alerts__alert_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"alert_id","in":"path","required":true,"schema":{"type":"string","title":"Alert Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/screening":{"get":{"tags":["customers"],"summary":"Get Customer Screening","description":"Screening history for a patient (ILN-721 brief §6).\n\nILN-722 pass 2: screening answers ARE clinical content — \"have you taken\nAccutane in the last 14 days\" is a medical question. Unlike the patient\ndetail there is nothing non-clinical left once they're removed, so this\nendpoint is gated whole rather than redacted field by field.\n\nSurfaces what the screening rails already persist but never exposed: which\nquestions were asked, what the patient answered, why a booking was refused,\nand the ILN-665 eligible-date so staff can see \"not eligible for laser until\nAug 14\" instead of guessing.","operationId":"get_customer_screening_api_v1_portal_customers__customer_id__screening_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScreeningHistoryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/memories":{"get":{"tags":["customers"],"summary":"Get Customer Memories","description":"Get memories/notes for a customer.","operationId":"get_customer_memories_api_v1_portal_customers__customer_id__memories_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemoriesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/notes":{"post":{"tags":["customers"],"summary":"Add Customer Note","description":"Add a manual note to a customer's profile.","operationId":"add_customer_note_api_v1_portal_customers__customer_id__notes_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddNoteRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddNoteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/notes/list":{"get":{"tags":["customers"],"summary":"List Customer Notes","description":"List manual notes for a customer profile.","operationId":"list_customer_notes_api_v1_portal_customers__customer_id__notes_list_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNotesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/notes/create":{"post":{"tags":["customers"],"summary":"Create Customer Note","description":"Create a manual note on a customer profile.","operationId":"create_customer_note_api_v1_portal_customers__customer_id__notes_create_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateNoteRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNoteItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/notes/{note_id}":{"patch":{"tags":["customers"],"summary":"Update Customer Note","description":"Update a customer note. Only the author can edit.","operationId":"update_customer_note_api_v1_portal_customers__customer_id__notes__note_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"note_id","in":"path","required":true,"schema":{"type":"string","title":"Note Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerNoteItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["customers"],"summary":"Delete Customer Note","description":"Delete a customer note. Only the author can delete.","operationId":"delete_customer_note_api_v1_portal_customers__customer_id__notes__note_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"note_id","in":"path","required":true,"schema":{"type":"string","title":"Note Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/attachments":{"get":{"tags":["customers"],"summary":"List Customer Attachments","description":"List a patient's documents (ILN-723).\n\nILN-722 pass 2 gated date-of-birth and intake answers behind clinical read\nbut left the FILES beside them on plain customers:read — so front desk was\nblocked from seeing a DOB while able to download the lab result containing\nit. Closing that here: an uploaded document is at least as sensitive as the\nfields it sits next to.","operationId":"list_customer_attachments_api_v1_portal_customers__customer_id__attachments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Archived"}},{"name":"document_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Type"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["customers"],"summary":"Upload Customer Attachment","description":"Upload a patient document (ILN-723).\n\nAccepts PDF, images, Office documents. Max 10MB.\n\nGated on clinical WRITE, not plain customers:write. Attaching a lab result or\nconsent form to a clinical record is a clinical act; the roles that may do it\nare the roles that may edit the record it belongs to.","operationId":"upload_customer_attachment_api_v1_portal_customers__customer_id__attachments_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_customer_attachment_api_v1_portal_customers__customer_id__attachments_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AttachmentItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/attachments/{attachment_id}":{"delete":{"tags":["customers"],"summary":"Archive Customer Attachment","description":"ARCHIVE a patient document. Nothing is deleted (ILN-723).\n\nThis used to hard-delete the row AND the S3 object. ILN-722 requires\narchive-only for clinical data, and the reason is concrete: a deleted consent\nform destroys the evidence that consent was ever given — exactly the record a\nclinic needs if the consent is later disputed.\n\nThe route keeps DELETE + 204 so existing clients are unaffected; only the\nserver's interpretation of \"remove this\" changed, from destroy to withdraw\nfrom view. Archived documents remain retrievable via\n``?include_archived=true``.","operationId":"archive_customer_attachment_api_v1_portal_customers__customer_id__attachments__attachment_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"attachment_id","in":"path","required":true,"schema":{"type":"string","title":"Attachment Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/context-summary":{"get":{"tags":["customers"],"summary":"Get Customer Context Summary","description":"Get AI-generated context summary for a customer relationship.\n\nSet refresh=true to force regeneration.","operationId":"get_customer_context_summary_api_v1_portal_customers__customer_id__context_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"refresh","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Refresh"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContextSummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/prescriptions":{"get":{"tags":["customers"],"summary":"List Optical Prescriptions","description":"A patient's refraction history, newest first.\n\nHistory is the point: the previous prescription stays readable after a new\none is issued, because it is the record of what was dispensed against and it\nis how staff see a change in the patient's vision over time.","operationId":"list_optical_prescriptions_api_v1_portal_customers__customer_id__prescriptions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"include_archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Archived"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpticalPrescriptionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["customers"],"summary":"Create Optical Prescription","description":"Record a refraction. Clinical write — this is a clinical measurement.","operationId":"create_optical_prescription_api_v1_portal_customers__customer_id__prescriptions_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpticalPrescriptionCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OpticalPrescriptionItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/prescriptions/{prescription_id}":{"delete":{"tags":["customers"],"summary":"Archive Optical Prescription","description":"Withdraw a prescription from view. Never deletes it.\n\nSame rule as documents and alerts: what was dispensed against is part of the\nrecord, and an entry removed in error must be recoverable.","operationId":"archive_optical_prescription_api_v1_portal_customers__customer_id__prescriptions__prescription_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"prescription_id","in":"path","required":true,"schema":{"type":"string","title":"Prescription Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/family":{"get":{"tags":["customers"],"summary":"List Family Members","description":"Relatives linked to this patient.\n\nOperational, not clinical: knowing who to call and who pays is front desk\nwork. The relative's own clinical record stays behind their own permissions.","operationId":"list_family_members_api_v1_portal_customers__customer_id__family_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FamilyMembersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["customers"],"summary":"Add Family Member","description":"Link a relative, optionally to their own patient record.","operationId":"add_family_member_api_v1_portal_customers__customer_id__family_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FamilyMemberCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FamilyMemberItem"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/family/{member_id}":{"delete":{"tags":["customers"],"summary":"Remove Family Member","description":"Unlink a relative. This one IS a delete — a link added in error carries no\nclinical content, unlike a document or an alert.","operationId":"remove_family_member_api_v1_portal_customers__customer_id__family__member_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/import/preview":{"post":{"tags":["customers"],"summary":"Preview Patient Import","description":"Parse a patient CSV and report what would happen. Writes nothing.","operationId":"preview_patient_import_api_v1_portal_customers_import_preview_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_preview_patient_import_api_v1_portal_customers_import_preview_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/customers/import/apply":{"post":{"tags":["customers"],"summary":"Apply Patient Import","description":"Write the patients from a CSV that was previewed first.\n\nCreated rows carry `meta.import_batch_id`, which is what makes a bad import\nrecoverable — an unmarked import is indistinguishable from the clinic's real\ndata an hour later.","operationId":"apply_patient_import_api_v1_portal_customers_import_apply_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_apply_patient_import_api_v1_portal_customers_import_apply_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportApplyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/payments":{"get":{"tags":["payments"],"summary":"List Payments","description":"List payments for tenant with optional filtering.\n\nArgs:\n    membership: Current membership from JWT token\n    session: Async database session\n    status: Optional status filter (pending, succeeded, failed, etc.)\n    min_amount: Minimum payment amount in dollars\n    max_amount: Maximum payment amount in dollars\n    limit: Maximum number of results (default 50, max 200)\n    offset: Number of results to skip (for pagination)\n\nReturns:\n    PaymentListResponse with list of payments and total count","operationId":"list_payments_api_v1_payments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"min_amount","in":"query","required":false,"schema":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}],"description":"Minimum amount in dollars","title":"Min Amount"},"description":"Minimum amount in dollars"},{"name":"max_amount","in":"query","required":false,"schema":{"anyOf":[{"type":"number","minimum":0},{"type":"null"}],"description":"Maximum amount in dollars","title":"Max Amount"},"description":"Maximum amount in dollars"},{"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/PaymentListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/payments/analytics/revenue":{"get":{"tags":["payments"],"summary":"Get Revenue Analytics","description":"Get daily revenue analytics for the tenant.\n\nReturns aggregated revenue data grouped by day for charting.","operationId":"get_revenue_analytics_api_v1_payments_analytics_revenue_get","security":[{"HTTPBearer":[]}],"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/RevenueAnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/payments/export":{"get":{"tags":["payments"],"summary":"Export Payments","description":"Export payments as CSV or PDF.\n\nReturns a downloadable file with payment records.\nLimited to 1000 rows maximum.","operationId":"export_payments_api_v1_payments_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(csv|pdf)$","default":"csv","title":"Format"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To Date"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/payments/{payment_id}":{"get":{"tags":["payments"],"summary":"Get Payment","description":"Get a specific payment by ID.\n\nArgs:\n    payment_id: Payment UUID\n    membership: Current membership from JWT token\n    session: Async database session\n\nReturns:\n    PaymentResponse with payment details\n\nRaises:\n    HTTPException 404: If payment not found or belongs to different tenant","operationId":"get_payment_api_v1_payments__payment_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"payment_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/payments/{payment_id}/refund":{"post":{"tags":["payments"],"summary":"Refund Payment","description":"Issue a full or partial refund for a succeeded payment.\n\nRequires owner or admin role. Only payments with status 'succeeded' can be refunded.\nCalls Stripe Refund API and updates the local payment record.\n\nFor partial refunds, provide `amount` in dollars. The total refunded amount\ncannot exceed the original payment amount.","operationId":"refund_payment_api_v1_payments__payment_id__refund_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"payment_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefundResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/bookings/{booking_id}/payments":{"get":{"tags":["payments"],"summary":"List Booking Payments","description":"List all payments for a specific booking.\n\nArgs:\n    booking_id: Booking UUID\n    membership: Current membership from JWT token\n    session: Async database session\n\nReturns:\n    PaymentListResponse with list of payments for the booking","operationId":"list_booking_payments_api_v1_bookings__booking_id__payments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"booking_id","in":"path","required":true,"schema":{"type":"string","title":"Booking Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/conversations/{conversation_id}/payments":{"get":{"tags":["payments"],"summary":"List Conversation Payments","description":"List all payments from a specific conversation.\n\nArgs:\n    conversation_id: Conversation UUID\n    membership: Current membership from JWT token\n    session: Async database session\n\nReturns:\n    PaymentListResponse with list of payments from the conversation","operationId":"list_conversation_payments_api_v1_conversations__conversation_id__payments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compliance/consent/status":{"get":{"tags":["compliance"],"summary":"Check Consent Status","description":"Check if valid consent exists for a customer.\n\nVerifies whether a customer has given valid (non-expired) consent\nof the specified type for the authenticated tenant.","operationId":"check_consent_status_api_v1_compliance_consent_status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_phone","in":"query","required":true,"schema":{"type":"string","description":"Customer phone number (E.164)","title":"Customer Phone"},"description":"Customer phone number (E.164)"},{"name":"consent_type","in":"query","required":true,"schema":{"$ref":"#/components/schemas/ConsentType","description":"Type of consent to check"},"description":"Type of consent to check"}],"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"}}}}}}},"/api/v1/compliance/consent/capture":{"post":{"tags":["compliance"],"summary":"Capture Consent","description":"Capture and store a new consent record.\n\nRecords consent given by a customer, including the method used\n(verbal, SMS, web form, email) and any supporting evidence like\nrecording URLs for verbal consent.","operationId":"capture_consent_api_v1_compliance_consent_capture_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptureConsentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CaptureConsentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compliance/consent/withdraw":{"post":{"tags":["compliance"],"summary":"Withdraw Consent","description":"Withdraw previously given consent.\n\nHandles consent withdrawal requests, which is required for\nGDPR Article 7(3) - right to withdraw consent at any time.","operationId":"withdraw_consent_api_v1_compliance_consent_withdraw_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WithdrawConsentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WithdrawConsentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compliance/consent/text":{"post":{"tags":["compliance"],"summary":"Generate Consent Text","description":"Generate jurisdiction-appropriate consent text.\n\nReturns localized consent text based on the consent type,\njurisdiction, and language. Used by voice agents to read\nconsent disclosure before recording.","operationId":"generate_consent_text_api_v1_compliance_consent_text_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentTextRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConsentTextResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compliance/consent/stats":{"get":{"tags":["compliance"],"summary":"Get Consent Stats","description":"Get consent statistics for the tenant.\n\nReturns aggregate statistics about consent rates, including\ntotal consents given, withdrawals, and overall consent rate.","operationId":"get_consent_stats_api_v1_compliance_consent_stats_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Stats from date (ISO 8601)","title":"Since"},"description":"Stats from date (ISO 8601)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Consent Stats Api V1 Compliance Consent Stats Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compliance/terms/status":{"get":{"tags":["compliance"],"summary":"Get Terms Status","description":"Get the current user's terms acceptance status.\n\nReturns whether the user has accepted the terms of service,\nwhen they accepted, and whether they need to re-accept a newer version.","operationId":"get_terms_status_api_v1_compliance_terms_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TermsStatusResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compliance/terms/accept":{"post":{"tags":["compliance"],"summary":"Accept Terms","description":"Accept or re-accept terms of service.\n\nUsed when terms are updated and users need to re-accept,\nor for users who haven't yet accepted terms.","operationId":"accept_terms_api_v1_compliance_terms_accept_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptTermsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptTermsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compliance/audit/logs":{"get":{"tags":["compliance"],"summary":"Get Audit Logs","description":"Get compliance audit logs for the tenant.\n\nReturns an audit trail of compliance-related actions including\nconsent captures, withdrawals, data access, and deletions.\nRequired for demonstrating GDPR/CCPA compliance to regulators.","operationId":"get_audit_logs_api_v1_compliance_audit_logs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/ComplianceAction"},{"type":"null"}],"description":"Filter by action type","title":"Action"},"description":"Filter by action type"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date (ISO 8601)","title":"Since"},"description":"Filter from date (ISO 8601)"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date (ISO 8601)","title":"Until"},"description":"Filter to date (ISO 8601)"},{"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/AuditLogsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/compliance/retention/policy":{"get":{"tags":["compliance"],"summary":"Get Retention Policy","description":"Get the data retention policy for the tenant.\n\nReturns the configured retention periods for different data types\nand whether automatic deletion is enabled.","operationId":"get_retention_policy_api_v1_compliance_retention_policy_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionPolicyResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["compliance"],"summary":"Update Retention Policy","description":"Update the data retention policy for the tenant.\n\nAllows configuring how long different types of data are retained\nbefore automatic deletion. Minimum retention periods are enforced\nto comply with regulatory requirements.","operationId":"update_retention_policy_api_v1_compliance_retention_policy_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateRetentionPolicyRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RetentionPolicyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compliance/data/delete-request":{"post":{"tags":["compliance"],"summary":"Request Data Deletion","description":"Record a clinic's request to delete a patient's data.\n\nThe request deletes nothing and schedules nothing. Until October 2026 this\nendpoint answered \"All customer data will be permanently removed\" with a\ndate 30 days out, and no code ever removed anything. A deletion is now run\nby ilna staff from the admin tool, after confirming with the clinic which\npatient is meant (a phone number alone can belong to two patients).","operationId":"request_data_deletion_api_v1_compliance_data_delete_request_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataDeletionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataDeletionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/compliance/recordings/{key}/url":{"get":{"tags":["compliance"],"summary":"Get Recording Url","description":"Get a pre-signed URL for accessing a recording.\n\nGenerates a time-limited URL for secure access to consent recordings.\nAccess is logged for audit trail compliance.","operationId":"get_recording_url_api_v1_compliance_recordings__key__url_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string","title":"Key"}},{"name":"expires_in","in":"query","required":false,"schema":{"type":"integer","maximum":3600,"minimum":60,"default":3600,"title":"Expires In"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__compliance__RecordingUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo/messages":{"get":{"tags":["demo"],"summary":"Get Demo Message Usage","description":"Get current chatbot demo message usage for tenant.\n\nCall this on chatbot open to show remaining messages.","operationId":"get_demo_message_usage_api_v1_demo_messages_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoMessageUsageResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/demo/usage":{"get":{"tags":["demo"],"summary":"Get Demo Usage","description":"Get current demo usage for tenant.\n\nCall this on demo modal open to sync remaining time.","operationId":"get_demo_usage_api_v1_demo_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoUsageResponse"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["demo"],"summary":"Record Demo Usage","description":"Record demo usage time.\n\nCall this periodically during demo call or on call end.","operationId":"record_demo_usage_api_v1_demo_usage_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecordUsageRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoUsageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/demo/can-start":{"get":{"tags":["demo"],"summary":"Check Can Start Demo","description":"Check if tenant can start a demo call.\n\nCall this before starting a demo to prevent wasted API calls.","operationId":"check_can_start_demo_api_v1_demo_can_start_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartDemoResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/demo/public/livekit-token":{"post":{"tags":["demo-public"],"summary":"Public Demo Livekit Token","description":"Mint an anonymous LiveKit token for a live voice demo of a showcase tenant.\n\nReuses the same room-metadata contract as the authenticated voice token\n(`voice.py`), so the voice agent (`_handle_demo_call`) is unchanged: it reads\n`tenant_id` + `connection_type=demo` + `max_duration_seconds` from metadata.","operationId":"public_demo_livekit_token_api_v1_demo_public_livekit_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDemoTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDemoTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo/public/chat":{"post":{"tags":["demo-public"],"summary":"Public Demo Chat","description":"Answer one chat turn as a showcase tenant via the real conversation engine.\n\nRoutes through `WorkflowEngine.process_message` — the exact path the live\nwebchat widget / portal Test AI use — so the demo has full capabilities\n(availability, booking, memory), not a washed-down RAG-only reply. The\nconversation is stamped `is_demo` (via `message_meta`) so the booking flow\ngives the 1:1 experience without real side-effects. `process_message` is\nsync and manages its own sessions, so this route is sync (threadpooled).","operationId":"public_demo_chat_api_v1_demo_public_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDemoChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicDemoChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/demo/public/voice-preview":{"post":{"tags":["demo-public"],"summary":"Public Voice Preview","description":"Stream a short TTS sample of a voice — unauthenticated, for the onboarding\nvoice picker. Uses gpt-4o-mini-tts (supports the OpenAI Realtime voices) and\nthe shared TTS cache so repeats are free. Per-IP rate limited.","operationId":"public_voice_preview_api_v1_demo_public_voice_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PublicVoicePreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/disputes":{"get":{"tags":["disputes"],"summary":"List Disputes","description":"List disputes for the current tenant.\n\nReturns paginated disputes with optional status filtering.\nDisputes are ordered by creation date (newest first).","operationId":"list_disputes_api_v1_disputes_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by dispute status","title":"Status"},"description":"Filter by dispute status"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DisputeListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/healthz":{"get":{"tags":["health"],"summary":"Healthz","description":"Basic liveness probe for the API process.","operationId":"healthz_api_v1_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Response Healthz Api V1 Healthz Get"}}}}}}},"/api/v1/db/healthz":{"get":{"tags":["health"],"summary":"Db Health","description":"Readiness probe for Postgres: runs a trivial SELECT.","operationId":"db_health_api_v1_db_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Response Db Health Api V1 Db Healthz Get"}}}}}}},"/api/v1/db/pool":{"get":{"tags":["health"],"summary":"Db Pool Metrics","description":"Get database connection pool metrics.\n\nReturns pool statistics for monitoring:\n- pool_size: Configured pool size\n- checked_in: Connections available in pool\n- checked_out: Connections currently in use\n- overflow: Current overflow connections\n- max_overflow: Configured max overflow\n- invalidated: Connections marked invalid\n- total_connections: Total active connections\n- pool_utilization: Percentage of pool in use (0.0-1.0)\n\nAlert thresholds (recommended):\n- pool_utilization > 0.8: Warning\n- pool_utilization > 0.95: Critical\n- overflow > 0: Warning (indicates load spike)","operationId":"db_pool_metrics_api_v1_db_pool_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PoolMetricsResponse"},{"type":"null"}],"title":"Response Db Pool Metrics Api V1 Db Pool Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/cache/healthz":{"get":{"tags":["health"],"summary":"Cache Health","description":"Readiness probe for Redis: sends PING.","operationId":"cache_health_api_v1_cache_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Response Cache Health Api V1 Cache Healthz Get"}}}}}}},"/api/v1/cache/test":{"post":{"tags":["health"],"summary":"Cache Test","description":"Smoke test: set/get a short-lived key.","operationId":"cache_test_api_v1_cache_test_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Response Cache Test Api V1 Cache Test Post"}}}}}}},"/api/v1/celery/healthz":{"get":{"tags":["health"],"summary":"Celery Health","description":"Readiness probe for Celery workers.","operationId":"celery_health_api_v1_celery_healthz_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"anyOf":[{"type":"boolean"},{"type":"string"}]},"type":"object","title":"Response Celery Health Api V1 Celery Healthz Get"}}}}}}},"/api/v1/status":{"get":{"tags":["health"],"summary":"Get System Status","description":"Get aggregated system status.\n\nReturns status for all components:\n\nInfrastructure:\n- API: Process health\n- Database: PostgreSQL connectivity\n- Cache: Redis connectivity\n- Message Queue: RabbitMQ connectivity\n\nThird-party services:\n- OpenAI: AI/embeddings API\n- Stripe: Payment processing\n- Email: the configured email provider\n\nOverall status:\n- operational: All components healthy\n- degraded: Some non-critical components unhealthy\n- outage: Critical components (DB) unhealthy","operationId":"get_system_status_api_v1_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemStatus"}}}}}}},"/api/v1/status/summary":{"get":{"tags":["health"],"summary":"Get Status Summary","description":"Lightweight public status summary (no component details).\n\nUsed by the portal footer status pill. Returns only the overall status\nstring without exposing infrastructure details. No auth required.","operationId":"get_status_summary_api_v1_status_summary_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Get Status Summary Api V1 Status Summary Get"}}}}}}},"/api/v1/tenants/{tenant_id}/tools":{"get":{"tags":["integrations"],"summary":"List Tools","description":"List available integration tools (CRMs, calendars, etc.) for the tenant's vertical.","operationId":"list_tools_api_v1_tenants__tenant_id__tools_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToolsListResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/integrations":{"get":{"tags":["integrations"],"summary":"List Integrations","description":"List currently connected integrations with their status and health.","operationId":"list_integrations_api_v1_tenants__tenant_id__integrations_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationsListResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/integrations/calendar-nudge":{"get":{"tags":["integrations"],"summary":"Get Calendar Nudge","description":"Whether to prompt the tenant to connect a calendar (ILN-636).\n\nTrue when the tenant has bookings but no connected calendar — their bookings\nare being created but never appear on any calendar.","operationId":"get_calendar_nudge_api_v1_tenants__tenant_id__integrations_calendar_nudge_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CalendarNudgeResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/tools/{tool_id}/oauth/start":{"post":{"tags":["integrations"],"summary":"Start Oauth","description":"Initiate OAuth flow for connecting an integration. Returns authorization URL.","operationId":"start_oauth_api_v1_tenants__tenant_id__tools__tool_id__oauth_start_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tool_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/ToolId"}},{"name":"source","in":"query","required":false,"schema":{"type":"string","description":"Source app: 'web' or 'portal'","default":"web","title":"Source"},"description":"Source app: 'web' or 'portal'"},{"name":"team_member_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-547: team member to connect this calendar to","title":"Team Member Id"},"description":"ILN-547: team member to connect this calendar to"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OAuthStartResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/oauth/{tool_id}/callback":{"get":{"tags":["integrations"],"summary":"Oauth Callback","description":"OAuth callback - handles redirect from OAuth provider and redirects back to frontend.","operationId":"oauth_callback_api_v1_oauth__tool_id__callback_get","parameters":[{"name":"tool_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/ToolId"}},{"name":"code","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","minLength":1,"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}/integrations/{integration_id}":{"delete":{"tags":["integrations"],"summary":"Disconnect Integration","description":"Disconnect an integration and delete the record.","operationId":"disconnect_integration_api_v1_tenants__tenant_id__integrations__integration_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Disconnect Integration Api V1 Tenants  Tenant Id  Integrations  Integration Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/integrations/{integration_id}/test":{"post":{"tags":["integrations"],"summary":"Test Integration","description":"Test an integration's connection health.","operationId":"test_integration_api_v1_tenants__tenant_id__integrations__integration_id__test_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationHealthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/integrations/{integration_id}/health":{"get":{"tags":["integrations"],"summary":"Get Integration Health","description":"Get stored health status for an integration.","operationId":"get_integration_health_api_v1_tenants__tenant_id__integrations__integration_id__health_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationHealthResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/integrations/{integration_id}/webhook-url":{"get":{"tags":["integrations"],"summary":"Get Integration Webhook Url","description":"Get the webhook URL for webhook-based integrations.","operationId":"get_integration_webhook_url_api_v1_tenants__tenant_id__integrations__integration_id__webhook_url_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebhookUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/integrations/{integration_id}/settings":{"get":{"tags":["integrations"],"summary":"Get Integration Settings","description":"Get sanitized provider-specific settings (no tokens/credentials).","operationId":"get_integration_settings_api_v1_tenants__tenant_id__integrations__integration_id__settings_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["integrations"],"summary":"Update Integration Settings","description":"Update editable integration settings (e.g. Google Calendar ID).","operationId":"update_integration_settings_api_v1_tenants__tenant_id__integrations__integration_id__settings_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"integration_id","in":"path","required":true,"schema":{"type":"string","title":"Integration Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationSettingsUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntegrationSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/tools/{tool_id}/credentials/connect":{"post":{"tags":["integrations"],"summary":"Credentials Connect","description":"Connect an integration using API key or basic auth credentials.\n\nRequired fields vary by tool:\n- Phorest: username, password, business_id (+ optional branch_id, region)\n- Zenoti: api_key (+ optional center_id)\n- Mindbody: api_key, site_id","operationId":"credentials_connect_api_v1_tenants__tenant_id__tools__tool_id__credentials_connect_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tool_id","in":"path","required":true,"schema":{"$ref":"#/components/schemas/ToolId"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CredentialsConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectResultResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/optistore/reminder-files":{"post":{"tags":["optistore-reminders"],"summary":"Upload Reminder File","description":"One store's daily file (text/csv, at most 5 MB).","operationId":"upload_reminder_file_api_v1_integrations_optistore_reminder_files_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderFileResult"}}}}}},"get":{"tags":["optistore-reminders"],"summary":"List Reminder Files","operationId":"list_reminder_files_api_v1_integrations_optistore_reminder_files_get","security":[{"HTTPBearer":[]}],"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/ReminderFilesOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/integrations/optistore/reminder-keys":{"get":{"tags":["optistore-reminders"],"summary":"List Reminder Keys","operationId":"list_reminder_keys_api_v1_integrations_optistore_reminder_keys_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderKeysOut"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["optistore-reminders"],"summary":"Create Reminder Key","description":"Make the store's key, revoking the one it had. The key is in this reply only.","operationId":"create_reminder_key_api_v1_integrations_optistore_reminder_keys_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderKeyCreateIn"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReminderKeyCreatedOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/integrations/optistore/reminder-keys/{key_id}":{"delete":{"tags":["optistore-reminders"],"summary":"Revoke Reminder Key","operationId":"revoke_reminder_key_api_v1_integrations_optistore_reminder_keys__key_id__delete","security":[{"HTTPBearer":[]}],"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"}}}}}}},"/api/v1/invoices/payments/{payment_id}/download":{"get":{"tags":["invoices","invoices"],"summary":"Download Payment Invoice","description":"Download a PDF invoice for a payment.\n\nGenerates the invoice on-demand from Payment model data.","operationId":"download_payment_invoice_api_v1_invoices_payments__payment_id__download_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"payment_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/payments/{payment_id}/email":{"post":{"tags":["invoices","invoices"],"summary":"Email Payment Invoice","description":"Email a PDF invoice to a customer.\n\nGenerates the invoice on-demand, then sends it as an email attachment.","operationId":"email_payment_invoice_api_v1_invoices_payments__payment_id__email_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"payment_id","in":"path","required":true,"schema":{"type":"string","title":"Payment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailInvoiceRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailInvoiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/invoices/subscription/{invoice_id}/download":{"get":{"tags":["invoices","invoices"],"summary":"Download Subscription Invoice","description":"Download a Stripe subscription invoice PDF.\n\nRedirects to the Stripe-hosted invoice PDF URL.","operationId":"download_subscription_invoice_api_v1_invoices_subscription__invoice_id__download_get","security":[{"HTTPBearer":[]}],"parameters":[{"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"}}}}}}},"/api/v1/invoices/subscription/{invoice_id}/email":{"post":{"tags":["invoices","invoices"],"summary":"Email Subscription Invoice","description":"Email a Stripe subscription invoice to the tenant owner.\n\nFetches the invoice PDF from Stripe and sends it as an attachment.","operationId":"email_subscription_invoice_api_v1_invoices_subscription__invoice_id__email_post","security":[{"HTTPBearer":[]}],"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/EmailInvoiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/documents":{"get":{"tags":["knowledge"],"summary":"List Documents","description":"List all indexed documents for current tenant.","operationId":"list_documents_api_v1_knowledge_documents_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":100,"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":"object","additionalProperties":true,"title":"Response List Documents Api V1 Knowledge Documents Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/documents/{document_id}":{"get":{"tags":["knowledge"],"summary":"Get Document","description":"Get full details of a specific document.","operationId":"get_document_api_v1_knowledge_documents__document_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Document Api V1 Knowledge Documents  Document Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["knowledge"],"summary":"Update Document","description":"Update a document's title or content.","operationId":"update_document_api_v1_knowledge_documents__document_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateDocumentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Document Api V1 Knowledge Documents  Document Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["knowledge"],"summary":"Delete Document","description":"Delete a document.","operationId":"delete_document_api_v1_knowledge_documents__document_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Delete Document Api V1 Knowledge Documents  Document Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/sources":{"get":{"tags":["knowledge"],"summary":"List Sources","description":"List all data sources for current tenant.\n\nHides demo-seed sources (``meta.demo_tenant = true``) so the admin's\nContent Sources page reflects only what the admin actually added. The\nunderlying rows stay active in the DB so RAG retrieval still answers\nfrom the demo content; PR #1088's hook deactivates them on the first\nreal user upload, after which they disappear from RAG too.","operationId":"list_sources_api_v1_knowledge_sources_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Sources Api V1 Knowledge Sources Get"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["knowledge"],"summary":"Create Source","description":"Create a URL source and trigger crawl.","operationId":"create_source_api_v1_knowledge_sources_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSourceRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Create Source Api V1 Knowledge Sources Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/sources/{source_id}/sync":{"post":{"tags":["knowledge"],"summary":"Sync Source","description":"Re-crawl an existing URL source.","operationId":"sync_source_api_v1_knowledge_sources__source_id__sync_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Sync Source Api V1 Knowledge Sources  Source Id  Sync Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/sources/{source_id}":{"delete":{"tags":["knowledge"],"summary":"Delete Source","description":"Delete a source and all its documents.","operationId":"delete_source_api_v1_knowledge_sources__source_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Delete Source Api V1 Knowledge Sources  Source Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/documents/upload":{"post":{"tags":["knowledge"],"summary":"Upload Document","description":"Upload a document (text, PDF, or Word) to the knowledge base.\n\nText files are processed synchronously. PDF/DOCX files are uploaded to S3\nand processed asynchronously via a Celery task.","operationId":"upload_document_api_v1_knowledge_documents_upload_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_document_api_v1_knowledge_documents_upload_post"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"additionalProperties":true,"type":"object"},{"$ref":"#/components/schemas/DocumentUploadResponse"}],"title":"Response Upload Document Api V1 Knowledge Documents Upload Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/sources/{source_id}/status":{"get":{"tags":["knowledge"],"summary":"Get Source Status","description":"Get processing status for a document upload.","operationId":"get_source_status_api_v1_knowledge_sources__source_id__status_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source_id","in":"path","required":true,"schema":{"type":"string","title":"Source Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentUploadStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/faqs":{"get":{"tags":["knowledge"],"summary":"List Faqs","description":"List custom FAQs for current tenant.","operationId":"list_faqs_api_v1_knowledge_faqs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}},{"name":"active_only","in":"query","required":false,"schema":{"type":"boolean","default":true,"title":"Active Only"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response List Faqs Api V1 Knowledge Faqs Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["knowledge"],"summary":"Create Faq","description":"Create a custom FAQ and sync to RAG documents.","operationId":"create_faq_api_v1_knowledge_faqs_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateFaqRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Create Faq Api V1 Knowledge Faqs Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/faqs/{faq_id}":{"patch":{"tags":["knowledge"],"summary":"Update Faq","description":"Update a custom FAQ.","operationId":"update_faq_api_v1_knowledge_faqs__faq_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"faq_id","in":"path","required":true,"schema":{"type":"string","title":"Faq Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateFaqRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Faq Api V1 Knowledge Faqs  Faq Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["knowledge"],"summary":"Delete Faq","description":"Delete a custom FAQ and its linked document.","operationId":"delete_faq_api_v1_knowledge_faqs__faq_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"faq_id","in":"path","required":true,"schema":{"type":"string","title":"Faq Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Delete Faq Api V1 Knowledge Faqs  Faq Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/faqs/reorder":{"post":{"tags":["knowledge"],"summary":"Reorder Faqs","description":"Bulk update FAQ priorities.","operationId":"reorder_faqs_api_v1_knowledge_faqs_reorder_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderFaqsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Reorder Faqs Api V1 Knowledge Faqs Reorder Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/faqs/suggest-reorganization":{"post":{"tags":["knowledge"],"summary":"Suggest Faq Reorganization","description":"Analyze tenant FAQs with LLM and return dedup/merge/recategorize suggestions.\n\nRequires at least 3 active FAQs. Returns suggestions without making any changes.","operationId":"suggest_faq_reorganization_api_v1_knowledge_faqs_suggest_reorganization_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuggestReorgResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/faqs/apply-reorganization":{"post":{"tags":["knowledge"],"summary":"Apply Faq Reorganization","description":"Apply accepted FAQ reorganization suggestions.\n\nUpdates the primary FAQ in each suggestion and deactivates duplicates.\nRe-syncs document embeddings for all modified FAQs.","operationId":"apply_faq_reorganization_api_v1_knowledge_faqs_apply_reorganization_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyReorgRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApplyReorgResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/faqs/suggest":{"post":{"tags":["knowledge"],"summary":"Suggest Faqs","description":"Analyze KB gaps and suggest new FAQs to fill them.\n\nCombines real customer gap questions (from KnowledgeGap table) with\ncoverage analysis (empty categories) and RAG search to generate\naccurate, contextual FAQ suggestions. Returns suggestions without\nmaking any changes.","operationId":"suggest_faqs_api_v1_knowledge_faqs_suggest_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuggestFaqsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/faqs/accept-suggestions":{"post":{"tags":["knowledge"],"summary":"Accept Faq Suggestions","description":"Create FAQs from accepted suggestions and resolve any linked knowledge gaps.\n\nEach suggestion becomes a new CustomFaq. If a suggestion has a gap_id,\nthe corresponding KnowledgeGap is marked as resolved and linked to the\nnew FAQ.","operationId":"accept_faq_suggestions_api_v1_knowledge_faqs_accept_suggestions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptSuggestionsRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptSuggestionsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/custom-instructions":{"get":{"tags":["knowledge"],"summary":"Get Custom Instructions","description":"Get tenant's custom instructions for the AI agent.","operationId":"get_custom_instructions_api_v1_knowledge_custom_instructions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Response Get Custom Instructions Api V1 Knowledge Custom Instructions Get"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["knowledge"],"summary":"Update Custom Instructions","description":"Update tenant's custom AI instructions (accessible on all plans).","operationId":"update_custom_instructions_api_v1_knowledge_custom_instructions_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCustomInstructionsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Response Update Custom Instructions Api V1 Knowledge Custom Instructions Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/ai-behavior":{"get":{"tags":["knowledge"],"summary":"Get Ai Behavior","description":"Get tenant's AI personality and language settings.","operationId":"get_ai_behavior_api_v1_knowledge_ai_behavior_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Get Ai Behavior Api V1 Knowledge Ai Behavior Get"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["knowledge"],"summary":"Update Ai Behavior","description":"Update AI personality and/or language (accessible on all plans).","operationId":"update_ai_behavior_api_v1_knowledge_ai_behavior_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAIBehaviorRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Update Ai Behavior Api V1 Knowledge Ai Behavior Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/business-info":{"get":{"tags":["knowledge"],"summary":"Get Business Info","description":"Get unified business info: tenant fields + scraped business_info.","operationId":"get_business_info_api_v1_knowledge_business_info_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Business Info Api V1 Knowledge Business Info Get"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["knowledge"],"summary":"Update Business Info","description":"Update business info — routes fields to Tenant or DataSource.meta.","operationId":"update_business_info_api_v1_knowledge_business_info_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessInfoUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Update Business Info Api V1 Knowledge Business Info Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/coverage":{"get":{"tags":["knowledge"],"summary":"Get Knowledge Coverage","description":"Get FAQ coverage per category — how complete is the KB?","operationId":"get_knowledge_coverage_api_v1_knowledge_coverage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Knowledge Coverage Api V1 Knowledge Coverage Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/faqs/generate":{"post":{"tags":["knowledge"],"summary":"Generate Faqs Endpoint","description":"Trigger auto-FAQ generation for this tenant.","operationId":"generate_faqs_endpoint_api_v1_knowledge_faqs_generate_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Generate Faqs Endpoint Api V1 Knowledge Faqs Generate Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/recommendations":{"get":{"tags":["knowledge"],"summary":"Get Recommendations","description":"Get KB gap recommendations — topics the AI can't answer.\n\nReturns skipped topics from FAQ generation where the tenant's\nwebsite didn't have enough info to create a proper FAQ.","operationId":"get_recommendations_api_v1_knowledge_recommendations_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Recommendations Api V1 Knowledge Recommendations Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/gaps":{"get":{"tags":["knowledge"],"summary":"Get Knowledge Gaps","description":"Get knowledge gaps — real questions customers asked that the AI couldn't answer.\n\nSorted by frequency (most-asked first). Only returns unresolved gaps.","operationId":"get_knowledge_gaps_api_v1_knowledge_gaps_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":20,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Knowledge Gaps Api V1 Knowledge Gaps Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/gaps/{gap_id}/resolve":{"post":{"tags":["knowledge"],"summary":"Resolve Knowledge Gap","description":"Mark a knowledge gap as resolved, optionally linking to the FAQ that answers it.","operationId":"resolve_knowledge_gap_api_v1_knowledge_gaps__gap_id__resolve_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"gap_id","in":"path","required":true,"schema":{"type":"string","title":"Gap Id"}},{"name":"faq_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Faq Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Resolve Knowledge Gap Api V1 Knowledge Gaps  Gap Id  Resolve Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/gaps/{gap_id}":{"delete":{"tags":["knowledge"],"summary":"Dismiss Knowledge Gap","description":"Dismiss/delete a knowledge gap.","operationId":"dismiss_knowledge_gap_api_v1_knowledge_gaps__gap_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"gap_id","in":"path","required":true,"schema":{"type":"string","title":"Gap Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Dismiss Knowledge Gap Api V1 Knowledge Gaps  Gap Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/recommendations/{index}":{"delete":{"tags":["knowledge"],"summary":"Dismiss Recommendation","description":"Dismiss a KB gap recommendation by index.","operationId":"dismiss_recommendation_api_v1_knowledge_recommendations__index__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"index","in":"path","required":true,"schema":{"type":"integer","title":"Index"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Dismiss Recommendation Api V1 Knowledge Recommendations  Index  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/knowledge/faqs/bulk":{"post":{"tags":["knowledge"],"summary":"Bulk Create Faqs","description":"Bulk-create FAQ records.","operationId":"bulk_create_faqs_api_v1_knowledge_faqs_bulk_post","requestBody":{"content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Body"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Bulk Create Faqs Api V1 Knowledge Faqs Bulk Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/knowledge/detect-services":{"post":{"tags":["knowledge"],"summary":"Detect Services From Kb","description":"Extract service names from the knowledge base using LLM.","operationId":"detect_services_from_kb_api_v1_knowledge_detect_services_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Detect Services From Kb Api V1 Knowledge Detect Services Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/start":{"post":{"tags":["onboarding"],"summary":"Start Onboarding","description":"Start onboarding process for a tenant.","operationId":"start_onboarding_api_v1_tenants__tenant_id__onboarding_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartOnboardingRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/state":{"get":{"tags":["onboarding"],"summary":"Get Onboarding State","description":"Get onboarding state for a tenant with Redis caching.","operationId":"get_onboarding_state_api_v1_tenants__tenant_id__onboarding_state_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/step/{step_id}/access":{"get":{"tags":["onboarding"],"summary":"Validate Step Access","description":"Validate if user can access a specific step (strict, no back/forward).","operationId":"validate_step_access_api_v1_tenants__tenant_id__onboarding_step__step_id__access_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"step_id","in":"path","required":true,"schema":{"type":"string","title":"Step Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Validate Step Access Api V1 Tenants  Tenant Id  Onboarding Step  Step Id  Access Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/onboarding/advance":{"post":{"tags":["onboarding"],"summary":"Advance Onboarding Step","description":"Mark current step as completed and advance to next step.","operationId":"advance_onboarding_step_api_v1_tenants__tenant_id__onboarding_advance_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdvanceStepRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/steps/scrape":{"post":{"tags":["onboarding"],"summary":"Submit Scrape Step","description":"Submit scrape step for onboarding.","operationId":"submit_scrape_step_api_v1_tenants__tenant_id__onboarding_steps_scrape_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"Idempotency-Key","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Idempotency-Key"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScrapeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/onboarding/steps/manual-content":{"post":{"tags":["onboarding"],"summary":"Submit Manual Content","description":"Add business info manually when website scraping fails.\n\nCreates a document from the pasted text and processes it through\nthe RAG pipeline (chunk + embed + index).","operationId":"submit_manual_content_api_v1_tenants__tenant_id__onboarding_steps_manual_content_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ManualContentRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/steps/voice":{"post":{"tags":["onboarding"],"summary":"Submit Voice Step","description":"Complete voice agent configuration (hub item or legacy step).\n\nArgs:\n    tenant_id: Tenant identifier\n    payload: Voice selection data\n    session: Database session\n    _member: Authorization dependency\n\nReturns:\n    Updated onboarding state","operationId":"submit_voice_step_api_v1_tenants__tenant_id__onboarding_steps_voice_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Step5CompleteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/steps/payment/complete":{"post":{"tags":["onboarding"],"summary":"Complete Payment Step","description":"Mark payment step as completed after successful Stripe payment.\n\nAlso triggers HubSpot lead→customer conversion as a background task.\n\nArgs:\n    payment_intent: Optional Stripe PaymentIntent ID from redirect URL.\n    setup_intent: Optional Stripe SetupIntent ID from redirect URL (free trial).","operationId":"complete_payment_step_api_v1_tenants__tenant_id__onboarding_steps_payment_complete_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"payment_intent","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Intent"}},{"name":"setup_intent","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Setup Intent"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/onboarding/hub/{item_id}/complete":{"post":{"tags":["onboarding"],"summary":"Complete Hub Item","description":"Mark a setup hub item as completed.\n\nDoes not advance the main flow — user stays in hub until all required items done.","operationId":"complete_hub_item_api_v1_tenants__tenant_id__onboarding_hub__item_id__complete_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/onboarding/hub/{item_id}/skip":{"post":{"tags":["onboarding"],"summary":"Skip Hub Item","description":"Skip an optional setup hub item.\n\nOnly allowed for skippable items (calendar, stripe connect).","operationId":"skip_hub_item_api_v1_tenants__tenant_id__onboarding_hub__item_id__skip_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/onboarding/documents":{"get":{"tags":["onboarding"],"summary":"List Verification Documents","description":"List verification documents for a tenant.","operationId":"list_verification_documents_api_v1_tenants__tenant_id__onboarding_documents_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Verification Documents Api V1 Tenants  Tenant Id  Onboarding Documents Get"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["onboarding"],"summary":"Handle Document Upload","description":"Upload a verification document for phone number registration (ILN-402).","operationId":"handle_document_upload_api_v1_tenants__tenant_id__onboarding_documents_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_handle_document_upload_api_v1_tenants__tenant_id__onboarding_documents_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Handle Document Upload Api V1 Tenants  Tenant Id  Onboarding Documents Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/steps/{step_id}/skip":{"post":{"tags":["onboarding"],"summary":"Skip Onboarding Step","description":"Skip a skippable onboarding step.","operationId":"skip_onboarding_step_api_v1_tenants__tenant_id__onboarding_steps__step_id__skip_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"step_id","in":"path","required":true,"schema":{"type":"string","title":"Step Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/re-crawl":{"post":{"tags":["onboarding"],"summary":"Re Crawl Datasource","description":"Re-crawl an existing data source with updated filtering.","operationId":"re_crawl_datasource_api_v1_tenants__tenant_id__re_crawl_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReCrawlRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingStateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/onboarding/steps/1":{"post":{"tags":["onboarding"],"summary":"Submit Step 1 Complete","description":"Complete step 1: signup/login + business info + optional website processing.\n\nThis endpoint provides email-based idempotency:\n- If email exists: verify password, return current state + fresh tokens (resume flow)\n- If email doesn't exist: create account, process business info, enqueue RAG if website","operationId":"submit_step_1_complete_api_v1_onboarding_steps_1_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Step1CompleteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Step1CompleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/onboarding/progress/stream":{"get":{"tags":["onboarding"],"summary":"Stream Processing Progress","description":"Stream processing progress via Server-Sent Events.","operationId":"stream_processing_progress_api_v1_tenants__tenant_id__onboarding_progress_stream_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/analytics/onboarding/summary":{"get":{"tags":["analytics","analytics","onboarding"],"summary":"Get Metrics Summary","description":"Get high-level onboarding metrics summary.\n\nRequires admin or owner role.","operationId":"get_metrics_summary_api_v1_analytics_onboarding_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date","title":"Start Date"},"description":"Filter from date"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date","title":"End Date"},"description":"Filter to date"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/analytics/onboarding/funnel":{"get":{"tags":["analytics","analytics","onboarding"],"summary":"Get Funnel Metrics","description":"Get complete funnel breakdown by step.\n\nRequires admin or owner role.","operationId":"get_funnel_metrics_api_v1_analytics_onboarding_funnel_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date","title":"Start Date"},"description":"Filter from date"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date","title":"End Date"},"description":"Filter to date"},{"name":"flow_variant","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by flow variant (legacy, always 'unified')","title":"Flow Variant"},"description":"Filter by flow variant (legacy, always 'unified')"},{"name":"region","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by region","title":"Region"},"description":"Filter by region"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/analytics/onboarding/drop-off":{"get":{"tags":["analytics","analytics","onboarding"],"summary":"Get Drop Off Analysis","description":"Get drop-off analysis showing where users abandon onboarding.\n\nRequires admin or owner role.","operationId":"get_drop_off_analysis_api_v1_analytics_onboarding_drop_off_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date","title":"Start Date"},"description":"Filter from date"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date","title":"End Date"},"description":"Filter to date"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":50,"minimum":1,"description":"Max results","default":10,"title":"Limit"},"description":"Max results"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/analytics/onboarding/time-metrics":{"get":{"tags":["analytics","analytics","onboarding"],"summary":"Get Time Metrics","description":"Get time-per-step statistics.\n\nRequires admin or owner role.","operationId":"get_time_metrics_api_v1_analytics_onboarding_time_metrics_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date","title":"Start Date"},"description":"Filter from date"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date","title":"End Date"},"description":"Filter to date"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/analytics/onboarding/conversion":{"get":{"tags":["analytics","analytics","onboarding"],"summary":"Get Conversion Over Time","description":"Get conversion rates over time.\n\nRequires admin or owner role.","operationId":"get_conversion_over_time_api_v1_analytics_onboarding_conversion_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"type":"string","description":"Aggregation: daily, weekly, monthly","default":"daily","title":"Period"},"description":"Aggregation: daily, weekly, monthly"},{"name":"start_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date","title":"Start Date"},"description":"Filter from date"},{"name":"end_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date","title":"End Date"},"description":"Filter to date"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/plans":{"get":{"tags":["onboarding"],"summary":"List Plans","description":"List available subscription plans, priced for a market.\n\n`market` is an ISO 3166-1 alpha-2 country (ILN-766). The signup wizard\npasses the country it geo-detected at step 1, so a UAE visitor is quoted\nAED and a US visitor USD from the first page they see.\n\nFalls back to the USD onboarding plans when market pricing is disabled or\nits Stripe prices are not configured — advertising a plan that checkout\ncannot actually sell is worse than showing the current one.\n\nNo authentication required.","operationId":"list_plans_api_v1_plans_get","parameters":[{"name":"market","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Market"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlansListEnvelope"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/tenants/{tenant_id}/onboarding/steps/plan":{"post":{"tags":["onboarding"],"summary":"Select Plan","description":"Select a subscription plan during onboarding.\n\nCreates or updates the subscription record with the selected plan.\nThe subscription starts in 'incomplete' status until payment is completed.\n\nThis endpoint is idempotent - calling it multiple times with the same\nplan will return the existing subscription without creating duplicates.","operationId":"select_plan_api_v1_tenants__tenant_id__onboarding_steps_plan_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanSelectionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlanSelectionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/steps/checkout":{"post":{"tags":["onboarding"],"summary":"Create Checkout","description":"Create a Stripe Checkout session for subscription payment.\n\nPrerequisites:\n- Tenant must exist\n- Plan must be selected (POST /steps/plan called first)\n\nReturns a checkout URL to redirect the user to Stripe's hosted\ncheckout page. After payment, user is redirected back to the\nsuccess_url with the session_id.","operationId":"create_checkout_api_v1_tenants__tenant_id__onboarding_steps_checkout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponseEnvelope"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/steps/validate-promo":{"post":{"tags":["onboarding"],"summary":"Validate Promo Code","description":"Validate a Stripe promotion code.\n\nReturns discount details if the code is valid and active.\nDoes not apply the code — that happens at payment intent creation.","operationId":"validate_promo_code_api_v1_tenants__tenant_id__onboarding_steps_validate_promo_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoCodeValidateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromoCodeValidateEnvelope"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/onboarding/steps/payment-intent":{"post":{"tags":["onboarding"],"summary":"Create Payment Intent","description":"Create a PaymentIntent for embedded payment (Stripe Elements).\n\nThis endpoint creates a subscription with incomplete payment status\nand returns a client_secret for confirming payment on the frontend\nusing Stripe Elements.\n\nIf email is not verified, returns a verification prompt without\nsending an email (the frontend modal sends a 6-digit code).\n\nPrerequisites:\n- Tenant must exist\n- Plan must be selected (POST /steps/plan called first)\n\nReturns client_secret for frontend payment confirmation, or verification prompt.","operationId":"create_payment_intent_api_v1_tenants__tenant_id__onboarding_steps_payment_intent_post","requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/PaymentIntentRequest"},{"type":"null"}],"title":"Payload"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentIntentResponseEnvelope"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/tenants/{tenant_id}/subscription":{"get":{"tags":["onboarding"],"summary":"Get Subscription","description":"Get current subscription status for a tenant.\n\nReturns subscription details including plan, status, and billing info.\nReturns null if no subscription exists.","operationId":"get_subscription_api_v1_tenants__tenant_id__subscription_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponseEnvelope"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/dashboard":{"get":{"tags":["portal"],"summary":"Get Dashboard","description":"Get dashboard data for the tenant.\n\nReturns statistics and recent activity including:\n- Conversation counts by channel and status\n- Message counts\n- Recent conversations with message counts","operationId":"get_dashboard_api_v1_portal_dashboard_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DashboardResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/onboarding/progress":{"get":{"tags":["portal"],"summary":"Get Onboarding Progress","description":"Get onboarding progress for the current tenant.\n\nReturns completion status for each setup step so the portal\ncan show a Getting Started checklist for new tenants.","operationId":"get_onboarding_progress_api_v1_portal_onboarding_progress_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingProgressResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/onboarding/dismiss-step":{"post":{"tags":["portal"],"summary":"Dismiss Onboarding Step","description":"Mark a setup step as \"we are not doing this\", for the whole practice.\n\nEvery step on the Getting Started checklist is derived from live\nconfiguration, so a practice that will never connect WhatsApp could not\nfinish the list and the card never went away.\n\nReturns the recomputed progress rather than an ack, so the client cannot\ndrift out of step with the server about what is dismissed.","operationId":"dismiss_onboarding_step_api_v1_portal_onboarding_dismiss_step_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DismissSetupStepRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingProgressResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/conversations":{"get":{"tags":["portal"],"summary":"List Conversations","description":"List conversations for tenant with pagination and filters.\n\nReturns paginated list of conversations with optional filtering by:\n- Channel (voice, sms, whatsapp, webchat)\n- Status (active, completed, etc.)\n- Search keyword (searches in phone_number)\n- Date range (from_date to to_date)\n- Sentiment (positive, neutral, negative) — from the conversation insight\n- Intent (booking, inquiry, complaint, ...) — from the conversation insight","operationId":"list_conversations_api_v1_portal_conversations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Page Size"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To Date"}},{"name":"sentiment","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"}},{"name":"intent","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Intent"}},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__portal__ConversationsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/conversations/export":{"get":{"tags":["portal"],"summary":"Export Conversations","description":"Export conversations as CSV or PDF with optional filters. Limit 1000 rows.","operationId":"export_conversations_api_v1_portal_conversations_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"from_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"From Date"}},{"name":"to_date","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"To Date"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(csv|pdf)$","default":"csv","title":"Format"}},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/conversations/{conversation_id}":{"get":{"tags":["portal"],"summary":"Get Conversation Detail","description":"Get detailed conversation with all messages.\n\nReturns full conversation details including:\n- All messages in chronological order\n- Recording info (if voice call)\n- Escalation details (if escalated)","operationId":"get_conversation_detail_api_v1_portal_conversations__conversation_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/conversations/{conversation_id}/status":{"patch":{"tags":["portal"],"summary":"Update Conversation Status","description":"Mark a conversation as completed or re-open it.","operationId":"update_conversation_status_api_v1_portal_conversations__conversation_id__status_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateConversationStatusRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Update Conversation Status Api V1 Portal Conversations  Conversation Id  Status Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/conversations/{conversation_id}/de-escalate":{"patch":{"tags":["portal"],"summary":"De Escalate Conversation","description":"Clear escalation status from a conversation.\n\nRemoves escalated_at, escalated_to, and escalation_reason so the\nconversation moves out of the \"Needs Attention\" section.","operationId":"de_escalate_conversation_api_v1_portal_conversations__conversation_id__de_escalate_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response De Escalate Conversation Api V1 Portal Conversations  Conversation Id  De Escalate Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/conversations/{conversation_id}/media":{"get":{"tags":["portal"],"summary":"Get Conversation Media","description":"Get paginated media attachments for a conversation.","operationId":"get_conversation_media_api_v1_portal_conversations__conversation_id__media_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"media_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter: image|video|audio|document","title":"Media Type"},"description":"Filter: image|video|audio|document"},{"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/MediaListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/conversations/{conversation_id}/recording":{"get":{"tags":["portal"],"summary":"Get Recording Url","description":"Get presigned S3 URL for call recording.\n\nReturns a time-limited presigned URL for downloading the recording.\nURL expires in 1 hour by default.","operationId":"get_recording_url_api_v1_portal_conversations__conversation_id__recording_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__portal__RecordingUrlResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/conversations/{conversation_id}/transcript":{"get":{"tags":["portal"],"summary":"Export Transcript","description":"Export conversation transcript as CSV or PDF.","operationId":"export_transcript_api_v1_portal_conversations__conversation_id__transcript_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}},{"name":"format","in":"query","required":false,"schema":{"type":"string","pattern":"^(csv|pdf)$","default":"csv","title":"Format"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/chatbot/test":{"post":{"tags":["portal"],"summary":"Test Chatbot","description":"Test the AI chatbot with a question.\n\nSupports two modes:\n- **text**: Returns text response only (WhatsApp-style chat)\n- **voice**: Returns text + base64-encoded audio (TTS playback)\n\nUses the tenant's RAG knowledge base for context-aware responses.","operationId":"test_chatbot_api_v1_portal_chatbot_test_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatbotTestRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatbotTestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/profile":{"get":{"tags":["portal"],"summary":"Get Tenant Profile","description":"Get tenant profile information for settings display.\n\nReturns business name, website, type, and owner email.","operationId":"get_tenant_profile_api_v1_portal_profile_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantProfileResponse"}}}}},"security":[{"HTTPBearer":[]}]},"patch":{"tags":["portal"],"summary":"Update Tenant Profile","description":"Update tenant profile (owner/admin only).","operationId":"update_tenant_profile_api_v1_portal_profile_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProfileRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/analytics/time-series":{"get":{"tags":["portal"],"summary":"Get Analytics Time Series","description":"Get time-series analytics data for charting.\n\nReturns daily conversation counts for the specified number of days.\nUseful for line/bar charts showing trends over time.","operationId":"get_analytics_time_series_api_v1_portal_analytics_time_series_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":7,"description":"Number of days to include","default":30,"title":"Days"},"description":"Number of days to include"},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TimeSeriesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/analytics/performance":{"get":{"tags":["portal"],"summary":"Get Analytics Performance","description":"Get performance and engagement metrics.\n\nReturns metrics like resolution rate, average messages per conversation,\nchannel distribution, and period-over-period comparisons.","operationId":"get_analytics_performance_api_v1_portal_analytics_performance_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"enum":["week","month"],"type":"string","default":"month","title":"Period"}},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PerformanceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/analytics/bookings":{"get":{"tags":["portal"],"summary":"Get Analytics Bookings","description":"Get bookings analytics grouped by date and status.\n\nReturns daily booking counts broken down by status (confirmed, completed,\ncancelled, pending) for the specified period.","operationId":"get_analytics_bookings_api_v1_portal_analytics_bookings_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":7,"description":"Number of days to include","default":30,"title":"Days"},"description":"Number of days to include"},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingsAnalyticsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/analytics/locations":{"get":{"tags":["portal"],"summary":"Get Analytics By Location","description":"Conversations, bookings and estimated booked value per branch (ILN-816).\n\nBranches come first in the practice's own order; activity with no branch\n(a conversation that never reached a booking tool) gets its own row, so the\nrows always add up to the practice total.","operationId":"get_analytics_by_location_api_v1_portal_analytics_locations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":7,"description":"Number of days to include","default":30,"title":"Days"},"description":"Number of days to include"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationReportResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/analytics/peak-hours":{"get":{"tags":["portal"],"summary":"Get Analytics Peak Hours","description":"Get peak hours and day-of-week distribution for conversations.\n\nReturns hourly (0-23) and daily (Mon-Sun) conversation counts\nto identify when the business is busiest.","operationId":"get_analytics_peak_hours_api_v1_portal_analytics_peak_hours_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":7,"description":"Number of days to include","default":30,"title":"Days"},"description":"Number of days to include"},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PeakHoursResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/analytics/export":{"get":{"tags":["portal"],"summary":"Export Analytics","description":"Export analytics data as a CSV file.\n\nCombines time-series conversation data and bookings by date.\nColumns: Date, Conversations, Voice, WhatsApp, SMS, Webchat, Bookings","operationId":"export_analytics_api_v1_portal_analytics_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":90,"minimum":7,"description":"Number of days to include","default":30,"title":"Days"},"description":"Number of days to include"},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/language":{"patch":{"tags":["portal"],"summary":"Update Customer Language","description":"Update a customer's preferred language.\n\nRequires: admin, owner, or member role\n\nArgs:\n    customer_id: Customer UUID\n    payload: Language update payload\n    membership: Authenticated membership\n    session: Database session\n\nReturns:\n    Updated customer language info\n\nRaises:\n    HTTPException: 404 if customer not found or doesn't belong to tenant","operationId":"update_customer_language_api_v1_portal_customers__customer_id__language_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerLanguageUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CustomerLanguageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/voice-presets":{"get":{"tags":["portal"],"summary":"Get Voice Presets","description":"Get list of available voice presets with language support.\n\nReturns voice options for each supported language (en, es, ar).\n\nRequires: admin, owner, or member role\n\nArgs:\n    membership: Authenticated membership\n\nReturns:\n    List of available voice presets","operationId":"get_voice_presets_api_v1_portal_voice_presets_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/VoicePresetResponse"},"type":"array","title":"Response Get Voice Presets Api V1 Portal Voice Presets Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/settings/hours":{"get":{"tags":["portal"],"summary":"Get Business Hours","description":"Get tenant business hours and timezone.","operationId":"get_business_hours_api_v1_portal_settings_hours_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHoursResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["portal"],"summary":"Update Business Hours","description":"Update tenant business hours (merge-update). Owner/admin only.","operationId":"update_business_hours_api_v1_portal_settings_hours_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHoursUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessHoursResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/settings/booking":{"get":{"tags":["portal"],"summary":"Get Booking Settings","description":"Get tenant booking settings.","operationId":"get_booking_settings_api_v1_portal_settings_booking_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingSettingsResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["portal"],"summary":"Update Booking Settings","description":"Update tenant booking settings (merge-update). Owner/admin only.","operationId":"update_booking_settings_api_v1_portal_settings_booking_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingSettingsUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BookingSettingsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/settings/outbound-policy":{"get":{"tags":["portal"],"summary":"Get Outbound Policy","description":"The tenant's outbound send policy (defaults when never set).","operationId":"get_outbound_policy_api_v1_portal_settings_outbound_policy_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundPolicyResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["portal"],"summary":"Update Outbound Policy","description":"Merge-update the outbound send policy. Owner/admin only.","operationId":"update_outbound_policy_api_v1_portal_settings_outbound_policy_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundPolicyUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OutboundPolicyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/settings/intent-actions":{"get":{"tags":["portal"],"summary":"Get Intent Actions","description":"Get tenant intent action configurations.","operationId":"get_intent_actions_api_v1_portal_settings_intent_actions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Get Intent Actions Api V1 Portal Settings Intent Actions Get"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["portal"],"summary":"Update Intent Actions","description":"Update tenant intent action settings (merge-update). Owner/admin only.","operationId":"update_intent_actions_api_v1_portal_settings_intent_actions_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntentActionsUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Update Intent Actions Api V1 Portal Settings Intent Actions Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/settings/modules":{"get":{"tags":["portal"],"summary":"Get Modules","description":"Get this tenant's operational modules (resolved enabled state + defaults).","operationId":"get_modules_api_v1_portal_settings_modules_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModulesResponse"}}}}},"security":[{"HTTPBearer":[]}]},"patch":{"tags":["portal"],"summary":"Update Modules","description":"Enable/disable modules for this tenant (admin override). Owner/admin only.\n\nMarketing is the paid SMS campaigns add-on: it comes with the add-on on the\nsubscription, and only an ilna admin (impersonating the tenant) can switch\nit on without one. The tenant's own owner cannot.","operationId":"update_modules_api_v1_portal_settings_modules_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModulesUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ModulesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/analytics/engagement":{"get":{"tags":["portal"],"summary":"Get Engagement Analytics","description":"Get customer engagement metrics for a time period.\n\nReturns new vs returning customer counts and average conversations per customer.","operationId":"get_engagement_analytics_api_v1_portal_analytics_engagement_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","maximum":365,"minimum":1,"default":30,"title":"Days"}},{"name":"location_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"ILN-816: only this branch. Omit for the whole practice.","title":"Location Id"},"description":"ILN-816: only this branch. Omit for the whole practice."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EngagementResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/phone":{"get":{"tags":["portal-phone"],"summary":"Get My Numbers","description":"The tenant's assigned number(s) + what their plan allows.","operationId":"get_my_numbers_api_v1_portal_phone_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CurrentNumbersResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/phone/search":{"get":{"tags":["portal-phone"],"summary":"Search Numbers","description":"Search numbers available to buy. Capabilities are forced by plan.\n\nSupports US and CA (and any Telnyx country code). Local numbers can be\nnarrowed by `area_code` and/or `city`/`province` (Telnyx locality +\nadministrative_area) — useful for CA where buyers think in city names\nrather than NANP area codes.","operationId":"search_numbers_api_v1_portal_phone_search_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"country","in":"query","required":false,"schema":{"type":"string","minLength":2,"maxLength":2,"default":"US","title":"Country"}},{"name":"area_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":5},{"type":"null"}],"title":"Area Code"}},{"name":"city","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"City"}},{"name":"province","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Province"}},{"name":"number_type","in":"query","required":false,"schema":{"type":"string","pattern":"^(local|toll-free)$","default":"local","title":"Number Type"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":30,"minimum":1,"default":15,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__portal_phone__SearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/phone/purchase-and-assign":{"post":{"tags":["portal-phone"],"summary":"Purchase And Assign","description":"Buy the selected number from Telnyx and assign it to the tenant (locked).\n\nRe-validates plan eligibility + phone limit server-side (never trust the\nclient). Spends real money; on assignment failure the number is released\nback to Telnyx.","operationId":"purchase_and_assign_api_v1_portal_phone_purchase_and_assign_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseAssignRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseAssignResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/phone/location":{"patch":{"tags":["portal-phone"],"summary":"Set Number Location","description":"Make an AI number a store's own line (or the main line again).\n\nA call or text to a store's line belongs to that store from the first turn.\nThe rules live in `location_service.assign_number_location`.","operationId":"set_number_location_api_v1_portal_phone_location_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NumberLocationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignedNumber"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/flows":{"get":{"tags":["flows"],"summary":"List Flows","operationId":"list_flows_api_v1_flows_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["flows"],"summary":"Create Flow","operationId":"create_flow_api_v1_flows_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/flows/analytics":{"get":{"tags":["flows"],"summary":"Flow Analytics","description":"Real workflow aggregates for this tenant. Engagement metrics\n(bookings/revenue) are gated off until runtime wiring lands (Phase E).","operationId":"flow_analytics_api_v1_flows_analytics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowAnalyticsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/flows/from-scenario":{"post":{"tags":["flows"],"summary":"Create Flow From Scenario","description":"Compile a wizard scenario config into a TenantFlowVersion, persist, publish.\n\nThe scenario compilers (scenarios.py) emit + validate the graph; this just\npersists the result as a flow draft and (by default) publishes v1.","operationId":"create_flow_from_scenario_api_v1_flows_from_scenario_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FromScenarioRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/flows/{flow_id}":{"get":{"tags":["flows"],"summary":"Get Flow","operationId":"get_flow_api_v1_flows__flow_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["flows"],"summary":"Update Flow","operationId":"update_flow_api_v1_flows__flow_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["flows"],"summary":"Delete Flow","operationId":"delete_flow_api_v1_flows__flow_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/flows/{flow_id}/publish":{"post":{"tags":["flows"],"summary":"Publish Flow","operationId":"publish_flow_api_v1_flows__flow_id__publish_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowVersionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/flows/{flow_id}/recompile":{"post":{"tags":["flows"],"summary":"Recompile Flow","description":"Re-compile a wizard-authored flow from its stored source config with the\nCURRENT compiler and publish the result as the next version (ILN-631).\n\nPublished flows store the compiled graph, so a compiler fix never reaches an\nalready-published flow. This regenerates the flow from its raw wizard\n`source_config` — the self-heal path. Graph-authored flows (no source config)\ncan't be recompiled; they return 409. So do flows changed in the editor since\ntheir last compile: the editor doesn't update `source_config`, so a recompile\nwould undo the clinic's edits.","operationId":"recompile_flow_api_v1_flows__flow_id__recompile_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowVersionOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/flows/{flow_id}/versions":{"get":{"tags":["flows"],"summary":"List Flow Versions","operationId":"list_flow_versions_api_v1_flows__flow_id__versions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FlowVersionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/flows/{flow_id}/run-preview":{"post":{"tags":["flows"],"summary":"Run Flow Preview","description":"Execute the saved draft spec through the engine for a Test Run.\n\nSide-effect-free preview: a no-op recording tool executor (no real bookings),\nand either a scripted fake LLM or the real OpenAI adapter.","operationId":"run_flow_preview_api_v1_flows__flow_id__run_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"flow_id","in":"path","required":true,"schema":{"type":"string","title":"Flow Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunPreviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RunPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/flows/demo/run":{"post":{"tags":["flows"],"summary":"Run Demo Flow","description":"Run the reference flow through the engine and return its ground-truth trace.\n\nToggle `allergies_confirmed` to watch the code-enforced rail block (or allow)\nthe booking — the same enforcement the ILN-611 spike proved, now in the engine.","operationId":"run_demo_flow_api_v1_flows_demo_run_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoRunRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DemoRunResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-forms":{"get":{"tags":["intake"],"summary":"List Forms","description":"Active forms by default; `?archived=true` lists ONLY archived ones.\n\nILN-746: archiving is only safe if the tenant can find what they archived and\nput it back. Hiding a form with no way to see it again is a delete wearing a\nsofter name — the trap ILN-738 hit with patients, where archived records\nbecame unreachable in the portal.\n\nDeliberately either/or rather than an `include_archived` union: the archived\nlist is a recovery view, and mixing retired forms into the working list is\nhow a tenant sends one by mistake.","operationId":"list_forms_api_v1_portal_intake_forms_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"archived","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Archived"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/IntakeFormOut"},"title":"Response List Forms Api V1 Portal Intake Forms Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["intake"],"summary":"Create Form","operationId":"create_form_api_v1_portal_intake_forms_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-templates":{"get":{"tags":["intake"],"summary":"List Intake Templates","description":"The template library (ILN-729). Pure in-repo content — no DB read, so this is\ncheap enough to serve the full specs for read-only previews.","operationId":"list_intake_templates_api_v1_portal_intake_templates_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"category","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeTemplateLibraryOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-templates/{template_id}/use":{"post":{"tags":["intake"],"summary":"Use Template","description":"Deep-copy a template into a new tenant DRAFT form (ILN-729).\n\nA snapshot, never a reference: from here the form is the tenant's own, and shipping\na new template version can't retroactively change a form patients are filling. The\nsource template id+version is stamped into meta for provenance.","operationId":"use_template_api_v1_portal_intake_templates__template_id__use_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}}],"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-forms/import":{"post":{"tags":["intake"],"summary":"Import Form","description":"ILN-801: upload an existing PDF/Word intake form. Creates a DRAFT right away\n(so the tenant sees it in the list) and drafts its questions in the background;\n`import_meta.status` moves processing → ready | failed. Never published by us.","operationId":"import_form_api_v1_portal_intake_forms_import_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_import_form_api_v1_portal_intake_forms_import_post"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/intake-forms/{form_id}":{"patch":{"tags":["intake"],"summary":"Update Form","operationId":"update_form_api_v1_portal_intake_forms__form_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"string","title":"Form Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-forms/{form_id}/publish":{"post":{"tags":["intake"],"summary":"Publish Form","operationId":"publish_form_api_v1_portal_intake_forms__form_id__publish_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"string","title":"Form Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-forms/{form_id}/archive":{"post":{"tags":["intake"],"summary":"Archive Form","description":"Retire a form from the picker and from flow selection (ILN-746).\n\nArchive rather than delete: submissions reference the form, and those are\npatient-supplied clinical records. Links already sent stay valid so a patient\nmid-fill can finish — see `intake_form_service.archive_form`.","operationId":"archive_form_api_v1_portal_intake_forms__form_id__archive_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"string","title":"Form Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-forms/{form_id}/unarchive":{"post":{"tags":["intake"],"summary":"Unarchive Form","description":"Bring an archived form back. Archiving is only safe if it is reversible.","operationId":"unarchive_form_api_v1_portal_intake_forms__form_id__unarchive_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"string","title":"Form Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeFormOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-forms/{form_id}/send-link":{"post":{"tags":["intake"],"summary":"Send Link","description":"Mint a fill link for a patient and DELIVER it (ILN-682 SMS; ILN-730 adds\n``channel``: sms | whatsapp | email). ``deliver=false`` keeps the mint-only\nbehavior; the absolute URL is returned either way. A customer who texted STOP\nis never messaged on a phone channel (``delivered=false, reason=opted_out``)\nbut the tenant still gets the link to share through their own channel.\nWhatsApp currently falls back to SMS (no approved outbound template yet) —\nthe response's ``channel`` reports what was actually used. Email requires\n``customer_email``, and is refused unless ``INTAKE_LINK_EMAIL_ENABLED`` is\nset (off by default: see that setting).","operationId":"send_link_api_v1_portal_intake_forms__form_id__send_link_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"string","title":"Form Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_send_link_api_v1_portal_intake_forms__form_id__send_link_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Send Link Api V1 Portal Intake Forms  Form Id  Send Link Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/intake-forms/{form_id}/submissions":{"get":{"tags":["intake"],"summary":"Form Submissions","description":"Submissions for one form, newest first (ILN-683 — the read side).","operationId":"form_submissions_api_v1_portal_intake_forms__form_id__submissions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"form_id","in":"path","required":true,"schema":{"type":"string","title":"Form Id"}},{"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/IntakeSubmissionOut"},"title":"Response Form Submissions Api V1 Portal Intake Forms  Form Id  Submissions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/customers/{customer_id}/intake-submissions":{"get":{"tags":["intake"],"summary":"Customer Intake Submissions","description":"A patient's intake submissions (ILN-683). Matches by customer link OR by the\nprofile's phone — submissions can predate the profile link.","operationId":"customer_intake_submissions_api_v1_portal_customers__customer_id__intake_submissions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}},{"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/IntakeSubmissionOut"},"title":"Response Customer Intake Submissions Api V1 Portal Customers  Customer Id  Intake Submissions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intake/{token}":{"get":{"tags":["intake-public"],"summary":"Get Intake Form","description":"The fill page fetches the published spec + link state. Always 200 — the\n`status` field (ok|used|expired|invalid) drives what the page renders, so we don't\nreveal whether a token exists via the HTTP status.","operationId":"get_intake_form_api_v1_intake__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/PublicIntakeForm"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intake/{token}/submit":{"post":{"tags":["intake-public"],"summary":"Submit Intake Form","description":"Validate + store the submission, upsert the Customer, consume the token.","operationId":"submit_intake_form_api_v1_intake__token__submit_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/IntakeSubmitRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Submit Intake Form Api V1 Intake  Token  Submit Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/intake/{token}/upload":{"post":{"tags":["intake-public"],"summary":"Upload Intake File","description":"Accept a file the PATIENT uploaded while filling the form (Ali 2026-07-30).\n\nUnauthenticated by necessity — the patient has a link, not an account — so\neverything about the destination comes from the TOKEN, and everything about\nthe document (including its type) comes from the FORM's field spec via\n``field_id``. The caller controls only the bytes.\n\nReturns a reference the form stores as its answer. The bytes never travel\nthrough submit: that endpoint takes JSON, and a 10MB file inside an answer\npayload would go through answer validation and into the encrypted blob.","operationId":"upload_intake_file_api_v1_intake__token__upload_post","parameters":[{"name":"token","in":"path","required":true,"schema":{"type":"string","title":"Token"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_intake_file_api_v1_intake__token__upload_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Upload Intake File Api V1 Intake  Token  Upload Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/channels/status":{"get":{"tags":["channels"],"summary":"Get Channels Status","description":"Get status of all communication channels for the tenant.\n\nReturns the assigned phone number and status of voice, SMS, and WhatsApp channels.","operationId":"get_channels_status_api_v1_portal_channels_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelsStatusResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/channels/webchat":{"get":{"tags":["channels"],"summary":"Get Webchat Config","description":"Get webchat channel configuration and embed code.","operationId":"get_webchat_config_api_v1_portal_channels_webchat_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__channels__WebchatConfigResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["channels"],"summary":"Update Webchat Config","description":"Update webchat widget configuration (colors, greeting, domains, etc.).","operationId":"update_webchat_config_api_v1_portal_channels_webchat_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebchatConfigUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__channels__WebchatConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/channels/webchat/enable":{"post":{"tags":["channels"],"summary":"Enable Webchat","description":"Enable webchat channel — generates a widget key.","operationId":"enable_webchat_api_v1_portal_channels_webchat_enable_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__channels__WebchatConfigResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/channels/webchat/disable":{"post":{"tags":["channels"],"summary":"Disable Webchat","description":"Disable webchat channel — revokes the widget key.","operationId":"disable_webchat_api_v1_portal_channels_webchat_disable_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__channels__WebchatConfigResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/rag/search":{"post":{"tags":["rag"],"summary":"Search Endpoint","description":"Search for relevant documents using vector similarity.","operationId":"search_endpoint_api_v1_rag_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__rag__SearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/rag/chat":{"post":{"tags":["rag"],"summary":"Chat Endpoint","description":"Generate a response using RAG (Retrieval-Augmented Generation).","operationId":"chat_endpoint_api_v1_rag_chat_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChatResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/rag/ai-mode":{"get":{"tags":["rag"],"summary":"Get Ai Mode","description":"Get the tenant's AI engine mode.\n\nAlways 'enhanced' — classic (ConversationOrchestrator) was removed and the\nWorkflowEngine is the only engine.","operationId":"get_ai_mode_api_v1_rag_ai_mode_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Get Ai Mode Api V1 Rag Ai Mode Get"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["rag"],"summary":"Update Ai Mode","description":"Deprecated: classic mode was removed. Always enforces 'enhanced'.\n\nKept so the existing client doesn't 404; the requested value is ignored.","operationId":"update_ai_mode_api_v1_rag_ai_mode_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateAIModeRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Update Ai Mode Api V1 Rag Ai Mode Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/stripe/webhooks":{"post":{"tags":["stripe"],"summary":"Stripe Webhook","description":"Handle Stripe webhook events.\n\nThis endpoint receives all Stripe webhook events and routes them\nto the appropriate handler based on event type.\n\nSecurity:\n- Signature verification prevents replay attacks\n- Raw body is used for signature verification\n- Failed verification returns 400\n\nIdempotency:\n- Each event has a unique ID\n- Handlers must be idempotent (safe to process same event twice)\n- Stripe may send the same event multiple times\n\nReturns:\n    {\"status\": \"ok\"} on success\n    400 on invalid signature\n    500 on processing error","operationId":"stripe_webhook_api_v1_stripe_webhooks_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Stripe Webhook Api V1 Stripe Webhooks Post"}}}}}}},"/api/v1/stripe-connect/config":{"get":{"tags":["stripe-connect"],"summary":"Get Connect Config","description":"Get platform's Stripe Connect configuration.\n\nReturns the platform region, supported countries, and charge types.\nUse this to determine what countries are available for account creation.","operationId":"get_connect_config_api_v1_stripe_connect_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectConfigResponse"}}}}}}},"/api/v1/stripe-connect/account":{"post":{"tags":["stripe-connect"],"summary":"Create Connect Account","description":"Create a Stripe Connect account for the tenant.\n\nThis creates a Stripe Connect account so the tenant can receive payments\nfrom their customers. Uses Express type by default for simpler onboarding.\n\nThe country must be valid for the platform region:\n- UAE platform: Only AE accounts allowed\n- Cross-border platform: US, UK, EEA, CA, CH accounts allowed\n\nAfter creation, the tenant must complete KYC verification via the\nonboarding link before they can receive payments.","operationId":"create_connect_account_api_v1_stripe_connect_account_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConnectAccountRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateConnectAccountResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/stripe-connect/onboarding-link":{"post":{"tags":["stripe-connect"],"summary":"Get Onboarding Link","description":"Generate an onboarding link for Connect KYC verification.\n\nReturns a Stripe-hosted URL where the tenant can:\n- Verify their identity (KYC)\n- Add bank account for payouts\n- Configure business settings\n\nThe link expires after a single use.","operationId":"get_onboarding_link_api_v1_stripe_connect_onboarding_link_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingLinkRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OnboardingLinkResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/stripe-connect/status":{"get":{"tags":["stripe-connect"],"summary":"Get Connect Status","description":"Get the KYC verification status of the tenant's Connect account.\n\nReturns detailed status about:\n- Whether they can receive payments\n- Whether they can send payouts\n- Any pending verification requirements\n- Overall readiness state\n\nUse this to determine if the tenant can start receiving payments\nfrom customers via the AI chatbot.","operationId":"get_connect_status_api_v1_stripe_connect_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConnectAccountStatus"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/stripe-connect/login-link":{"post":{"tags":["stripe-connect"],"summary":"Get Login Link","description":"Generate a login link for the Stripe Express dashboard.\n\nReturns a URL where the tenant can:\n- View their balance\n- Manage payouts\n- Update business information\n- View transaction history\n\nThe link is single-use and expires after use.","operationId":"get_login_link_api_v1_stripe_connect_login_link_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginLinkResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/stripe-connect/payment-link":{"post":{"tags":["stripe-connect"],"summary":"Create Payment Link Endpoint","description":"Create a payment link for a customer.\n\nThis endpoint is used by the AI chatbot to generate payment links\nthat can be sent to customers during conversations (chat, SMS, WhatsApp).\n\nThe tenant must have:\n- A connected Stripe Connect account\n- Account must be ready to receive payments (KYC complete)\n\nReturns a Stripe Checkout URL that the customer can use to pay.\nLinks expire after 24 hours. Duplicate requests with the same\nparameters return the existing link if still valid.","operationId":"create_payment_link_endpoint_api_v1_stripe_connect_payment_link_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePaymentLinkRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaymentLinkResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/synthesize":{"post":{"tags":["voice"],"summary":"Synthesize Speech","description":"TTS synthesis has been removed. Use OpenAI Realtime voices instead.","operationId":"synthesize_speech_api_v1_voice_synthesize_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextToSpeechRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/stream":{"post":{"tags":["voice"],"summary":"Stream Speech","description":"TTS streaming has been removed. Use OpenAI Realtime voices instead.","operationId":"stream_speech_api_v1_voice_stream_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TextToSpeechRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/options":{"get":{"tags":["voice"],"summary":"Get Voice Options","description":"Get available voice presets.","operationId":"get_voice_options_api_v1_voice_options_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/VoiceOptionResponse"},"type":"array","title":"Response Get Voice Options Api V1 Voice Options Get"}}}}}}},"/api/v1/voice/preview":{"post":{"tags":["voice"],"summary":"Preview Voice","description":"Preview a voice with sample text.\n\nRequires authenticated membership; IP rate limited to prevent abuse.\nNo voice plan check — allows preview during onboarding before subscription.","operationId":"preview_voice_api_v1_voice_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoicePreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/preview-greeting":{"post":{"tags":["voice"],"summary":"Preview Greeting","description":"Preview the tenant's greeting with their voice and naturalness settings.\n\nGenerates TTS audio of the greeting message with humanization applied.\nUses tenant's configured voice, greeting message, and naturalness level.","operationId":"preview_greeting_api_v1_voice_preview_greeting_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/tenant/current":{"get":{"tags":["voice"],"summary":"Get Tenant Voice","description":"Get tenant's current voice configuration.\n\nReturns the preset KEY (e.g., \"sarah\") which matches the voice options API.","operationId":"get_tenant_voice_api_v1_voice_tenant_current_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantVoiceResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["voice"],"summary":"Update Tenant Voice","description":"Update tenant's voice preference.\n\nNo voice plan check — this saves a preference only, no resources consumed.\nAllows voice selection during onboarding before subscription is fully active.","operationId":"update_tenant_voice_api_v1_voice_tenant_current_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantVoiceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantVoiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/tenant/greeting":{"get":{"tags":["voice"],"summary":"Get Tenant Greeting","description":"Get tenant's greeting message configuration.","operationId":"get_tenant_greeting_api_v1_voice_tenant_greeting_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantGreetingResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["voice"],"summary":"Update Tenant Greeting","description":"Update tenant's greeting message.\n\nSet greeting_message to null to use the default system greeting.","operationId":"update_tenant_greeting_api_v1_voice_tenant_greeting_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantGreetingRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantGreetingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/tenant/language":{"get":{"tags":["voice"],"summary":"Get Tenant Language","description":"Get tenant's default language for AI communication.","operationId":"get_tenant_language_api_v1_voice_tenant_language_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantLanguageResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["voice"],"summary":"Update Tenant Language","description":"Update tenant's default language for AI communication.\n\nThis affects the Telnyx AI assistant's language setting and\ntranscription language for phone calls.","operationId":"update_tenant_language_api_v1_voice_tenant_language_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantLanguageRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantLanguageResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/tenant/agent-config":{"get":{"tags":["voice"],"summary":"Get Agent Config","description":"Get tenant's AI agent configuration (personality and custom instructions).","operationId":"get_agent_config_api_v1_voice_tenant_agent_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentConfigResponse"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["voice"],"summary":"Update Agent Config","description":"Update tenant's AI agent configuration.\n\nStores personality and custom instructions in the ai_settings JSON column.","operationId":"update_agent_config_api_v1_voice_tenant_agent_config_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentConfigRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/health":{"get":{"tags":["voice"],"summary":"Health Check","description":"Check voice service health.","operationId":"health_check_api_v1_voice_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/livekit-token":{"post":{"tags":["voice"],"summary":"Get Livekit Token","description":"Get a LiveKit access token for browser-based voice calls.\n\nCreates a LiveKit room, dispatches the ilna-voice-agent, and returns\nan access token for the browser to join the room.\n\nconnection_type:\n- \"demo\": Onboarding demo — checks usage limits, enforces time cap\n- \"test\": Portal Test AI — full access, no time limit","operationId":"get_livekit_token_api_v1_voice_livekit_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveKitTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LiveKitTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/available-numbers":{"get":{"tags":["voice"],"summary":"List Available Numbers","description":"List available phone numbers for selection.\n\nReturns numbers from the pool that can be assigned to this tenant.\n\nQuery Parameters:\n    area_code: Filter by area code (e.g., \"415\", \"212\")\n    country_code: ISO country code (default: US)\n    limit: Max numbers to return (default: 10, max: 50)","operationId":"list_available_numbers_api_v1_voice_available_numbers_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"area_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"}},{"name":"country_code","in":"query","required":false,"schema":{"type":"string","default":"US","title":"Country Code"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AvailableNumbersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice/config":{"get":{"tags":["voice"],"summary":"Get Voice Config","description":"Get current voice configuration for the tenant.\n\nReturns the assigned phone number and voice persona settings.","operationId":"get_voice_config_api_v1_voice_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceConfigResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/configure":{"post":{"tags":["voice"],"summary":"Configure Voice","description":"Configure voice settings for the tenant.\n\nThis is the main endpoint for the voice setup step during onboarding.\nIt assigns the selected phone number and sets the voice persona.\n\nRequest Body:\n    phone_id: ID of the selected phone number from available-numbers\n    voice_id: Voice ID\n    voice_name: Optional display name for the voice","operationId":"configure_voice_api_v1_voice_configure_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigureVoiceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/style":{"put":{"tags":["voice"],"summary":"Update Voice Style","description":"Update the voice persona for the tenant.\n\nCan be used after initial setup to change the voice style.\n\nRequest Body:\n    voice_id: Voice ID\n    voice_name: Optional display name for the voice","operationId":"update_voice_style_api_v1_voice_style_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateVoiceStyleRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/assign-number":{"post":{"tags":["voice"],"summary":"Assign Number","description":"Assign a phone number to the tenant.\n\nAlternative to /configure if you want to assign number without\nsetting voice style (e.g., in a multi-step form).\n\nRequest Body:\n    phone_id: ID of the phone number to assign","operationId":"assign_number_api_v1_voice_assign_number_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignNumberRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice/search-numbers":{"get":{"tags":["voice"],"summary":"Search Numbers","description":"Search Telnyx inventory for available numbers (not yet purchased).\n\nUnlike /available-numbers which queries the pre-purchased pool,\nthis endpoint queries Telnyx live inventory.\n\nQuery Parameters:\n    country_code: US or CA (default: US)\n    number_type: toll_free or local (default: toll_free)\n    area_code: Area code filter (local numbers only)\n    city: City name filter (local numbers only)\n    province: State/province filter (local numbers only)\n    limit: Max results (default: 10, max: 20)","operationId":"search_numbers_api_v1_voice_search_numbers_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"country_code","in":"query","required":false,"schema":{"type":"string","default":"US","title":"Country Code"}},{"name":"number_type","in":"query","required":false,"schema":{"type":"string","default":"toll_free","title":"Number Type"}},{"name":"area_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"}},{"name":"city","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"}},{"name":"province","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Province"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":10,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchNumbersResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice/select-number":{"post":{"tags":["voice"],"summary":"Select Number","description":"Purchase a number from Telnyx and add to pool.\n\nThis does NOT assign the number to a tenant. After purchasing,\nuse /configure or /assign-number to assign it.\n\nSafety checks:\n- One number per tenant (409 if already has one)\n- Verifies cost <= $1.00/mo via Telnyx lookup before purchasing\n\nRequest Body:\n    e164: E.164 number to purchase\n    country_code: ISO country code (US or CA)","operationId":"select_number_api_v1_voice_select_number_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectNumberRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SelectNumberResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/health":{"get":{"tags":["voice-usage"],"summary":"Health Check","description":"Check voice service health.","operationId":"health_check_api_v1_voice_usage_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/rate-limit/status":{"get":{"tags":["voice-usage"],"summary":"Get Rate Limit Status","description":"Get current rate limit status for tenant.","operationId":"get_rate_limit_status_api_v1_voice_usage_rate_limit_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RateLimitStatusResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/content/validate":{"post":{"tags":["voice-usage"],"summary":"Validate Content","description":"Validate text content without generating TTS.\n\nUseful for pre-validating content before synthesis.","operationId":"validate_content_api_v1_voice_usage_content_validate_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentValidationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContentValidationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/analyze-language":{"post":{"tags":["voice-usage"],"summary":"Analyze Language","description":"Analyze text for language and code-switching patterns.\n\nUseful for understanding language complexity before TTS generation.","operationId":"analyze_language_api_v1_voice_usage_analyze_language_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LanguageAnalysisRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LanguageAnalysisResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/usage/current":{"get":{"tags":["voice-usage"],"summary":"Get Current Usage","description":"Get current month's TTS usage statistics.\n\nReturns usage breakdown including:\n- Total requests and characters\n- Billable vs cached characters\n- Cost estimation\n- Usage by voice preset\n- Daily usage breakdown","operationId":"get_current_usage_api_v1_voice_usage_usage_current_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageStatisticsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/usage/limit-check":{"get":{"tags":["voice-usage"],"summary":"Check Usage Limit","description":"Check if tenant is approaching their monthly usage limit.\n\nReturns limit status with warning levels:\n- \"approaching\": 80%+ of limit used\n- \"critical\": 95%+ of limit used\n- null: under 80%","operationId":"check_usage_limit_api_v1_voice_usage_usage_limit_check_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageLimitResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/usage/trend":{"get":{"tags":["voice-usage"],"summary":"Get Usage Trend","description":"Get daily usage trend for the specified number of days.\n\nArgs:\n    days: Number of days to look back (default: 30, max: 90)\n\nReturns daily breakdown with characters, requests, and cost.","operationId":"get_usage_trend_api_v1_voice_usage_usage_trend_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"days","in":"query","required":false,"schema":{"type":"integer","default":30,"title":"Days"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageTrendResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice-usage/metrics":{"get":{"tags":["voice-usage"],"summary":"Prometheus Metrics","description":"Expose Prometheus metrics for TTS service (tenant-authenticated).","operationId":"prometheus_metrics_api_v1_voice_usage_metrics_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/voice-usage/minutes/summary":{"get":{"tags":["voice-usage"],"summary":"Get Voice Minutes Summary","description":"Get voice call minutes usage summary for current or specified period.\n\nArgs:\n    period: Billing period in \"YYYY-MM\" format. Defaults to current month.\n\nReturns:\n    Usage summary including:\n    - total_calls: Number of calls\n    - total_minutes: Total billed minutes\n    - included_minutes: Minutes included in plan\n    - overage_minutes: Minutes over plan limit\n    - overage_cost: Cost of overage minutes\n    - is_over_limit: Whether tenant exceeded limit","operationId":"get_voice_minutes_summary_api_v1_voice_usage_minutes_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Voice Minutes Summary Api V1 Voice Usage Minutes Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice-usage/minutes/history":{"get":{"tags":["voice-usage"],"summary":"Get Voice Minutes History","description":"Get voice minutes usage history for past months.\n\nArgs:\n    months: Number of months to look back (default: 6, max: 12)\n\nReturns:\n    Monthly usage breakdown.","operationId":"get_voice_minutes_history_api_v1_voice_usage_minutes_history_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","default":6,"title":"Months"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Voice Minutes History Api V1 Voice Usage Minutes History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice-usage/minutes/comparison":{"get":{"tags":["voice-usage"],"summary":"Get Voice Runtime Comparison","description":"Get side-by-side usage comparison between legacy and Telnyx AI runtimes.\n\nArgs:\n    period: Billing period in \"YYYY-MM\" format. Defaults to current month.\n\nReturns:\n    Comparison with total_calls, total_minutes, avg_duration_sec for each mode.","operationId":"get_voice_runtime_comparison_api_v1_voice_usage_minutes_comparison_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Voice Runtime Comparison Api V1 Voice Usage Minutes Comparison Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice-usage/credits/summary":{"get":{"tags":["voice-usage"],"summary":"Get Marketing Credits Summary","description":"Get marketing credits usage summary.\n\nArgs:\n    period: Billing period in \"YYYY-MM\" format. Defaults to current month.\n\nReturns:\n    Credits summary including:\n    - period: Billing period\n    - plan_id: Current plan\n    - limit: Credits included in plan\n    - used: Credits consumed\n    - remaining: Credits available\n    - is_over_limit: Whether limit exceeded","operationId":"get_marketing_credits_summary_api_v1_voice_usage_credits_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Marketing Credits Summary Api V1 Voice Usage Credits Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice-usage/messages/summary":{"get":{"tags":["voice-usage"],"summary":"Get Message Usage Summary","description":"Get message usage summary for current or specified period.\n\nArgs:\n    period: Billing period in \"YYYY-MM\" format. Defaults to current month.\n\nReturns:\n    Usage summary including:\n    - outbound_count: Total outbound messages\n    - inbound_count: Total inbound messages\n    - included_messages: Messages included in plan\n    - messages_remaining: Remaining before overage\n    - overage_count: Messages over plan limit\n    - by_channel: SMS/WhatsApp breakdown","operationId":"get_message_usage_summary_api_v1_voice_usage_messages_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"period","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Period"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Message Usage Summary Api V1 Voice Usage Messages Summary Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/voice-usage/messages/history":{"get":{"tags":["voice-usage"],"summary":"Get Message Usage History","description":"Get message usage history for past months.\n\nArgs:\n    months: Number of months to look back (default: 6, max: 12)\n\nReturns:\n    Monthly usage breakdown.","operationId":"get_message_usage_history_api_v1_voice_usage_messages_history_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"months","in":"query","required":false,"schema":{"type":"integer","default":6,"title":"Months"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Message Usage History Api V1 Voice Usage Messages History Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/telephony/sms":{"post":{"tags":["telephony"],"summary":"Handle Sms Webhook Lookup","description":"Handle incoming Telnyx SMS - lookup tenant from phone number.\n\nThis is the main webhook endpoint configured on the Telnyx Messaging Profile.\nTenant is determined by looking up the \"To\" number in the phone pool.\n\nReturns:\n    JSON acknowledgment","operationId":"handle_sms_webhook_lookup_api_v1_telephony_sms_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/telephony/sms/{tenant_id}":{"post":{"tags":["telephony"],"summary":"Handle Sms Webhook","description":"Handle incoming Telnyx SMS webhook with explicit tenant ID.\n\nArgs:\n    tenant_id: Tenant ID from URL path\n    request: FastAPI Request\n\nReturns:\n    JSON acknowledgment","operationId":"handle_sms_webhook_api_v1_telephony_sms__tenant_id__post","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/telephony/status/{tenant_id}":{"post":{"tags":["telephony"],"summary":"Handle Status Webhook","description":"Handle call/SMS status update webhook.\n\nArgs:\n    tenant_id: Tenant ID from URL path\n    request: FastAPI Request\n\nReturns:\n    204 No Content","operationId":"handle_status_webhook_api_v1_telephony_status__tenant_id__post","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/admin/dashboard/auth/google":{"post":{"tags":["admin"],"summary":"Admin Google Login","description":"Exchange Google id_token for admin JWT. Approved @ilna.ai admins only.","operationId":"admin_google_login_api_v1_admin_dashboard_auth_google_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleLoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants":{"get":{"tags":["admin"],"summary":"List Tenants","description":"Paginated tenant list with aggregated data.\n\nStrategy: paginate Tenant rows first, then enrich the page with\ncorrelated subqueries.  This avoids full-table aggregations across\ndocuments/customers/etc. that made the old CTE approach ~28 s.","operationId":"list_tenants_api_v1_admin_dashboard_tenants_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search by name, website, or email","title":"Search"},"description":"Search by name, website, or email"},{"name":"onboarding_status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter: active|completed|failed","title":"Onboarding Status"},"description":"Filter: active|completed|failed"},{"name":"subscription_plan","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by subscription plan","title":"Subscription Plan"},"description":"Filter by subscription plan"},{"name":"step","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":10,"minimum":1},{"type":"null"}],"description":"Filter by current onboarding step","title":"Step"},"description":"Filter by current onboarding step"},{"name":"sort_by","in":"query","required":false,"schema":{"type":"string","description":"Sort field","default":"created_at","title":"Sort By"},"description":"Sort field"},{"name":"sort_order","in":"query","required":false,"schema":{"type":"string","description":"asc|desc","default":"desc","title":"Sort Order"},"description":"asc|desc"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":250,"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/TenantListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}":{"get":{"tags":["admin"],"summary":"Get Tenant Detail","description":"Full detail view for a single tenant.","operationId":"get_tenant_detail_api_v1_admin_dashboard_tenants__tenant_id__get","security":[{"HTTPBearer":[]}],"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"}}}}}}},"/api/v1/admin/dashboard/stats":{"get":{"tags":["admin"],"summary":"Get Admin Stats","description":"Aggregate dashboard statistics.","operationId":"get_admin_stats_api_v1_admin_dashboard_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminStatsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/dashboard/audit-log":{"get":{"tags":["admin"],"summary":"Get Audit Log","description":"Paginated admin audit log with optional filters.","operationId":"get_audit_log_api_v1_admin_dashboard_audit_log_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"admin_email","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by admin email","title":"Admin Email"},"description":"Filter by admin email"},{"name":"action","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by action type","title":"Action"},"description":"Filter by action type"},{"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":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":250,"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"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/impersonate":{"post":{"tags":["admin"],"summary":"Impersonate Tenant","description":"Generate a one-time impersonation code for secure portal handoff.\n\nReturns an opaque code (not a JWT) that must be exchanged via\nPOST /api/v1/auth/exchange-impersonation-code within 60 seconds.","operationId":"impersonate_tenant_api_v1_admin_dashboard_tenants__tenant_id__impersonate_post","security":[{"HTTPBearer":[]}],"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/ImpersonateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/datasources/{source_id}/rescrape":{"post":{"tags":["admin"],"summary":"Admin Rescrape Datasource","description":"Trigger a re-scrape of a tenant's website datasource.\n\nCreates a new Job and submits the RAG pipeline.  Reuses the same\n``submit_scrape_task`` helper used during onboarding.","operationId":"admin_rescrape_datasource_api_v1_admin_dashboard_tenants__tenant_id__datasources__source_id__rescrape_post","security":[{"HTTPBearer":[]}],"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":{"$ref":"#/components/schemas/RescrapeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/conversations":{"get":{"tags":["admin"],"summary":"List Tenant Conversations","description":"Paginated conversation list with computed message stats for a tenant.","operationId":"list_tenant_conversations_api_v1_admin_dashboard_tenants__tenant_id__conversations_get","security":[{"HTTPBearer":[]}],"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"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"channel","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Channel"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search by phone number or customer name","title":"Search"},"description":"Search by phone number or customer name"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/customers":{"get":{"tags":["admin"],"summary":"List Tenant Customers","description":"Paginated customer list for a tenant.","operationId":"list_tenant_customers_api_v1_admin_dashboard_tenants__tenant_id__customers_get","security":[{"HTTPBearer":[]}],"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"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Search by name, phone, or email","title":"Search"},"description":"Search by name, phone, or email"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__admin_tenant_data__CustomerListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/campaigns":{"get":{"tags":["admin"],"summary":"List Tenant Campaigns","description":"Paginated campaign list for a tenant.","operationId":"list_tenant_campaigns_api_v1_admin_dashboard_tenants__tenant_id__campaigns_get","security":[{"HTTPBearer":[]}],"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"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"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/app__api__admin_tenant_data__CampaignListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/conversations/{conversation_id}":{"get":{"tags":["admin"],"summary":"Get Tenant Conversation","description":"Conversation detail with full message history for a tenant.","operationId":"get_tenant_conversation_api_v1_admin_dashboard_tenants__tenant_id__conversations__conversation_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","title":"Conversation Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/reset/preview":{"post":{"tags":["admin"],"summary":"Preview Tenant Reset","description":"Count what a reset would remove, without removing anything.\n\nTwo steps rather than one on purpose. A reset cannot be undone, so the\nadmin confirms REAL NUMBERS (\"4,213 patients, 18,902 messages\") instead of\nconfirming a tier name and finding out what it meant afterwards. Same\npreview-then-commit shape as the patient CSV import (ILN-806).","operationId":"preview_tenant_reset_api_v1_admin_dashboard_tenants__tenant_id__reset_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPreviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetPlanResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/reset":{"post":{"tags":["admin"],"summary":"Execute Tenant Reset","description":"Run the reset. Requires the token from a preview of the same tier.\n\nThe token is bound to the tenant, the tier and the counts, and the service\nre-derives it before deleting anything. So a preview of `knowledge` cannot\nbe used to confirm a `full` reset, and a confirmation held over while the\ntenant kept taking calls is refused rather than silently applied to numbers\nthe admin never saw.","operationId":"execute_tenant_reset_api_v1_admin_dashboard_tenants__tenant_id__reset_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetExecuteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResetResultResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/patients/{customer_id}/deletion/preview":{"post":{"tags":["admin"],"summary":"Preview Patient Deletion","description":"Count what deleting this patient would remove, blank and keep. Writes\nnothing but the trail that someone looked.","operationId":"preview_patient_deletion_api_v1_admin_dashboard_tenants__tenant_id__patients__customer_id__deletion_preview_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientDeletionPlanResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/patients/{customer_id}/deletion":{"post":{"tags":["admin"],"summary":"Execute Patient Deletion","description":"Delete the patient. Cannot be undone.\n\nNeeds the token of a preview of THIS patient with THESE counts, the\npatient's name typed again, and a reason. Database first, files after the\ncommit: a file that cannot be removed stays on the deletion record and is\nretried with `POST /patient-deletions/{id}/files`.","operationId":"execute_patient_deletion_api_v1_admin_dashboard_tenants__tenant_id__patients__customer_id__deletion_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"customer_id","in":"path","required":true,"schema":{"type":"string","title":"Customer Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientDeletionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientDeletionResultResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/patient-deletions/{deletion_id}/files":{"post":{"tags":["admin"],"summary":"Retry Patient Deletion Files","description":"Try again to remove the files a deletion could not remove.","operationId":"retry_patient_deletion_files_api_v1_admin_dashboard_patient_deletions__deletion_id__files_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"deletion_id","in":"path","required":true,"schema":{"type":"string","title":"Deletion Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"integer"},"title":"Response Retry Patient Deletion Files Api V1 Admin Dashboard Patient Deletions  Deletion Id  Files Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/patient-deletions":{"get":{"tags":["admin"],"summary":"List Patient Deletions","description":"The deletions run for this clinic: what, when, by whom. No names.","operationId":"list_patient_deletions_api_v1_admin_dashboard_tenants__tenant_id__patient_deletions_get","security":[{"HTTPBearer":[]}],"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/PatientDeletionRecord"},"title":"Response List Patient Deletions Api V1 Admin Dashboard Tenants  Tenant Id  Patient Deletions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/marketing-credits":{"get":{"tags":["admin"],"summary":"Get Marketing Credits","description":"What this tenant can actually spend, and where it comes from.\n\nSplit into allowance and granted on purpose. \"0 remaining\" was the symptom\nof ILN-818 and it told nobody whether the plan grants nothing or the pack\nran out — which are different problems with different fixes.","operationId":"get_marketing_credits_api_v1_admin_dashboard_tenants__tenant_id__marketing_credits_get","security":[{"HTTPBearer":[]}],"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/CreditBalanceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Grant Marketing Credits","description":"Give a tenant credits on top of their plan allowance.\n\nThis is the mechanism Ali's credit-packs pricing plugs into, and it exists\nnow precisely so the pricing can be decided later: the numbers are an input\nhere rather than a constant in the code. Granting does not touch the\ntenant's plan, which matters — the alternative workaround was moving a live\nsubscription onto a legacy plan, i.e. changing a paying customer's billing\nto run a test.\n\nPlatform admin only, and `granted_by` records who. A tenant user must never\nreach this: it is money.","operationId":"grant_marketing_credits_api_v1_admin_dashboard_tenants__tenant_id__marketing_credits_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GrantCreditsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreditBalanceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/integrations/optistore":{"get":{"tags":["admin"],"summary":"Get Optistore Connection","description":"Whether this tenant books into OptiStore, and whether it still works.\n\n`usable` is the answer to \"would a booking reach them right now\", which is\nnot the same question as \"is there a row\". A row whose secret cannot be\ndecrypted still routes bookings away from our own calendar, so it reads as\nconnected but unusable, with the reason in `problem`.","operationId":"get_optistore_connection_api_v1_admin_dashboard_tenants__tenant_id__integrations_optistore_get","security":[{"HTTPBearer":[]}],"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/OptiStoreStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Connect Optistore","description":"Connect the clinic, after proving the credentials work.\n\nThe credentials are read back from OptiStore before anything is stored, so\na wrong `LOCATION` or a mistyped secret fails here with their own message\ninstead of failing at the end of a patient's phone call. Nothing is saved\non a refusal.","operationId":"connect_optistore_api_v1_admin_dashboard_tenants__tenant_id__integrations_optistore_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptiStoreConnectRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OptiStoreConnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["admin"],"summary":"Disconnect Optistore","description":"Stop routing this tenant's bookings to OptiStore.\n\nBooking settings are left where the connection put them: a clinic leaving\nOptiStore has to decide for itself whether it now wants our reminders, and\nguessing on its behalf would start messaging its patients.","operationId":"disconnect_optistore_api_v1_admin_dashboard_tenants__tenant_id__integrations_optistore_delete","security":[{"HTTPBearer":[]}],"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/OptiStoreStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/tenants/{tenant_id}/channel-switches":{"get":{"tags":["admin"],"summary":"Get Channel Switches","description":"Whether WhatsApp and Instagram are on for this clinic.","operationId":"get_channel_switches_api_v1_admin_dashboard_tenants__tenant_id__channel_switches_get","security":[{"HTTPBearer":[]}],"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/ChannelSwitchesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin"],"summary":"Set Channel Switches","description":"Switch WhatsApp and/or Instagram on or off for one clinic.\n\nOff stops the channel in both directions (see `app/services/channel_gate.py`)\nand takes effect on the next message: the gate reads the row fresh. The\nconnected account is left in place, so switching back on needs no reconnect.\n\nPlatform admin only. A clinic cannot switch itself back on: the reason a\nchannel is off is usually that the clinic's regulator does not allow it.","operationId":"set_channel_switches_api_v1_admin_dashboard_tenants__tenant_id__channel_switches_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelSwitchesRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelSwitchesResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/costs":{"get":{"tags":["admin"],"summary":"Get Cost Summary","description":"Per-tenant cost rollup for a date range (default last 30 days).","operationId":"get_cost_summary_api_v1_admin_dashboard_costs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD","title":"Start"},"description":"YYYY-MM-DD"},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD","title":"End"},"description":"YYYY-MM-DD"},{"name":"vendor","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":500,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CostSummaryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/costs/tenants/{tenant_id}":{"get":{"tags":["admin"],"summary":"Get Tenant Cost Detail","description":"Daily trend + vendor/category breakdown for a single tenant.","operationId":"get_tenant_cost_detail_api_v1_admin_dashboard_costs_tenants__tenant_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}},{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD","title":"Start"},"description":"YYYY-MM-DD"},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"YYYY-MM-DD","title":"End"},"description":"YYYY-MM-DD"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TenantCostDetailResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/costs.csv":{"get":{"tags":["admin"],"summary":"Export Costs Csv","description":"Per-day per-tenant per-vendor per-category CSV export.","operationId":"export_costs_csv_api_v1_admin_dashboard_costs_csv_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"start","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start"}},{"name":"end","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/stats":{"get":{"tags":["admin"],"summary":"Get Pool Stats","description":"Get phone pool health and statistics.\n\nReturns counts of available, assigned, and reserved numbers,\nalong with breakdown by country and provider.","operationId":"get_pool_stats_api_v1_admin_phone_pool_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PoolHealthResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/phone-pool/numbers":{"get":{"tags":["admin"],"summary":"List Numbers","description":"List phone numbers in the pool with filters.\n\nQuery Parameters:\n    status: Filter by status (available, assigned, reserved)\n    country_code: Filter by ISO country code\n    area_code: Filter by area code\n    provider: Filter by provider (telnyx)\n    limit: Max results (default 50, max 250)\n    offset: Pagination offset","operationId":"list_numbers_api_v1_admin_phone_pool_numbers_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"country_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"}},{"name":"area_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"}},{"name":"provider","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":250,"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/PhoneNumberListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/provision":{"post":{"tags":["admin"],"summary":"Provision Numbers","description":"Provision new phone numbers from a provider.\n\nSearches for available numbers from the specified provider,\npurchases them, and adds them to the pool.\n\nRequest Body:\n    provider: telnyx\n    count: Number of numbers to provision (1-50)\n    area_code: Optional area code filter\n    country_code: ISO country code (default: US)\n    capabilities: Required capabilities (default: voice, sms)","operationId":"provision_numbers_api_v1_admin_phone_pool_provision_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ProvisionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/phone-pool/numbers/{phone_id}/release-to-provider":{"post":{"tags":["admin"],"summary":"Release To Provider","description":"Release a phone number back to the provider.\n\nThis removes the number from the pool and releases it back to the\nprovider inventory. The number will no longer be available.\n\nOnly unassigned pool numbers can be released.","operationId":"release_to_provider_api_v1_admin_phone_pool_numbers__phone_id__release_to_provider_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/numbers/{phone_id}/release-to-pool":{"post":{"tags":["admin"],"summary":"Release To Pool","description":"Release a phone number back to the pool.\n\nThis removes the tenant assignment but keeps the number in the pool.\nUsed when manually releasing a number from a tenant.","operationId":"release_to_pool_api_v1_admin_phone_pool_numbers__phone_id__release_to_pool_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReleaseResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/numbers/{phone_id}":{"get":{"tags":["admin"],"summary":"Get Number","description":"Get details of a specific phone number.","operationId":"get_number_api_v1_admin_phone_pool_numbers__phone_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PhoneNumberResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/sync/{provider}":{"post":{"tags":["admin"],"summary":"Sync From Provider","description":"Sync phone numbers from provider account to local database.\n\nImports numbers that exist in the provider account (e.g., Telnyx)\nbut are not yet in our database. Useful for:\n- Bootstrapping the pool with existing numbers\n- Recovering from drift between provider and database\n- Adding manually purchased numbers to the pool\n\nPath Parameters:\n    provider: Provider name (telnyx)\n\nReturns:\n    imported: Number of new numbers added to pool\n    existing: Numbers already in database (skipped)\n    total: Total numbers found in provider account","operationId":"sync_from_provider_api_v1_admin_phone_pool_sync__provider__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","title":"Provider"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SyncResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/numbers/{phone_id}/enable-whatsapp":{"post":{"tags":["admin"],"summary":"Enable Whatsapp","description":"Enable legacy phone-level WhatsApp metadata for a number.\n\nThis endpoint does NOT connect a tenant to a WhatsApp BSP.\nUse `/api/v1/whatsapp/connect` for Gupshup/Meta onboarding.","operationId":"enable_whatsapp_api_v1_admin_phone_pool_numbers__phone_id__enable_whatsapp_post","deprecated":true,"security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnableWhatsAppRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnableWhatsAppResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/numbers/{phone_id}/disable-whatsapp":{"post":{"tags":["admin"],"summary":"Disable Whatsapp","description":"Disable legacy phone-level WhatsApp metadata for a phone number.","operationId":"disable_whatsapp_api_v1_admin_phone_pool_numbers__phone_id__disable_whatsapp_post","deprecated":true,"security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnableWhatsAppResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/numbers/{phone_id}/assign":{"post":{"tags":["admin"],"summary":"Assign Number To Tenant","description":"Assign a pool number to a tenant.\n\nAssigns the number and optionally configures provider webhooks.\nOnly available/reserved numbers can be assigned.","operationId":"assign_number_to_tenant_api_v1_admin_phone_pool_numbers__phone_id__assign_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AssignResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/numbers/{phone_id}/configure-webhooks":{"post":{"tags":["admin"],"summary":"Configure Webhooks","description":"Force re-configure webhooks on the provider for a number.\n\nUseful when webhooks failed during initial assignment or need\nto be updated after URL changes.","operationId":"configure_webhooks_api_v1_admin_phone_pool_numbers__phone_id__configure_webhooks_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfigureWebhooksResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/phone-pool/tenant/{tenant_id}/release-all":{"post":{"tags":["admin"],"summary":"Release All Tenant Numbers","description":"Release all phone numbers assigned to a tenant back to the pool.\n\nUsed when a tenant churns, cancels subscription, or needs a full reset.\nNumbers remain in the pool but are no longer assigned.","operationId":"release_all_tenant_numbers_api_v1_admin_phone_pool_tenant__tenant_id__release_all_post","security":[{"HTTPBearer":[]}],"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/ReleaseAllResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/verifications":{"get":{"tags":["admin"],"summary":"List Verifications","description":"List verification documents with filters.\n\nQuery Parameters:\n    status: Filter by status (pending, in_review, approved, rejected)\n    country_code: Filter by ISO country code\n    tenant_id: Filter by specific tenant\n    limit: Max results (default 50, max 250)\n    offset: Pagination offset","operationId":"list_verifications_api_v1_admin_verifications_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"country_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"}},{"name":"tenant_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":250,"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/VerificationListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/verifications/stats":{"get":{"tags":["admin"],"summary":"Get Verification Stats","description":"Get verification document statistics.","operationId":"get_verification_stats_api_v1_admin_verifications_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerificationStatsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/verifications/{document_id}":{"get":{"tags":["admin"],"summary":"Get Verification","description":"Get details of a specific verification document.","operationId":"get_verification_api_v1_admin_verifications__document_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"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/VerificationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Review Verification","description":"Review (approve/reject) a verification document.\n\nActions:\n    - approve: Mark document as approved\n    - reject: Mark document as rejected (notes required)\n    - request_resubmit: Mark as pending with notes for user\n\nOn approval:\n    - Updates document status to 'approved'\n    - Updates tenant voice_mode to 'local_approved'\n    - Sends confirmation email to tenant owner\n    - Triggers number provisioning (async task)\n\nOn rejection:\n    - Updates document status to 'rejected'\n    - Sends rejection email with notes to tenant owner","operationId":"review_verification_api_v1_admin_verifications__document_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/tenants-pending-verification":{"get":{"tags":["admin"],"summary":"List Tenants Pending Verification","description":"List tenants with pending document verification.\n\nReturns tenants where voice_mode is 'local_pending' along with\ntheir uploaded documents.","operationId":"list_tenants_pending_verification_api_v1_admin_tenants_pending_verification_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response List Tenants Pending Verification Api V1 Admin Tenants Pending Verification Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns/usage":{"get":{"tags":["campaigns"],"summary":"Get Campaign Usage","description":"This month's campaigns add-on usage: distinct patients added, against the cap.","operationId":"get_campaign_usage_api_v1_portal_campaigns_usage_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignUsageResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns/templates":{"get":{"tags":["campaigns"],"summary":"List Whatsapp Templates","description":"List approved WhatsApp templates for the tenant's Gupshup app.","operationId":"list_whatsapp_templates_api_v1_portal_campaigns_templates_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/TemplateResponse"},"type":"array","title":"Response List Whatsapp Templates Api V1 Portal Campaigns Templates Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns":{"get":{"tags":["campaigns"],"summary":"List Campaigns","description":"List campaigns for the tenant.","operationId":"list_campaigns_api_v1_portal_campaigns_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string","pattern":"^(draft|scheduled|running|paused|completed|canceled)$"},{"type":"null"}],"title":"Status"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":20,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__schemas__campaigns__CampaignListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["campaigns"],"summary":"Create Campaign","description":"Create a new campaign in draft status.","operationId":"create_campaign_api_v1_portal_campaigns_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCampaignRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/stats":{"get":{"tags":["campaigns"],"summary":"Get Campaign Stats","description":"Get aggregate campaign statistics.","operationId":"get_campaign_stats_api_v1_portal_campaigns_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignStatsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns/segments":{"get":{"tags":["campaigns"],"summary":"List Segments Endpoint","description":"The tenant's saved segments.\n\n`with_counts` is opt-in because each count is its own aggregate over the\npatient base — fine for a picker showing a handful, wasteful on every page\nthat merely needs the names.","operationId":"list_segments_endpoint_api_v1_portal_campaigns_segments_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"with_counts","in":"query","required":false,"schema":{"type":"boolean","description":"Also count matching patients","default":false,"title":"With Counts"},"description":"Also count matching patients"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["campaigns"],"summary":"Create Segment Endpoint","description":"Save a filter as a reusable segment.","operationId":"create_segment_endpoint_api_v1_portal_campaigns_segments_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/segments/{segment_id}":{"patch":{"tags":["campaigns"],"summary":"Update Segment Endpoint","operationId":"update_segment_endpoint_api_v1_portal_campaigns_segments__segment_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"segment_id","in":"path","required":true,"schema":{"type":"string","title":"Segment Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SegmentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["campaigns"],"summary":"Delete Segment Endpoint","description":"Delete a segment, unless a campaign that has not sent yet still uses it.","operationId":"delete_segment_endpoint_api_v1_portal_campaigns_segments__segment_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"segment_id","in":"path","required":true,"schema":{"type":"string","title":"Segment Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/channels":{"get":{"tags":["campaigns"],"summary":"Get Channel Availability","description":"Which channels this practice can actually launch on, and why not (ILN-823).\n\nRead by the channel picker so voice is offered only when it would work, with\nthe reason shown instead of a disabled control and no explanation. That\n\"no explanation\" is the ILN-818 mistake: a builder that lets a clinic\nassemble something it cannot launch, then refuses at the end.\n\nDeclared above `/campaigns/{campaign_id}` on purpose — FastAPI matches in\ndeclaration order, so a literal path after the parameterised one is\nswallowed and returns \"campaign not found\".","operationId":"get_channel_availability_api_v1_portal_campaigns_channels_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChannelAvailabilityResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns/library":{"get":{"tags":["campaigns"],"summary":"Campaign Library","description":"The four ready-made clinic campaigns, with what each audience matches now.\n\nCounts are on by default here (unlike the segment list): the whole point of\nthe picker is \"recall would reach 84 patients\", and there are four of them,\nnot an unbounded list.","operationId":"campaign_library_api_v1_portal_campaigns_library_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"with_counts","in":"query","required":false,"schema":{"type":"boolean","description":"Estimate each audience","default":true,"title":"With Counts"},"description":"Estimate each audience"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignLibraryResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/library/{template_id}/use":{"post":{"tags":["campaigns"],"summary":"Use Campaign Template","description":"Create a draft campaign from a template, audience included.\n\nThe body is deep-copied, never referenced — see the package docstring. The\ncampaign stays in draft: the clinic reads the wording, pastes a review link\nwhere one is needed, and launches when it is ready.","operationId":"use_campaign_template_api_v1_portal_campaigns_library__template_id__use_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"template_id","in":"path","required":true,"schema":{"type":"string","title":"Template Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UseTemplateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/body/preview":{"post":{"tags":["campaigns"],"summary":"Preview Campaign Body","description":"What a patient actually receives, with the placeholders filled in.\n\nWorth its own endpoint rather than rendering in the browser: the substitution\nrules (the no-name fallback, the tidy-up after a dropped placeholder) live on\nthe server, and a preview that disagreed with the send would be worse than\nno preview.","operationId":"preview_campaign_body_api_v1_portal_campaigns_body_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BodyPreviewRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BodyPreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns/body/variants":{"post":{"tags":["campaigns"],"summary":"Campaign Body Variants","description":"AI rewordings of a body, each one already safe to save.","operationId":"campaign_body_variants_api_v1_portal_campaigns_body_variants_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BodyVariantsRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BodyVariantsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns/{campaign_id}":{"get":{"tags":["campaigns"],"summary":"Get Campaign","description":"Get campaign detail.","operationId":"get_campaign_api_v1_portal_campaigns__campaign_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["campaigns"],"summary":"Update Campaign","description":"Update a campaign (only draft/paused).","operationId":"update_campaign_api_v1_portal_campaigns__campaign_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCampaignRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["campaigns"],"summary":"Delete Campaign","description":"Delete a draft campaign.","operationId":"delete_campaign_api_v1_portal_campaigns__campaign_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/funnel":{"get":{"tags":["campaigns"],"summary":"Get Campaign Funnel","description":"ILN-809: the funnel counted from the recipient rows, plus the bookings won.\n\nSeparate from the campaign detail endpoint because it aggregates over every\nrecipient: the detail call is on the page's critical path, this one is not.","operationId":"get_campaign_funnel_api_v1_portal_campaigns__campaign_id__funnel_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignFunnelResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/launch":{"post":{"tags":["campaigns"],"summary":"Launch Campaign","description":"Launch a campaign (start sending messages/calls).","operationId":"launch_campaign_api_v1_portal_campaigns__campaign_id__launch_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/pause":{"post":{"tags":["campaigns"],"summary":"Pause Campaign","description":"Pause a running campaign.","operationId":"pause_campaign_api_v1_portal_campaigns__campaign_id__pause_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/resume":{"post":{"tags":["campaigns"],"summary":"Resume Campaign","description":"Resume a paused campaign.","operationId":"resume_campaign_api_v1_portal_campaigns__campaign_id__resume_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/cancel":{"post":{"tags":["campaigns"],"summary":"Cancel Campaign","description":"Cancel a campaign.","operationId":"cancel_campaign_api_v1_portal_campaigns__campaign_id__cancel_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CampaignDetail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/recipients":{"get":{"tags":["campaigns"],"summary":"List Recipients","description":"List recipients for a campaign.","operationId":"list_recipients_api_v1_portal_campaigns__campaign_id__recipients_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}},{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1,"title":"Page"}},{"name":"page_size","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Page Size"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RecipientListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["campaigns"],"summary":"Add Recipients","description":"Add recipients to a campaign.","operationId":"add_recipients_api_v1_portal_campaigns__campaign_id__recipients_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddRecipientsRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Add Recipients Api V1 Portal Campaigns  Campaign Id  Recipients Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/audience/preview":{"post":{"tags":["campaigns"],"summary":"Preview Patient Audience","description":"ILN-800: how many existing patients match a rule, with a small sample.","operationId":"preview_patient_audience_api_v1_portal_campaigns_audience_preview_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientAudienceFilter"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudiencePreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/campaigns/{campaign_id}/recipients/from-patients":{"post":{"tags":["campaigns"],"summary":"Add Recipients From Patients","description":"ILN-800: add every matching patient as a recipient (skips those already in\nthe campaign; opted-out and archived patients never match).","operationId":"add_recipients_from_patients_api_v1_portal_campaigns__campaign_id__recipients_from_patients_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PatientAudienceFilter"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AudienceAddResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/recipients/csv":{"post":{"tags":["campaigns"],"summary":"Upload Csv","description":"Upload a CSV file of leads to add as campaign recipients.","operationId":"upload_csv_api_v1_portal_campaigns__campaign_id__recipients_csv_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_csv_api_v1_portal_campaigns__campaign_id__recipients_csv_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CsvUploadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/campaigns/{campaign_id}/recipients/{recipient_id}":{"delete":{"tags":["campaigns"],"summary":"Remove Recipient","description":"Remove a pending recipient from a campaign.","operationId":"remove_recipient_api_v1_portal_campaigns__campaign_id__recipients__recipient_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"campaign_id","in":"path","required":true,"schema":{"type":"string","title":"Campaign Id"}},{"name":"recipient_id","in":"path","required":true,"schema":{"type":"string","title":"Recipient Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/whatsapp/webhook":{"get":{"tags":["whatsapp"],"summary":"Verify Webhook","description":"Verify Meta webhook subscription.","operationId":"verify_webhook_api_v1_whatsapp_webhook_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["whatsapp"],"summary":"Handle Incoming Message","description":"Handle incoming WhatsApp webhook from Meta Cloud API.","operationId":"handle_incoming_message_api_v1_whatsapp_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/whatsapp/status":{"get":{"tags":["whatsapp"],"summary":"Get Whatsapp Status","description":"Get WhatsApp connection status for the tenant.","operationId":"get_whatsapp_status_api_v1_whatsapp_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppStatusResponse"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["whatsapp"],"summary":"Handle Message Status","description":"Handle WhatsApp status updates via Meta webhook.","operationId":"handle_message_status_api_v1_whatsapp_status_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/whatsapp/oauth/start":{"get":{"tags":["whatsapp"],"summary":"Start Meta Oauth","description":"Start Meta OAuth flow for WhatsApp Cloud API.","operationId":"start_meta_oauth_api_v1_whatsapp_oauth_start_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source","in":"query","required":false,"schema":{"type":"string","description":"Source app: 'web' or 'portal'","default":"web","title":"Source"},"description":"Source app: 'web' or 'portal'"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/whatsapp/oauth/callback":{"get":{"tags":["whatsapp"],"summary":"Meta Oauth Callback","description":"OAuth callback to store Meta tokens + WABA info.","operationId":"meta_oauth_callback_api_v1_whatsapp_oauth_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","minLength":1,"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/whatsapp/connect":{"post":{"tags":["whatsapp"],"summary":"Connect Whatsapp","description":"Connect a WhatsApp Business number to the tenant.","operationId":"connect_whatsapp_api_v1_whatsapp_connect_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppConnectRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppConnectResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/whatsapp/disconnect":{"delete":{"tags":["whatsapp"],"summary":"Disconnect Whatsapp","description":"Disconnect WhatsApp from the tenant.","operationId":"disconnect_whatsapp_api_v1_whatsapp_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WhatsAppConnectResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/whatsapp/embedded-signup/config":{"get":{"tags":["whatsapp"],"summary":"Get Embedded Signup Config","description":"Get configuration for frontend Embedded Signup SDK.\n\nFrontend uses this to initialize FB SDK and launch signup flow.","operationId":"get_embedded_signup_config_api_v1_whatsapp_embedded_signup_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddedSignupConfigResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/whatsapp/embedded-signup/complete":{"post":{"tags":["whatsapp"],"summary":"Complete Embedded Signup","description":"Complete Embedded Signup after frontend flow finishes.\n\nFrontend calls this with the code and IDs received from Meta's\nsessionInfoListener after user completes the signup flow.\n\nThis endpoint:\n1. Exchanges the code for a long-lived access token\n2. Stores WABA ID, phone number ID, and token for tenant\n3. Subscribes the app to receive webhooks for this WABA","operationId":"complete_embedded_signup_api_v1_whatsapp_embedded_signup_complete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddedSignupCompleteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmbeddedSignupCompleteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/whatsapp/verification/start":{"post":{"tags":["whatsapp"],"summary":"Start Phone Verification","description":"Start phone number verification for WhatsApp Embedded Signup.\n\nCall this BEFORE the user enters the phone number in Meta's flow.\nThis creates a pending verification record so we can capture the OTP\nwhen Meta sends it.\n\nArgs:\n    request: Contains the phone number to verify\n    membership: Current user's membership\n\nReturns:\n    VerificationStatusResponse with initial 'pending' status","operationId":"start_phone_verification_api_v1_whatsapp_verification_start_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StartVerificationRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__whatsapp_connect__VerificationStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/whatsapp/verification/status/{phone_number}":{"get":{"tags":["whatsapp"],"summary":"Get Verification Status","description":"Check phone number verification status.\n\nPoll this endpoint to check if the OTP has been received.\nWhen status is 'otp_received', the OTP code is included.\n\nArgs:\n    phone_number: E.164 phone number being verified\n    membership: Current user's membership\n\nReturns:\n    VerificationStatusResponse with current status and OTP if available","operationId":"get_verification_status_api_v1_whatsapp_verification_status__phone_number__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_number","in":"path","required":true,"schema":{"type":"string","title":"Phone Number"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__whatsapp_connect__VerificationStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/whatsapp/verification/{phone_number}":{"delete":{"tags":["whatsapp"],"summary":"Cancel Verification","description":"Cancel a pending phone number verification.\n\nArgs:\n    phone_number: E.164 phone number\n    membership: Current user's membership\n\nReturns:\n    Confirmation of cancellation","operationId":"cancel_verification_api_v1_whatsapp_verification__phone_number__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"phone_number","in":"path","required":true,"schema":{"type":"string","title":"Phone Number"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__whatsapp_connect__VerificationStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/gupshup/create":{"post":{"tags":["gupshup"],"summary":"Create Gupshup App","description":"Create a Gupshup app for WhatsApp Business onboarding.\n\nThis is the first step in the onboarding flow. Creates a new WABA app\nin Gupshup's Partner system for this tenant.","operationId":"create_gupshup_app_api_v1_gupshup_create_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GupshupCreateAppRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GupshupCreateAppResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/gupshup/embed-link":{"get":{"tags":["gupshup"],"summary":"Get Embed Link","description":"Get embedded signup link for white-label Meta Business verification.\n\nReturns a URL that can be loaded in an iframe or popup for the tenant\nto complete WhatsApp Business verification without seeing Gupshup branding.","operationId":"get_embed_link_api_v1_gupshup_embed_link_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GupshupEmbedLinkResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/gupshup/status":{"get":{"tags":["gupshup"],"summary":"Get Gupshup Status","description":"Get current Gupshup WhatsApp connection status.\n\nUse this to poll for onboarding completion after the tenant starts\nthe embedded signup flow.","operationId":"get_gupshup_status_api_v1_gupshup_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GupshupStatusResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/gupshup/complete":{"post":{"tags":["gupshup"],"summary":"Complete Gupshup Connection","description":"Finalize WhatsApp connection after Meta Business verification.\n\nCall this after the embedded signup flow completes successfully.\nFetches the app token and stores connection details.","operationId":"complete_gupshup_connection_api_v1_gupshup_complete_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GupshupCompleteResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/gupshup/disconnect":{"delete":{"tags":["gupshup"],"summary":"Disconnect Gupshup","description":"Disconnect WhatsApp from the tenant account.\n\nThis removes the stored credentials but does not delete the Gupshup app.\nThe app can be reconnected later.","operationId":"disconnect_gupshup_api_v1_gupshup_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GupshupDisconnectResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/gupshup/resend-verification":{"post":{"tags":["gupshup"],"summary":"Resend Verification Email","description":"Resend the email verification link for WhatsApp onboarding.","operationId":"resend_verification_email_api_v1_gupshup_resend_verification_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Resend Verification Email Api V1 Gupshup Resend Verification Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/gupshup/webhook":{"post":{"tags":["gupshup"],"summary":"Gupshup Webhook","description":"Handle inbound Gupshup webhook events.\n\nProcesses:\n- message: Inbound messages from WhatsApp users\n- message-event: Status updates (enqueued, sent, delivered, read, failed)","operationId":"gupshup_webhook_api_v1_gupshup_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/instagram/webhook":{"get":{"tags":["instagram"],"summary":"Verify Instagram Webhook","description":"Verify Meta IG webhook subscription.\n\nMeta calls this once when the webhook URL is registered in Console. The\nhandshake exchanges three query params:\n    ?hub.mode=subscribe\n    &hub.verify_token=<our-shared-secret>\n    &hub.challenge=<random-string>\n\nWe echo `hub.challenge` as plain-text body if the verify token matches.","operationId":"verify_instagram_webhook_api_v1_instagram_webhook_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}},"post":{"tags":["instagram"],"summary":"Handle Instagram Event","description":"Receive and route Instagram webhook events.\n\nAlways returns 200 after signature verification, even on parsing or\nrouting errors — Meta retries 4xx/5xx aggressively, so we accept the\npayload then handle errors out-of-band via logs/observability.","operationId":"handle_instagram_event_api_v1_instagram_webhook_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/instagram/oauth/start":{"post":{"tags":["instagram"],"summary":"Start Instagram Oauth","description":"Kick off Instagram Login OAuth — returns the authorize URL.\n\nTwo-step flow (avoids JWT-in-URL): the parent window calls this with a\nBearer token, gets the authorize URL, then opens it in a popup.\nAuth is required here (CSRF-protection: we mint a state token tied to\nthe calling tenant); the popup goes straight to instagram.com (no auth)\nand the /oauth/callback endpoint identifies the tenant from the state.","operationId":"start_instagram_oauth_api_v1_instagram_oauth_start_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"source","in":"query","required":false,"schema":{"type":"string","description":"Source app: 'portal' or 'web'","default":"portal","title":"Source"},"description":"Source app: 'portal' or 'web'"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramOAuthStartResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/instagram/oauth/callback":{"get":{"tags":["instagram"],"summary":"Instagram Oauth Callback","description":"Handle Instagram OAuth redirect.\n\nValidates state, exchanges code → long-lived token, fetches user profile,\nrejects PERSONAL accounts, encrypts + persists tokens, redirects to portal.","operationId":"instagram_oauth_callback_api_v1_instagram_oauth_callback_get","parameters":[{"name":"code","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"Code"}},{"name":"state","in":"query","required":true,"schema":{"type":"string","minLength":1,"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/instagram/status":{"get":{"tags":["instagram"],"summary":"Get Instagram Status","description":"Get Instagram connection status for the tenant.","operationId":"get_instagram_status_api_v1_instagram_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramStatusResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/instagram/disconnect":{"delete":{"tags":["instagram"],"summary":"Disconnect Instagram","description":"Disconnect Instagram from the tenant.\n\nClears credentials locally. Note: this does NOT revoke the Meta-side\npermission grant — tenant must also remove our app from Instagram\nSettings → Apps and Websites for full revocation.","operationId":"disconnect_instagram_api_v1_instagram_disconnect_delete","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InstagramDisconnectResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/instagram/deauthorize":{"get":{"tags":["instagram"],"summary":"Instagram Deauthorize","description":"Meta calls this when a user revokes our app from Instagram settings.\n\nPayload format: signed_request=<token>.<payload-base64>\nFor now: log + acknowledge. Full handler in B6 will decode the\nsigned_request and clear the matching tenant row.","operationId":"instagram_deauthorize_api_v1_instagram_deauthorize_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/instagram/data-deletion":{"get":{"tags":["instagram"],"summary":"Instagram Data Deletion","description":"GDPR/CCPA data deletion request endpoint required by Meta.\n\nPer Meta spec, must return JSON with `url` (status page) and\n`confirmation_code` (audit identifier). For now we generate a\ncorrelation ID and log; full implementation lands with B6.","operationId":"instagram_data_deletion_api_v1_instagram_data_deletion_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/api/v1/hubspot/webhooks/document-review":{"post":{"tags":["hubspot","hubspot"],"summary":"Handle Document Review","description":"Handle document review webhook from HubSpot workflow.\n\nCalled when a HubSpot user updates the document_review_status\nproperty on a verification ticket.\n\nSecurity:\n- Signature verification prevents spoofed requests\n- Document ID must exist in database\n\nReturns:\n    {\"status\": \"ok\", \"document_id\": \"...\", \"new_status\": \"...\"}","operationId":"handle_document_review_api_v1_hubspot_webhooks_document_review_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Handle Document Review Api V1 Hubspot Webhooks Document Review Post"}}}}}}},"/api/v1/hubspot/webhooks/health":{"get":{"tags":["hubspot","hubspot"],"summary":"Hubspot Webhook Health","description":"Health check for HubSpot webhook endpoint.","operationId":"hubspot_webhook_health_api_v1_hubspot_webhooks_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Hubspot Webhook Health Api V1 Hubspot Webhooks Health Get"}}}}}}},"/api/v1/calendly/webhooks":{"post":{"tags":["calendly","calendly"],"summary":"Handle Calendly Webhook","description":"Handle Calendly webhook events.\n\nProcesses invitee.created and invitee.canceled events to create\nor update Booking records in the system.\n\nSecurity:\n- Signature verification prevents spoofed requests\n- Tenant is identified from integration record\n\nReturns:\n    {\"status\": \"ok\", \"event\": \"...\", \"booking_id\": \"...\"}","operationId":"handle_calendly_webhook_api_v1_calendly_webhooks_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Handle Calendly Webhook Api V1 Calendly Webhooks Post"}}}}}}},"/api/v1/calendly/webhooks/health":{"get":{"tags":["calendly","calendly"],"summary":"Calendly Webhook Health","description":"Health check for Calendly webhook endpoint.","operationId":"calendly_webhook_health_api_v1_calendly_webhooks_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Calendly Webhook Health Api V1 Calendly Webhooks Health Get"}}}}}}},"/api/v1/portal/notifications":{"get":{"tags":["notifications"],"summary":"List Notifications","description":"List notifications for the current tenant.","operationId":"list_notifications_api_v1_portal_notifications_get","security":[{"HTTPBearer":[]}],"parameters":[{"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"}},{"name":"unread_only","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Unread Only"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationsListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/notifications/unread-count":{"get":{"tags":["notifications"],"summary":"Get Unread Count","description":"Get unread notification count for badge display.","operationId":"get_unread_count_api_v1_portal_notifications_unread_count_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnreadCountResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/notifications/{notification_id}/read":{"patch":{"tags":["notifications"],"summary":"Mark Read","description":"Mark a single notification as read.","operationId":"mark_read_api_v1_portal_notifications__notification_id__read_patch","security":[{"HTTPBearer":[]}],"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/MarkReadResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/notifications/read-all":{"post":{"tags":["notifications"],"summary":"Mark All Read","description":"Mark all notifications as read.","operationId":"mark_all_read_api_v1_portal_notifications_read_all_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MarkAllReadResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/notifications/preferences":{"get":{"tags":["notifications"],"summary":"Get Preferences","description":"Get notification preferences for tenant.","operationId":"get_preferences_api_v1_portal_notifications_preferences_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreferencesOut"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"tags":["notifications"],"summary":"Update Preferences","description":"Update notification preferences for tenant.","operationId":"update_preferences_api_v1_portal_notifications_preferences_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreferencesUpdate"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PreferencesOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/escalation-paths":{"get":{"tags":["escalation-paths"],"summary":"List Escalation Paths","description":"List all escalation paths for the current tenant.","operationId":"list_escalation_paths_api_v1_portal_escalation_paths_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationPathListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["escalation-paths"],"summary":"Create Escalation Path","description":"Create a new escalation path. No hard cap — tenants size to need.","operationId":"create_escalation_path_api_v1_portal_escalation_paths_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationPathCreate"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationPathOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/escalation-paths/{path_id}":{"get":{"tags":["escalation-paths"],"summary":"Get Escalation Path","description":"Get a single escalation path.","operationId":"get_escalation_path_api_v1_portal_escalation_paths__path_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"path_id","in":"path","required":true,"schema":{"type":"string","title":"Path Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationPathOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["escalation-paths"],"summary":"Update Escalation Path","description":"Update an escalation path.\n\nSystem paths cannot have their name changed.","operationId":"update_escalation_path_api_v1_portal_escalation_paths__path_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"path_id","in":"path","required":true,"schema":{"type":"string","title":"Path Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationPathUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EscalationPathOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["escalation-paths"],"summary":"Delete Escalation Path","description":"Delete an AI Action.\n\nILN-559: is_system no longer blocks delete. Tenants own their data.","operationId":"delete_escalation_path_api_v1_portal_escalation_paths__path_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"path_id","in":"path","required":true,"schema":{"type":"string","title":"Path Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/escalation-paths/reorder":{"put":{"tags":["escalation-paths"],"summary":"Reorder Escalation Paths","description":"Update sort_order for escalation paths.","operationId":"reorder_escalation_paths_api_v1_portal_escalation_paths_reorder_put","requestBody":{"content":{"application/json":{"schema":{"items":{"type":"string"},"type":"array","title":"Ordered Ids"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/notification-routing/{feature}":{"get":{"tags":["escalation-paths"],"summary":"Get Notification Routing","description":"Read the per-feature notification routing override for the tenant.\n\n`feature` is currently 'escalation' or 'booking'. Returns 404 if the\nfeature key is unknown; returns the row with phone=None when no\noverride has been set (UI shows the fallback).","operationId":"get_notification_routing_api_v1_portal_notification_routing__feature__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"feature","in":"path","required":true,"schema":{"type":"string","title":"Feature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationRoutingOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["escalation-paths"],"summary":"Upsert Notification Routing","description":"Set or clear the per-feature notification override.\n\n`phone=null` clears the override (falls back to tenant.escalation_phone).","operationId":"upsert_notification_routing_api_v1_portal_notification_routing__feature__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"feature","in":"path","required":true,"schema":{"type":"string","title":"Feature"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationRoutingUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NotificationRoutingOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/escalation-paths/share-info-capability":{"get":{"tags":["escalation-paths"],"summary":"Get Share Info Capability","description":"Return outbound capability flags driving the Share Info form gating.\n\nThe form uses these to decide whether to warn the tenant admin that a\nshare_info action they're about to save will fail at runtime. Mirrors\nthe gate that ``_customer_action_tools`` checks in the workflow engine.","operationId":"get_share_info_capability_api_v1_portal_escalation_paths_share_info_capability_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ShareInfoCapabilityOut"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/staff-numbers/failing":{"get":{"tags":["staff-numbers"],"summary":"List Failing Staff Numbers","description":"The signed-in clinic's staff numbers currently marked failing.","operationId":"list_failing_staff_numbers_api_v1_portal_staff_numbers_failing_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailingStaffNumbersResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/media-assets":{"get":{"tags":["media-assets"],"summary":"List Media Assets","description":"List all media assets for the tenant.","operationId":"list_media_assets_api_v1_portal_media_assets_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["media-assets"],"summary":"Upload Media Asset","description":"Upload a new media asset for the AI agent to send to customers.","operationId":"upload_media_asset_api_v1_portal_media_assets_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_upload_media_asset_api_v1_portal_media_assets_post"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/media-assets/{asset_id}":{"patch":{"tags":["media-assets"],"summary":"Update Media Asset","description":"Update display_name or description of a media asset.","operationId":"update_media_asset_api_v1_portal_media_assets__asset_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","title":"Asset Id"}},{"name":"display_name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Name"}},{"name":"description","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["media-assets"],"summary":"Delete Media Asset","description":"Soft-delete a media asset (deactivate).","operationId":"delete_media_asset_api_v1_portal_media_assets__asset_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","title":"Asset Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/media-assets/{asset_id}/serve":{"get":{"tags":["media-assets"],"summary":"Serve Media Asset","description":"Serve the file content directly (for local dev or inline preview).","operationId":"serve_media_asset_api_v1_portal_media_assets__asset_id__serve_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"asset_id","in":"path","required":true,"schema":{"type":"string","title":"Asset Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/media-assets/from-datasource/{datasource_id}":{"post":{"tags":["media-assets"],"summary":"Link Kb Document As Asset","description":"Link an existing KB document as a sendable media asset (no re-upload).\n\nCreates a TenantMediaAsset record pointing to the KB document's S3 key.\nThe AI agent can then send this document to customers via send_media.","operationId":"link_kb_document_as_asset_api_v1_portal_media_assets_from_datasource__datasource_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"datasource_id","in":"path","required":true,"schema":{"type":"string","title":"Datasource Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkFromKBRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MediaAssetResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/action-items":{"get":{"tags":["action-items"],"summary":"List Action Items","description":"List action items with optional filters.","operationId":"list_action_items_api_v1_portal_action_items_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"status","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},{"name":"priority","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Priority"}},{"name":"type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"}},{"name":"conversation_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"}},{"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":{"$ref":"#/components/schemas/ActionItemListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/action-items/stats":{"get":{"tags":["action-items"],"summary":"Get Action Item Stats","description":"Get action item counts by status for dashboard badges.","operationId":"get_action_item_stats_api_v1_portal_action_items_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionItemStats"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/action-items/{item_id}":{"get":{"tags":["action-items"],"summary":"Get Action Item","description":"Get a single action item.","operationId":"get_action_item_api_v1_portal_action_items__item_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionItemOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/action-items/{item_id}/status":{"patch":{"tags":["action-items"],"summary":"Update Action Item Status","description":"Update action item status (resolve, dismiss, reopen).","operationId":"update_action_item_status_api_v1_portal_action_items__item_id__status_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionItemStatusUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionItemOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/action-items/{item_id}/assign":{"patch":{"tags":["action-items"],"summary":"Assign Action Item","description":"Assign or unassign an action item to a team member.","operationId":"assign_action_item_api_v1_portal_action_items__item_id__assign_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"item_id","in":"path","required":true,"schema":{"type":"string","title":"Item Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionItemAssign"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActionItemOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/users/me/sessions":{"get":{"tags":["sessions"],"summary":"List Sessions","description":"List all active sessions for the current user.","operationId":"list_sessions_api_v1_users_me_sessions_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionListResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/sessions/{session_id}/revoke":{"post":{"tags":["sessions"],"summary":"Revoke Session","description":"Revoke a specific session by ID.","operationId":"revoke_session_api_v1_users_me_sessions__session_id__revoke_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Revoke Session Api V1 Users Me Sessions  Session Id  Revoke Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/users/me/sessions/revoke-all":{"post":{"tags":["sessions"],"summary":"Revoke All Sessions","description":"Revoke all sessions except the current one and re-issue tokens.","operationId":"revoke_all_sessions_api_v1_users_me_sessions_revoke_all_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeAllSessionsResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/account/delete":{"post":{"tags":["gdpr"],"summary":"Request Account Deletion","description":"Schedule account for deletion with 30-day grace period.","operationId":"request_account_deletion_api_v1_users_me_account_delete_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountDeletionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccountDeletionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/account/cancel-deletion":{"post":{"tags":["gdpr"],"summary":"Cancel Account Deletion","description":"Cancel a pending account deletion during grace period.","operationId":"cancel_account_deletion_api_v1_users_me_account_cancel_deletion_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CancelDeletionResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/data/export":{"get":{"tags":["gdpr"],"summary":"Export Personal Data","description":"Export all personal data for the current user (GDPR Article 20).","operationId":"export_personal_data_api_v1_users_me_data_export_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DataExportResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/mfa/setup":{"post":{"tags":["mfa"],"summary":"Setup Mfa","description":"Generate TOTP secret and provisioning URI for QR code.","operationId":"setup_mfa_api_v1_users_me_mfa_setup_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MFASetupResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/mfa/verify":{"post":{"tags":["mfa"],"summary":"Verify Mfa Setup","description":"Confirm MFA setup by verifying first TOTP code. Returns backup codes.","operationId":"verify_mfa_setup_api_v1_users_me_mfa_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MFAVerifySetupRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MFAVerifySetupResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/mfa/disable":{"post":{"tags":["mfa"],"summary":"Disable Mfa","description":"Disable MFA (requires password confirmation).","operationId":"disable_mfa_api_v1_users_me_mfa_disable_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MFADisableRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Disable Mfa Api V1 Users Me Mfa Disable Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/mfa/status":{"get":{"tags":["mfa"],"summary":"Mfa Status","description":"Check MFA status for the current user.","operationId":"mfa_status_api_v1_users_me_mfa_status_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MFAStatusResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/users/me/mfa/backup-codes":{"get":{"tags":["mfa"],"summary":"Regenerate Backup Codes","description":"Regenerate backup codes (invalidates previous ones).","operationId":"regenerate_backup_codes_api_v1_users_me_mfa_backup_codes_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MFABackupCodesResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/auth/mfa/verify":{"post":{"tags":["mfa"],"summary":"Verify Mfa Login","description":"Complete MFA-gated login by verifying TOTP code or backup code.","operationId":"verify_mfa_login_api_v1_auth_mfa_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MFAVerifyLoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Verify Mfa Login Api V1 Auth Mfa Verify Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/support/ticket":{"post":{"tags":["support"],"summary":"Create Ticket","description":"Create a support ticket in HubSpot with full error context.\n\nThis endpoint can be called even when the user is not fully authenticated,\nas errors can occur during signup/onboarding before auth is complete.\n\nThe ticket includes:\n- Error details (message, type, stack trace)\n- Location context (source, step, URL)\n- User context (tenant ID, email, business name)\n- Environment context (browser, timestamp)","operationId":"create_ticket_api_v1_support_ticket_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportTicketRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportTicketResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team":{"get":{"tags":["team"],"summary":"List Team Members","description":"List all team members for the current tenant.","operationId":"list_team_members_api_v1_portal_team_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamMemberListResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/team/invite":{"post":{"tags":["team"],"summary":"Invite Team Member","description":"Send a team invite email. Requires admin or owner role.","operationId":"invite_team_member_api_v1_portal_team_invite_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteSentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/team/invites":{"get":{"tags":["team"],"summary":"List Team Invites","description":"List all invites for the current tenant. Requires admin or owner.","operationId":"list_team_invites_api_v1_portal_team_invites_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteListResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/team/invites/{invite_id}":{"delete":{"tags":["team"],"summary":"Revoke Team Invite","description":"Revoke a pending invite. Requires admin or owner.","operationId":"revoke_team_invite_api_v1_portal_team_invites__invite_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","title":"Invite Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamActionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/invites/{invite_id}/resend":{"post":{"tags":["team"],"summary":"Resend Team Invite","description":"Resend an invite with a fresh token. Requires admin or owner.","operationId":"resend_team_invite_api_v1_portal_team_invites__invite_id__resend_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"invite_id","in":"path","required":true,"schema":{"type":"string","title":"Invite Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteSentResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/{membership_id}/role":{"patch":{"tags":["team"],"summary":"Change Member Role","description":"Change a team member's role. Owner can set admin/member, admin can set member only.","operationId":"change_member_role_api_v1_portal_team__membership_id__role_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"membership_id","in":"path","required":true,"schema":{"type":"string","title":"Membership Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamActionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/{membership_id}":{"delete":{"tags":["team"],"summary":"Remove Team Member","description":"Remove a member from the team. Owner can remove anyone, admin can remove members only.","operationId":"remove_team_member_api_v1_portal_team__membership_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"membership_id","in":"path","required":true,"schema":{"type":"string","title":"Membership Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamActionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/activity":{"get":{"tags":["team"],"summary":"List Team Activity","description":"Get team activity log. Requires admin or owner.","operationId":"list_team_activity_api_v1_portal_team_activity_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by event type","title":"Event Type"},"description":"Filter by event type"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date (ISO 8601)","title":"Since"},"description":"Filter from date (ISO 8601)"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date (ISO 8601)","title":"Until"},"description":"Filter to date (ISO 8601)"},{"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/ActivityLogResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/activity/export":{"get":{"tags":["team"],"summary":"Export Team Activity","description":"Export team activity log as CSV or JSON. Requires admin or owner.","operationId":"export_team_activity_api_v1_portal_team_activity_export_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"format","in":"query","required":false,"schema":{"type":"string","description":"Export format: csv or json","default":"csv","title":"Format"},"description":"Export format: csv or json"},{"name":"event_type","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by event type","title":"Event Type"},"description":"Filter by event type"},{"name":"since","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter from date (ISO 8601)","title":"Since"},"description":"Filter from date (ISO 8601)"},{"name":"until","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"description":"Filter to date (ISO 8601)","title":"Until"},"description":"Filter to date (ISO 8601)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/transfer-ownership":{"post":{"tags":["team"],"summary":"Initiate Ownership Transfer","description":"Initiate ownership transfer to an admin. Owner only.\n\nSends a confirmation email to the target admin. The transfer completes\nonly when they click the confirmation link.","operationId":"initiate_ownership_transfer_api_v1_portal_team_transfer_ownership_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TransferOwnershipRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamActionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/team/transfer-ownership/confirm":{"post":{"tags":["team"],"summary":"Confirm Ownership Transfer","description":"Confirm an ownership transfer via email token. No auth required (token-based).\n\nAtomically swaps the owner and admin roles and revokes both users' tokens.","operationId":"confirm_ownership_transfer_api_v1_portal_team_transfer_ownership_confirm_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConfirmOwnershipTransferRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TeamActionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/invite-preview":{"get":{"tags":["team"],"summary":"Preview Team Invite","description":"Resolve an invite token for the accept page without accepting it.\n\nPublic (token-based). Returns a status the UI can branch on plus business/\nrole context for a valid invite — so the page never has to attempt an accept\njust to discover what state the invite is in.","operationId":"preview_team_invite_api_v1_portal_team_invite_preview_get","parameters":[{"name":"token","in":"query","required":true,"schema":{"type":"string","minLength":1,"title":"Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/InvitePreviewResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/team/accept-invite":{"post":{"tags":["team"],"summary":"Accept Team Invite","description":"Accept a team invite. No authentication required (token-based).\n\nIf the email has an existing account, adds them to the team.\nIf new, creates an account (password required).","operationId":"accept_team_invite_api_v1_portal_team_accept_invite_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInviteRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AcceptInviteResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/staff/me":{"get":{"tags":["team-staff"],"summary":"Get My Staff Record","description":"Return the TeamMember record linked to the calling user, or None.\n\nILN-563 Phase 5: the team_member-role portal calls this on bootstrap to\ndiscover its own member_id (used to call /staff/{id}/services with\nself-edit semantics). Admins also get a meaningful response if their\nuser is linked to a TeamMember (e.g. an owner who also takes bookings).\nReturns null body for unlinked users (most admins).","operationId":"get_my_staff_record_api_v1_portal_staff_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/StaffResponse"},{"type":"null"}],"title":"Response Get My Staff Record Api V1 Portal Staff Me Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/staff":{"get":{"tags":["team-staff"],"summary":"List Staff","description":"List all active staff members with booking counts and connected calendars.","operationId":"list_staff_api_v1_portal_staff_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffListResponse"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"tags":["team-staff"],"summary":"Create Staff","description":"Create a new booking staff member.","operationId":"create_staff_api_v1_portal_staff_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffCreateRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/staff/{member_id}":{"get":{"tags":["team-staff"],"summary":"Get Staff","description":"Get a single staff member by ID.","operationId":"get_staff_api_v1_portal_staff__member_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["team-staff"],"summary":"Update Staff","description":"Update a staff member's profile.","operationId":"update_staff_api_v1_portal_staff__member_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StaffResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["team-staff"],"summary":"Delete Staff","description":"Deactivate (soft delete) or hard-delete a staff member.\n\nHard delete only if no active bookings. Otherwise sets is_active=False.","operationId":"delete_staff_api_v1_portal_staff__member_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Staff Api V1 Portal Staff  Member Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/staff/{member_id}/calendar/oauth/start":{"post":{"tags":["team-staff"],"summary":"Start Staff Calendar Oauth","description":"Start OAuth flow to connect a calendar for a specific staff member.\n\nBody: {\"tool_id\": \"google_calendar\", \"source\": \"portal\"}\nReturns: {\"auth_url\": \"...\", \"state\": \"...\"}","operationId":"start_staff_calendar_oauth_api_v1_portal_staff__member_id__calendar_oauth_start_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Start Staff Calendar Oauth Api V1 Portal Staff  Member Id  Calendar Oauth Start Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/staff/{member_id}/services":{"get":{"tags":["team-staff"],"summary":"List Member Services","description":"Return the services this team member offers, with per-row overrides.\n\nThe ``duration_minutes`` and ``price_cents`` fields are EFFECTIVE values\n(override → catalog fallback). ``override_*`` exposes the raw assignment\nfields so the UI can show \"uses default\" vs explicit override.","operationId":"list_member_services_api_v1_portal_staff__member_id__services_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberServicesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["team-staff"],"summary":"Replace Member Services","description":"Replace the member's entire service list.\n\nILN-563 Phase 5: admins (admin/owner role) edit any member's assignments\nfreely. ``team_member`` role can only edit their own TeamMember row\n(matched via TeamMember.user_id) and any ``price_cents`` they include\nin the payload is silently stripped — price is admin-only.\n\nBody: ``{\"assignments\": [{\"service_id\": \"...\", \"price_cents\": 3500,\n\"duration_minutes\": 45}, ...]}`` — empty list clears all.","operationId":"replace_member_services_api_v1_portal_staff__member_id__services_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberServicesPutRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberServicesListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/staff/{member_id}/schedule":{"get":{"tags":["team-staff"],"summary":"Get Member Schedule","description":"Return the member's weekly recurring schedule rows.","operationId":"get_member_schedule_api_v1_portal_staff__member_id__schedule_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WeeklyScheduleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["team-staff"],"summary":"Replace Member Schedule","description":"Replace the member's entire weekly schedule with this set.\n\nILN-563 Phase 5: admin/owner can edit any member; team_member role can\nonly edit their own row (TeamMember.user_id == caller). 403 otherwise.\n\nEmpty ``rows`` clears all weekly recurring rows for the member.\nSplit shifts are expressed as multiple rows with the same\n``day_of_week`` — the DB CHECK on ``start_time < end_time`` and the\nschema-level pattern catch malformed entries before write.","operationId":"replace_member_schedule_api_v1_portal_staff__member_id__schedule_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WeeklyScheduleRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/WeeklyScheduleResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/staff/{member_id}/locations":{"get":{"tags":["team-staff"],"summary":"Get Member Locations","description":"The branches this member works at. Empty = every branch.","operationId":"get_member_locations_api_v1_portal_staff__member_id__locations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberLocationsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["team-staff"],"summary":"Replace Member Locations","description":"Replace which branches this member works at. Empty = every branch.\n\nAdmin-only (TEAM_MANAGE): where someone works is a manager's decision, unlike\ntheir own hours, which a team member may edit.","operationId":"replace_member_locations_api_v1_portal_staff__member_id__locations_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberLocationsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MemberLocationsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/staff/{member_id}/schedule/exceptions":{"get":{"tags":["team-staff"],"summary":"List Member Schedule Exceptions","description":"List all schedule exceptions for the member, ordered by date.","operationId":"list_member_schedule_exceptions_api_v1_portal_staff__member_id__schedule_exceptions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleExceptionListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["team-staff"],"summary":"Add Member Schedule Exception","description":"Add a single date-override exception (unavailable or custom_hours).\n\nILN-563 Phase 5: admin/owner can add for any member; team_member role\ncan only add their own.\n\nSchema-level validators enforce: ``unavailable`` rows MUST NOT have\ntimes, ``custom_hours`` rows MUST have both times with end > start.\nThe DB CHECK ``ck_tmse_times_match_kind`` is the second line of defense.","operationId":"add_member_schedule_exception_api_v1_portal_staff__member_id__schedule_exceptions_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleExceptionInput"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ScheduleExceptionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/staff/{member_id}/schedule/exceptions/{exception_id}":{"delete":{"tags":["team-staff"],"summary":"Delete Member Schedule Exception","description":"Remove a single exception. Returns 404 if not found OR cross-tenant.\n\nILN-563 Phase 5: admin/owner can delete any; team_member only their own.","operationId":"delete_member_schedule_exception_api_v1_portal_staff__member_id__schedule_exceptions__exception_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"member_id","in":"path","required":true,"schema":{"type":"string","title":"Member Id"}},{"name":"exception_id","in":"path","required":true,"schema":{"type":"string","title":"Exception Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Delete Member Schedule Exception Api V1 Portal Staff  Member Id  Schedule Exceptions  Exception Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/services":{"get":{"tags":["services"],"summary":"List Services","description":"List services for the current tenant.","operationId":"list_services_api_v1_portal_services_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","description":"Include deactivated services. Default lists only active.","default":false,"title":"Include Inactive"},"description":"Include deactivated services. Default lists only active."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["services"],"summary":"Create Service","description":"Create a new service in the tenant catalog.","operationId":"create_service_api_v1_portal_services_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceCreateRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/services/{service_id}":{"get":{"tags":["services"],"summary":"Get Service","description":"Fetch a single service by ID.","operationId":"get_service_api_v1_portal_services__service_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["services"],"summary":"Update Service","description":"Partial update of an existing service. Unset fields are left unchanged.","operationId":"update_service_api_v1_portal_services__service_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["services"],"summary":"Deactivate Service","description":"Soft-delete a service (set ``is_active=False``).\n\nWe never hard-delete to preserve referential integrity with future\n``bookings.service_id`` references (Phase 4).","operationId":"deactivate_service_api_v1_portal_services__service_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Deactivate Service Api V1 Portal Services  Service Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/services/{service_id}/restore":{"post":{"tags":["services"],"summary":"Restore Service","description":"Re-activate a previously deactivated service.","operationId":"restore_service_api_v1_portal_services__service_id__restore_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/services/extract-from-kb":{"post":{"tags":["services"],"summary":"Extract Services From Kb","description":"Scan the tenant's KB and propose bookable services.\n\nCandidates are NOT persisted — the admin reviews them in the portal and\nsubmits a curated subset via ``POST /services/bulk``. Existing services\nare flagged via ``already_exists`` so the admin can skip duplicates.\n\nSynchronous (5-10s typical, 30s LLM timeout). Considered moving to\nCelery + SSE polling but the budget here is small enough that blocking\nthe request is acceptable for v1. Revisit if extraction latency grows.","operationId":"extract_services_from_kb_api_v1_portal_services_extract_from_kb_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KbExtractionResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/services/bulk":{"post":{"tags":["services"],"summary":"Bulk Create Services","description":"Create multiple services in one round-trip.\n\nPer-item outcome is reported in the response — a duplicate name does NOT\nabort the batch, it just becomes ``skipped_duplicate`` for that item.\nAll non-error commits land in a single transaction (committed at the end);\nif the transaction fails mid-way the entire batch rolls back. We tolerate\nthat imperfection because the alternative — a per-item commit loop — is\nN round-trips and fights the session's transaction model.","operationId":"bulk_create_services_api_v1_portal_services_bulk_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkServiceCreateRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BulkServiceCreateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/portal/services/{service_id}/team":{"get":{"tags":["services"],"summary":"List Service Team","description":"Return active team members offering this service, with per-row overrides.","operationId":"list_service_team_api_v1_portal_services__service_id__team_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceTeamListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["services"],"summary":"Replace Service Team","description":"Replace the team-member set offering this service (admin/owner only).\n\nMirror of ``PUT /portal/staff/{id}/services`` but inverted: the URL keys\nthe service, the payload lists the members. Lets admins manage member↔\nservice assignments from either side of the M:N without bouncing between\npages. Atomic — existing assignments not in the payload are removed,\nnew ones are upserted with their per-member duration/price overrides.","operationId":"replace_service_team_api_v1_portal_services__service_id__team_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceTeamPutRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceTeamListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/services/{service_id}/locations":{"get":{"tags":["services"],"summary":"Get Service Locations","description":"Which branches offer this service. Empty = every branch.","operationId":"get_service_locations_api_v1_portal_services__service_id__locations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceLocationsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["services"],"summary":"Replace Service Locations","description":"Restrict a service to some branches, or (empty list) offer it everywhere.\n\nBoth runtimes read this: the shared branch block lists the service under\nthe branches that offer it, and check_availability / create_booking refuse\nit anywhere else.","operationId":"replace_service_locations_api_v1_portal_services__service_id__locations_put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"service_id","in":"path","required":true,"schema":{"type":"string","title":"Service Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceLocationsBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ServiceLocationsResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/locations":{"get":{"tags":["locations"],"summary":"List Locations","operationId":"list_locations_api_v1_portal_locations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"include_inactive","in":"query","required":false,"schema":{"type":"boolean","default":false,"title":"Include Inactive"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationListOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["locations"],"summary":"Create Location","operationId":"create_location_api_v1_portal_locations_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationCreateIn"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/locations/{location_id}":{"patch":{"tags":["locations"],"summary":"Update Location","operationId":"update_location_api_v1_portal_locations__location_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"location_id","in":"path","required":true,"schema":{"type":"string","title":"Location Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationUpdateIn"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["locations"],"summary":"Delete Location","operationId":"delete_location_api_v1_portal_locations__location_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"location_id","in":"path","required":true,"schema":{"type":"string","title":"Location Id"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/locations/{location_id}/primary":{"post":{"tags":["locations"],"summary":"Set Primary","operationId":"set_primary_api_v1_portal_locations__location_id__primary_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"location_id","in":"path","required":true,"schema":{"type":"string","title":"Location Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/portal/locations/{location_id}/close":{"post":{"tags":["locations"],"summary":"Close Location","description":"Deactivate rather than delete. Keeps the history, frees the billed slot.","operationId":"close_location_api_v1_portal_locations__location_id__close_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"location_id","in":"path","required":true,"schema":{"type":"string","title":"Location Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationOut"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/auth/register":{"post":{"tags":["partner"],"summary":"Register Partner","description":"Register a new partner account.","operationId":"register_partner_api_v1_partner_auth_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerRegisterRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/auth/login":{"post":{"tags":["partner"],"summary":"Login Partner","description":"Login with email and password.","operationId":"login_partner_api_v1_partner_auth_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerLoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/validate/{code}":{"get":{"tags":["partner"],"summary":"Validate Partner Code","description":"Validate a partner referral code for the signup form.\n\nPublic, rate-limited endpoint so the signup UI can confirm a partner\ncode before submitting. Returns 200 + partner name on active match,\n404 otherwise. Intentionally does NOT distinguish between \"unknown\ncode\" and \"inactive partner\" in the error message — prevents\npartial enumeration.\n\nRate limit: 20 req/min per IP (tighter than login to discourage\nenumeration scripts).","operationId":"validate_partner_code_api_v1_partner_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/PartnerValidateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/me":{"get":{"tags":["partner"],"summary":"Get Profile","description":"Get partner profile.","operationId":"get_profile_api_v1_partner_me_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerProfileResponse"}}}}},"security":[{"HTTPBearer":[]}]},"patch":{"tags":["partner"],"summary":"Update Profile","description":"Update partner profile fields.","operationId":"update_profile_api_v1_partner_me_patch","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerProfileUpdateRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/partner/me/banking":{"put":{"tags":["partner"],"summary":"Update Banking","description":"Create or update banking details (encrypted at rest).","operationId":"update_banking_api_v1_partner_me_banking_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerBankingRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Update Banking Api V1 Partner Me Banking Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/partner/clients":{"get":{"tags":["partner"],"summary":"List Clients","description":"List all attributed clients with subscription and commission data.","operationId":"list_clients_api_v1_partner_clients_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/PartnerClientResponse"},"type":"array","title":"Response List Clients Api V1 Partner Clients Get"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/partner/clients/{tenant_id}":{"get":{"tags":["partner"],"summary":"Get Client","description":"Get single client detail.","operationId":"get_client_api_v1_partner_clients__tenant_id__get","security":[{"HTTPBearer":[]}],"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/PartnerClientResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/commissions":{"get":{"tags":["partner"],"summary":"List Commissions","description":"List all commissions, optionally filtered by month.","operationId":"list_commissions_api_v1_partner_commissions_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"month","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Filter by month (YYYY-MM)","title":"Month"},"description":"Filter by month (YYYY-MM)"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/PartnerCommissionResponse"},"title":"Response List Commissions Api V1 Partner Commissions Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/commissions/summary":{"get":{"tags":["partner"],"summary":"Get Commission Summary","description":"Get monthly commission summary with per-client breakdown.","operationId":"get_commission_summary_api_v1_partner_commissions_summary_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"month","in":"query","required":true,"schema":{"type":"string","description":"Month to summarize (YYYY-MM)","title":"Month"},"description":"Month to summarize (YYYY-MM)"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerMonthlySummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/partner/dashboard":{"get":{"tags":["partner"],"summary":"Get Dashboard","description":"Dashboard aggregate stats.","operationId":"get_dashboard_api_v1_partner_dashboard_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerDashboardResponse"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/v1/admin/dashboard/partners/commissions/{commission_id}/status":{"patch":{"tags":["admin"],"summary":"Update Commission Status","description":"Mark a commission as approved, paid, or voided.","operationId":"update_commission_status_api_v1_admin_dashboard_partners_commissions__commission_id__status_patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"commission_id","in":"path","required":true,"schema":{"type":"string","title":"Commission Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminCommissionStatusUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Commission Status Api V1 Admin Dashboard Partners Commissions  Commission Id  Status Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/partners/":{"get":{"tags":["admin"],"summary":"List Partners","description":"List all partners with aggregated stats.","operationId":"list_partners_api_v1_admin_dashboard_partners__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"search","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Search"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":50,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPartnerListResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/partners/{partner_id}":{"get":{"tags":["admin"],"summary":"Get Partner","description":"Get partner detail.","operationId":"get_partner_api_v1_admin_dashboard_partners__partner_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Update Partner","description":"Update partner status or default commission rates.","operationId":"update_partner_api_v1_admin_dashboard_partners__partner_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminPartnerUpdateRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PartnerProfileResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/partners/{partner_id}/clients":{"get":{"tags":["admin"],"summary":"List Partner Clients","description":"List all clients attributed to a partner with subscription + commission data.","operationId":"list_partner_clients_api_v1_admin_dashboard_partners__partner_id__clients_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Partner Clients Api V1 Admin Dashboard Partners  Partner Id  Clients Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["admin"],"summary":"Attribute Client","description":"Manually attribute a tenant to a partner.","operationId":"attribute_client_api_v1_admin_dashboard_partners__partner_id__clients_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminAttributeClientRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Attribute Client Api V1 Admin Dashboard Partners  Partner Id  Clients Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/partners/{partner_id}/clients/{tenant_id}":{"delete":{"tags":["admin"],"summary":"Remove Attribution","description":"Remove client attribution from a partner.","operationId":"remove_attribution_api_v1_admin_dashboard_partners__partner_id__clients__tenant_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}},{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Remove Attribution Api V1 Admin Dashboard Partners  Partner Id  Clients  Tenant Id  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["admin"],"summary":"Override Client Commission","description":"Override commission rates for a specific partner-client pair.","operationId":"override_client_commission_api_v1_admin_dashboard_partners__partner_id__clients__tenant_id__patch","security":[{"HTTPBearer":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}},{"name":"tenant_id","in":"path","required":true,"schema":{"type":"string","title":"Tenant Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AdminClientCommissionOverrideRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Override Client Commission Api V1 Admin Dashboard Partners  Partner Id  Clients  Tenant Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/admin/dashboard/partners/{partner_id}/banking":{"get":{"tags":["admin"],"summary":"Get Banking","description":"View partner banking details (admin only, decrypted).","operationId":"get_banking_api_v1_admin_dashboard_partners__partner_id__banking_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"partner_id","in":"path","required":true,"schema":{"type":"string","title":"Partner Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Banking Api V1 Admin Dashboard Partners  Partner Id  Banking Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webchat/config/{widget_key}":{"get":{"tags":["webchat","webchat"],"summary":"Get Widget Config","description":"Get public widget configuration for embedding.\n\nCalled by the widget JS on page load to render the bubble\nwith correct branding. No session required.","operationId":"get_widget_config_api_v1_webchat_config__widget_key__get","parameters":[{"name":"widget_key","in":"path","required":true,"schema":{"type":"string","title":"Widget Key"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/app__api__webchat__WebchatConfigResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webchat/sessions":{"post":{"tags":["webchat","webchat"],"summary":"Create Webchat Session","description":"Initialize a new webchat session.\n\nCreates a customer (by email), conversation, and session record.\nReturns an HMAC-signed session token for WebSocket authentication.","operationId":"create_webchat_session_api_v1_webchat_sessions_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webchat/sessions/{session_id}/resume":{"post":{"tags":["webchat","webchat"],"summary":"Resume Webchat Session","description":"Resume an existing webchat session.\n\nValidates the session token and returns conversation history.\nUsed when the widget reloads (page refresh, return visit).","operationId":"resume_webchat_session_api_v1_webchat_sessions__session_id__resume_post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResumeSessionRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResumeSessionResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/webchat/sessions/{session_id}/voice-token":{"post":{"tags":["webchat","webchat"],"summary":"Create Webchat Voice Token","description":"Issue a LiveKit access token for a voice call from a webchat session.\n\nValidates the HMAC session token, then dispatches the ilna-voice-agent\ninto a freshly created LiveKit room scoped to the visitor's tenant.\nNo auth required beyond the session token — same trust level as the\nrest of the public webchat API.","operationId":"create_webchat_voice_token_api_v1_webchat_sessions__session_id__voice_token_post","parameters":[{"name":"session_id","in":"path","required":true,"schema":{"type":"string","title":"Session Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceTokenRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VoiceTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/debug/phone-pool-sync":{"get":{"tags":["debug"],"summary":"Get Phone Pool Sync Status","description":"Get the result of the startup phone pool sync. No auth required.","operationId":"get_phone_pool_sync_status_api_v1_debug_phone_pool_sync_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AcceptInviteRequest":{"properties":{"token":{"type":"string","minLength":1,"title":"Token"},"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name","description":"Display name for new users"},"password":{"anyOf":[{"type":"string","minLength":8},{"type":"null"}],"title":"Password","description":"Password for new users (required if no existing account)"}},"type":"object","required":["token"],"title":"AcceptInviteRequest","description":"Request to accept a team invite."},"AcceptInviteResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"membership_id":{"type":"string","title":"Membership Id"},"business_name":{"type":"string","title":"Business Name"}},"type":"object","required":["access_token","tenant_id","role","membership_id","business_name"],"title":"AcceptInviteResponse","description":"Response after accepting an invite."},"AcceptSuggestionsRequest":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/FaqSuggestion"},"type":"array","minItems":1,"title":"Suggestions"}},"type":"object","required":["suggestions"],"title":"AcceptSuggestionsRequest","description":"Accepted FAQ suggestions to create."},"AcceptSuggestionsResponse":{"properties":{"created":{"type":"integer","title":"Created"},"gaps_resolved":{"type":"integer","title":"Gaps Resolved"}},"type":"object","required":["created","gaps_resolved"],"title":"AcceptSuggestionsResponse","description":"Result of accepting FAQ suggestions."},"AcceptTermsRequest":{"properties":{"accept_terms":{"type":"boolean","title":"Accept Terms","description":"Must be true to accept"},"accept_privacy":{"type":"boolean","title":"Accept Privacy","description":"Must be true to accept"},"terms_version":{"type":"string","title":"Terms Version","description":"Version being accepted","default":"v1.0"}},"type":"object","required":["accept_terms","accept_privacy"],"title":"AcceptTermsRequest","description":"Request to accept terms."},"AcceptTermsResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"terms_version":{"type":"string","title":"Terms Version"},"accepted_at":{"type":"string","format":"date-time","title":"Accepted At"}},"type":"object","required":["success","terms_version","accepted_at"],"title":"AcceptTermsResponse","description":"Response after accepting terms."},"AccountDeletionRequest":{"properties":{"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","title":"AccountDeletionRequest","description":"Request to schedule account deletion."},"AccountDeletionResponse":{"properties":{"message":{"type":"string","title":"Message"},"deletion_scheduled_at":{"type":"string","title":"Deletion Scheduled At"},"grace_period_days":{"type":"integer","title":"Grace Period Days","default":30}},"type":"object","required":["message","deletion_scheduled_at"],"title":"AccountDeletionResponse","description":"Response after scheduling account deletion."},"ActionItemAssign":{"properties":{"user_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"User Id"}},"type":"object","title":"ActionItemAssign","description":"Request body for assigning an action item."},"ActionItemListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ActionItemOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"ActionItemListResponse","description":"Response model for listing action items."},"ActionItemOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"},"escalation_path_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalation Path Id"},"type":{"type":"string","title":"Type"},"priority":{"type":"string","title":"Priority"},"summary":{"type":"string","title":"Summary"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"},"status":{"type":"string","title":"Status"},"assigned_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assigned To"},"resolution_note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolution Note"},"resolved_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Resolved At"},"resolved_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolved By"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Phone"},"conversation_channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Channel"}},"type":"object","required":["id","tenant_id","customer_id","conversation_id","escalation_path_id","type","priority","summary","details","status","assigned_to","resolution_note","resolved_at","resolved_by","created_at","updated_at"],"title":"ActionItemOut","description":"Response model for a single action item."},"ActionItemStats":{"properties":{"open":{"type":"integer","title":"Open","default":0},"in_progress":{"type":"integer","title":"In Progress","default":0},"resolved":{"type":"integer","title":"Resolved","default":0},"dismissed":{"type":"integer","title":"Dismissed","default":0}},"type":"object","title":"ActionItemStats","description":"Counts by status for dashboard badges."},"ActionItemStatusUpdate":{"properties":{"status":{"type":"string","pattern":"^(open|in_progress|resolved|dismissed)$","title":"Status"},"resolution_note":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Resolution Note"}},"type":"object","required":["status"],"title":"ActionItemStatusUpdate","description":"Request body for updating action item status."},"ActivityLogEntry":{"properties":{"id":{"type":"string","title":"Id"},"event_type":{"type":"string","title":"Event Type"},"actor_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Email"},"actor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Name"},"target_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Email"},"target_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Name"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","event_type","created_at"],"title":"ActivityLogEntry","description":"A single team activity log entry."},"ActivityLogResponse":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/ActivityLogEntry"},"type":"array","title":"Entries"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["entries","total","limit","offset"],"title":"ActivityLogResponse","description":"Paginated team activity log."},"AddNoteRequest":{"properties":{"content":{"type":"string","maxLength":2000,"minLength":1,"title":"Content"}},"type":"object","required":["content"],"title":"AddNoteRequest","description":"Request payload for adding a manual note to a customer profile."},"AddNoteResponse":{"properties":{"id":{"type":"string","title":"Id"},"memory_type":{"type":"string","title":"Memory Type"},"content":{"type":"string","title":"Content"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","memory_type","content","created_at"],"title":"AddNoteResponse","description":"Response after successfully adding a customer note."},"AddRecipientsRequest":{"properties":{"recipients":{"items":{"$ref":"#/components/schemas/RecipientInput"},"type":"array","title":"Recipients"}},"type":"object","required":["recipients"],"title":"AddRecipientsRequest","description":"Request to add recipients to a campaign."},"AdminAttributeClientRequest":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"}},"type":"object","required":["tenant_id"],"title":"AdminAttributeClientRequest"},"AdminClientCommissionOverrideRequest":{"properties":{"commission_rate_override":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Commission Rate Override"},"ongoing_rate_override":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Ongoing Rate Override"},"commission_cycles_override":{"anyOf":[{"type":"integer","maximum":24.0,"minimum":1.0},{"type":"null"}],"title":"Commission Cycles Override"}},"type":"object","title":"AdminClientCommissionOverrideRequest"},"AdminCommissionStatusUpdateRequest":{"properties":{"status":{"type":"string","title":"Status","description":"approved, paid, or voided"}},"type":"object","required":["status"],"title":"AdminCommissionStatusUpdateRequest"},"AdminPartnerListItem":{"properties":{"id":{"type":"string","title":"Id"},"partner_code":{"type":"string","title":"Partner Code"},"name":{"type":"string","title":"Name"},"email":{"type":"string","title":"Email"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"status":{"type":"string","title":"Status"},"client_count":{"type":"integer","title":"Client Count"},"total_commission_cents":{"type":"integer","title":"Total Commission Cents"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","partner_code","name","email","company","status","client_count","total_commission_cents","created_at"],"title":"AdminPartnerListItem"},"AdminPartnerListResponse":{"properties":{"partners":{"items":{"$ref":"#/components/schemas/AdminPartnerListItem"},"type":"array","title":"Partners"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["partners","total"],"title":"AdminPartnerListResponse"},"AdminPartnerUpdateRequest":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"default_commission_rate":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Default Commission Rate"},"default_ongoing_rate":{"anyOf":[{"type":"integer","maximum":100.0,"minimum":0.0},{"type":"null"}],"title":"Default Ongoing Rate"},"default_commission_cycles":{"anyOf":[{"type":"integer","maximum":24.0,"minimum":1.0},{"type":"null"}],"title":"Default Commission Cycles"}},"type":"object","title":"AdminPartnerUpdateRequest"},"AdminStatsResponse":{"properties":{"total_tenants":{"type":"integer","title":"Total Tenants","default":0},"tenants_last_7_days":{"type":"integer","title":"Tenants Last 7 Days","default":0},"tenants_last_30_days":{"type":"integer","title":"Tenants Last 30 Days","default":0},"onboarding_active":{"type":"integer","title":"Onboarding Active","default":0},"onboarding_completed":{"type":"integer","title":"Onboarding Completed","default":0},"onboarding_by_step":{"additionalProperties":{"type":"integer"},"type":"object","title":"Onboarding By Step","default":{}},"subscription_by_plan":{"additionalProperties":{"type":"integer"},"type":"object","title":"Subscription By Plan","default":{}},"total_customers":{"type":"integer","title":"Total Customers","default":0},"total_bookings":{"type":"integer","title":"Total Bookings","default":0},"total_conversations":{"type":"integer","title":"Total Conversations","default":0},"total_revenue_cents":{"type":"integer","title":"Total Revenue Cents","default":0},"mrr_usd_cents":{"type":"integer","title":"Mrr Usd Cents","default":0},"total_llm_cost_cents":{"type":"number","title":"Total Llm Cost Cents","default":0.0},"total_voice_minutes":{"type":"integer","title":"Total Voice Minutes","default":0},"total_messages_today":{"type":"integer","title":"Total Messages Today","default":0},"active_conversations":{"type":"integer","title":"Active Conversations","default":0},"total_integrations_active":{"type":"integer","title":"Total Integrations Active","default":0}},"type":"object","title":"AdminStatsResponse"},"AdminTokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"email":{"type":"string","title":"Email"},"name":{"type":"string","title":"Name"},"picture":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Picture"}},"type":"object","required":["access_token","email","name"],"title":"AdminTokenResponse"},"AdvanceStepRequest":{"properties":{"current_step_id":{"type":"string","title":"Current Step Id"},"payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Payload"}},"type":"object","required":["current_step_id"],"title":"AdvanceStepRequest","description":"Request to mark a step as completed and advance onboarding."},"AgentConfigRequest":{"properties":{"agent_instructions":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Agent Instructions","description":"Custom instructions for the AI agent. Set to null to clear."},"personality":{"anyOf":[{"type":"string","pattern":"^(professional|friendly|warm|casual)$"},{"type":"null"}],"title":"Personality","description":"Personality tone for the AI agent."},"naturalness_level":{"anyOf":[{"$ref":"#/components/schemas/NaturalnessLevel"},{"type":"null"}],"description":"Voice naturalness level. Controls fillers and pauses in speech."},"streaming_latency":{"anyOf":[{"type":"integer","maximum":4.0,"minimum":0.0},{"type":"null"}],"title":"Streaming Latency","description":"TTS latency optimization (0=disabled, 1-4=increasingly aggressive)."},"speech_speed":{"anyOf":[{"type":"number","maximum":2.0,"minimum":0.5},{"type":"null"}],"title":"Speech Speed","description":"Speech rate multiplier (0.5=slow, 1.0=normal, 2.0=fast)"}},"type":"object","title":"AgentConfigRequest","description":"Request to update agent configuration."},"AgentConfigResponse":{"properties":{"agent_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Instructions","description":"Custom business-specific instructions injected into the AI system prompt."},"personality":{"type":"string","title":"Personality","description":"Personality tone: professional, friendly, warm, or casual.","default":"professional"},"naturalness_level":{"$ref":"#/components/schemas/NaturalnessLevel","description":"Voice naturalness: professional, natural (default), very_human","default":"natural"},"streaming_latency":{"type":"integer","maximum":4.0,"minimum":0.0,"title":"Streaming Latency","description":"TTS latency optimization (0=off, 1-4=aggressive)","default":2},"speech_speed":{"type":"number","maximum":2.0,"minimum":0.5,"title":"Speech Speed","description":"Speech rate multiplier (0.5=slow, 1.0=normal, 2.0=fast)","default":1.0}},"type":"object","title":"AgentConfigResponse","description":"Agent personality and custom instructions."},"AnalyticsResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"title":"Data"}},"type":"object","required":["data"],"title":"AnalyticsResponse","description":"Standard analytics response envelope."},"ApplyReorgRequest":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/ReorgSuggestion"},"type":"array","minItems":1,"title":"Suggestions"}},"type":"object","required":["suggestions"],"title":"ApplyReorgRequest","description":"Accepted suggestions to apply."},"ApplyReorgResponse":{"properties":{"status":{"type":"string","title":"Status"},"updated":{"type":"integer","title":"Updated"},"deactivated":{"type":"integer","title":"Deactivated"}},"type":"object","required":["status","updated","deactivated"],"title":"ApplyReorgResponse","description":"Result of applying reorganization suggestions."},"AppointmentResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"booking_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Id"},"integration_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Integration Id"},"external_event_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Event Id"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"title":{"type":"string","title":"Title"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"timezone":{"type":"string","title":"Timezone"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"sync_status":{"type":"string","title":"Sync Status"},"google_event_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Google Event Link"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","tenant_id","booking_id","integration_id","external_event_id","provider","title","description","start_time","end_time","timezone","location","sync_status","google_event_link","created_at","updated_at"],"title":"AppointmentResponse","description":"Appointment response model."},"AssignNumberRequest":{"properties":{"phone_id":{"type":"string","title":"Phone Id","description":"ID of the phone number to assign"}},"type":"object","required":["phone_id"],"title":"AssignNumberRequest","description":"Request to assign a phone number."},"AssignRequest":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant ID to assign the number to"},"configure_webhooks":{"type":"boolean","title":"Configure Webhooks","description":"Whether to configure provider webhooks after assignment","default":true}},"type":"object","required":["tenant_id"],"title":"AssignRequest","description":"Request to assign a number to a tenant."},"AssignResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"phone":{"$ref":"#/components/schemas/PhoneNumberResponse"}},"type":"object","required":["success","message","phone"],"title":"AssignResponse","description":"Response for assign operation."},"AssignedNumber":{"properties":{"e164":{"type":"string","title":"E164"},"friendly_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Friendly Name"},"capabilities":{"anyOf":[{"additionalProperties":{"type":"boolean"},"type":"object"},{"type":"null"}],"title":"Capabilities"},"country_code":{"type":"string","title":"Country Code"},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id"}},"type":"object","required":["e164","friendly_name","capabilities","country_code","area_code"],"title":"AssignedNumber","description":"A number currently assigned to the tenant."},"AttachmentInfo":{"properties":{"type":{"type":"string","title":"Type"},"mime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mime Type"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"}},"type":"object","required":["type"],"title":"AttachmentInfo","description":"Media attachment metadata for a message."},"AttachmentItem":{"properties":{"id":{"type":"string","title":"Id"},"filename":{"type":"string","title":"Filename"},"content_type":{"type":"string","title":"Content Type"},"file_size":{"type":"integer","title":"File Size"},"uploaded_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Uploaded By Name"},"download_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Download Url"},"created_at":{"type":"string","title":"Created At"},"document_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Type"},"booking_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Id"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"is_expired":{"type":"boolean","title":"Is Expired","default":false},"supersedes_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supersedes Id"},"archived_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Archived At"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["id","filename","content_type","file_size","created_at"],"title":"AttachmentItem","description":"A file attachment on a customer profile."},"AttachmentsResponse":{"properties":{"attachments":{"items":{"$ref":"#/components/schemas/AttachmentItem"},"type":"array","title":"Attachments"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["attachments","total"],"title":"AttachmentsResponse","description":"List of customer attachments."},"AudienceAddResponse":{"properties":{"matched":{"type":"integer","title":"Matched"},"added":{"type":"integer","title":"Added"},"skipped_existing":{"type":"integer","title":"Skipped Existing"}},"type":"object","required":["matched","added","skipped_existing"],"title":"AudienceAddResponse"},"AudiencePreviewResponse":{"properties":{"count":{"type":"integer","title":"Count"},"sample":{"items":{"$ref":"#/components/schemas/AudienceSample"},"type":"array","title":"Sample"}},"type":"object","required":["count","sample"],"title":"AudiencePreviewResponse"},"AudienceSample":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"primary_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Phone"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"}},"type":"object","required":["id"],"title":"AudienceSample"},"AuditLogResponse":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/app__api__admin__AuditLogEntry"},"type":"array","title":"Entries"},"total":{"type":"integer","title":"Total"},"offset":{"type":"integer","title":"Offset"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["entries","total","offset","limit"],"title":"AuditLogResponse"},"AuditLogsResponse":{"properties":{"logs":{"items":{"$ref":"#/components/schemas/app__schemas__compliance__AuditLogEntry"},"type":"array","title":"Logs"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["logs","total","limit","offset"],"title":"AuditLogsResponse","description":"Response model for audit logs."},"AvailabilityResponse":{"properties":{"slots":{"items":{"$ref":"#/components/schemas/TimeSlotResponse"},"type":"array","title":"Slots"},"total_slots":{"type":"integer","title":"Total Slots"},"date_range":{"additionalProperties":{"type":"string","format":"date-time"},"type":"object","title":"Date Range"},"duration_minutes":{"type":"integer","title":"Duration Minutes"}},"type":"object","required":["slots","total_slots","date_range","duration_minutes"],"title":"AvailabilityResponse","description":"Response model for availability check."},"AvailableNumberOut":{"properties":{"e164":{"type":"string","title":"E164"},"friendly_name":{"type":"string","title":"Friendly Name"},"country_code":{"type":"string","title":"Country Code"},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region"},"locality":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locality"},"voice":{"type":"boolean","title":"Voice"},"sms":{"type":"boolean","title":"Sms"},"monthly_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Cost Cents"}},"type":"object","required":["e164","friendly_name","country_code","area_code","region","locality","voice","sms","monthly_cost_cents"],"title":"AvailableNumberOut","description":"A number available to buy (from the provider search)."},"AvailableNumberResponse":{"properties":{"id":{"type":"string","title":"Id"},"e164":{"type":"string","title":"E164"},"friendly_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Friendly Name"},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"},"country_code":{"type":"string","title":"Country Code"},"provider":{"type":"string","title":"Provider"},"capabilities":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Capabilities"},"whatsapp_enabled":{"type":"boolean","title":"Whatsapp Enabled","default":false}},"type":"object","required":["id","e164","friendly_name","area_code","country_code","provider","capabilities"],"title":"AvailableNumberResponse","description":"Response for a single available phone number."},"AvailableNumbersResponse":{"properties":{"numbers":{"items":{"$ref":"#/components/schemas/AvailableNumberResponse"},"type":"array","title":"Numbers"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["numbers","count"],"title":"AvailableNumbersResponse","description":"Response for listing available numbers."},"BillingPortalResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"BillingPortalResponse","description":"Response with Stripe Billing Portal URL."},"BlackoutDate":{"properties":{"start":{"type":"string","title":"Start","description":"Start date (YYYY-MM-DD)"},"end":{"type":"string","title":"End","description":"End date (YYYY-MM-DD)"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["start","end"],"title":"BlackoutDate","description":"A date range when bookings are blocked."},"BodyPreviewRequest":{"properties":{"body":{"type":"string","maxLength":2000,"title":"Body"},"sample_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Sample Name"}},"type":"object","required":["body"],"title":"BodyPreviewRequest"},"BodyPreviewResponse":{"properties":{"rendered":{"type":"string","title":"Rendered"},"length":{"type":"integer","title":"Length"},"segments":{"type":"integer","title":"Segments"}},"type":"object","required":["rendered","length","segments"],"title":"BodyPreviewResponse"},"BodyVariantsRequest":{"properties":{"body":{"type":"string","maxLength":2000,"minLength":1,"title":"Body"},"count":{"type":"integer","maximum":5.0,"minimum":1.0,"title":"Count","default":3}},"type":"object","required":["body"],"title":"BodyVariantsRequest"},"BodyVariantsResponse":{"properties":{"variants":{"items":{"type":"string"},"type":"array","title":"Variants"}},"type":"object","required":["variants"],"title":"BodyVariantsResponse"},"Body_apply_patient_import_api_v1_portal_customers_import_apply_post":{"properties":{"confirm":{"type":"boolean","title":"Confirm","default":false},"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_apply_patient_import_api_v1_portal_customers_import_apply_post"},"Body_handle_document_upload_api_v1_tenants__tenant_id__onboarding_documents_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"document_type":{"type":"string","title":"Document Type"},"country_code":{"type":"string","title":"Country Code"}},"type":"object","required":["file","document_type","country_code"],"title":"Body_handle_document_upload_api_v1_tenants__tenant_id__onboarding_documents_post"},"Body_import_form_api_v1_portal_intake_forms_import_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_import_form_api_v1_portal_intake_forms_import_post"},"Body_preview_patient_import_api_v1_portal_customers_import_preview_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_preview_patient_import_api_v1_portal_customers_import_preview_post"},"Body_send_link_api_v1_portal_intake_forms__form_id__send_link_post":{"properties":{"customer_phone":{"type":"string","title":"Customer Phone"},"booking_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Id"},"deliver":{"type":"boolean","title":"Deliver","default":true},"channel":{"type":"string","title":"Channel","default":"sms"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"}},"type":"object","required":["customer_phone"],"title":"Body_send_link_api_v1_portal_intake_forms__form_id__send_link_post"},"Body_upload_csv_api_v1_portal_campaigns__campaign_id__recipients_csv_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_csv_api_v1_portal_campaigns__campaign_id__recipients_csv_post"},"Body_upload_customer_attachment_api_v1_portal_customers__customer_id__attachments_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"document_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Type"},"booking_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Id"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"supersedes_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Supersedes Id"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"}},"type":"object","required":["file"],"title":"Body_upload_customer_attachment_api_v1_portal_customers__customer_id__attachments_post"},"Body_upload_document_api_v1_knowledge_documents_upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"}},"type":"object","required":["file"],"title":"Body_upload_document_api_v1_knowledge_documents_upload_post"},"Body_upload_intake_file_api_v1_intake__token__upload_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"field_id":{"type":"string","title":"Field Id"}},"type":"object","required":["file","field_id"],"title":"Body_upload_intake_file_api_v1_intake__token__upload_post"},"Body_upload_media_asset_api_v1_portal_media_assets_post":{"properties":{"file":{"type":"string","contentMediaType":"application/octet-stream","title":"File"},"asset_name":{"type":"string","title":"Asset Name"},"display_name":{"type":"string","title":"Display Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["file","asset_name","display_name"],"title":"Body_upload_media_asset_api_v1_portal_media_assets_post"},"BookingResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"customer_name":{"type":"string","title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Phone"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"status":{"type":"string","title":"Status"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"timezone":{"type":"string","title":"Timezone"},"service_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Type"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"cancelled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Cancelled At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"has_calendar_event":{"type":"boolean","title":"Has Calendar Event","default":false},"team_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Member Id"},"team_member_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Member Name"},"feedback_sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feedback Sentiment"},"feedback_stars":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Feedback Stars"},"feedback_comment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Feedback Comment"},"feedback_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Feedback At"}},"type":"object","required":["id","tenant_id","customer_name","customer_email","customer_phone","status","start_time","end_time","timezone","service_type","conversation_id","notes","created_at","updated_at","cancelled_at","completed_at"],"title":"BookingResponse","description":"Booking response model."},"BookingSettingsResponse":{"properties":{"buffer_minutes":{"type":"integer","title":"Buffer Minutes","default":15},"default_slot_minutes":{"type":"integer","title":"Default Slot Minutes","default":15},"default_duration_minutes":{"type":"integer","title":"Default Duration Minutes","default":60},"blackout_dates":{"items":{"$ref":"#/components/schemas/BlackoutDate"},"type":"array","title":"Blackout Dates"},"services":{"items":{"$ref":"#/components/schemas/ServiceEntry"},"type":"array","title":"Services"},"reminders_enabled":{"type":"boolean","title":"Reminders Enabled","default":false},"reminder_hours_before":{"type":"integer","title":"Reminder Hours Before","default":24},"reminder_channels":{"items":{"type":"string"},"type":"array","title":"Reminder Channels"},"reminder_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reminder Message"},"reminder_template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reminder Template Name"},"require_email_for_booking":{"type":"boolean","title":"Require Email For Booking","default":false},"booking_enabled":{"type":"boolean","title":"Booking Enabled","default":true}},"type":"object","title":"BookingSettingsResponse","description":"Current booking configuration for the tenant."},"BookingSettingsUpdate":{"properties":{"buffer_minutes":{"anyOf":[{"type":"integer","maximum":120.0,"minimum":0.0},{"type":"null"}],"title":"Buffer Minutes"},"default_slot_minutes":{"anyOf":[{"type":"integer","maximum":120.0,"minimum":5.0},{"type":"null"}],"title":"Default Slot Minutes"},"default_duration_minutes":{"anyOf":[{"type":"integer","maximum":480.0,"minimum":15.0},{"type":"null"}],"title":"Default Duration Minutes"},"blackout_dates":{"anyOf":[{"items":{"$ref":"#/components/schemas/BlackoutDate"},"type":"array"},{"type":"null"}],"title":"Blackout Dates"},"reminders_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Reminders Enabled"},"reminder_hours_before":{"anyOf":[{"type":"integer","maximum":72.0,"minimum":1.0},{"type":"null"}],"title":"Reminder Hours Before"},"reminder_channels":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Reminder Channels"},"reminder_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reminder Message"},"reminder_template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reminder Template Name"},"require_email_for_booking":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Require Email For Booking"},"booking_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Booking Enabled"},"services":{"anyOf":[{"items":{"$ref":"#/components/schemas/ServiceEntry"},"type":"array"},{"type":"null"}],"title":"Services"}},"type":"object","title":"BookingSettingsUpdate","description":"Partial update for booking settings."},"BookingsAnalyticsResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"data":{"items":{"$ref":"#/components/schemas/BookingsDataPoint"},"type":"array","title":"Data"},"total_bookings":{"type":"integer","title":"Total Bookings"},"status_breakdown":{"additionalProperties":{"type":"integer"},"type":"object","title":"Status Breakdown"}},"type":"object","required":["period_days","data","total_bookings","status_breakdown"],"title":"BookingsAnalyticsResponse","description":"Bookings analytics response."},"BookingsDataPoint":{"properties":{"date":{"type":"string","title":"Date","description":"Date in YYYY-MM-DD format"},"total":{"type":"integer","title":"Total","default":0},"confirmed":{"type":"integer","title":"Confirmed","default":0},"completed":{"type":"integer","title":"Completed","default":0},"cancelled":{"type":"integer","title":"Cancelled","default":0},"pending":{"type":"integer","title":"Pending","default":0}},"type":"object","required":["date"],"title":"BookingsDataPoint","description":"Single data point for bookings time series."},"BookingsListResponse":{"properties":{"bookings":{"items":{"$ref":"#/components/schemas/BookingResponse"},"type":"array","title":"Bookings"},"total":{"type":"integer","title":"Total"},"upcoming_count":{"type":"integer","title":"Upcoming Count"},"today_count":{"type":"integer","title":"Today Count"}},"type":"object","required":["bookings","total","upcoming_count","today_count"],"title":"BookingsListResponse","description":"Response model for bookings list."},"BulkServiceCreateRequest":{"properties":{"services":{"items":{"$ref":"#/components/schemas/ServiceCreateRequest"},"type":"array","maxItems":50,"minItems":1,"title":"Services"}},"type":"object","required":["services"],"title":"BulkServiceCreateRequest","description":"Bulk-create payload — the admin's chosen subset from the extraction draft."},"BulkServiceCreateResponse":{"properties":{"results":{"items":{"$ref":"#/components/schemas/BulkServiceItemResult"},"type":"array","title":"Results"},"created_count":{"type":"integer","title":"Created Count"},"skipped_count":{"type":"integer","title":"Skipped Count"},"error_count":{"type":"integer","title":"Error Count"}},"type":"object","required":["results","created_count","skipped_count","error_count"],"title":"BulkServiceCreateResponse","description":"Response from POST /portal/services/bulk."},"BulkServiceItemResult":{"properties":{"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"service":{"anyOf":[{"$ref":"#/components/schemas/ServiceResponse"},{"type":"null"}]},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["name","status"],"title":"BulkServiceItemResult","description":"Per-item outcome of a bulk-create call."},"BusinessHoursResponse":{"properties":{"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"monday":{"$ref":"#/components/schemas/DayHours"},"tuesday":{"$ref":"#/components/schemas/DayHours"},"wednesday":{"$ref":"#/components/schemas/DayHours"},"thursday":{"$ref":"#/components/schemas/DayHours"},"friday":{"$ref":"#/components/schemas/DayHours"},"saturday":{"$ref":"#/components/schemas/DayHours"},"sunday":{"$ref":"#/components/schemas/DayHours"}},"type":"object","title":"BusinessHoursResponse","description":"Current business hours for the tenant."},"BusinessHoursUpdate":{"properties":{"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"monday":{"anyOf":[{"$ref":"#/components/schemas/DayHours"},{"type":"null"}]},"tuesday":{"anyOf":[{"$ref":"#/components/schemas/DayHours"},{"type":"null"}]},"wednesday":{"anyOf":[{"$ref":"#/components/schemas/DayHours"},{"type":"null"}]},"thursday":{"anyOf":[{"$ref":"#/components/schemas/DayHours"},{"type":"null"}]},"friday":{"anyOf":[{"$ref":"#/components/schemas/DayHours"},{"type":"null"}]},"saturday":{"anyOf":[{"$ref":"#/components/schemas/DayHours"},{"type":"null"}]},"sunday":{"anyOf":[{"$ref":"#/components/schemas/DayHours"},{"type":"null"}]}},"type":"object","title":"BusinessHoursUpdate","description":"Partial update for business hours. Only provided fields are updated."},"BusinessInfoUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"business_type":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Business Type"},"timezone":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Timezone"},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"website":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Website"},"services":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Services"},"contact":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Contact"},"location":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Location"}},"type":"object","title":"BusinessInfoUpdate","description":"Validated schema for business info updates."},"CalendarNudgeResponse":{"properties":{"should_nudge":{"type":"boolean","title":"Should Nudge"},"has_calendar":{"type":"boolean","title":"Has Calendar"},"has_bookings":{"type":"boolean","title":"Has Bookings"},"booking_count":{"type":"integer","title":"Booking Count","default":0},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["should_nudge","has_calendar","has_bookings"],"title":"CalendarNudgeResponse","description":"Whether to prompt the tenant to connect a calendar (ILN-636).\n\nTrue `should_nudge` means the tenant has bookings but no connected calendar,\nso their bookings aren't appearing on any calendar. The portal renders a\nconnect-your-calendar banner off this."},"CallMeWidgetConfig":{"properties":{"buttonText":{"type":"string","title":"Buttontext","description":"Widget button text","default":"Talk to AI Agent"},"buttonColor":{"type":"string","title":"Buttoncolor","description":"Button color (hex)","default":"#6366f1"},"position":{"type":"string","title":"Position","description":"bottom-right | bottom-left","default":"bottom-right"},"phoneLabel":{"type":"string","title":"Phonelabel","description":"Phone input label","default":"Enter your phone number"}},"type":"object","title":"CallMeWidgetConfig","description":"Call Me Widget configuration (ILN-423)."},"CampaignAddonDetails":{"properties":{"tier":{"type":"string","title":"Tier"},"patient_cap":{"type":"integer","title":"Patient Cap"},"monthly_price":{"type":"integer","title":"Monthly Price"},"monthly_price_minor":{"type":"integer","title":"Monthly Price Minor"},"currency":{"type":"string","title":"Currency","default":"usd"}},"type":"object","required":["tier","patient_cap","monthly_price","monthly_price_minor"],"title":"CampaignAddonDetails","description":"One tier of the SMS campaigns add-on, as signup and billing offer it."},"CampaignDetail":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"campaign_type":{"type":"string","title":"Campaign Type"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"whatsapp_template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Whatsapp Template Name"},"whatsapp_template_params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Whatsapp Template Params"},"message_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Body"},"voice_script":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Script"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"scheduled_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scheduled At"},"completed_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Completed At"},"voice_followup_delay_hours":{"type":"integer","title":"Voice Followup Delay Hours","default":48},"send_rate_per_minute":{"type":"integer","title":"Send Rate Per Minute","default":30},"total_recipients":{"type":"integer","title":"Total Recipients","default":0},"sent_count":{"type":"integer","title":"Sent Count","default":0},"delivered_count":{"type":"integer","title":"Delivered Count","default":0},"read_count":{"type":"integer","title":"Read Count","default":0},"responded_count":{"type":"integer","title":"Responded Count","default":0},"converted_count":{"type":"integer","title":"Converted Count","default":0},"failed_count":{"type":"integer","title":"Failed Count","default":0},"opted_out_count":{"type":"integer","title":"Opted Out Count","default":0},"segment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Segment Id"},"segment_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Segment Name"},"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","campaign_type","channel","status","created_at","updated_at"],"title":"CampaignDetail","description":"Full campaign detail including message content and stats."},"CampaignFunnelResponse":{"properties":{"campaign_id":{"type":"string","title":"Campaign Id"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"total_recipients":{"type":"integer","title":"Total Recipients"},"pending":{"type":"integer","title":"Pending"},"failed":{"type":"integer","title":"Failed"},"opted_out":{"type":"integer","title":"Opted Out"},"stages":{"items":{"$ref":"#/components/schemas/FunnelStageResponse"},"type":"array","title":"Stages"},"bookings":{"items":{"$ref":"#/components/schemas/FunnelBookingResponse"},"type":"array","title":"Bookings"},"voice":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Voice"},"reply_outcomes":{"additionalProperties":{"type":"integer"},"type":"object","title":"Reply Outcomes"},"deferral":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Deferral"},"launch_block":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Launch Block"},"counter_drift":{"additionalProperties":{"additionalProperties":{"type":"integer"},"type":"object"},"type":"object","title":"Counter Drift"}},"type":"object","required":["campaign_id","channel","status","total_recipients","pending","failed","opted_out","stages","bookings"],"title":"CampaignFunnelResponse"},"CampaignLibraryResponse":{"properties":{"templates":{"items":{"$ref":"#/components/schemas/CampaignTemplateResponse"},"type":"array","title":"Templates"},"placeholders":{"additionalProperties":{"type":"string"},"type":"object","title":"Placeholders"}},"type":"object","required":["templates"],"title":"CampaignLibraryResponse"},"CampaignListItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"campaign_type":{"type":"string","title":"Campaign Type"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"message_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Body"},"total_recipients":{"type":"integer","title":"Total Recipients","default":0},"sent_count":{"type":"integer","title":"Sent Count","default":0},"delivered_count":{"type":"integer","title":"Delivered Count","default":0},"read_count":{"type":"integer","title":"Read Count","default":0},"responded_count":{"type":"integer","title":"Responded Count","default":0},"failed_count":{"type":"integer","title":"Failed Count","default":0},"opted_out_count":{"type":"integer","title":"Opted Out Count","default":0},"scheduled_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Scheduled At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","campaign_type","channel","status","created_at"],"title":"CampaignListItem"},"CampaignStatsResponse":{"properties":{"total_campaigns":{"type":"integer","title":"Total Campaigns","default":0},"active_campaigns":{"type":"integer","title":"Active Campaigns","default":0},"total_recipients":{"type":"integer","title":"Total Recipients","default":0},"total_sent":{"type":"integer","title":"Total Sent","default":0},"total_delivered":{"type":"integer","title":"Total Delivered","default":0},"total_responded":{"type":"integer","title":"Total Responded","default":0},"total_converted":{"type":"integer","title":"Total Converted","default":0},"delivery_rate":{"type":"number","title":"Delivery Rate","default":0.0},"response_rate":{"type":"number","title":"Response Rate","default":0.0},"conversion_rate":{"type":"number","title":"Conversion Rate","default":0.0}},"type":"object","title":"CampaignStatsResponse","description":"Aggregated campaign statistics."},"CampaignSummary":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"campaign_type":{"type":"string","title":"Campaign Type"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"scheduled_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scheduled At"},"total_recipients":{"type":"integer","title":"Total Recipients","default":0},"sent_count":{"type":"integer","title":"Sent Count","default":0},"delivered_count":{"type":"integer","title":"Delivered Count","default":0},"responded_count":{"type":"integer","title":"Responded Count","default":0},"converted_count":{"type":"integer","title":"Converted Count","default":0},"failed_count":{"type":"integer","title":"Failed Count","default":0},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","name","campaign_type","channel","status","created_at","updated_at"],"title":"CampaignSummary","description":"Campaign summary for list views."},"CampaignTemplateResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"description":{"type":"string","title":"Description"},"campaign_type":{"type":"string","title":"Campaign Type"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"body":{"type":"string","title":"Body"},"body_length":{"type":"integer","title":"Body Length"},"notes":{"items":{"type":"string"},"type":"array","title":"Notes"},"version":{"type":"integer","title":"Version","default":1},"suggested_filter":{"additionalProperties":true,"type":"object","title":"Suggested Filter"},"suggested_segment_name":{"type":"string","title":"Suggested Segment Name"},"estimated_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimated Count"}},"type":"object","required":["id","name","category","description","campaign_type","body","body_length","suggested_segment_name"],"title":"CampaignTemplateResponse"},"CampaignUsageResponse":{"properties":{"period":{"type":"string","title":"Period"},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier"},"cap":{"type":"integer","title":"Cap"},"used":{"type":"integer","title":"Used"},"remaining":{"type":"integer","title":"Remaining"}},"type":"object","required":["period","tier","cap","used","remaining"],"title":"CampaignUsageResponse","description":"This month's SMS campaigns add-on usage (distinct patients added)."},"CancelDeletionResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"CancelDeletionResponse","description":"Response after cancelling a pending deletion."},"CancelSubscriptionRequest":{"properties":{"immediately":{"type":"boolean","title":"Immediately","description":"Cancel now rather than at period end. Defaults False because the customer has already paid for the current period; ending it on the spot removes service they are owed.","default":false}},"type":"object","title":"CancelSubscriptionRequest","description":"Request body for cancelling a subscription."},"CaptureConsentRequest":{"properties":{"customer_phone":{"type":"string","title":"Customer Phone","description":"Customer phone number (E.164 format)"},"consent_type":{"type":"string","title":"Consent Type","description":"Type of consent"},"consent_method":{"type":"string","title":"Consent Method","description":"How consent was captured"},"jurisdiction":{"type":"string","title":"Jurisdiction","description":"Legal jurisdiction (US, EU, CA)","default":"US"},"language":{"type":"string","title":"Language","description":"ISO 639-1 language code","default":"en"},"consent_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Consent Text","description":"Custom consent text (generated if not provided)"},"recording_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recording Url","description":"URL to verbal consent recording"}},"type":"object","required":["customer_phone","consent_type","consent_method"],"title":"CaptureConsentRequest","description":"Request model for capturing consent."},"CaptureConsentResponse":{"properties":{"id":{"type":"string","title":"Id"},"consent_type":{"type":"string","title":"Consent Type"},"consent_given":{"type":"boolean","title":"Consent Given"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["id","consent_type","consent_given","created_at"],"title":"CaptureConsentResponse","description":"Response model for captured consent."},"CategoryBreakdown":{"properties":{"category":{"type":"string","title":"Category"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"}},"type":"object","required":["category","total_cost_cents"],"title":"CategoryBreakdown"},"ChangePasswordRequest":{"properties":{"current_password":{"type":"string","minLength":1,"title":"Current Password","description":"Current password for verification"},"new_password":{"type":"string","minLength":8,"title":"New Password","description":"New password (minimum 8 characters)"}},"type":"object","required":["current_password","new_password"],"title":"ChangePasswordRequest","description":"Request model for changing password while authenticated."},"ChangePasswordResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"membership_id":{"type":"string","title":"Membership Id"},"message":{"type":"string","title":"Message"}},"type":"object","required":["access_token","tenant_id","role","membership_id","message"],"title":"ChangePasswordResponse","description":"Response model for password change that keeps the current session alive."},"ChangeSubscriptionRequest":{"properties":{"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan","description":"Target plan ID; omit to keep the current."},"locations":{"anyOf":[{"type":"integer","maximum":99.0,"minimum":1.0},{"type":"null"}],"title":"Locations","description":"Target TOTAL locations; omit to keep the current count."},"campaign_tier":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Campaign Tier","description":"SMS campaigns add-on tier (campaigns_100 … campaigns_1000); \"\" removes it; omit to keep it."}},"type":"object","title":"ChangeSubscriptionRequest","description":"Request body for changing plan and/or location count (ILN-766)."},"ChangeSubscriptionResponse":{"properties":{"plan_id":{"type":"string","title":"Plan Id"},"location_count":{"type":"integer","title":"Location Count"},"campaign_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Tier"},"currency":{"type":"string","title":"Currency"},"monthly_total_minor":{"type":"integer","title":"Monthly Total Minor"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"prorated":{"type":"boolean","title":"Prorated","default":false}},"type":"object","required":["plan_id","location_count","currency","monthly_total_minor"],"title":"ChangeSubscriptionResponse","description":"What the subscription bills after a plan/location change."},"ChangeUnverifiedEmailRequest":{"properties":{"new_email":{"type":"string","format":"email","title":"New Email"}},"type":"object","required":["new_email"],"title":"ChangeUnverifiedEmailRequest","description":"Request model for changing email before verification."},"ChannelAvailability":{"properties":{"available":{"type":"boolean","title":"Available"},"code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["available"],"title":"ChannelAvailability","description":"Whether one channel can be launched on, and why not (ILN-823)."},"ChannelAvailabilityResponse":{"properties":{"sms":{"$ref":"#/components/schemas/ChannelAvailability"},"whatsapp":{"$ref":"#/components/schemas/ChannelAvailability"},"voice":{"$ref":"#/components/schemas/ChannelAvailability"}},"type":"object","required":["sms","whatsapp","voice"],"title":"ChannelAvailabilityResponse","description":"What the channel picker reads before offering voice."},"ChannelSwitchesRequest":{"properties":{"whatsapp_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Whatsapp Enabled"},"instagram_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Instagram Enabled"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["reason"],"title":"ChannelSwitchesRequest"},"ChannelSwitchesResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"whatsapp_enabled":{"type":"boolean","title":"Whatsapp Enabled"},"instagram_enabled":{"type":"boolean","title":"Instagram Enabled"}},"type":"object","required":["tenant_id","tenant_name","whatsapp_enabled","instagram_enabled"],"title":"ChannelSwitchesResponse"},"ChannelsStatusResponse":{"properties":{"phone":{"anyOf":[{"$ref":"#/components/schemas/PhoneNumberInfo"},{"type":"null"}]},"voice":{"$ref":"#/components/schemas/VoiceChannelStatus"},"sms":{"$ref":"#/components/schemas/SmsChannelStatus"},"whatsapp":{"$ref":"#/components/schemas/WhatsAppChannelStatus"}},"type":"object","required":["voice","sms","whatsapp"],"title":"ChannelsStatusResponse","description":"Unified status of all communication channels."},"ChatRequest":{"properties":{"query":{"type":"string","title":"Query"},"context_limit":{"type":"integer","title":"Context Limit","default":2000},"is_first_message":{"type":"boolean","title":"Is First Message","default":true}},"type":"object","required":["query"],"title":"ChatRequest","description":"Request model for RAG chat endpoint."},"ChatResponse":{"properties":{"query":{"type":"string","title":"Query"},"context":{"type":"string","title":"Context"},"sources":{"items":{"$ref":"#/components/schemas/SourceInfo"},"type":"array","title":"Sources"},"response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response"},"voice_response":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Response"}},"type":"object","required":["query","context","sources","response"],"title":"ChatResponse","description":"Response model for RAG chat endpoint."},"ChatbotMediaAttachment":{"properties":{"media_url":{"type":"string","title":"Media Url"},"media_type":{"type":"string","title":"Media Type"},"display_name":{"type":"string","title":"Display Name"},"mime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mime Type"}},"type":"object","required":["media_url","media_type","display_name"],"title":"ChatbotMediaAttachment","description":"Media file attached to a chatbot response."},"ChatbotTestRequest":{"properties":{"question":{"type":"string","maxLength":2000,"minLength":0,"title":"Question","description":"Question to ask the chatbot"},"mode":{"type":"string","enum":["text","voice"],"title":"Mode","description":"Response mode: text only or with voice","default":"text"},"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice","description":"Voice personality (for voice mode). None = use tenant's configured voice."},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id","description":"Optional conversation ID for multi-turn context (None for single question)"},"enable_tools":{"type":"boolean","title":"Enable Tools","description":"Enable AI tool execution (bookings, payments, etc.)","default":false},"override_instructions":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Override Instructions","description":"Draft custom instructions to preview (ILN-450). Bypasses saved instructions."},"override_personality":{"anyOf":[{"type":"string","pattern":"^(professional|friendly|warm|casual)$"},{"type":"null"}],"title":"Override Personality","description":"Draft personality to preview (ILN-450)."}},"type":"object","required":["question"],"title":"ChatbotTestRequest","description":"Request model for chatbot testing."},"ChatbotTestResponse":{"properties":{"question":{"type":"string","title":"Question"},"answer":{"type":"string","title":"Answer"},"conversation_id":{"type":"string","title":"Conversation Id"},"audio_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio Base64","description":"Base64-encoded MP3 audio (voice mode only)"},"audio_content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Audio Content Type","description":"Audio content type (audio/mpeg)"},"voice_used":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Used","description":"Voice personality used"},"sources":{"items":{"$ref":"#/components/schemas/ChatbotTestSource"},"type":"array","title":"Sources","description":"RAG sources for context"},"tokens_used":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Tokens Used","description":"Tokens used for LLM response"},"media_attachments":{"items":{"$ref":"#/components/schemas/ChatbotMediaAttachment"},"type":"array","title":"Media Attachments","description":"Media files to send alongside the text response"}},"type":"object","required":["question","answer","conversation_id"],"title":"ChatbotTestResponse","description":"Response model for chatbot testing."},"ChatbotTestSource":{"properties":{"title":{"type":"string","title":"Title","default":"Unknown"},"url":{"type":"string","title":"Url","default":""},"similarity":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Similarity"}},"type":"object","title":"ChatbotTestSource","description":"Normalized source shape for chatbot test responses."},"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","description":"Checkout session response."},"CheckoutResponseEnvelope":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"$ref":"#/components/schemas/CheckoutResponse"}},"type":"object","required":["data"],"title":"CheckoutResponseEnvelope","description":"Checkout response envelope."},"CheckoutSessionRequest":{"properties":{"plan":{"type":"string","title":"Plan"},"interval":{"type":"string","title":"Interval"},"locations":{"anyOf":[{"type":"integer","maximum":99.0,"minimum":1.0},{"type":"null"}],"title":"Locations"},"campaign_tier":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Campaign Tier"}},"type":"object","required":["plan","interval"],"title":"CheckoutSessionRequest","description":"Request body for creating a Stripe Checkout session."},"CheckoutSessionResponse":{"properties":{"checkout_url":{"type":"string","title":"Checkout Url"},"session_id":{"type":"string","title":"Session Id"}},"type":"object","required":["checkout_url","session_id"],"title":"CheckoutSessionResponse","description":"Response with Stripe Checkout session URL."},"ComplianceAction":{"type":"string","enum":["consent_given","consent_withdrawn","data_accessed","data_exported","data_deleted","data_deletion_scheduled","recording_accessed","terms_accepted","retention_policy_updated","retention_dry_run","data_deletion_requested"],"title":"ComplianceAction","description":"Actions tracked in compliance audit logs."},"ComponentStatus":{"properties":{"name":{"type":"string","title":"Name"},"status":{"type":"string","enum":["operational","degraded","outage"],"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":"ComponentStatus","description":"Status of an individual system component."},"ConfigureVoiceRequest":{"properties":{"phone_id":{"type":"string","title":"Phone Id","description":"ID of the selected phone number"},"voice_id":{"type":"string","title":"Voice Id","description":"Voice ID"},"voice_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Name","description":"Display name for the voice"}},"type":"object","required":["phone_id","voice_id"],"title":"ConfigureVoiceRequest","description":"Request to configure voice (number + voice) during onboarding."},"ConfigureWebhooksResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"ConfigureWebhooksResponse","description":"Response for webhook configuration."},"ConfirmOwnershipTransferRequest":{"properties":{"token":{"type":"string","minLength":1,"title":"Token"}},"type":"object","required":["token"],"title":"ConfirmOwnershipTransferRequest","description":"Request to confirm an ownership transfer via email token."},"ConnectAccountStatus":{"properties":{"account_id":{"type":"string","title":"Account Id"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"payments_enabled":{"type":"boolean","title":"Payments Enabled","default":false},"transfers_enabled":{"type":"boolean","title":"Transfers Enabled","default":false},"charges_enabled":{"type":"boolean","title":"Charges Enabled","default":false},"payouts_enabled":{"type":"boolean","title":"Payouts Enabled","default":false},"details_submitted":{"type":"boolean","title":"Details Submitted","default":false},"requirements_due":{"items":{"type":"string"},"type":"array","title":"Requirements Due","default":[]},"eventually_due":{"items":{"type":"string"},"type":"array","title":"Eventually Due","default":[]},"ready_to_receive_payments":{"type":"boolean","title":"Ready To Receive Payments","default":false}},"type":"object","required":["account_id"],"title":"ConnectAccountStatus","description":"Stripe Connect account status."},"ConnectConfigResponse":{"properties":{"platform_region":{"type":"string","title":"Platform Region"},"supported_countries":{"items":{"type":"string"},"type":"array","title":"Supported Countries"},"charge_types":{"items":{"type":"string"},"type":"array","title":"Charge Types"},"is_cross_border_enabled":{"type":"boolean","title":"Is Cross Border Enabled"}},"type":"object","required":["platform_region","supported_countries","charge_types","is_cross_border_enabled"],"title":"ConnectConfigResponse","description":"Platform's Stripe Connect configuration."},"ConnectResultResponse":{"properties":{"integration_id":{"type":"string","title":"Integration Id"},"provider":{"type":"string","title":"Provider"},"status":{"type":"string","title":"Status"}},"type":"object","required":["integration_id","provider","status"],"title":"ConnectResultResponse","description":"Generic connect result."},"ConsentRequest":{"properties":{"granted":{"type":"boolean","title":"Granted"},"source":{"type":"string","maxLength":64,"title":"Source","default":"staff"}},"type":"object","required":["granted"],"title":"ConsentRequest","description":"Record a patient's answer about one contact channel (ILN-823)."},"ConsentStatusResponse":{"properties":{"has_valid_consent":{"type":"boolean","title":"Has Valid Consent"},"consent_type":{"type":"string","title":"Consent Type"},"consent_given_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Consent Given At"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"jurisdiction":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Jurisdiction"}},"type":"object","required":["has_valid_consent","consent_type"],"title":"ConsentStatusResponse","description":"Response model for consent status check."},"ConsentTextRequest":{"properties":{"consent_type":{"type":"string","title":"Consent Type"},"jurisdiction":{"type":"string","title":"Jurisdiction","default":"US"},"language":{"type":"string","title":"Language","default":"en"}},"type":"object","required":["consent_type"],"title":"ConsentTextRequest","description":"Request model for generating consent text."},"ConsentTextResponse":{"properties":{"consent_text":{"type":"string","title":"Consent Text"},"consent_type":{"type":"string","title":"Consent Type"},"jurisdiction":{"type":"string","title":"Jurisdiction"},"language":{"type":"string","title":"Language"}},"type":"object","required":["consent_text","consent_type","jurisdiction","language"],"title":"ConsentTextResponse","description":"Response model for generated consent text."},"ConsentType":{"type":"string","enum":["voice_recording","data_processing","marketing","terms_of_service","privacy_policy"],"title":"ConsentType","description":"Types of consent that can be captured."},"ContentValidationRequest":{"properties":{"text":{"type":"string","maxLength":5000,"minLength":1,"title":"Text"}},"type":"object","required":["text"],"title":"ContentValidationRequest","description":"Request to validate content without TTS."},"ContentValidationResponse":{"properties":{"is_valid":{"type":"boolean","title":"Is Valid"},"violations":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Violations"},"content_summary":{"additionalProperties":true,"type":"object","title":"Content Summary"}},"type":"object","required":["is_valid","violations","content_summary"],"title":"ContentValidationResponse","description":"Content validation result."},"ContextSummaryResponse":{"properties":{"id":{"type":"string","title":"Id"},"summary":{"type":"string","title":"Summary"},"conversation_count":{"type":"integer","title":"Conversation Count"},"key_topics":{"items":{"type":"string"},"type":"array","title":"Key Topics"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"action_items":{"items":{"type":"string"},"type":"array","title":"Action Items"},"last_interaction_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Interaction At"},"generated_at":{"type":"string","title":"Generated At"}},"type":"object","required":["id","summary","conversation_count","key_topics","action_items","generated_at"],"title":"ContextSummaryResponse","description":"AI-generated customer context summary."},"ConversationDetail":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"channel":{"type":"string","title":"Channel"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"status":{"type":"string","title":"Status"},"external_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Id"},"escalated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Escalated At"},"escalated_to":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalated To"},"escalation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalation Reason"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"messages":{"items":{"$ref":"#/components/schemas/app__api__portal__MessageItem"},"type":"array","title":"Messages"},"message_count":{"type":"integer","title":"Message Count"},"has_recording":{"type":"boolean","title":"Has Recording"},"recording_duration":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Recording Duration"},"insight":{"anyOf":[{"$ref":"#/components/schemas/ConversationInsight"},{"type":"null"}]}},"type":"object","required":["id","tenant_id","channel","phone_number","status","external_id","escalated_at","escalated_to","escalation_reason","created_at","updated_at","messages","message_count","has_recording","recording_duration"],"title":"ConversationDetail","description":"Detailed conversation with messages."},"ConversationDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"escalated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Escalated At"},"escalation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalation Reason"},"summary":{"anyOf":[{"$ref":"#/components/schemas/ConversationSummaryItem"},{"type":"null"}]},"messages":{"items":{"$ref":"#/components/schemas/app__api__admin_tenant_data__MessageItem"},"type":"array","title":"Messages"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","channel","status","messages","created_at","updated_at"],"title":"ConversationDetailResponse"},"ConversationInsight":{"properties":{"summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Summary"},"themes":{"items":{"type":"string"},"type":"array","title":"Themes"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"primary_intent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Intent"},"resolution_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolution Status"},"satisfaction_score":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Satisfaction Score"},"needs_human_followup":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Needs Human Followup"},"generated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Generated At"}},"type":"object","title":"ConversationInsight","description":"AI-generated insight for a conversation (from the ConversationSummary table).\n\nSurfaces the insight pipeline that already runs post-conversation\n(Telnyx AI Insights / LLM extraction) but was never exposed to the portal."},"ConversationItem":{"properties":{"id":{"type":"string","title":"Id"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","channel","status","created_at","updated_at"],"title":"ConversationItem","description":"Summary of a customer conversation (voice, SMS, WhatsApp)."},"ConversationListItem":{"properties":{"id":{"type":"string","title":"Id"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"message_count":{"type":"integer","title":"Message Count","default":0},"last_message_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Message At"},"last_message_preview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Message Preview"},"escalated":{"type":"boolean","title":"Escalated","default":false},"escalation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalation Reason"},"ai_handled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ai Handled"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","channel","status","created_at"],"title":"ConversationListItem"},"ConversationListResponse":{"properties":{"conversations":{"items":{"$ref":"#/components/schemas/ConversationListItem"},"type":"array","title":"Conversations"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["conversations","total"],"title":"ConversationListResponse"},"ConversationSummary":{"properties":{"id":{"type":"string","title":"Id"},"channel":{"type":"string","title":"Channel"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"customer_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Name"},"status":{"type":"string","title":"Status"},"message_count":{"type":"integer","title":"Message Count"},"last_message_preview":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Message Preview"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"escalated_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Escalated At"},"escalation_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalation Reason"},"themes":{"items":{"type":"string"},"type":"array","title":"Themes"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"}},"type":"object","required":["id","channel","status","message_count","created_at","updated_at"],"title":"ConversationSummary","description":"Summary of a single conversation for dashboard display."},"ConversationSummaryItem":{"properties":{"summary":{"type":"string","title":"Summary"},"key_topics":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Key Topics"},"sentiment":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sentiment"},"resolution_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resolution Status"},"primary_intent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Intent"},"ai_handled_successfully":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Ai Handled Successfully"},"needs_human_followup":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Needs Human Followup"}},"type":"object","required":["summary"],"title":"ConversationSummaryItem"},"CostSummaryResponse":{"properties":{"start_date":{"type":"string","format":"date","title":"Start Date"},"end_date":{"type":"string","format":"date","title":"End Date"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"},"total_commission_cents":{"type":"integer","title":"Total Commission Cents"},"tenant_count":{"type":"integer","title":"Tenant Count"},"tenants":{"items":{"$ref":"#/components/schemas/TenantCostRow"},"type":"array","title":"Tenants"}},"type":"object","required":["start_date","end_date","total_cost_cents","total_commission_cents","tenant_count","tenants"],"title":"CostSummaryResponse"},"CreateBookingRequest":{"properties":{"customer_name":{"type":"string","maxLength":255,"minLength":1,"title":"Customer Name"},"customer_email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Customer Email"},"customer_phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Customer Phone"},"start_time":{"type":"string","format":"date-time","title":"Start Time"},"end_time":{"type":"string","format":"date-time","title":"End Time"},"timezone":{"type":"string","maxLength":50,"title":"Timezone","default":"UTC"},"service_type":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Service Type"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"},"team_member_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Team Member Id"}},"type":"object","required":["customer_name","start_time","end_time"],"title":"CreateBookingRequest","description":"Request to create a new booking."},"CreateCampaignRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"campaign_type":{"type":"string","pattern":"^(promotion|re_engagement|event_invite|follow_up)$","title":"Campaign Type","default":"promotion"},"channel":{"type":"string","pattern":"^(whatsapp|sms|voice|multi_touch)$","title":"Channel","default":"sms"},"whatsapp_template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Whatsapp Template Name"},"whatsapp_template_params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Whatsapp Template Params"},"message_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Body"},"voice_script":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Script"},"goal":{"anyOf":[{"type":"string","pattern":"^(schedule_meeting|visit_store|respond_to_offer|purchase)$"},{"type":"null"}],"title":"Goal"},"scheduled_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scheduled At"},"voice_followup_delay_hours":{"type":"integer","maximum":720.0,"minimum":1.0,"title":"Voice Followup Delay Hours","default":48},"send_rate_per_minute":{"type":"integer","maximum":120.0,"minimum":1.0,"title":"Send Rate Per Minute","default":30},"segment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Segment Id","description":"ILN-810: draw recipients from this saved segment. Resolved when the campaign starts sending, not when it is saved."}},"type":"object","required":["name"],"title":"CreateCampaignRequest","description":"Request to create a new campaign."},"CreateConnectAccountRequest":{"properties":{"business_email":{"type":"string","title":"Business Email"},"business_url":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Business Url"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"account_type":{"type":"string","title":"Account Type","default":"express"},"country":{"type":"string","maxLength":2,"minLength":2,"title":"Country"}},"type":"object","required":["business_email","country"],"title":"CreateConnectAccountRequest","description":"Request to create a Stripe Connect account."},"CreateConnectAccountResponse":{"properties":{"account_id":{"type":"string","title":"Account Id"},"onboarding_link":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Onboarding Link"},"message":{"type":"string","title":"Message"}},"type":"object","required":["account_id","message"],"title":"CreateConnectAccountResponse","description":"Response after creating Connect account."},"CreateFaqRequest":{"properties":{"question":{"type":"string","maxLength":500,"minLength":1,"title":"Question"},"answer":{"type":"string","maxLength":10000,"minLength":1,"title":"Answer"},"category":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Category"}},"type":"object","required":["question","answer"],"title":"CreateFaqRequest","description":"Request to create a custom FAQ."},"CreateNoteRequest":{"properties":{"content":{"type":"string","maxLength":5000,"minLength":1,"title":"Content"}},"type":"object","required":["content"],"title":"CreateNoteRequest","description":"Request to create a customer note."},"CreatePaymentLinkRequest":{"properties":{"amount":{"type":"number","exclusiveMinimum":0.0,"title":"Amount"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"},"description":{"type":"string","maxLength":500,"minLength":1,"title":"Description"},"payment_channel":{"type":"string","enum":["chat","sms","whatsapp"],"title":"Payment Channel"},"conversation_id":{"type":"string","minLength":1,"title":"Conversation Id"},"message_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Id"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Phone"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["amount","description","payment_channel","conversation_id"],"title":"CreatePaymentLinkRequest","description":"Request to create a payment link for a customer."},"CreateSessionRequest":{"properties":{"widget_key":{"type":"string","title":"Widget Key"},"visitor_name":{"type":"string","maxLength":255,"minLength":1,"title":"Visitor Name"},"visitor_email":{"type":"string","format":"email","title":"Visitor Email"},"page_url":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Page Url"}},"type":"object","required":["widget_key","visitor_name","visitor_email"],"title":"CreateSessionRequest","description":"Request to start a new webchat session."},"CreateSessionResponse":{"properties":{"session_token":{"type":"string","title":"Session Token"},"session_id":{"type":"string","title":"Session Id"},"conversation_id":{"type":"string","title":"Conversation Id"},"greeting":{"type":"string","title":"Greeting"},"config":{"$ref":"#/components/schemas/app__api__webchat__WebchatConfigResponse"}},"type":"object","required":["session_token","session_id","conversation_id","greeting","config"],"title":"CreateSessionResponse","description":"Response after session creation."},"CreateSourceRequest":{"properties":{"url":{"type":"string","maxLength":2083,"minLength":1,"format":"uri","title":"Url"}},"type":"object","required":["url"],"title":"CreateSourceRequest","description":"Request to add a URL source for crawling."},"CredentialsConnectRequest":{"properties":{"api_key":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Api Key"},"username":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Username"},"password":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Password"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"},"branch_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Branch Id"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region","description":"API region: 'eu' or 'us'","default":"eu"},"center_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Center Id"},"site_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Site Id"}},"type":"object","title":"CredentialsConnectRequest","description":"Flexible credentials connect request for API key / basic auth integrations.\n\nRequired fields vary by tool:\n- Phorest: username, password, business_id (+ optional branch_id, region)\n- Zenoti: api_key (+ optional center_id)\n- Mindbody: api_key, site_id"},"CreditBalanceResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"plan":{"type":"string","title":"Plan"},"plan_allowance":{"type":"integer","title":"Plan Allowance"},"allowance_used":{"type":"integer","title":"Allowance Used"},"allowance_remaining":{"type":"integer","title":"Allowance Remaining"},"granted_balance":{"type":"integer","title":"Granted Balance"},"total_remaining":{"type":"integer","title":"Total Remaining"},"period":{"type":"string","title":"Period"}},"type":"object","required":["tenant_id","tenant_name","plan","plan_allowance","allowance_used","allowance_remaining","granted_balance","total_remaining","period"],"title":"CreditBalanceResponse"},"CsvUploadResponse":{"properties":{"imported":{"type":"integer","title":"Imported"},"skipped":{"type":"integer","title":"Skipped"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"}},"type":"object","required":["imported","skipped","errors"],"title":"CsvUploadResponse","description":"Response after CSV lead upload."},"CurrentNumbersResponse":{"properties":{"numbers":{"items":{"$ref":"#/components/schemas/AssignedNumber"},"type":"array","title":"Numbers"},"capabilities":{"$ref":"#/components/schemas/PlanCapabilities"}},"type":"object","required":["numbers","capabilities"],"title":"CurrentNumbersResponse"},"CustomerCreate":{"properties":{"primary_phone":{"type":"string","maxLength":32,"minLength":3,"title":"Primary Phone"},"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"preferred_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Preferred Name"},"email":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}],"title":"Email"},"date_of_birth":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date Of Birth"},"sex":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Sex"},"pronouns":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Pronouns"},"display_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Display Id"},"preferred_language":{"anyOf":[{"type":"string","maxLength":5},{"type":"null"}],"title":"Preferred Language"},"preferred_channel":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Preferred Channel"},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":25},{"type":"null"}],"title":"Tags"},"assigned_practitioner_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Assigned Practitioner Id"},"address_line1":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line1"},"address_line2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line2"},"address_city":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Address City"},"address_state":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Address State"},"address_postal_code":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Address Postal Code"},"address_country":{"anyOf":[{"type":"string","maxLength":2},{"type":"null"}],"title":"Address Country"},"emergency_contact":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Emergency Contact"}},"type":"object","required":["primary_phone"],"title":"CustomerCreate","description":"Manually create a patient (ILN-721).\n\nOnly the phone is required — it is the identity key every matching path\nrelies on (``uq_customers_tenant_phone``)."},"CustomerDetail":{"properties":{"clinical_redacted":{"type":"boolean","title":"Clinical Redacted","default":false},"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"primary_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Phone"},"total_conversations":{"type":"integer","title":"Total Conversations","default":0},"last_conversation_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Conversation At"},"preferred_language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Language"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"},"additional_phones":{"items":{"type":"string"},"type":"array","title":"Additional Phones","default":[]},"status":{"type":"string","title":"Status","default":"lead"},"total_bookings":{"type":"integer","title":"Total Bookings","default":0},"total_revenue_cents":{"type":"integer","title":"Total Revenue Cents","default":0},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"status_is_manual":{"type":"boolean","title":"Status Is Manual","default":false},"preferred_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Name"},"date_of_birth":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date Of Birth"},"sex":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sex"},"pronouns":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pronouns"},"address_line1":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address Line1"},"address_line2":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address Line2"},"address_city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address City"},"address_state":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address State"},"address_postal_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address Postal Code"},"address_country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address Country"},"display_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Id"},"preferred_channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Channel"},"channel_consent":{"additionalProperties":true,"type":"object","title":"Channel Consent","default":{}},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","default":[]},"emergency_contact":{"additionalProperties":true,"type":"object","title":"Emergency Contact","default":{}},"assigned_practitioner_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assigned Practitioner Id"},"archived_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Archived At"},"messaging_opted_out":{"type":"boolean","title":"Messaging Opted Out","default":false},"insurance_provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insurance Provider"},"insurance_policy_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insurance Policy Number"},"insurance_group_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insurance Group Number"},"insurance_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insurance Member Id"},"insurance_policy_holder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insurance Policy Holder"},"insurance_coverage_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Insurance Coverage Amount"},"insurance_coverage_remaining":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Insurance Coverage Remaining"},"insurance_renewal_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Insurance Renewal Date"},"health_card_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Health Card Number"},"allergies":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Allergies"},"medications":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Medications"},"conditions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conditions"},"pinned_fields":{"items":{"type":"string"},"type":"array","title":"Pinned Fields","default":[]}},"type":"object","required":["id","created_at","updated_at"],"title":"CustomerDetail","description":"Full customer profile including revenue and activity metrics."},"CustomerLanguageResponse":{"properties":{"customer_id":{"type":"string","title":"Customer Id"},"preferred_language":{"type":"string","title":"Preferred Language"},"message":{"type":"string","title":"Message"}},"type":"object","required":["customer_id","preferred_language","message"],"title":"CustomerLanguageResponse","description":"Response with updated customer language."},"CustomerLanguageUpdate":{"properties":{"language":{"type":"string","pattern":"^(en|es|ar)$","title":"Language","description":"Language code: en, es, or ar"}},"type":"object","required":["language"],"title":"CustomerLanguageUpdate","description":"Request to update customer language preference."},"CustomerNoteItem":{"properties":{"id":{"type":"string","title":"Id"},"content":{"type":"string","title":"Content"},"author_user_id":{"type":"string","title":"Author User Id"},"author_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Author Name"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","content","author_user_id","created_at","updated_at"],"title":"CustomerNoteItem","description":"A manual note on a customer profile."},"CustomerNotesResponse":{"properties":{"notes":{"items":{"$ref":"#/components/schemas/CustomerNoteItem"},"type":"array","title":"Notes"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["notes","total"],"title":"CustomerNotesResponse","description":"List of customer notes."},"CustomerProfileUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string","maxLength":320},{"type":"null"}],"title":"Email"},"preferred_language":{"anyOf":[{"type":"string","maxLength":5},{"type":"null"}],"title":"Preferred Language"},"additional_phones":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":10},{"type":"null"}],"title":"Additional Phones"},"preferred_name":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Preferred Name"},"date_of_birth":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Date Of Birth"},"sex":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Sex"},"pronouns":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Pronouns"},"address_line1":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line1"},"address_line2":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Address Line2"},"address_city":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Address City"},"address_state":{"anyOf":[{"type":"string","maxLength":128},{"type":"null"}],"title":"Address State"},"address_postal_code":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Address Postal Code"},"address_country":{"anyOf":[{"type":"string","maxLength":2},{"type":"null"}],"title":"Address Country"},"display_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Display Id"},"preferred_channel":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Preferred Channel"},"tags":{"anyOf":[{"items":{"type":"string"},"type":"array","maxItems":25},{"type":"null"}],"title":"Tags"},"emergency_contact":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Emergency Contact"},"assigned_practitioner_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Assigned Practitioner Id"},"insurance_provider":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Insurance Provider"},"insurance_policy_number":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Insurance Policy Number"},"insurance_group_number":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Insurance Group Number"},"insurance_member_id":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Insurance Member Id"},"insurance_policy_holder":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Insurance Policy Holder"},"insurance_coverage_amount":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Insurance Coverage Amount"},"insurance_coverage_remaining":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Insurance Coverage Remaining"},"insurance_renewal_date":{"anyOf":[{"type":"string","format":"date"},{"type":"null"}],"title":"Insurance Renewal Date"},"allergies":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Allergies"},"medications":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Medications"},"conditions":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Conditions"},"health_card_number":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Health Card Number"},"status":{"anyOf":[{"type":"string","maxLength":16},{"type":"null"}],"title":"Status"}},"type":"object","title":"CustomerProfileUpdate","description":"Editable profile fields (ILN-684, extended by ILN-721).\n\nPATCH semantics: omitted fields stay unchanged. Nullable fields accept an\nexplicit ``null`` to clear them — distinguished from \"omitted\" by\n``model_fields_set``, so clearing a date of birth is possible without a\nseparate endpoint."},"DailyDataPoint":{"properties":{"day":{"type":"integer","maximum":6.0,"minimum":0.0,"title":"Day","description":"Day of week (0=Mon, 6=Sun)"},"name":{"type":"string","title":"Name","description":"Day name"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","required":["day","name"],"title":"DailyDataPoint","description":"Daily-of-week conversation distribution."},"DailyPoint":{"properties":{"day":{"type":"string","format":"date","title":"Day"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"}},"type":"object","required":["day","total_cost_cents"],"title":"DailyPoint"},"DashboardResponse":{"properties":{"today_date":{"type":"string","title":"Today Date","description":"Today's date in ISO format"},"today":{"$ref":"#/components/schemas/DashboardStats"},"week":{"$ref":"#/components/schemas/DashboardStats"},"month":{"$ref":"#/components/schemas/DashboardStats"},"recent_conversations":{"items":{"$ref":"#/components/schemas/ConversationSummary"},"type":"array","title":"Recent Conversations"},"upcoming_bookings":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Upcoming Bookings"},"recent_payments":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Recent Payments"}},"type":"object","required":["today_date"],"title":"DashboardResponse","description":"Dashboard data with stats and recent activity."},"DashboardStats":{"properties":{"total_conversations":{"type":"integer","title":"Total Conversations","default":0},"voice_conversations":{"type":"integer","title":"Voice Conversations","default":0},"whatsapp_conversations":{"type":"integer","title":"Whatsapp Conversations","default":0},"sms_conversations":{"type":"integer","title":"Sms Conversations","default":0},"webchat_conversations":{"type":"integer","title":"Webchat Conversations","default":0},"total_messages":{"type":"integer","title":"Total Messages","default":0},"active_conversations":{"type":"integer","title":"Active Conversations","default":0},"escalated_conversations":{"type":"integer","title":"Escalated Conversations","default":0}},"type":"object","title":"DashboardStats","description":"Dashboard metrics for a time period."},"DataDeletionRequest":{"properties":{"customer_phone":{"type":"string","title":"Customer Phone","description":"Customer phone number (E.164 format)"}},"type":"object","required":["customer_phone"],"title":"DataDeletionRequest","description":"Request model for GDPR data deletion request."},"DataDeletionResponse":{"properties":{"scheduled_deletion_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Scheduled Deletion Date"},"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"DataDeletionResponse","description":"What a deletion request returns. The request deletes nothing by itself."},"DataExportResponse":{"properties":{"user":{"additionalProperties":true,"type":"object","title":"User"},"memberships":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Memberships"},"audit_logs":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Audit Logs"},"export_timestamp":{"type":"string","title":"Export Timestamp"}},"type":"object","required":["user","memberships","audit_logs","export_timestamp"],"title":"DataExportResponse","description":"Response containing exported user data."},"DataSourceDetail":{"properties":{"id":{"type":"string","title":"Id"},"source_type":{"type":"string","title":"Source Type"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"status":{"type":"string","title":"Status"},"document_count":{"type":"integer","title":"Document Count","default":0},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","source_type","status","created_at"],"title":"DataSourceDetail"},"DayHours":{"properties":{"open":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Open","description":"Opening time, e.g. '9:00 AM'"},"close":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Close","description":"Closing time, e.g. '5:00 PM'"},"closed":{"type":"boolean","title":"Closed","description":"Whether the business is closed this day","default":false}},"type":"object","title":"DayHours","description":"Operating hours for a single day."},"DemoMessageUsageResponse":{"properties":{"messages_used":{"type":"integer","title":"Messages Used"},"messages_remaining":{"type":"integer","title":"Messages Remaining"},"messages_limit":{"type":"integer","title":"Messages Limit"},"is_exhausted":{"type":"boolean","title":"Is Exhausted"},"has_subscription":{"type":"boolean","title":"Has Subscription"}},"type":"object","required":["messages_used","messages_remaining","messages_limit","is_exhausted","has_subscription"],"title":"DemoMessageUsageResponse","description":"Current chatbot demo message usage state."},"DemoRunRequest":{"properties":{"allergies_confirmed":{"type":"boolean","title":"Allergies Confirmed","default":false},"accutane_decision":{"type":"string","title":"Accutane Decision","default":"no"},"user_answer":{"type":"string","title":"User Answer","default":"Patient answered the screening questions."},"use_real_llm":{"type":"boolean","title":"Use Real Llm","default":false}},"type":"object","title":"DemoRunRequest"},"DemoRunResponse":{"properties":{"status":{"type":"string","title":"Status"},"booking_executed":{"type":"boolean","title":"Booking Executed"},"rail_blocked":{"type":"boolean","title":"Rail Blocked"},"variables":{"additionalProperties":true,"type":"object","title":"Variables"},"trace":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Trace"},"instructions":{"type":"string","title":"Instructions"},"nodes":{"items":{"$ref":"#/components/schemas/GraphNode"},"type":"array","title":"Nodes"},"edges":{"items":{"$ref":"#/components/schemas/GraphEdge"},"type":"array","title":"Edges"},"visited_path":{"items":{"type":"string"},"type":"array","title":"Visited Path"},"blocked_node_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Blocked Node Id"},"used_real_llm":{"type":"boolean","title":"Used Real Llm","default":false}},"type":"object","required":["status","booking_executed","rail_blocked","variables","trace","instructions","nodes","edges","visited_path"],"title":"DemoRunResponse"},"DemoUsageResponse":{"properties":{"seconds_used":{"type":"integer","title":"Seconds Used"},"seconds_remaining":{"type":"integer","title":"Seconds Remaining"},"limit_seconds":{"type":"integer","title":"Limit Seconds"},"is_exhausted":{"type":"boolean","title":"Is Exhausted"},"has_subscription":{"type":"boolean","title":"Has Subscription"}},"type":"object","required":["seconds_used","seconds_remaining","limit_seconds","is_exhausted","has_subscription"],"title":"DemoUsageResponse","description":"Current demo usage state."},"DismissSetupStepRequest":{"properties":{"step_id":{"type":"string","maxLength":64,"minLength":1,"title":"Step Id"},"dismissed":{"type":"boolean","title":"Dismissed","description":"False restores a step that was dismissed by mistake.","default":true}},"type":"object","required":["step_id"],"title":"DismissSetupStepRequest","description":"Dismiss (or restore) one setup-checklist step for the whole practice."},"DisputeListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/DisputeOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"DisputeListResponse","description":"Response model for disputes list."},"DisputeOut":{"properties":{"id":{"type":"string","title":"Id"},"stripe_dispute_id":{"type":"string","title":"Stripe Dispute Id"},"amount_cents":{"type":"integer","title":"Amount Cents"},"currency":{"type":"string","title":"Currency"},"reason":{"type":"string","title":"Reason"},"status":{"type":"string","title":"Status"},"evidence_due_by":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Evidence Due By"},"payment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payment Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","stripe_dispute_id","amount_cents","currency","reason","status","evidence_due_by","payment_id","created_at"],"title":"DisputeOut","description":"Dispute response model."},"DocumentUploadResponse":{"properties":{"id":{"type":"string","title":"Id"},"job_id":{"type":"string","title":"Job Id"},"filename":{"type":"string","title":"Filename"},"status":{"type":"string","title":"Status"},"file_size":{"type":"integer","title":"File Size"},"content_type":{"type":"string","title":"Content Type"}},"type":"object","required":["id","job_id","filename","status","file_size","content_type"],"title":"DocumentUploadResponse","description":"Response after uploading a document for processing."},"DocumentUploadStatusResponse":{"properties":{"id":{"type":"string","title":"Id"},"job_id":{"type":"string","title":"Job Id"},"filename":{"type":"string","title":"Filename"},"status":{"type":"string","title":"Status"},"current_step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Step"},"step_progress":{"type":"integer","title":"Step Progress","default":0},"overall_progress":{"type":"integer","title":"Overall Progress","default":0},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"document_count":{"type":"integer","title":"Document Count","default":0}},"type":"object","required":["id","job_id","filename","status"],"title":"DocumentUploadStatusResponse","description":"Response for document upload processing status."},"DuplicateCandidateOut":{"properties":{"reasons":{"items":{"type":"string"},"type":"array","title":"Reasons"},"confidence":{"type":"string","title":"Confidence"},"a":{"$ref":"#/components/schemas/DuplicateSideOut"},"b":{"$ref":"#/components/schemas/DuplicateSideOut"}},"type":"object","required":["reasons","confidence","a","b"],"title":"DuplicateCandidateOut"},"DuplicateSideOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"primary_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"date_of_birth":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date Of Birth"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"booking_count":{"type":"integer","title":"Booking Count","default":0}},"type":"object","required":["id"],"title":"DuplicateSideOut","description":"Enough of each record for a reviewer to tell the two apart."},"DuplicatesResponse":{"properties":{"candidates":{"items":{"$ref":"#/components/schemas/DuplicateCandidateOut"},"type":"array","title":"Candidates"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["candidates","total"],"title":"DuplicatesResponse"},"EmailInvoiceRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"EmailInvoiceRequest","description":"Request body for emailing an invoice."},"EmailInvoiceResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"EmailInvoiceResponse","description":"Response after sending an invoice email."},"EmailVerificationRequiredResponse":{"properties":{"requires_verification":{"type":"boolean","title":"Requires Verification","default":true},"message":{"type":"string","title":"Message"},"email":{"type":"string","title":"Email"}},"type":"object","required":["message","email"],"title":"EmailVerificationRequiredResponse","description":"Response when email verification is required before payment."},"EmbeddedSignupCompleteRequest":{"properties":{"code":{"type":"string","title":"Code"},"waba_id":{"type":"string","title":"Waba Id"},"phone_number_id":{"type":"string","title":"Phone Number Id"},"business_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Id"}},"type":"object","required":["code","waba_id","phone_number_id"],"title":"EmbeddedSignupCompleteRequest","description":"Request from frontend after Embedded Signup completion."},"EmbeddedSignupCompleteResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"waba_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Waba Id"},"phone_number_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number Id"}},"type":"object","required":["success","message"],"title":"EmbeddedSignupCompleteResponse","description":"Response after completing Embedded Signup."},"EmbeddedSignupConfigResponse":{"properties":{"app_id":{"type":"string","title":"App Id"},"config_id":{"type":"string","title":"Config Id"},"api_version":{"type":"string","title":"Api Version","default":"v22.0"}},"type":"object","required":["app_id","config_id"],"title":"EmbeddedSignupConfigResponse","description":"Configuration for frontend Embedded Signup SDK."},"EnableWhatsAppRequest":{"properties":{"sender_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sender Sid","description":"Legacy sender ID metadata (optional, for tracking only)"}},"type":"object","title":"EnableWhatsAppRequest","description":"Legacy request to set phone-level WhatsApp metadata."},"EnableWhatsAppResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"phone":{"$ref":"#/components/schemas/PhoneNumberResponse"}},"type":"object","required":["success","message","phone"],"title":"EnableWhatsAppResponse","description":"Response for legacy phone-level WhatsApp metadata operation."},"EngagementResponse":{"properties":{"new_customers":{"type":"integer","title":"New Customers"},"returning_customers":{"type":"integer","title":"Returning Customers"},"avg_conversations_per_customer":{"type":"number","title":"Avg Conversations Per Customer"},"period_days":{"type":"integer","title":"Period Days"}},"type":"object","required":["new_customers","returning_customers","avg_conversations_per_customer","period_days"],"title":"EngagementResponse","description":"Customer engagement analytics."},"EscalationPathCreate":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"description":{"type":"string","maxLength":500,"minLength":1,"title":"Description"},"kind":{"type":"string","pattern":"^(escalation|call_transfer|custom|share_info)$","title":"Kind","default":"escalation"},"priority":{"type":"string","pattern":"^(low|normal|high|urgent)$","title":"Priority","default":"normal"},"sms_phones":{"items":{"type":"string"},"type":"array","title":"Sms Phones"},"whatsapp_phones":{"items":{"type":"string"},"type":"array","title":"Whatsapp Phones"},"transfer_phone":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Transfer Phone"},"steps":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Steps"},"body":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}],"title":"Body"},"qualification_question":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Qualification Question"},"response_template":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Response Template"},"is_active":{"type":"boolean","title":"Is Active","default":true},"location_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Location Id"}},"type":"object","required":["name","description"],"title":"EscalationPathCreate","description":"Request body for creating an AI Action / escalation path."},"EscalationPathListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/EscalationPathOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"EscalationPathListResponse","description":"Response model for listing AI Actions."},"EscalationPathOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"kind":{"type":"string","title":"Kind"},"priority":{"type":"string","title":"Priority"},"sms_phones":{"items":{"type":"string"},"type":"array","title":"Sms Phones"},"whatsapp_phones":{"items":{"type":"string"},"type":"array","title":"Whatsapp Phones"},"transfer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transfer Phone"},"steps":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Steps"},"body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Body"},"qualification_question":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qualification Question"},"response_template":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Template"},"is_active":{"type":"boolean","title":"Is Active"},"sort_order":{"type":"integer","title":"Sort Order"},"is_system":{"type":"boolean","title":"Is System"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id"}},"type":"object","required":["id","tenant_id","name","description","kind","priority","sms_phones","whatsapp_phones","qualification_question","response_template","is_active","sort_order","is_system","created_at","updated_at"],"title":"EscalationPathOut","description":"Response model for a single AI Action."},"EscalationPathUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"null"}],"title":"Description"},"kind":{"anyOf":[{"type":"string","pattern":"^(escalation|call_transfer|custom|share_info)$"},{"type":"null"}],"title":"Kind"},"priority":{"anyOf":[{"type":"string","pattern":"^(low|normal|high|urgent)$"},{"type":"null"}],"title":"Priority"},"sms_phones":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Sms Phones"},"whatsapp_phones":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Whatsapp Phones"},"transfer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transfer Phone"},"steps":{"anyOf":[{"items":{"additionalProperties":true,"type":"object"},"type":"array"},{"type":"null"}],"title":"Steps"},"body":{"anyOf":[{"type":"string","maxLength":1024},{"type":"null"}],"title":"Body"},"qualification_question":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Qualification Question"},"response_template":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Template"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"location_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Location Id"}},"type":"object","title":"EscalationPathUpdate","description":"Request body for updating an AI Action. All fields optional."},"FailingStaffNumberOut":{"properties":{"phone":{"type":"string","title":"Phone"},"last_error_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Error Code"},"failing_since":{"type":"string","format":"date-time","title":"Failing Since"}},"type":"object","required":["phone","failing_since"],"title":"FailingStaffNumberOut","description":"One of the clinic's own staff numbers that is not receiving our texts.\n\n`phone` is the number as it was texted: the clinic typed it into AI Actions\nor Settings, so it is shown to the clinic in full, never to anyone else."},"FailingStaffNumbersResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FailingStaffNumberOut"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"FailingStaffNumbersResponse"},"FamilyMemberCreate":{"properties":{"name":{"type":"string","maxLength":200,"minLength":1,"title":"Name"},"relationship":{"type":"string","maxLength":32,"title":"Relationship","default":"other"},"phone":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Phone"},"related_customer_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Related Customer Id"},"is_primary_contact":{"type":"boolean","title":"Is Primary Contact","default":false}},"type":"object","required":["name"],"title":"FamilyMemberCreate"},"FamilyMemberItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"relationship":{"type":"string","title":"Relationship"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"related_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Related Customer Id"},"is_primary_contact":{"type":"boolean","title":"Is Primary Contact","default":false},"related_is_patient":{"type":"boolean","title":"Related Is Patient","default":false}},"type":"object","required":["id","name","relationship"],"title":"FamilyMemberItem"},"FamilyMembersResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/FamilyMemberItem"},"type":"array","title":"Members"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["members","total"],"title":"FamilyMembersResponse"},"FaqSuggestion":{"properties":{"question":{"type":"string","maxLength":500,"minLength":1,"title":"Question"},"answer":{"type":"string","maxLength":10000,"minLength":1,"title":"Answer"},"category":{"type":"string","pattern":"^(about|services|pricing|availability|location|policies|contact)$","title":"Category","description":"Category ID the FAQ belongs to."},"source":{"type":"string","pattern":"^(gap|coverage)$","title":"Source","description":"'gap' if from a real customer question, 'coverage' if filling an empty category."},"gap_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gap Id","description":"KnowledgeGap ID if sourced from a real question."}},"type":"object","required":["question","answer","category","source"],"title":"FaqSuggestion","description":"A single suggested FAQ to fill a knowledge gap or empty category."},"FaqSummary":{"properties":{"total":{"type":"integer","title":"Total","default":0},"active":{"type":"integer","title":"Active","default":0},"categories":{"items":{"type":"string"},"type":"array","title":"Categories","default":[]}},"type":"object","title":"FaqSummary"},"FlowAnalyticsRecent":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"status":{"type":"string","title":"Status"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"latest_version":{"type":"integer","title":"Latest Version"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"}},"type":"object","required":["id","name","status","category","latest_version","updated_at"],"title":"FlowAnalyticsRecent"},"FlowAnalyticsResponse":{"properties":{"total_flows":{"type":"integer","title":"Total Flows"},"active_flows":{"type":"integer","title":"Active Flows"},"draft_flows":{"type":"integer","title":"Draft Flows"},"published_versions":{"type":"integer","title":"Published Versions"},"by_status":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Status"},"by_category":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Category"},"node_kind_usage":{"additionalProperties":{"type":"integer"},"type":"object","title":"Node Kind Usage"},"recent":{"items":{"$ref":"#/components/schemas/FlowAnalyticsRecent"},"type":"array","title":"Recent"},"engagement_available":{"type":"boolean","title":"Engagement Available","default":false}},"type":"object","required":["total_flows","active_flows","draft_flows","published_versions","by_status","by_category","node_kind_usage","recent"],"title":"FlowAnalyticsResponse","description":"Genuinely-knowable workflow aggregates (ILN-610).\n\nPer-run engagement metrics (bookings/recovery/revenue) require flow-run\ntracking introduced with runtime wiring (Phase E / ILN-614); until then\n`engagement_available` is false and the UI shows a coming-soon state instead\nof fabricated numbers."},"FlowCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"category":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Category"},"draft_spec":{"additionalProperties":true,"type":"object","title":"Draft Spec"},"layout":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout"}},"type":"object","required":["name"],"title":"FlowCreate","description":"Create a new (draft) workflow."},"FlowListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FlowOut"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"FlowListResponse"},"FlowOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"status":{"type":"string","title":"Status"},"latest_version":{"type":"integer","title":"Latest Version"},"draft_spec":{"additionalProperties":true,"type":"object","title":"Draft Spec"},"layout":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout"},"source_scenario":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Source Scenario"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","tenant_id","name","category","status","latest_version","draft_spec","layout","created_at","updated_at"],"title":"FlowOut","description":"A workflow as returned by the API."},"FlowUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"category":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Category"},"status":{"anyOf":[{"type":"string","pattern":"^(draft|active|paused|archived)$"},{"type":"null"}],"title":"Status"},"draft_spec":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Draft Spec"},"layout":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Layout"}},"type":"object","title":"FlowUpdate","description":"Update a workflow's draft. All fields optional (partial update)."},"FlowVersionListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/FlowVersionOut"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"FlowVersionListResponse"},"FlowVersionOut":{"properties":{"id":{"type":"string","title":"Id"},"flow_id":{"type":"string","title":"Flow Id"},"version":{"type":"integer","title":"Version"},"spec":{"additionalProperties":true,"type":"object","title":"Spec"},"published_at":{"type":"string","format":"date-time","title":"Published At"}},"type":"object","required":["id","flow_id","version","spec","published_at"],"title":"FlowVersionOut"},"FromScenarioRequest":{"properties":{"scenario":{"type":"string","pattern":"^(vetting|followup|reengagement|intake|birthday|lens_refill_due|insurance_expiring)$","title":"Scenario"},"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"publish":{"type":"boolean","title":"Publish","default":true}},"type":"object","required":["scenario","name"],"title":"FromScenarioRequest","description":"Build a flow from a wizard scenario + its config (ILN-610 Phase D2)."},"FunnelBookingResponse":{"properties":{"recipient_id":{"type":"string","title":"Recipient Id"},"recipient_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Recipient Name"},"phone_number":{"type":"string","title":"Phone Number"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"converted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Converted At"},"booking_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Id"},"service_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Type"},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Time"},"booking_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Status"}},"type":"object","required":["recipient_id","phone_number"],"title":"FunnelBookingResponse"},"FunnelStageResponse":{"properties":{"key":{"type":"string","title":"Key"},"label":{"type":"string","title":"Label"},"count":{"type":"integer","title":"Count"},"observable":{"type":"boolean","title":"Observable"},"pct_of_sent":{"type":"number","title":"Pct Of Sent"}},"type":"object","required":["key","label","count","observable","pct_of_sent"],"title":"FunnelStageResponse"},"GoogleLoginRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"GoogleLoginRequest"},"GrantCreditsRequest":{"properties":{"credits":{"type":"integer","title":"Credits"},"reason":{"type":"string","title":"Reason"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["credits","reason"],"title":"GrantCreditsRequest"},"GraphEdge":{"properties":{"source":{"type":"string","title":"Source"},"target":{"type":"string","title":"Target"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","required":["source","target"],"title":"GraphEdge"},"GraphNode":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind"},"type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Type"},"title":{"type":"string","title":"Title"},"subtitle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subtitle"}},"type":"object","required":["id","kind","title"],"title":"GraphNode"},"GupshupCompleteResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"}},"type":"object","required":["success","message"],"title":"GupshupCompleteResponse","description":"Response after completing WhatsApp connection."},"GupshupCreateAppRequest":{"properties":{"business_name":{"type":"string","maxLength":255,"minLength":1,"title":"Business Name"},"contact_email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Contact Email"},"contact_phone":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Contact Phone"},"coexistence":{"type":"boolean","title":"Coexistence","description":"Opt into Gupshup/Meta Coexistence onboarding (closed beta)","default":false}},"type":"object","required":["business_name"],"title":"GupshupCreateAppRequest","description":"Request to create a Gupshup app for WhatsApp onboarding."},"GupshupCreateAppResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"app_id":{"type":"string","title":"App Id"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","app_id","message"],"title":"GupshupCreateAppResponse","description":"Response after creating Gupshup app."},"GupshupDisconnectResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"GupshupDisconnectResponse","description":"Response after disconnecting WhatsApp."},"GupshupEmbedLinkResponse":{"properties":{"url":{"type":"string","title":"Url"},"expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Expires At"},"already_live":{"type":"boolean","title":"Already Live","default":false}},"type":"object","required":["url"],"title":"GupshupEmbedLinkResponse","description":"Response with embedded signup link."},"GupshupStatusResponse":{"properties":{"connected":{"type":"boolean","title":"Connected"},"app_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"App Id"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"waba_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Waba Id"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"onboarding_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Onboarding Status"},"connected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Connected At"}},"type":"object","required":["connected"],"title":"GupshupStatusResponse","description":"Gupshup WhatsApp connection status."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","title":"Status"},"cache_available":{"type":"boolean","title":"Cache Available"}},"type":"object","required":["status","cache_available"],"title":"HealthResponse","description":"Health check response."},"HourlyDataPoint":{"properties":{"hour":{"type":"integer","maximum":23.0,"minimum":0.0,"title":"Hour","description":"Hour of day (0-23)"},"count":{"type":"integer","title":"Count","default":0}},"type":"object","required":["hour"],"title":"HourlyDataPoint","description":"Hourly conversation distribution."},"HubItemStatus":{"properties":{"id":{"type":"string","title":"Id"},"display_name":{"type":"string","title":"Display Name"},"status":{"type":"string","title":"Status"},"required":{"type":"boolean","title":"Required"},"skippable":{"type":"boolean","title":"Skippable"},"visible":{"type":"boolean","title":"Visible"}},"type":"object","required":["id","display_name","status","required","skippable","visible"],"title":"HubItemStatus","description":"Status of a setup hub item."},"ImpersonateResponse":{"properties":{"code":{"type":"string","title":"Code"},"tenant_id":{"type":"string","title":"Tenant Id"},"portal_url":{"type":"string","title":"Portal Url"}},"type":"object","required":["code","tenant_id","portal_url"],"title":"ImpersonateResponse"},"ImpersonationCodeExchangeRequest":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"ImpersonationCodeExchangeRequest"},"ImpersonationCodeExchangeResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"admin_email":{"type":"string","title":"Admin Email"}},"type":"object","required":["access_token","tenant_id","role","admin_email"],"title":"ImpersonationCodeExchangeResponse"},"ImportApplyResponse":{"properties":{"batch_id":{"type":"string","title":"Batch Id"},"created":{"type":"integer","title":"Created"},"updated":{"type":"integer","title":"Updated"},"skipped":{"type":"integer","title":"Skipped"}},"type":"object","required":["batch_id","created","updated","skipped"],"title":"ImportApplyResponse"},"ImportPreviewResponse":{"properties":{"batch_id":{"type":"string","title":"Batch Id"},"total_rows":{"type":"integer","title":"Total Rows"},"new_count":{"type":"integer","title":"New Count"},"existing_count":{"type":"integer","title":"Existing Count"},"error_count":{"type":"integer","title":"Error Count"},"mapping":{"additionalProperties":{"type":"string"},"type":"object","title":"Mapping"},"unmapped_headers":{"items":{"type":"string"},"type":"array","title":"Unmapped Headers"},"errors":{"items":{"type":"string"},"type":"array","title":"Errors"},"sample":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sample"}},"type":"object","required":["batch_id","total_rows","new_count","existing_count","error_count"],"title":"ImportPreviewResponse","description":"The dry run. Nothing has been written when this returns."},"InstagramDisconnectResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"InstagramDisconnectResponse","description":"Response after disconnecting Instagram."},"InstagramOAuthStartResponse":{"properties":{"authorize_url":{"type":"string","title":"Authorize Url"}},"type":"object","required":["authorize_url"],"title":"InstagramOAuthStartResponse","description":"OAuth start response — returns the Instagram authorize URL.\n\nTwo-step flow: parent window calls this (authed) → opens authorize_url\nin a popup. Keeps the JWT off the URL bar."},"InstagramStatusResponse":{"properties":{"connected":{"type":"boolean","title":"Connected"},"handle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Handle"},"account_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Type"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"token_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Token Expires At"},"connected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Connected At"},"switched_off":{"type":"boolean","title":"Switched Off","default":false}},"type":"object","required":["connected"],"title":"InstagramStatusResponse","description":"Instagram connection status for the tenant."},"IntakeAnswerOut":{"properties":{"field_id":{"type":"string","title":"Field Id"},"label":{"type":"string","title":"Label"},"type":{"type":"string","title":"Type"},"value":{"title":"Value"}},"type":"object","required":["field_id","label","type","value"],"title":"IntakeAnswerOut","description":"One answered field, labeled from the exact version the patient filled."},"IntakeAutoSendConfig":{"properties":{"enabled":{"type":"boolean","title":"Enabled","default":false},"services":{"items":{"type":"string"},"type":"array","maxItems":100,"title":"Services"},"timing":{"type":"string","enum":["on_booking","hours_before"],"title":"Timing","default":"on_booking"},"hours_before":{"type":"integer","maximum":336.0,"minimum":1.0,"title":"Hours Before","default":24},"freshness_days":{"type":"integer","maximum":730.0,"minimum":0.0,"title":"Freshness Days","default":90}},"type":"object","title":"IntakeAutoSendConfig","description":"ILN-730: per-form auto-send rule. ``services`` empty (or containing \"*\")\nmeans every service; ``timing`` decides when the link goes out."},"IntakeError":{"properties":{"row":{"type":"integer","title":"Row"},"column":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Column"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["row","reason"],"title":"IntakeError","description":"A row number, a column and a reason code. Never a value from the file."},"IntakeFieldSpec":{"properties":{"id":{"type":"string","maxLength":64,"minLength":1,"title":"Id"},"label":{"type":"string","maxLength":200,"minLength":1,"title":"Label"},"type":{"$ref":"#/components/schemas/IntakeFieldType"},"required":{"type":"boolean","title":"Required","default":false},"options":{"items":{"type":"string"},"type":"array","title":"Options"},"order":{"type":"integer","title":"Order","default":0},"section":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Section"},"help_text":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Help Text"},"document_type":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Document Type"},"min_value":{"type":"integer","maximum":1000.0,"minimum":-1000.0,"title":"Min Value","default":0},"max_value":{"type":"integer","maximum":1000.0,"minimum":-1000.0,"title":"Max Value","default":10},"show_if":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Show If"},"require_if":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Require If"}},"type":"object","required":["id","label","type"],"title":"IntakeFieldSpec","description":"One field in an intake form. `id` is stable across edits (answers key off it)."},"IntakeFieldType":{"type":"string","enum":["text","textarea","select","multiselect","date","checkbox","phone","email","scale","consent","address","signature","medications","file","photo"],"title":"IntakeFieldType"},"IntakeFormCreate":{"properties":{"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"fields":{"items":{"$ref":"#/components/schemas/IntakeFieldSpec"},"type":"array","title":"Fields"},"sections":{"items":{"$ref":"#/components/schemas/IntakeSectionSpec"},"type":"array","title":"Sections"}},"type":"object","required":["name"],"title":"IntakeFormCreate"},"IntakeFormOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"status":{"type":"string","title":"Status"},"latest_version":{"type":"integer","title":"Latest Version"},"draft_fields":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Draft Fields"},"draft_sections":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Draft Sections"},"end_form_if":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"End Form If"},"auto_send":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Auto Send"},"submission_count":{"type":"integer","title":"Submission Count","default":0},"source_template":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Source Template"},"import_meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Import Meta"}},"type":"object","required":["id","name","description","status","latest_version","draft_fields"],"title":"IntakeFormOut"},"IntakeFormUpdate":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"fields":{"anyOf":[{"items":{"$ref":"#/components/schemas/IntakeFieldSpec"},"type":"array"},{"type":"null"}],"title":"Fields"},"sections":{"anyOf":[{"items":{"$ref":"#/components/schemas/IntakeSectionSpec"},"type":"array"},{"type":"null"}],"title":"Sections"},"end_form_if":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"End Form If"},"auto_send":{"anyOf":[{"$ref":"#/components/schemas/IntakeAutoSendConfig"},{"type":"null"}]}},"type":"object","title":"IntakeFormUpdate"},"IntakeRedirectCardOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"description":{"type":"string","title":"Description"},"rationale":{"type":"string","title":"Rationale"},"target":{"type":"string","title":"Target"}},"type":"object","required":["id","name","category","description","rationale","target"],"title":"IntakeRedirectCardOut","description":"A library card that deep-links into the FLOW builder instead of copying a form —\nbooking pre-screening and post-treatment check-in are flows with server-enforced\nrails, not questionnaires (ILN-727 epic rationale)."},"IntakeSectionSpec":{"properties":{"id":{"type":"string","maxLength":64,"minLength":1,"title":"Id"},"title":{"type":"string","maxLength":200,"minLength":1,"title":"Title"},"description":{"anyOf":[{"type":"string","maxLength":1000},{"type":"null"}],"title":"Description"},"order":{"type":"integer","title":"Order","default":0}},"type":"object","required":["id","title"],"title":"IntakeSectionSpec","description":"An ordered group of questions. Purely presentational — answers stay keyed by\nfield id, so adding/removing sections never rewrites stored submissions."},"IntakeSubmissionOut":{"properties":{"id":{"type":"string","title":"Id"},"form_id":{"type":"string","title":"Form Id"},"form_name":{"type":"string","title":"Form Name"},"form_version":{"type":"integer","title":"Form Version"},"customer_phone":{"type":"string","title":"Customer Phone"},"booking_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Id"},"submitted_at":{"type":"string","format":"date-time","title":"Submitted At"},"answers":{"items":{"$ref":"#/components/schemas/IntakeAnswerOut"},"type":"array","title":"Answers"}},"type":"object","required":["id","form_id","form_name","form_version","customer_phone","booking_id","submitted_at","answers"],"title":"IntakeSubmissionOut","description":"Display-ready submission row (ILN-683 read side)."},"IntakeSubmitRequest":{"properties":{"answers":{"additionalProperties":true,"type":"object","title":"Answers"}},"type":"object","required":["answers"],"title":"IntakeSubmitRequest"},"IntakeTemplateLibraryOut":{"properties":{"templates":{"items":{"$ref":"#/components/schemas/IntakeTemplateOut"},"type":"array","title":"Templates"},"redirects":{"items":{"$ref":"#/components/schemas/IntakeRedirectCardOut"},"type":"array","title":"Redirects"}},"type":"object","required":["templates","redirects"],"title":"IntakeTemplateLibraryOut"},"IntakeTemplateOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"clinic_type":{"type":"string","title":"Clinic Type"},"description":{"type":"string","title":"Description"},"est_minutes":{"type":"integer","title":"Est Minutes"},"version":{"type":"integer","title":"Version"},"question_count":{"type":"integer","title":"Question Count"},"section_count":{"type":"integer","title":"Section Count"},"recommended_services":{"items":{"type":"string"},"type":"array","title":"Recommended Services"},"sections":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sections"},"fields":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Fields"},"end_form_if":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"End Form If"}},"type":"object","required":["id","name","category","clinic_type","description","est_minutes","version","question_count","section_count"],"title":"IntakeTemplateOut","description":"A library card (ILN-729). `fields`/`sections` carry the full spec so the preview\nrenders the real fill page read-only, with no second round-trip."},"IntegrationDetail":{"properties":{"id":{"type":"string","title":"Id"},"provider":{"type":"string","title":"Provider"},"status":{"type":"string","title":"Status"},"last_synced_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Synced At"},"sync_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sync Error"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","provider","status","created_at"],"title":"IntegrationDetail"},"IntegrationHealthResponse":{"properties":{"healthy":{"type":"boolean","title":"Healthy"},"message":{"type":"string","title":"Message"},"last_synced_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Synced At"},"sync_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sync Error"},"status":{"type":"string","title":"Status"}},"type":"object","required":["healthy","message","status"],"title":"IntegrationHealthResponse","description":"Health status of a connected integration."},"IntegrationOut":{"properties":{"id":{"type":"string","title":"Id"},"provider":{"type":"string","title":"Provider"},"status":{"type":"string","title":"Status"},"account_ref":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Ref"},"created_at":{"type":"string","title":"Created At"},"last_synced_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Synced At"},"sync_error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sync Error"}},"type":"object","required":["id","provider","status","created_at"],"title":"IntegrationOut","description":"Connected integration summary."},"IntegrationSettingsResponse":{"properties":{"provider":{"type":"string","title":"Provider"},"config":{"additionalProperties":{"anyOf":[{"type":"string"},{"type":"null"}]},"type":"object","title":"Config"},"editable_fields":{"items":{"type":"string"},"type":"array","title":"Editable Fields"}},"type":"object","required":["provider","config","editable_fields"],"title":"IntegrationSettingsResponse","description":"Sanitized per-provider settings (no tokens/credentials exposed)."},"IntegrationSettingsUpdate":{"properties":{"config":{"additionalProperties":{"type":"string"},"type":"object","title":"Config"}},"type":"object","required":["config"],"title":"IntegrationSettingsUpdate","description":"Partial update for editable integration settings."},"IntegrationSummary":{"properties":{"id":{"type":"string","title":"Id"},"provider":{"type":"string","title":"Provider"},"status":{"type":"string","title":"Status"},"account_ref":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Account Ref"}},"type":"object","required":["id","provider","status"],"title":"IntegrationSummary"},"IntegrationsListResponse":{"properties":{"integrations":{"items":{"$ref":"#/components/schemas/IntegrationOut"},"type":"array","title":"Integrations"}},"type":"object","required":["integrations"],"title":"IntegrationsListResponse","description":"Response for tenant connected integrations."},"IntentActionConfig":{"properties":{"enabled":{"type":"boolean","title":"Enabled","default":false},"url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Url","description":"URL to send when this intent is detected"},"response_message":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Response Message","description":"Custom AI response text when this intent is detected"},"qualification_question":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Qualification Question","description":"Optional question AI asks before sending the link"}},"type":"object","title":"IntentActionConfig","description":"Configuration for a single intent action."},"IntentActionsUpdate":{"properties":{"actions":{"additionalProperties":{"$ref":"#/components/schemas/IntentActionConfig"},"type":"object","title":"Actions","description":"Map of action key to its updated configuration"}},"type":"object","required":["actions"],"title":"IntentActionsUpdate","description":"Partial update for intent actions. Only provided keys are updated."},"InviteListResponse":{"properties":{"invites":{"items":{"$ref":"#/components/schemas/InviteResponse"},"type":"array","title":"Invites"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["invites","total"],"title":"InviteListResponse","description":"List of invites."},"InvitePreviewResponse":{"properties":{"status":{"type":"string","title":"Status"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"inviter_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Inviter Name"},"requires_password":{"type":"boolean","title":"Requires Password","default":false}},"type":"object","required":["status"],"title":"InvitePreviewResponse","description":"Read-only resolution of an invite token for the accept page.\n\n``status`` is one of: ``valid | expired | revoked | already_accepted |\ninvalid_token``. The context fields are only populated when ``status`` is\n``valid``."},"InviteRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"role":{"$ref":"#/components/schemas/InviteRole","default":"member"},"team_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Member Id","description":"Existing team_members.id to link (team_member role); omit to auto-create"},"member_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Member Name","description":"Display name for the auto-created staff profile (team_member role only)"}},"type":"object","required":["email"],"title":"InviteRequest","description":"Request to invite a team member.\n\nILN-564 Stream 2: for a ``team_member`` invite the invite must map to a\n``team_members`` row. ``team_member_id`` links an existing one; if omitted,\nthe backend auto-creates a profile (named ``member_name`` or the email\nlocal-part) so the admin can invite in a single step."},"InviteResponse":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"invited_by_email":{"type":"string","title":"Invited By Email"},"invited_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invited By Name"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","title":"Created At"},"expires_at":{"type":"string","title":"Expires At"},"accepted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Accepted At"},"team_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Member Id"}},"type":"object","required":["id","email","role","invited_by_email","status","created_at","expires_at"],"title":"InviteResponse","description":"A pending team invite."},"InviteRole":{"type":"string","enum":["admin","member","team_member"],"title":"InviteRole","description":"Roles that can be assigned via invite (excludes owner).\n\nILN-564 Stream 2: ``team_member`` invites a staff member who maps to a\npre-created ``team_members`` row (link via ``InviteRequest.team_member_id``)."},"InviteSentResponse":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"role":{"type":"string","title":"Role"},"expires_at":{"type":"string","title":"Expires At"},"team_member_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Team Member Id"},"message":{"type":"string","title":"Message","default":"Invitation sent successfully"}},"type":"object","required":["id","email","role","expires_at"],"title":"InviteSentResponse","description":"Response after sending an invite."},"InvoicesListResponse":{"properties":{"invoices":{"items":{"$ref":"#/components/schemas/StripeInvoiceItem"},"type":"array","title":"Invoices"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["invoices","has_more"],"title":"InvoicesListResponse","description":"Response for billing invoices list."},"JobDetail":{"properties":{"id":{"type":"string","title":"Id"},"type":{"type":"string","title":"Type"},"status":{"type":"string","title":"Status"},"current_step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Step"},"step_progress":{"type":"integer","title":"Step Progress","default":0},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","type","status","created_at"],"title":"JobDetail"},"KbExtractionResponse":{"properties":{"candidates":{"items":{"$ref":"#/components/schemas/ServiceCandidateOut"},"type":"array","title":"Candidates"},"docs_scanned":{"type":"integer","title":"Docs Scanned"},"truncated":{"type":"boolean","title":"Truncated"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["candidates","docs_scanned","truncated"],"title":"KbExtractionResponse","description":"Response from POST /portal/services/extract-from-kb."},"LanguageAnalysisRequest":{"properties":{"text":{"type":"string","maxLength":5000,"minLength":1,"title":"Text"}},"type":"object","required":["text"],"title":"LanguageAnalysisRequest","description":"Request to analyze text language."},"LanguageAnalysisResponse":{"properties":{"primary_language":{"type":"string","title":"Primary Language"},"has_code_switching":{"type":"boolean","title":"Has Code Switching"},"languages":{"items":{"type":"string"},"type":"array","title":"Languages"},"complexity":{"type":"string","title":"Complexity"},"switch_count":{"type":"integer","title":"Switch Count"},"segments":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Segments"},"recommendation":{"type":"string","title":"Recommendation"}},"type":"object","required":["primary_language","has_code_switching","languages","complexity","switch_count","segments","recommendation"],"title":"LanguageAnalysisResponse","description":"Language analysis result."},"LinkFromKBRequest":{"properties":{"asset_name":{"type":"string","title":"Asset Name"},"display_name":{"type":"string","title":"Display Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["asset_name","display_name"],"title":"LinkFromKBRequest"},"LiveKitTokenRequest":{"properties":{"connection_type":{"type":"string","title":"Connection Type"}},"type":"object","required":["connection_type"],"title":"LiveKitTokenRequest","description":"Request for a LiveKit access token."},"LiveKitTokenResponse":{"properties":{"token":{"type":"string","title":"Token"},"room_name":{"type":"string","title":"Room Name"},"livekit_url":{"type":"string","title":"Livekit Url"},"seconds_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Seconds Remaining"}},"type":"object","required":["token","room_name","livekit_url"],"title":"LiveKitTokenResponse","description":"LiveKit access token for browser voice connection."},"LocationCreateIn":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Phone"},"timezone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Timezone"},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"blackout_dates":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Blackout Dates"},"ai_facts":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Ai Facts"}},"type":"object","required":["name"],"title":"LocationCreateIn"},"LocationListOut":{"properties":{"locations":{"items":{"$ref":"#/components/schemas/LocationOut"},"type":"array","title":"Locations"},"licensed":{"type":"integer","title":"Licensed"},"can_add":{"type":"boolean","title":"Can Add"}},"type":"object","required":["locations","licensed","can_add"],"title":"LocationListOut"},"LocationOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"blackout_dates":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Blackout Dates"},"is_primary":{"type":"boolean","title":"Is Primary"},"is_active":{"type":"boolean","title":"Is Active"},"sort_order":{"type":"integer","title":"Sort Order"},"ai_facts":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ai Facts"}},"type":"object","required":["id","name","is_primary","is_active","sort_order"],"title":"LocationOut"},"LocationReportResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"},"locations":{"items":{"$ref":"#/components/schemas/LocationReportRow"},"type":"array","title":"Locations"}},"type":"object","required":["period_days","currency","locations"],"title":"LocationReportResponse"},"LocationReportRow":{"properties":{"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id","description":"None = activity not tied to any branch (no tool call resolved one)."},"name":{"type":"string","title":"Name"},"conversations":{"type":"integer","title":"Conversations","default":0},"bookings":{"type":"integer","title":"Bookings","default":0},"completed":{"type":"integer","title":"Completed","default":0},"cancelled":{"type":"integer","title":"Cancelled","default":0},"booked_value_cents":{"type":"integer","title":"Booked Value Cents","description":"ESTIMATE: catalog price x non-cancelled bookings. Bookings carry no price of their own, so this is what the diary is worth at list price, not money taken.","default":0},"unpriced_bookings":{"type":"integer","title":"Unpriced Bookings","description":"Non-cancelled bookings whose service has no catalog price, left out of the value.","default":0}},"type":"object","required":["location_id","name"],"title":"LocationReportRow","description":"One branch's volume over the period (ILN-816)."},"LocationUpdateIn":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Address"},"phone":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Phone"},"timezone":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Timezone"},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"blackout_dates":{"anyOf":[{"items":{},"type":"array"},{"type":"null"}],"title":"Blackout Dates"},"sort_order":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sort Order"},"ai_facts":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Ai Facts"}},"type":"object","title":"LocationUpdateIn"},"LoginLinkResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"LoginLinkResponse","description":"Response with Express dashboard login link."},"LoginRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"LoginRequest","description":"Request model for username/password login."},"MFABackupCodesResponse":{"properties":{"backup_codes":{"items":{"type":"string"},"type":"array","title":"Backup Codes"},"message":{"type":"string","title":"Message","default":"Previous backup codes have been invalidated"}},"type":"object","required":["backup_codes"],"title":"MFABackupCodesResponse","description":"Response with regenerated backup codes."},"MFADisableRequest":{"properties":{"password":{"type":"string","title":"Password"}},"type":"object","required":["password"],"title":"MFADisableRequest","description":"Request to disable MFA (requires password)."},"MFASetupResponse":{"properties":{"secret":{"type":"string","title":"Secret"},"provisioning_uri":{"type":"string","title":"Provisioning Uri"},"message":{"type":"string","title":"Message","default":"Scan the QR code with your authenticator app"}},"type":"object","required":["secret","provisioning_uri"],"title":"MFASetupResponse","description":"Response for MFA setup initiation."},"MFAStatusResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"verified_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Verified At"},"last_used_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Used At"}},"type":"object","required":["enabled"],"title":"MFAStatusResponse","description":"MFA status for the current user."},"MFAVerifyLoginRequest":{"properties":{"mfa_token":{"type":"string","title":"Mfa Token"},"code":{"type":"string","maxLength":20,"minLength":1,"title":"Code"}},"type":"object","required":["mfa_token","code"],"title":"MFAVerifyLoginRequest","description":"Request to complete MFA-gated login."},"MFAVerifySetupRequest":{"properties":{"code":{"type":"string","maxLength":6,"minLength":6,"pattern":"^\\d{6}$","title":"Code"}},"type":"object","required":["code"],"title":"MFAVerifySetupRequest","description":"Request to confirm MFA setup with a TOTP code."},"MFAVerifySetupResponse":{"properties":{"message":{"type":"string","title":"Message"},"backup_codes":{"items":{"type":"string"},"type":"array","title":"Backup Codes"}},"type":"object","required":["message","backup_codes"],"title":"MFAVerifySetupResponse","description":"Response after confirming MFA setup."},"ManualContentRequest":{"properties":{"content":{"type":"string","title":"Content"}},"type":"object","required":["content"],"title":"ManualContentRequest","description":"Request to add business info manually when scraping fails."},"MarkAllReadResponse":{"properties":{"count":{"type":"integer","title":"Count"}},"type":"object","required":["count"],"title":"MarkAllReadResponse","description":"Response after marking all notifications as read."},"MarkReadResponse":{"properties":{"success":{"type":"boolean","title":"Success"}},"type":"object","required":["success"],"title":"MarkReadResponse","description":"Response after marking a single notification as read."},"MediaAssetListResponse":{"properties":{"assets":{"items":{"$ref":"#/components/schemas/MediaAssetResponse"},"type":"array","title":"Assets"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["assets","count"],"title":"MediaAssetListResponse"},"MediaAssetResponse":{"properties":{"id":{"type":"string","title":"Id"},"asset_name":{"type":"string","title":"Asset Name"},"display_name":{"type":"string","title":"Display Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"media_type":{"type":"string","title":"Media Type"},"mime_type":{"type":"string","title":"Mime Type"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"},"is_active":{"type":"boolean","title":"Is Active"},"download_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Download Url"}},"type":"object","required":["id","asset_name","display_name","description","media_type","mime_type","file_size","is_active"],"title":"MediaAssetResponse"},"MediaItem":{"properties":{"message_id":{"type":"string","title":"Message Id"},"conversation_id":{"type":"string","title":"Conversation Id"},"type":{"type":"string","title":"Type"},"mime_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Mime Type"},"file_size":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"File Size"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"sender":{"type":"string","title":"Sender"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["message_id","conversation_id","type","sender","created_at"],"title":"MediaItem","description":"A media attachment from a conversation message."},"MediaListResponse":{"properties":{"items":{"items":{"$ref":"#/components/schemas/MediaItem"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["items","total"],"title":"MediaListResponse","description":"Paginated media list."},"MemberLocationsRequest":{"properties":{"location_ids":{"items":{"type":"string"},"type":"array","maxItems":100,"title":"Location Ids"}},"type":"object","title":"MemberLocationsRequest","description":"PUT body. An empty list means the member works at every branch."},"MemberLocationsResponse":{"properties":{"location_ids":{"items":{"type":"string"},"type":"array","title":"Location Ids"}},"type":"object","required":["location_ids"],"title":"MemberLocationsResponse"},"MemberServiceAssignmentInput":{"properties":{"service_id":{"type":"string","title":"Service Id"},"price_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Price Cents"},"duration_minutes":{"anyOf":[{"type":"integer","maximum":1440.0,"exclusiveMinimum":0.0},{"type":"null"}],"title":"Duration Minutes"}},"type":"object","required":["service_id"],"title":"MemberServiceAssignmentInput","description":"One entry in the bulk-replace payload for a member's service list."},"MemberServiceAssignmentOut":{"properties":{"service_id":{"type":"string","title":"Service Id"},"service_name":{"type":"string","title":"Service Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"currency":{"type":"string","title":"Currency"},"duration_minutes":{"type":"integer","title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Price Cents"},"override_duration_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Override Duration Minutes"},"override_price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Override Price Cents"}},"type":"object","required":["service_id","service_name","description","currency","duration_minutes","price_cents","override_duration_minutes","override_price_cents"],"title":"MemberServiceAssignmentOut","description":"One assigned service from a member's perspective.\n\nEffective fields (``duration_minutes``, ``price_cents``) reflect the\nper-row override when set, else the service's catalog default. The\n``override_*`` fields expose the raw override values for the portal\nUI to distinguish \"uses default\" from \"explicit override\"."},"MemberServicesListResponse":{"properties":{"assignments":{"items":{"$ref":"#/components/schemas/MemberServiceAssignmentOut"},"type":"array","title":"Assignments"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["assignments","total"],"title":"MemberServicesListResponse","description":"Response from GET /portal/staff/{id}/services."},"MemberServicesPutRequest":{"properties":{"assignments":{"items":{"$ref":"#/components/schemas/MemberServiceAssignmentInput"},"type":"array","maxItems":200,"title":"Assignments"}},"type":"object","required":["assignments"],"title":"MemberServicesPutRequest","description":"Replace the member's entire service list with this set.\n\nEmpty list clears all assignments."},"MemoriesListResponse":{"properties":{"memories":{"items":{"$ref":"#/components/schemas/MemoryItem"},"type":"array","title":"Memories"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["memories","total"],"title":"MemoriesListResponse","description":"List of memories/notes for a specific customer."},"MemoryItem":{"properties":{"id":{"type":"string","title":"Id"},"memory_type":{"type":"string","title":"Memory Type"},"content":{"type":"string","title":"Content"},"importance_score":{"type":"number","title":"Importance Score"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","memory_type","content","importance_score","created_at"],"title":"MemoryItem","description":"AI-extracted or manually added customer memory/note."},"MergeRequest":{"properties":{"loser_id":{"type":"string","title":"Loser Id"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"}},"type":"object","required":["loser_id"],"title":"MergeRequest"},"ModuleState":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"source":{"type":"string","title":"Source","description":"vertical_default | admin_override | plan"}},"type":"object","required":["enabled","source"],"title":"ModuleState","description":"Resolved on/off state for a single module."},"ModulesResponse":{"properties":{"modules":{"additionalProperties":{"$ref":"#/components/schemas/ModuleState"},"type":"object","title":"Modules","description":"Every module id → resolved {enabled, source}."},"defaults":{"items":{"type":"string"},"type":"array","title":"Defaults","description":"Module ids enabled by the tenant's vertical default."}},"type":"object","required":["modules","defaults"],"title":"ModulesResponse","description":"Full module state for a tenant."},"ModulesUpdate":{"properties":{"modules":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Modules","description":"Map of module id to desired enabled state (admin override)."}},"type":"object","required":["modules"],"title":"ModulesUpdate","description":"Admin override request: module id → enabled."},"NaturalnessLevel":{"type":"string","enum":["professional","natural","very_human"],"title":"NaturalnessLevel","description":"Voice naturalness presets for tenant customization."},"NoPaymentRequiredResponse":{"properties":{"requires_payment":{"type":"boolean","title":"Requires Payment","default":false},"subscription_id":{"type":"string","title":"Subscription Id"},"message":{"type":"string","title":"Message"}},"type":"object","required":["subscription_id","message"],"title":"NoPaymentRequiredResponse","description":"Response when the discounted total is $0 — no Stripe Elements needed.\n\nFrontend type-discriminates on `requires_payment`: when False, skip the\nElements form and call `completePaymentStep` directly to advance the\nonboarding wizard."},"NotificationOut":{"properties":{"id":{"type":"string","title":"Id"},"type":{"type":"string","title":"Type"},"title":{"type":"string","title":"Title"},"body":{"type":"string","title":"Body"},"resource_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Type"},"resource_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Id"},"read_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Read At"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","type","title","body","created_at"],"title":"NotificationOut","description":"Single notification with type, content, and read status."},"NotificationRoutingOut":{"properties":{"feature":{"type":"string","title":"Feature"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"fallback_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fallback Phone","description":"The tenant.escalation_phone fallback if no override is set"}},"type":"object","required":["feature"],"title":"NotificationRoutingOut","description":"Per-feature notification routing override."},"NotificationRoutingUpdate":{"properties":{"phone":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Phone"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"}},"type":"object","title":"NotificationRoutingUpdate","description":"Request body for setting a per-feature notification override.\n\nPass `phone=null` to clear the override (falls back to escalation_phone)."},"NotificationsListResponse":{"properties":{"notifications":{"items":{"$ref":"#/components/schemas/NotificationOut"},"type":"array","title":"Notifications"},"unread_count":{"type":"integer","title":"Unread Count"}},"type":"object","required":["notifications","unread_count"],"title":"NotificationsListResponse","description":"List of notifications with unread count for badge display."},"NumberLocationRequest":{"properties":{"e164":{"type":"string","maxLength":32,"title":"E164"},"location_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Location Id"}},"type":"object","required":["e164"],"title":"NumberLocationRequest"},"OAuthStartResponse":{"properties":{"auth_url":{"type":"string","title":"Auth Url"},"state":{"type":"string","title":"State"},"redirect_uri":{"type":"string","title":"Redirect Uri"}},"type":"object","required":["auth_url","state","redirect_uri"],"title":"OAuthStartResponse","description":"Response for OAuth start."},"OnboardingCompleteResponse":{"properties":{"portal_callback_url":{"type":"string","title":"Portal Callback Url"}},"type":"object","required":["portal_callback_url"],"title":"OnboardingCompleteResponse","description":"Response for onboarding completion handoff."},"OnboardingLinkRequest":{"properties":{"return_url":{"type":"string","title":"Return Url"},"refresh_url":{"type":"string","title":"Refresh Url"}},"type":"object","required":["return_url","refresh_url"],"title":"OnboardingLinkRequest","description":"Request to generate onboarding link."},"OnboardingLinkResponse":{"properties":{"url":{"type":"string","title":"Url"},"account_id":{"type":"string","title":"Account Id"}},"type":"object","required":["url","account_id"],"title":"OnboardingLinkResponse","description":"Response with onboarding link."},"OnboardingProgressResponse":{"properties":{"has_knowledge":{"type":"boolean","title":"Has Knowledge","description":"Has at least one knowledge source or document"},"has_phone":{"type":"boolean","title":"Has Phone","description":"Has a phone number assigned"},"has_voice_configured":{"type":"boolean","title":"Has Voice Configured","description":"Voice agent is configured (non-default)"},"has_whatsapp":{"type":"boolean","title":"Has Whatsapp","description":"WhatsApp channel is connected"},"has_calendar":{"type":"boolean","title":"Has Calendar","description":"At least one calendar integration connected"},"has_conversation":{"type":"boolean","title":"Has Conversation","description":"Has at least one real conversation"},"completed_steps":{"type":"integer","title":"Completed Steps","description":"Number of completed steps"},"total_steps":{"type":"integer","title":"Total Steps","description":"Total onboarding steps"},"progress_pct":{"type":"integer","title":"Progress Pct","description":"Progress percentage (0-100)"},"dismissed_steps":{"items":{"type":"string"},"type":"array","title":"Dismissed Steps","description":"Step ids the practice has dismissed. Practice-wide, not per user. The client treats these as satisfied so the checklist can be finished by a clinic that will never connect, say, WhatsApp."}},"type":"object","required":["has_knowledge","has_phone","has_voice_configured","has_whatsapp","has_calendar","has_conversation","completed_steps","total_steps","progress_pct"],"title":"OnboardingProgressResponse","description":"Onboarding checklist progress for new tenants."},"OnboardingRunOut":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"current_step":{"type":"integer","title":"Current Step"},"current_step_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Current Step Id"},"validated_step_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Validated Step Id"},"status":{"type":"string","title":"Status"},"percent_complete":{"type":"integer","title":"Percent Complete"},"next_step_no":{"type":"integer","title":"Next Step No"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region"},"flow_variant":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Flow Variant"},"selected_plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Selected Plan"},"locked_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locked By"},"locked_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Locked At"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","tenant_id","current_step","status","percent_complete","next_step_no","created_at","updated_at"],"title":"OnboardingRunOut","description":"Onboarding run output model."},"OnboardingStateData":{"properties":{"run":{"$ref":"#/components/schemas/OnboardingRunOut"},"steps":{"items":{"$ref":"#/components/schemas/StepDefinitionOut"},"type":"array","title":"Steps"},"can_advance":{"type":"boolean","title":"Can Advance","default":false},"next_step_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Step Id"},"blockers":{"items":{"type":"string"},"type":"array","title":"Blockers"},"step_records":{"items":{"$ref":"#/components/schemas/OnboardingStepOut"},"type":"array","title":"Step Records"},"tenant_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Name"},"business_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Type"},"datasource_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Datasource Status"},"rag_ready":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Rag Ready"},"rag_blockers":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Rag Blockers"},"latest_job_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Job Status"},"documents_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Documents Count"},"email_verified":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Email Verified"},"is_sample_data":{"type":"boolean","title":"Is Sample Data","default":false},"scrape_blocked":{"type":"boolean","title":"Scrape Blocked","default":false},"scrape_blocked_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scrape Blocked Reason"},"hub_status":{"anyOf":[{"items":{"$ref":"#/components/schemas/HubItemStatus"},"type":"array"},{"type":"null"}],"title":"Hub Status"},"hub_can_proceed":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Hub Can Proceed"}},"type":"object","required":["run","steps"],"title":"OnboardingStateData","description":"Onboarding state payload."},"OnboardingStateResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"$ref":"#/components/schemas/OnboardingStateData"}},"type":"object","required":["data"],"title":"OnboardingStateResponse","description":"Onboarding state response envelope."},"OnboardingStepDetail":{"properties":{"step_no":{"type":"integer","title":"Step No"},"type":{"type":"string","title":"Type"},"status":{"type":"string","title":"Status"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"duration_seconds":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Duration Seconds"},"retries":{"type":"integer","title":"Retries","default":0},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Payload"}},"type":"object","required":["step_no","type","status"],"title":"OnboardingStepDetail"},"OnboardingStepOut":{"properties":{"id":{"type":"string","title":"Id"},"run_id":{"type":"string","title":"Run Id"},"step_no":{"type":"integer","title":"Step No"},"type":{"type":"string","title":"Type"},"status":{"type":"string","title":"Status"},"payload":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Payload"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"},"started_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Started At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"},"retries":{"type":"integer","title":"Retries"}},"type":"object","required":["id","run_id","step_no","type","status","retries"],"title":"OnboardingStepOut","description":"Onboarding step output model."},"OnboardingSummary":{"properties":{"current_step":{"type":"integer","title":"Current Step"},"status":{"type":"string","title":"Status"},"percent_complete":{"type":"integer","title":"Percent Complete"},"selected_plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Selected Plan"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region"}},"type":"object","required":["current_step","status","percent_complete"],"title":"OnboardingSummary"},"OnboardingTokenExchangeRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"OnboardingTokenExchangeRequest","description":"Request model for exchanging onboarding token."},"OptiStoreConnectRequest":{"properties":{"base_url":{"type":"string","title":"Base Url"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"api_key":{"type":"string","title":"Api Key"},"api_secret":{"type":"string","title":"Api Secret"},"locations":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Locations"}},"type":"object","required":["base_url","api_key","api_secret"],"title":"OptiStoreConnectRequest"},"OptiStoreConnectResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"location":{"type":"string","title":"Location"},"base_url":{"type":"string","title":"Base Url"},"schedules_seen":{"type":"integer","title":"Schedules Seen"},"applied":{"items":{"type":"string"},"type":"array","title":"Applied"},"conflicts":{"items":{"type":"string"},"type":"array","title":"Conflicts"},"locations":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Locations"},"schedules_by_store":{"anyOf":[{"additionalProperties":{"type":"integer"},"type":"object"},{"type":"null"}],"title":"Schedules By Store"}},"type":"object","required":["tenant_id","tenant_name","location","base_url","schedules_seen","applied","conflicts"],"title":"OptiStoreConnectResponse"},"OptiStoreStatusResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"connected":{"type":"boolean","title":"Connected"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"locations":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Locations"},"base_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Base Url"},"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"usable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Usable"},"problem":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Problem"}},"type":"object","required":["tenant_id","tenant_name","connected"],"title":"OptiStoreStatusResponse"},"OpticalPrescriptionCreate":{"properties":{"issued_date":{"type":"string","format":"date","title":"Issued Date"},"validity_months":{"type":"integer","maximum":120.0,"minimum":1.0,"title":"Validity Months","default":24},"kind":{"type":"string","title":"Kind","default":"general"},"details":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Details"},"attachment_id":{"anyOf":[{"type":"string","maxLength":64},{"type":"null"}],"title":"Attachment Id"},"od_sphere":{"anyOf":[{"type":"number","maximum":30.0,"minimum":-30.0},{"type":"null"}],"title":"Od Sphere"},"od_cylinder":{"anyOf":[{"type":"number","maximum":15.0,"minimum":-15.0},{"type":"null"}],"title":"Od Cylinder"},"od_axis":{"anyOf":[{"type":"integer","maximum":180.0,"minimum":0.0},{"type":"null"}],"title":"Od Axis"},"od_add":{"anyOf":[{"type":"number","maximum":10.0,"minimum":0.0},{"type":"null"}],"title":"Od Add"},"os_sphere":{"anyOf":[{"type":"number","maximum":30.0,"minimum":-30.0},{"type":"null"}],"title":"Os Sphere"},"os_cylinder":{"anyOf":[{"type":"number","maximum":15.0,"minimum":-15.0},{"type":"null"}],"title":"Os Cylinder"},"os_axis":{"anyOf":[{"type":"integer","maximum":180.0,"minimum":0.0},{"type":"null"}],"title":"Os Axis"},"os_add":{"anyOf":[{"type":"number","maximum":10.0,"minimum":0.0},{"type":"null"}],"title":"Os Add"},"pupillary_distance":{"anyOf":[{"type":"number","maximum":85.0,"minimum":40.0},{"type":"null"}],"title":"Pupillary Distance"},"prescribed_by":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Prescribed By"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes"}},"type":"object","required":["issued_date"],"title":"OpticalPrescriptionCreate"},"OpticalPrescriptionItem":{"properties":{"id":{"type":"string","title":"Id"},"kind":{"type":"string","title":"Kind","default":"general"},"details":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Details"},"attachment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attachment Id"},"attachment_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Attachment Filename"},"od_sphere":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Od Sphere"},"od_cylinder":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Od Cylinder"},"od_axis":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Od Axis"},"od_add":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Od Add"},"os_sphere":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Os Sphere"},"os_cylinder":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Os Cylinder"},"os_axis":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Os Axis"},"os_add":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Os Add"},"pupillary_distance":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Pupillary Distance"},"issued_date":{"type":"string","title":"Issued Date"},"validity_months":{"type":"integer","title":"Validity Months"},"prescribed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Prescribed By"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"archived_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Archived At"},"expires_on":{"type":"string","title":"Expires On"},"is_expired":{"type":"boolean","title":"Is Expired"},"days_remaining":{"type":"integer","title":"Days Remaining"}},"type":"object","required":["id","issued_date","validity_months","expires_on","is_expired","days_remaining"],"title":"OpticalPrescriptionItem","description":"One prescription as the client sees it."},"OpticalPrescriptionsResponse":{"properties":{"prescriptions":{"items":{"$ref":"#/components/schemas/OpticalPrescriptionItem"},"type":"array","title":"Prescriptions"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["prescriptions","total"],"title":"OpticalPrescriptionsResponse"},"OutboundPolicyResponse":{"properties":{"quiet_hours_enabled":{"type":"boolean","title":"Quiet Hours Enabled"},"quiet_start":{"type":"string","title":"Quiet Start"},"quiet_end":{"type":"string","title":"Quiet End"},"daily_cap":{"type":"integer","title":"Daily Cap"},"timezone":{"type":"string","title":"Timezone"}},"type":"object","required":["quiet_hours_enabled","quiet_start","quiet_end","daily_cap","timezone"],"title":"OutboundPolicyResponse","description":"Quiet hours + daily cap governing PROACTIVE outreach — campaigns and\nfollow-up / re-engagement flows. Booking confirmations, reminders and live\nreplies are transactional and never held back."},"OutboundPolicyUpdate":{"properties":{"quiet_hours_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Quiet Hours Enabled"},"quiet_start":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},{"type":"null"}],"title":"Quiet Start"},"quiet_end":{"anyOf":[{"type":"string","pattern":"^([01]\\d|2[0-3]):[0-5]\\d$"},{"type":"null"}],"title":"Quiet End"},"daily_cap":{"anyOf":[{"type":"integer","maximum":100000.0,"minimum":0.0},{"type":"null"}],"title":"Daily Cap"}},"type":"object","title":"OutboundPolicyUpdate","description":"Partial update; omitted fields keep their current value."},"PartnerBankingRequest":{"properties":{"account_holder":{"type":"string","maxLength":255,"title":"Account Holder"},"bank_name":{"type":"string","maxLength":255,"title":"Bank Name"},"account_number":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Account Number"},"iban":{"anyOf":[{"type":"string","maxLength":50},{"type":"null"}],"title":"Iban"},"swift":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Swift"},"bank_address":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Bank Address"},"contact_number":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Contact Number"}},"type":"object","required":["account_holder","bank_name"],"title":"PartnerBankingRequest"},"PartnerClientCommissionBreakdown":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"type":"string","title":"Business Name"},"amount_paid_cents":{"type":"integer","title":"Amount Paid Cents"},"commission_rate":{"type":"integer","title":"Commission Rate"},"commission_amount_cents":{"type":"integer","title":"Commission Amount Cents"}},"type":"object","required":["tenant_id","business_name","amount_paid_cents","commission_rate","commission_amount_cents"],"title":"PartnerClientCommissionBreakdown"},"PartnerClientResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"type":"string","title":"Business Name"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email"},"status":{"type":"string","title":"Status"},"signup_date":{"type":"string","format":"date-time","title":"Signup Date"},"plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Plan"},"interval":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Interval"},"amount_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Cents"},"billing_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Billing Status"},"commission_rate":{"type":"integer","title":"Commission Rate"},"ongoing_rate":{"type":"integer","title":"Ongoing Rate"},"total_commission_cents":{"type":"integer","title":"Total Commission Cents"},"total_paid_cycles":{"type":"integer","title":"Total Paid Cycles"}},"type":"object","required":["tenant_id","business_name","contact_email","status","signup_date","plan","interval","amount_cents","billing_status","commission_rate","ongoing_rate","total_commission_cents","total_paid_cycles"],"title":"PartnerClientResponse"},"PartnerCommissionResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"stripe_invoice_id":{"type":"string","title":"Stripe Invoice Id"},"amount_paid_cents":{"type":"integer","title":"Amount Paid Cents"},"commission_rate":{"type":"integer","title":"Commission Rate"},"commission_amount_cents":{"type":"integer","title":"Commission Amount Cents"},"billing_cycle_number":{"type":"integer","title":"Billing Cycle Number"},"status":{"type":"string","title":"Status"},"period_start":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Period Start"},"period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Period End"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","tenant_id","stripe_invoice_id","amount_paid_cents","commission_rate","commission_amount_cents","billing_cycle_number","status","period_start","period_end","created_at"],"title":"PartnerCommissionResponse"},"PartnerDashboardResponse":{"properties":{"total_clients":{"type":"integer","title":"Total Clients"},"active_clients":{"type":"integer","title":"Active Clients"},"total_commission_cents":{"type":"integer","title":"Total Commission Cents"},"pending_commission_cents":{"type":"integer","title":"Pending Commission Cents"},"current_month_commission_cents":{"type":"integer","title":"Current Month Commission Cents"}},"type":"object","required":["total_clients","active_clients","total_commission_cents","pending_commission_cents","current_month_commission_cents"],"title":"PartnerDashboardResponse"},"PartnerLoginRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"password":{"type":"string","title":"Password"}},"type":"object","required":["email","password"],"title":"PartnerLoginRequest"},"PartnerMonthlySummary":{"properties":{"month":{"type":"string","title":"Month"},"total_commission_cents":{"type":"integer","title":"Total Commission Cents"},"total_paid_cents":{"type":"integer","title":"Total Paid Cents"},"client_count":{"type":"integer","title":"Client Count"},"breakdown":{"items":{"$ref":"#/components/schemas/PartnerClientCommissionBreakdown"},"type":"array","title":"Breakdown"}},"type":"object","required":["month","total_commission_cents","total_paid_cents","client_count","breakdown"],"title":"PartnerMonthlySummary"},"PartnerProfileResponse":{"properties":{"id":{"type":"string","title":"Id"},"partner_code":{"type":"string","title":"Partner Code"},"email":{"type":"string","title":"Email"},"name":{"type":"string","title":"Name"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"status":{"type":"string","title":"Status"},"default_commission_rate":{"type":"integer","title":"Default Commission Rate"},"default_ongoing_rate":{"type":"integer","title":"Default Ongoing Rate"},"default_commission_cycles":{"type":"integer","title":"Default Commission Cycles"},"banking_details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Banking Details"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","partner_code","email","name","company","phone","status","default_commission_rate","default_ongoing_rate","default_commission_cycles","banking_details","created_at"],"title":"PartnerProfileResponse"},"PartnerProfileUpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"company":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Company"},"phone":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Phone"}},"type":"object","title":"PartnerProfileUpdateRequest"},"PartnerRegisterRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"password":{"type":"string","maxLength":128,"minLength":8,"title":"Password"},"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"company":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Company"},"phone":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Phone"}},"type":"object","required":["email","password","name"],"title":"PartnerRegisterRequest"},"PartnerTokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"partner_id":{"type":"string","title":"Partner Id"},"partner_code":{"type":"string","title":"Partner Code"},"name":{"type":"string","title":"Name"},"email":{"type":"string","title":"Email"}},"type":"object","required":["access_token","partner_id","partner_code","name","email"],"title":"PartnerTokenResponse"},"PartnerValidateResponse":{"properties":{"partner_code":{"type":"string","title":"Partner Code"},"name":{"type":"string","title":"Name"},"company":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Company"}},"type":"object","required":["partner_code","name"],"title":"PartnerValidateResponse","description":"Public response for partner code validation on signup.\n\nIntentionally minimal — we return only the partner's display name\n(and optionally company) so the signup UI can confirm the referral\nwithout leaking email, rates, or banking info. Inactive or unknown\ncodes return 404, not 200 with `is_valid: false`, so the frontend\ncan treat 200 as \"valid & confirmed\"."},"PasswordResetRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"PasswordResetRequest","description":"Request model for initiating password reset."},"PasswordResetResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"PasswordResetResponse","description":"Response model for password reset request."},"PatientAlertCreate":{"properties":{"alert_type":{"type":"string","title":"Alert Type"},"message":{"type":"string","maxLength":500,"minLength":1,"title":"Message"},"severity":{"type":"string","title":"Severity","default":"warning"},"detail":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Detail"},"starts_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Starts At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"}},"type":"object","required":["alert_type","message"],"title":"PatientAlertCreate"},"PatientAlertOut":{"properties":{"alert_type":{"type":"string","title":"Alert Type"},"severity":{"type":"string","title":"Severity"},"message":{"type":"string","title":"Message"},"source":{"type":"string","title":"Source","default":"manual"},"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"},"starts_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Starts At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"acknowledged_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Acknowledged At"},"acknowledged_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Acknowledged By Name"},"created_by_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Name"},"is_clinical":{"type":"boolean","title":"Is Clinical","default":false},"extra":{"additionalProperties":true,"type":"object","title":"Extra","default":{}}},"type":"object","required":["alert_type","severity","message"],"title":"PatientAlertOut","description":"One alert, manual or screening-derived."},"PatientAlertsResponse":{"properties":{"alerts":{"items":{"$ref":"#/components/schemas/PatientAlertOut"},"type":"array","title":"Alerts"},"total":{"type":"integer","title":"Total"},"highest_severity":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Highest Severity"},"clinical_withheld":{"type":"boolean","title":"Clinical Withheld","default":false}},"type":"object","required":["alerts","total"],"title":"PatientAlertsResponse"},"PatientAudienceFilter":{"properties":{"status":{"anyOf":[{"type":"string","maxLength":40},{"type":"null"}],"title":"Status","description":"Patient status (lead, new, active, returning, dormant)"},"last_visit_before_days":{"anyOf":[{"type":"integer","maximum":3650.0,"minimum":1.0},{"type":"null"}],"title":"Last Visit Before Days","description":"No visit in the last N days (and at least one visit ever) — recall"},"last_visit_after_days":{"anyOf":[{"type":"integer","maximum":3650.0,"minimum":1.0},{"type":"null"}],"title":"Last Visit After Days","description":"Visited within the last N days"},"service_type":{"anyOf":[{"type":"string","maxLength":120},{"type":"null"}],"title":"Service Type","description":"Had a visit for this service"},"no_upcoming":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"No Upcoming","description":"No pending/confirmed future booking"},"practitioner_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Practitioner Id"},"tag":{"anyOf":[{"type":"string","maxLength":60},{"type":"null"}],"title":"Tag"}},"type":"object","title":"PatientAudienceFilter","description":"Rule-based audience from the patient base. All fields optional, AND-ed.\nArchived and opted-out patients are always excluded."},"PatientAuditChange":{"properties":{"field":{"type":"string","title":"Field"},"old":{"title":"Old"},"new":{"title":"New"}},"type":"object","required":["field"],"title":"PatientAuditChange"},"PatientAuditEntry":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"action":{"type":"string","title":"Action"},"actor_kind":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor Kind"},"actor_user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Actor User Id"},"fields":{"items":{"type":"string"},"type":"array","title":"Fields","default":[]},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"changes":{"anyOf":[{"items":{"$ref":"#/components/schemas/PatientAuditChange"},"type":"array"},{"type":"null"}],"title":"Changes"},"values_unavailable":{"type":"boolean","title":"Values Unavailable","default":false}},"type":"object","required":["action"],"title":"PatientAuditEntry"},"PatientAuditResponse":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/PatientAuditEntry"},"type":"array","title":"Entries"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["entries","total"],"title":"PatientAuditResponse"},"PatientDeletionPlanResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"customer_id":{"type":"string","title":"Customer Id"},"patient_name":{"type":"string","title":"Patient Name"},"deleted":{"additionalProperties":{"type":"integer"},"type":"object","title":"Deleted"},"blanked":{"additionalProperties":{"type":"integer"},"type":"object","title":"Blanked"},"kept":{"additionalProperties":{"type":"integer"},"type":"object","title":"Kept"},"files":{"type":"integer","title":"Files"},"shared_numbers":{"type":"integer","title":"Shared Numbers"},"left_on_shared_numbers":{"additionalProperties":{"type":"integer"},"type":"object","title":"Left On Shared Numbers","default":{}},"keeps_do_not_contact":{"type":"boolean","title":"Keeps Do Not Contact"},"consents_retained":{"type":"integer","title":"Consents Retained","default":0},"consent_recordings_left":{"type":"integer","title":"Consent Recordings Left","default":0},"blockers":{"items":{"type":"string"},"type":"array","title":"Blockers"},"linked_patients":{"items":{"additionalProperties":{"type":"string"},"type":"object"},"type":"array","title":"Linked Patients","default":[]},"token":{"type":"string","title":"Token"}},"type":"object","required":["tenant_id","customer_id","patient_name","deleted","blanked","kept","files","shared_numbers","keeps_do_not_contact","blockers","token"],"title":"PatientDeletionPlanResponse"},"PatientDeletionRecord":{"properties":{"deletion_id":{"type":"string","title":"Deletion Id"},"customer_id":{"type":"string","title":"Customer Id"},"requested_by":{"type":"string","title":"Requested By"},"status":{"type":"string","title":"Status"},"rows_deleted":{"type":"integer","title":"Rows Deleted"},"rows_blanked":{"type":"integer","title":"Rows Blanked"},"files_deleted":{"type":"integer","title":"Files Deleted"},"files_pending":{"type":"integer","title":"Files Pending"},"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":["deletion_id","customer_id","requested_by","status","rows_deleted","rows_blanked","files_deleted","files_pending","created_at","completed_at"],"title":"PatientDeletionRecord"},"PatientDeletionRequest":{"properties":{"token":{"type":"string","title":"Token"},"confirm_name":{"type":"string","title":"Confirm Name"},"reason":{"type":"string","title":"Reason"}},"type":"object","required":["token","confirm_name","reason"],"title":"PatientDeletionRequest"},"PatientDeletionResultResponse":{"properties":{"deletion_id":{"type":"string","title":"Deletion Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"customer_id":{"type":"string","title":"Customer Id"},"deleted":{"additionalProperties":{"type":"integer"},"type":"object","title":"Deleted"},"blanked":{"additionalProperties":{"type":"integer"},"type":"object","title":"Blanked"},"kept":{"additionalProperties":{"type":"integer"},"type":"object","title":"Kept"},"files":{"type":"integer","title":"Files"},"files_removed":{"type":"integer","title":"Files Removed"},"files_failed":{"type":"integer","title":"Files Failed"},"folder_swept":{"type":"boolean","title":"Folder Swept","default":true},"shared_numbers":{"type":"integer","title":"Shared Numbers"},"left_on_shared_numbers":{"additionalProperties":{"type":"integer"},"type":"object","title":"Left On Shared Numbers","default":{}},"kept_do_not_contact":{"type":"boolean","title":"Kept Do Not Contact"},"consents_retained":{"type":"integer","title":"Consents Retained","default":0},"consent_recordings_left":{"type":"integer","title":"Consent Recordings Left","default":0}},"type":"object","required":["deletion_id","tenant_id","customer_id","deleted","blanked","kept","files","files_removed","files_failed","shared_numbers","kept_do_not_contact"],"title":"PatientDeletionResultResponse"},"PaymentDetail":{"properties":{"id":{"type":"string","title":"Id"},"amount_cents":{"type":"integer","title":"Amount Cents"},"currency":{"type":"string","title":"Currency","default":"usd"},"status":{"type":"string","title":"Status"},"description":{"type":"string","title":"Description"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Phone"},"refunded_amount_cents":{"type":"integer","title":"Refunded Amount Cents","default":0},"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","amount_cents","status","description","created_at"],"title":"PaymentDetail"},"PaymentIntentRequest":{"properties":{"promo_code":{"anyOf":[{"type":"string","maxLength":100},{"type":"null"}],"title":"Promo Code","description":"Stripe promotion code string (e.g., WELCOME20)"}},"type":"object","title":"PaymentIntentRequest","description":"Request for embedded payment flow (Stripe Elements)."},"PaymentIntentResponse":{"properties":{"client_secret":{"type":"string","title":"Client Secret"},"subscription_id":{"type":"string","title":"Subscription Id"},"intent_type":{"type":"string","title":"Intent Type"},"amount_due_minor":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Amount Due Minor"},"currency":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Currency"},"trial_end":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trial End"}},"type":"object","required":["client_secret","subscription_id","intent_type"],"title":"PaymentIntentResponse","description":"Response for embedded payment flow (Stripe Elements)."},"PaymentIntentResponseEnvelope":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"anyOf":[{"$ref":"#/components/schemas/PaymentIntentResponse"},{"$ref":"#/components/schemas/EmailVerificationRequiredResponse"},{"$ref":"#/components/schemas/NoPaymentRequiredResponse"}],"title":"Data"}},"type":"object","required":["data"],"title":"PaymentIntentResponseEnvelope","description":"Payment intent response envelope."},"PaymentLinkResponse":{"properties":{"payment_link_id":{"type":"string","title":"Payment Link Id"},"payment_link_url":{"type":"string","title":"Payment Link Url"},"session_id":{"type":"string","title":"Session Id"},"expires_at":{"type":"string","title":"Expires At"},"amount_cents":{"type":"integer","title":"Amount Cents"},"currency":{"type":"string","title":"Currency"},"description":{"type":"string","title":"Description"},"is_existing":{"type":"boolean","title":"Is Existing","default":false}},"type":"object","required":["payment_link_id","payment_link_url","session_id","expires_at","amount_cents","currency","description"],"title":"PaymentLinkResponse","description":"Response with payment link details."},"PaymentListResponse":{"properties":{"payments":{"items":{"$ref":"#/components/schemas/PaymentResponse"},"type":"array","title":"Payments"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["payments","total"],"title":"PaymentListResponse","description":"Response model for payments list."},"PaymentResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"booking_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Id"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"},"stripe_checkout_session_id":{"type":"string","title":"Stripe Checkout Session Id"},"stripe_payment_intent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Payment Intent Id"},"amount_cents":{"type":"integer","title":"Amount Cents"},"currency":{"type":"string","title":"Currency"},"description":{"type":"string","title":"Description"},"customer_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Email"},"customer_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Phone"},"status":{"type":"string","title":"Status"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"completed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Completed At"}},"type":"object","required":["id","tenant_id","booking_id","conversation_id","stripe_checkout_session_id","stripe_payment_intent_id","amount_cents","currency","description","customer_email","customer_phone","status","created_at","updated_at","completed_at"],"title":"PaymentResponse","description":"Payment response model."},"PayoutInfoResponse":{"properties":{"available_balance":{"type":"integer","title":"Available Balance"},"pending_balance":{"type":"integer","title":"Pending Balance"},"currency":{"type":"string","title":"Currency"},"payout_interval":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Interval"},"payout_delay_days":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Payout Delay Days"}},"type":"object","required":["available_balance","pending_balance","currency","payout_interval","payout_delay_days"],"title":"PayoutInfoResponse","description":"Payout schedule and balance information for Stripe Connect account."},"PeakHoursResponse":{"properties":{"hourly":{"items":{"$ref":"#/components/schemas/HourlyDataPoint"},"type":"array","title":"Hourly"},"daily":{"items":{"$ref":"#/components/schemas/DailyDataPoint"},"type":"array","title":"Daily"},"peak_hour":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Peak Hour"},"peak_day":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Peak Day"}},"type":"object","required":["hourly","daily"],"title":"PeakHoursResponse","description":"Peak hours analytics response."},"PerformanceMetrics":{"properties":{"avg_messages_per_conversation":{"type":"number","title":"Avg Messages Per Conversation","default":0.0},"avg_conversation_duration_minutes":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Conversation Duration Minutes"},"resolution_rate":{"type":"number","title":"Resolution Rate","default":0.0},"escalation_rate":{"type":"number","title":"Escalation Rate","default":0.0},"most_active_channel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Most Active Channel"},"channel_distribution":{"additionalProperties":{"type":"number"},"type":"object","title":"Channel Distribution"},"conversations_change_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Conversations Change Pct"},"messages_change_pct":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Messages Change Pct"}},"type":"object","title":"PerformanceMetrics","description":"Performance and engagement metrics."},"PerformanceResponse":{"properties":{"period":{"type":"string","title":"Period","description":"Analysis period: week, month"},"metrics":{"$ref":"#/components/schemas/PerformanceMetrics"},"current_period":{"$ref":"#/components/schemas/DashboardStats"},"previous_period":{"$ref":"#/components/schemas/DashboardStats"}},"type":"object","required":["period","metrics","current_period","previous_period"],"title":"PerformanceResponse","description":"Performance analytics response."},"PhoneNumberDetail":{"properties":{"id":{"type":"string","title":"Id"},"e164":{"type":"string","title":"E164"},"provider":{"type":"string","title":"Provider"},"status":{"type":"string","title":"Status"},"country_code":{"type":"string","title":"Country Code","default":"US"},"monthly_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Cost Cents"},"whatsapp_enabled":{"type":"boolean","title":"Whatsapp Enabled","default":false},"assigned_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Assigned At"}},"type":"object","required":["id","e164","provider","status"],"title":"PhoneNumberDetail"},"PhoneNumberInfo":{"properties":{"id":{"type":"string","title":"Id"},"e164":{"type":"string","title":"E164"},"friendly_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Friendly Name"},"provider":{"type":"string","title":"Provider"},"capabilities":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Capabilities"}},"type":"object","required":["id","e164","friendly_name","provider","capabilities"],"title":"PhoneNumberInfo","description":"Assigned phone number details."},"PhoneNumberListResponse":{"properties":{"numbers":{"items":{"$ref":"#/components/schemas/PhoneNumberResponse"},"type":"array","title":"Numbers"},"count":{"type":"integer","title":"Count"},"offset":{"type":"integer","title":"Offset"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["numbers","count","offset","limit"],"title":"PhoneNumberListResponse","description":"Response for listing phone numbers."},"PhoneNumberResponse":{"properties":{"id":{"type":"string","title":"Id"},"e164":{"type":"string","title":"E164"},"friendly_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Friendly Name"},"provider":{"type":"string","title":"Provider"},"provider_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider Sid"},"status":{"type":"string","title":"Status"},"tenant_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tenant Id"},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"},"country_code":{"type":"string","title":"Country Code"},"capabilities":{"anyOf":[{"additionalProperties":{"type":"boolean"},"type":"object"},{"type":"null"}],"title":"Capabilities"},"monthly_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Cost Cents"},"whatsapp_enabled":{"type":"boolean","title":"Whatsapp Enabled","default":false},"whatsapp_sender_sid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Whatsapp Sender Sid"}},"type":"object","required":["id","e164","friendly_name","provider","provider_sid","status","tenant_id","area_code","country_code","capabilities","monthly_cost_cents"],"title":"PhoneNumberResponse","description":"Response for a phone number."},"PlanCapabilities":{"properties":{"plan":{"type":"string","title":"Plan"},"voice_enabled":{"type":"boolean","title":"Voice Enabled"},"sms_enabled":{"type":"boolean","title":"Sms Enabled","default":true},"can_buy":{"type":"boolean","title":"Can Buy"},"reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reason"},"is_expired":{"type":"boolean","title":"Is Expired","default":false}},"type":"object","required":["plan","voice_enabled","can_buy"],"title":"PlanCapabilities","description":"What the tenant's current plan allows for phone numbers."},"PlanDetails":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"monthly_price":{"type":"integer","title":"Monthly Price"},"annual_price":{"type":"integer","title":"Annual Price"},"annual_monthly_equivalent":{"type":"integer","title":"Annual Monthly Equivalent"},"annual_savings":{"type":"integer","title":"Annual Savings"},"features":{"items":{"type":"string"},"type":"array","title":"Features"},"limits":{"additionalProperties":{"type":"integer"},"type":"object","title":"Limits"},"popular":{"type":"boolean","title":"Popular","default":false},"track":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Track","default":""},"tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tier","default":""},"coming_soon":{"type":"boolean","title":"Coming Soon","default":false},"message_limit":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Message Limit"},"voice_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Voice Minutes"},"message_overage_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Message Overage Rate"},"voice_overage_rate":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Voice Overage Rate"},"white_glove_fee":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"White Glove Fee"},"currency":{"type":"string","title":"Currency","default":"usd"},"monthly_price_minor":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Price Minor"},"message_overage_minor":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Message Overage Minor"},"voice_overage_minor":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Voice Overage Minor"},"white_glove_fee_minor":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"White Glove Fee Minor"},"location_price":{"type":"integer","title":"Location Price","default":0},"location_price_minor":{"type":"integer","title":"Location Price Minor","default":0},"voice_minutes_per_extra_location":{"type":"integer","title":"Voice Minutes Per Extra Location","default":0}},"type":"object","required":["id","name","description","monthly_price","annual_price","annual_monthly_equivalent","annual_savings","features","limits"],"title":"PlanDetails","description":"Plan configuration details."},"PlanSelectionData":{"properties":{"subscription":{"$ref":"#/components/schemas/SubscriptionResponse"}},"type":"object","required":["subscription"],"title":"PlanSelectionData","description":"Plan selection response payload."},"PlanSelectionRequest":{"properties":{"plan":{"type":"string","title":"Plan","description":"Plan ID: messaging_only, messaging_voice, or messaging_voice_pro"},"interval":{"type":"string","title":"Interval","description":"Billing interval: monthly or annual"},"locations":{"type":"integer","maximum":99.0,"minimum":1.0,"title":"Locations","description":"TOTAL locations, including the one the plan covers (ILN-766). Set from a sales link so the customer does not re-enter terms already agreed on the call. Bounded rather than unbounded: a mistyped 500 would silently bill 499 add-on locations.","default":1},"campaign_tier":{"anyOf":[{"type":"string","maxLength":32},{"type":"null"}],"title":"Campaign Tier","description":"SMS campaigns add-on tier (campaigns_100 … campaigns_1000), or none."}},"type":"object","required":["plan","interval"],"title":"PlanSelectionRequest","description":"Request body for plan selection."},"PlanSelectionResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"$ref":"#/components/schemas/PlanSelectionData"}},"type":"object","required":["data"],"title":"PlanSelectionResponse","description":"Plan selection response envelope."},"PlansListEnvelope":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"$ref":"#/components/schemas/PlansListResponse"}},"type":"object","required":["data"],"title":"PlansListEnvelope","description":"Plans list response envelope."},"PlansListResponse":{"properties":{"plans":{"items":{"$ref":"#/components/schemas/PlanDetails"},"type":"array","title":"Plans"},"campaign_addons":{"items":{"$ref":"#/components/schemas/CampaignAddonDetails"},"type":"array","title":"Campaign Addons","default":[]},"trial_days":{"type":"integer","title":"Trial Days","default":0}},"type":"object","required":["plans"],"title":"PlansListResponse","description":"List of available plans."},"PoolHealthResponse":{"properties":{"total_available":{"type":"integer","title":"Total Available"},"total_assigned":{"type":"integer","title":"Total Assigned"},"total_reserved":{"type":"integer","title":"Total Reserved"},"is_healthy":{"type":"boolean","title":"Is Healthy"},"threshold":{"type":"integer","title":"Threshold"},"available_by_country":{"additionalProperties":{"type":"integer"},"type":"object","title":"Available By Country"},"available_by_provider":{"additionalProperties":{"type":"integer"},"type":"object","title":"Available By Provider"}},"type":"object","required":["total_available","total_assigned","total_reserved","is_healthy","threshold","available_by_country","available_by_provider"],"title":"PoolHealthResponse","description":"Response for pool health status."},"PoolMetricsResponse":{"properties":{"pool_size":{"type":"integer","title":"Pool Size"},"checked_in":{"type":"integer","title":"Checked In"},"checked_out":{"type":"integer","title":"Checked Out"},"overflow":{"type":"integer","title":"Overflow"},"max_overflow":{"type":"integer","title":"Max Overflow"},"total_connections":{"type":"integer","title":"Total Connections"},"pool_utilization":{"type":"number","title":"Pool Utilization"}},"type":"object","required":["pool_size","checked_in","checked_out","overflow","max_overflow","total_connections","pool_utilization"],"title":"PoolMetricsResponse","description":"Database connection pool metrics for monitoring."},"PreferencesOut":{"properties":{"new_conversation":{"type":"boolean","title":"New Conversation"},"escalation":{"type":"boolean","title":"Escalation"},"new_booking":{"type":"boolean","title":"New Booking"},"booking_cancelled":{"type":"boolean","title":"Booking Cancelled"},"payment_received":{"type":"boolean","title":"Payment Received"},"missed_call":{"type":"boolean","title":"Missed Call"}},"type":"object","required":["new_conversation","escalation","new_booking","booking_cancelled","payment_received","missed_call"],"title":"PreferencesOut","description":"User notification preferences by event type."},"PreferencesUpdate":{"properties":{"new_conversation":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"New Conversation"},"escalation":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Escalation"},"new_booking":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"New Booking"},"booking_cancelled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Booking Cancelled"},"payment_received":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Payment Received"},"missed_call":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Missed Call"}},"type":"object","title":"PreferencesUpdate","description":"Partial update to notification preferences (null = no change)."},"PreviewSubscriptionResponse":{"properties":{"plan_id":{"type":"string","title":"Plan Id"},"location_count":{"type":"integer","title":"Location Count"},"campaign_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Tier"},"currency":{"type":"string","title":"Currency"},"monthly_total_minor":{"type":"integer","title":"Monthly Total Minor"},"proration_minor":{"type":"integer","title":"Proration Minor","default":0},"next_invoice_total_minor":{"type":"integer","title":"Next Invoice Total Minor","default":0},"next_invoice_amount_due_minor":{"type":"integer","title":"Next Invoice Amount Due Minor","default":0},"prorated":{"type":"boolean","title":"Prorated","default":false}},"type":"object","required":["plan_id","location_count","currency","monthly_total_minor"],"title":"PreviewSubscriptionResponse","description":"What a plan/location/add-on change would bill, before it is made."},"PromoCodeValidateEnvelope":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"$ref":"#/components/schemas/PromoCodeValidateResponse"}},"type":"object","required":["data"],"title":"PromoCodeValidateEnvelope","description":"Promo code validation response envelope."},"PromoCodeValidateRequest":{"properties":{"code":{"type":"string","maxLength":100,"minLength":1,"title":"Code","description":"Promotion code string (e.g., WELCOME20)"}},"type":"object","required":["code"],"title":"PromoCodeValidateRequest","description":"Request to validate a Stripe promotion code."},"PromoCodeValidateResponse":{"properties":{"valid":{"type":"boolean","title":"Valid"},"promo_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Promo Id"},"percent_off":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Percent Off"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"}},"type":"object","required":["valid"],"title":"PromoCodeValidateResponse","description":"Result of promo code validation."},"ProvisionRequest":{"properties":{"provider":{"type":"string","pattern":"^(telnyx)$","title":"Provider","description":"Provider to purchase from","default":"telnyx"},"count":{"type":"integer","maximum":50.0,"minimum":1.0,"title":"Count","description":"Number of phone numbers to provision","default":10},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code","description":"Optional area code filter (e.g., '415')"},"country_code":{"type":"string","title":"Country Code","description":"ISO country code","default":"US"},"capabilities":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Capabilities","description":"Required capabilities (voice, sms, mms)"},"max_cost_cents":{"anyOf":[{"type":"integer","maximum":10000.0,"minimum":0.0},{"type":"null"}],"title":"Max Cost Cents","description":"Max monthly cost in cents. Default 200 ($2.00) — Telnyx local US ranges $1.00-$2.00 depending on area code. Set to 100 ($1) for strict cheapest-only, or higher for premium area codes.","default":200},"number_type":{"type":"string","pattern":"^(local|toll-free)$","title":"Number Type","description":"Number type: 'local' (default, cheap, area-code aware) or 'toll-free'","default":"local"}},"type":"object","title":"ProvisionRequest","description":"Request to provision new numbers."},"ProvisionResponse":{"properties":{"requested":{"type":"integer","title":"Requested"},"provisioned":{"type":"integer","title":"Provisioned"},"numbers":{"items":{"$ref":"#/components/schemas/PhoneNumberResponse"},"type":"array","title":"Numbers"}},"type":"object","required":["requested","provisioned","numbers"],"title":"ProvisionResponse","description":"Response for provisioning operation."},"PublicDemoChatRequest":{"properties":{"industry":{"type":"string","title":"Industry","description":"Industry slug; resolved to an allowlisted tenant"},"message":{"type":"string","maxLength":2000,"minLength":1,"title":"Message"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id","description":"Thread id from the previous reply; omit on the first turn"}},"type":"object","required":["industry","message"],"title":"PublicDemoChatRequest","description":"Request for an anonymous chat turn against a showcase tenant.\n\nConversation state is server-side: pass back the `conversation_id` from the\nprevious reply so the agent threads context (no client-sent history). The\norchestrator is the same one the real webchat widget uses, so the demo is\n1:1 with the live tenant AI (availability, booking, memory)."},"PublicDemoChatResponse":{"properties":{"response":{"type":"string","title":"Response"},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id","description":"Echo back on the next turn to keep conversation state"}},"type":"object","required":["response"],"title":"PublicDemoChatResponse","description":"Anonymous chat reply for the public demo."},"PublicDemoTokenRequest":{"properties":{"industry":{"type":"string","title":"Industry","description":"Industry slug; resolved to an allowlisted tenant"}},"type":"object","required":["industry"],"title":"PublicDemoTokenRequest","description":"Request for an anonymous LiveKit token scoped to a showcase tenant."},"PublicDemoTokenResponse":{"properties":{"token":{"type":"string","title":"Token"},"room_name":{"type":"string","title":"Room Name"},"livekit_url":{"type":"string","title":"Livekit Url"},"seconds_remaining":{"type":"integer","title":"Seconds Remaining"}},"type":"object","required":["token","room_name","livekit_url","seconds_remaining"],"title":"PublicDemoTokenResponse","description":"Anonymous LiveKit access token for the public voice demo."},"PublicIntakeForm":{"properties":{"form_name":{"type":"string","title":"Form Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"fields":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Fields"},"status":{"type":"string","title":"Status"},"sections":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Sections"},"end_form_if":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"End Form If"}},"type":"object","required":["form_name","description","fields","status"],"title":"PublicIntakeForm","description":"What the unauthenticated fill page renders — the published spec + link state."},"PublicVoicePreviewRequest":{"properties":{"voice_id":{"type":"string","title":"Voice Id","description":"Realtime voice preset key, e.g. rt_alloy"},"text":{"anyOf":[{"type":"string","maxLength":200},{"type":"null"}],"title":"Text","description":"Optional custom line to speak (e.g. the greeting). Hard-capped; falls back to a default sample when omitted."}},"type":"object","required":["voice_id"],"title":"PublicVoicePreviewRequest","description":"Request for an anonymous voice sample (onboarding voice picker / greeting)."},"PurchaseAssignRequest":{"properties":{"e164":{"type":"string","title":"E164","description":"E.164 number the tenant selected from search"},"country":{"type":"string","maxLength":2,"minLength":2,"title":"Country","description":"ISO country of the selected number (US/CA) — scopes the cost-verify search","default":"US"}},"type":"object","required":["e164"],"title":"PurchaseAssignRequest"},"PurchaseAssignResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"number":{"$ref":"#/components/schemas/AssignedNumber"}},"type":"object","required":["success","number"],"title":"PurchaseAssignResponse"},"RateLimitStatusResponse":{"properties":{"tier":{"type":"string","title":"Tier"},"limits":{"additionalProperties":{"type":"integer"},"type":"object","title":"Limits"},"remaining":{"additionalProperties":{"type":"integer"},"type":"object","title":"Remaining"},"reset_seconds":{"additionalProperties":{"type":"integer"},"type":"object","title":"Reset Seconds"}},"type":"object","required":["tier","limits","remaining","reset_seconds"],"title":"RateLimitStatusResponse","description":"Rate limit status response."},"ReCrawlRequest":{"properties":{"datasource_id":{"type":"string","title":"Datasource Id"}},"type":"object","required":["datasource_id"],"title":"ReCrawlRequest","description":"Request to re-crawl a data source."},"RecipientInput":{"properties":{"phone_number":{"type":"string","maxLength":20,"minLength":1,"title":"Phone Number"},"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Email"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"}},"type":"object","required":["phone_number"],"title":"RecipientInput","description":"Single recipient input."},"RecipientListResponse":{"properties":{"recipients":{"items":{"$ref":"#/components/schemas/RecipientSummary"},"type":"array","title":"Recipients"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["recipients","total","page","page_size"],"title":"RecipientListResponse","description":"Paginated recipient list for a campaign."},"RecipientSummary":{"properties":{"id":{"type":"string","title":"Id"},"phone_number":{"type":"string","title":"Phone Number"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Customer Id"},"status":{"type":"string","title":"Status"},"sent_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Sent At"},"delivered_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Delivered At"},"read_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Read At"},"responded_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Responded At"},"converted_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Converted At"},"voice_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Status"},"reply_outcome":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reply Outcome"},"reply_outcome_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reply Outcome Reason"},"voice_called_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Called At"},"error_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Message"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","phone_number","status","created_at"],"title":"RecipientSummary","description":"Recipient row for campaign detail view."},"RecommendedPlanResponse":{"properties":{"recommended_plan_id":{"type":"string","title":"Recommended Plan Id"},"recommended_plan_name":{"type":"string","title":"Recommended Plan Name"},"monthly_price":{"type":"integer","title":"Monthly Price"},"track":{"type":"string","title":"Track"},"tier":{"type":"string","title":"Tier"},"reasoning":{"type":"string","title":"Reasoning"}},"type":"object","required":["recommended_plan_id","recommended_plan_name","monthly_price","track","tier","reasoning"],"title":"RecommendedPlanResponse","description":"Recommended new-grid plan based on tenant's usage history."},"RecordUsageRequest":{"properties":{"seconds":{"type":"integer","maximum":300.0,"minimum":1.0,"title":"Seconds","description":"Seconds to record (1-300)"}},"type":"object","required":["seconds"],"title":"RecordUsageRequest","description":"Request to record demo usage."},"RefreshRequest":{"properties":{"refresh_token":{"type":"string","title":"Refresh Token"}},"type":"object","required":["refresh_token"],"title":"RefreshRequest","description":"Request Model for refreshing with a refresh token."},"RefundReason":{"type":"string","enum":["requested_by_customer","duplicate","fraudulent"],"title":"RefundReason","description":"Valid refund reasons (maps to Stripe reason codes)."},"RefundRequest":{"properties":{"reason":{"anyOf":[{"$ref":"#/components/schemas/RefundReason"},{"type":"null"}]},"amount":{"anyOf":[{"type":"number","exclusiveMinimum":0.0},{"type":"null"}],"title":"Amount","description":"Partial refund amount in dollars. Omit for full refund."}},"type":"object","title":"RefundRequest","description":"Request body for issuing a full or partial refund."},"RefundResponse":{"properties":{"payment_id":{"type":"string","title":"Payment Id"},"refund_id":{"type":"string","title":"Refund Id"},"status":{"type":"string","title":"Status"},"amount_cents":{"type":"integer","title":"Amount Cents"},"is_partial":{"type":"boolean","title":"Is Partial","default":false}},"type":"object","required":["payment_id","refund_id","status","amount_cents"],"title":"RefundResponse","description":"Response after issuing a refund."},"ReleaseAllResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"released_count":{"type":"integer","title":"Released Count"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","released_count","message"],"title":"ReleaseAllResponse","description":"Response for release-all operation."},"ReleaseResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"ReleaseResponse","description":"Response for release operation."},"ReminderFileOut":{"properties":{"id":{"type":"string","title":"Id"},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id"},"location_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Name"},"received_at":{"type":"string","format":"date-time","title":"Received At"},"rows_total":{"type":"integer","title":"Rows Total"},"rows_ok":{"type":"integer","title":"Rows Ok"},"rows_rejected":{"type":"integer","title":"Rows Rejected"},"error_summary":{"additionalProperties":{"type":"integer"},"type":"object","title":"Error Summary"},"errors":{"items":{"$ref":"#/components/schemas/IntakeError"},"type":"array","title":"Errors"},"errors_truncated":{"type":"boolean","title":"Errors Truncated","default":false}},"type":"object","required":["id","received_at","rows_total","rows_ok","rows_rejected"],"title":"ReminderFileOut"},"ReminderFileResult":{"properties":{"file_id":{"type":"string","title":"File Id"},"rows_total":{"type":"integer","title":"Rows Total"},"rows_ok":{"type":"integer","title":"Rows Ok"},"rows_rejected":{"type":"integer","title":"Rows Rejected"},"errors":{"items":{"$ref":"#/components/schemas/IntakeError"},"type":"array","title":"Errors"},"errors_truncated":{"type":"boolean","title":"Errors Truncated","default":false}},"type":"object","required":["file_id","rows_total","rows_ok","rows_rejected"],"title":"ReminderFileResult"},"ReminderFilesOut":{"properties":{"files":{"items":{"$ref":"#/components/schemas/ReminderFileOut"},"type":"array","title":"Files"}},"type":"object","required":["files"],"title":"ReminderFilesOut"},"ReminderKeyCreateIn":{"properties":{"location_id":{"type":"string","maxLength":64,"minLength":1,"title":"Location Id"}},"type":"object","required":["location_id"],"title":"ReminderKeyCreateIn"},"ReminderKeyCreatedOut":{"properties":{"id":{"type":"string","title":"Id"},"location_id":{"type":"string","title":"Location Id"},"key":{"type":"string","title":"Key","description":"The key itself. Shown once; only its hash is kept."},"key_prefix":{"type":"string","title":"Key Prefix"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","location_id","key","key_prefix","created_at"],"title":"ReminderKeyCreatedOut"},"ReminderKeyOut":{"properties":{"id":{"type":"string","title":"Id"},"key_prefix":{"type":"string","title":"Key Prefix"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","key_prefix","created_at"],"title":"ReminderKeyOut"},"ReminderKeysOut":{"properties":{"intake_url":{"type":"string","title":"Intake Url"},"stores":{"items":{"$ref":"#/components/schemas/ReminderStoreOut"},"type":"array","title":"Stores"}},"type":"object","required":["intake_url","stores"],"title":"ReminderKeysOut"},"ReminderStoreOut":{"properties":{"location_id":{"type":"string","title":"Location Id"},"location_name":{"type":"string","title":"Location Name"},"store_code":{"type":"string","title":"Store Code"},"key":{"anyOf":[{"$ref":"#/components/schemas/ReminderKeyOut"},{"type":"null"}]}},"type":"object","required":["location_id","location_name","store_code"],"title":"ReminderStoreOut"},"ReorderFaqsRequest":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ReorderItem"},"type":"array","minItems":1,"title":"Items"}},"type":"object","required":["items"],"title":"ReorderFaqsRequest","description":"Request to bulk update FAQ priorities."},"ReorderItem":{"properties":{"id":{"type":"string","title":"Id"},"priority":{"type":"integer","title":"Priority"}},"type":"object","required":["id","priority"],"title":"ReorderItem","description":"Single item in a reorder request."},"ReorgSuggestion":{"properties":{"keep_ids":{"items":{"type":"string"},"type":"array","minItems":1,"title":"Keep Ids","description":"FAQ IDs to merge. First ID is the primary; rest are deactivated."},"question":{"type":"string","maxLength":500,"minLength":1,"title":"Question"},"answer":{"type":"string","maxLength":10000,"minLength":1,"title":"Answer"},"category":{"type":"string","maxLength":100,"minLength":1,"title":"Category"},"priority":{"type":"integer","maximum":5.0,"minimum":1.0,"title":"Priority"}},"type":"object","required":["keep_ids","question","answer","category","priority"],"title":"ReorgSuggestion","description":"A single reorganized FAQ entry from the LLM suggestion."},"RescrapeResponse":{"properties":{"job_id":{"type":"string","title":"Job Id"},"datasource_id":{"type":"string","title":"Datasource Id"},"status":{"type":"string","title":"Status"}},"type":"object","required":["job_id","datasource_id","status"],"title":"RescrapeResponse"},"ResendVerificationRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"}},"type":"object","required":["email"],"title":"ResendVerificationRequest","description":"Request model for resending verification email."},"ResetExecuteRequest":{"properties":{"tier":{"type":"string","title":"Tier"},"token":{"type":"string","title":"Token"}},"type":"object","required":["tier","token"],"title":"ResetExecuteRequest"},"ResetPasswordRequest":{"properties":{"token":{"type":"string","minLength":1,"title":"Token","description":"Password reset token from email"},"new_password":{"type":"string","minLength":8,"title":"New Password","description":"New password (minimum 8 characters)"}},"type":"object","required":["token","new_password"],"title":"ResetPasswordRequest","description":"Request model for completing password reset with token."},"ResetPlanResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"tier":{"type":"string","title":"Tier"},"counts":{"additionalProperties":{"type":"integer"},"type":"object","title":"Counts"},"total":{"type":"integer","title":"Total"},"token":{"type":"string","title":"Token"},"blockers":{"items":{"type":"string"},"type":"array","title":"Blockers","default":[]},"notice":{"type":"string","title":"Notice","default":""}},"type":"object","required":["tenant_id","tenant_name","tier","counts","total","token"],"title":"ResetPlanResponse"},"ResetPreviewRequest":{"properties":{"tier":{"type":"string","title":"Tier"}},"type":"object","required":["tier"],"title":"ResetPreviewRequest"},"ResetResultResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"tenant_name":{"type":"string","title":"Tenant Name"},"tier":{"type":"string","title":"Tier"},"deleted":{"additionalProperties":{"type":"integer"},"type":"object","title":"Deleted"},"total_deleted":{"type":"integer","title":"Total Deleted"}},"type":"object","required":["tenant_id","tenant_name","tier","deleted","total_deleted"],"title":"ResetResultResponse"},"ResumeSessionRequest":{"properties":{"session_token":{"type":"string","title":"Session Token"}},"type":"object","required":["session_token"],"title":"ResumeSessionRequest","description":"Request to resume an existing session."},"ResumeSessionResponse":{"properties":{"session_id":{"type":"string","title":"Session Id"},"conversation_id":{"type":"string","title":"Conversation Id"},"visitor_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Visitor Name"},"messages":{"items":{"$ref":"#/components/schemas/app__api__webchat__MessageItem"},"type":"array","title":"Messages"},"config":{"$ref":"#/components/schemas/app__api__webchat__WebchatConfigResponse"}},"type":"object","required":["session_id","conversation_id","messages","config"],"title":"ResumeSessionResponse","description":"Response with session details and message history."},"RetentionPolicyResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"conversations_retention_days":{"type":"integer","title":"Conversations Retention Days"},"recordings_retention_days":{"type":"integer","title":"Recordings Retention Days"},"transcripts_retention_days":{"type":"integer","title":"Transcripts Retention Days"},"analytics_retention_days":{"type":"integer","title":"Analytics Retention Days"},"auto_delete_enabled":{"type":"boolean","title":"Auto Delete Enabled"},"legal_hold":{"type":"boolean","title":"Legal Hold"},"legal_hold_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Legal Hold Reason"},"legal_hold_until":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Legal Hold Until"}},"type":"object","required":["id","tenant_id","conversations_retention_days","recordings_retention_days","transcripts_retention_days","analytics_retention_days","auto_delete_enabled","legal_hold"],"title":"RetentionPolicyResponse","description":"Response model for data retention policy."},"RevenueAnalyticsResponse":{"properties":{"period_days":{"type":"integer","title":"Period Days"},"data":{"items":{"$ref":"#/components/schemas/RevenueDataPoint"},"type":"array","title":"Data"},"total_revenue_cents":{"type":"integer","title":"Total Revenue Cents"},"total_count":{"type":"integer","title":"Total Count"}},"type":"object","required":["period_days","data","total_revenue_cents","total_count"],"title":"RevenueAnalyticsResponse","description":"Revenue analytics over a time period."},"RevenueDataPoint":{"properties":{"date":{"type":"string","title":"Date"},"revenue_cents":{"type":"integer","title":"Revenue Cents"},"count":{"type":"integer","title":"Count"},"pending_cents":{"type":"integer","title":"Pending Cents"}},"type":"object","required":["date","revenue_cents","count","pending_cents"],"title":"RevenueDataPoint","description":"Single day revenue data point."},"ReviewRequest":{"properties":{"action":{"type":"string","enum":["approve","reject","request_resubmit"],"title":"Action","description":"Review action: approve, reject, or request_resubmit"},"notes":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Notes","description":"Reviewer notes (required for reject/request_resubmit)"}},"type":"object","required":["action"],"title":"ReviewRequest","description":"Request to review (approve/reject) a document."},"ReviewResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"document_id":{"type":"string","title":"Document Id"},"new_status":{"type":"string","title":"New Status"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","document_id","new_status","message"],"title":"ReviewResponse","description":"Response after review action."},"RevokeAllSessionsResponse":{"properties":{"message":{"type":"string","title":"Message"},"revoked_count":{"type":"integer","title":"Revoked Count"},"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"membership_id":{"type":"string","title":"Membership Id"}},"type":"object","required":["message","revoked_count","access_token","tenant_id","role","membership_id"],"title":"RevokeAllSessionsResponse","description":"Response after revoking all sessions."},"RoleUpdateRequest":{"properties":{"role":{"$ref":"#/components/schemas/InviteRole"}},"type":"object","required":["role"],"title":"RoleUpdateRequest","description":"Request to change a member's role."},"RunPreviewRequest":{"properties":{"seed_variables":{"additionalProperties":true,"type":"object","title":"Seed Variables"},"user_input":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Input"},"use_real_llm":{"type":"boolean","title":"Use Real Llm","default":false},"scripted_decisions":{"additionalProperties":{"type":"string"},"type":"object","title":"Scripted Decisions"},"use_agent_runtime":{"type":"boolean","title":"Use Agent Runtime","default":false}},"type":"object","title":"RunPreviewRequest","description":"Drive a saved flow through the engine for a Test Run / Preview.\n\n`seed_variables` pre-populates the variable bag (e.g. selected_service,\nallergies_confirmed) so the operator can drive a specific path. `use_real_llm`\nswaps the scripted fake for the real OpenAI adapter. `scripted_decisions`\nmaps an ai_decision node's title -> chosen output when not using the real LLM."},"RunPreviewResponse":{"properties":{"status":{"type":"string","title":"Status"},"variables":{"additionalProperties":true,"type":"object","title":"Variables"},"trace":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Trace"},"visited_path":{"items":{"type":"string"},"type":"array","title":"Visited Path"},"blocked_node_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Blocked Node Id"},"used_real_llm":{"type":"boolean","title":"Used Real Llm","default":false}},"type":"object","required":["status","variables","trace","visited_path"],"title":"RunPreviewResponse"},"ScheduleExceptionInput":{"properties":{"date":{"type":"string","format":"date-time","title":"Date"},"kind":{"type":"string","pattern":"^(unavailable|custom_hours)$","title":"Kind"},"start_time":{"anyOf":[{"type":"string","pattern":"^[0-2]\\d:[0-5]\\d$"},{"type":"null"}],"title":"Start Time"},"end_time":{"anyOf":[{"type":"string","pattern":"^[0-2]\\d:[0-5]\\d$"},{"type":"null"}],"title":"End Time"},"note":{"anyOf":[{"type":"string","maxLength":2000},{"type":"null"}],"title":"Note"}},"type":"object","required":["date","kind"],"title":"ScheduleExceptionInput","description":"POST body for a single date-override exception."},"ScheduleExceptionListResponse":{"properties":{"exceptions":{"items":{"$ref":"#/components/schemas/ScheduleExceptionResponse"},"type":"array","title":"Exceptions"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["exceptions","total"],"title":"ScheduleExceptionListResponse"},"ScheduleExceptionResponse":{"properties":{"id":{"type":"string","title":"Id"},"team_member_id":{"type":"string","title":"Team Member Id"},"date":{"type":"string","format":"date-time","title":"Date"},"kind":{"type":"string","title":"Kind"},"start_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Start Time"},"end_time":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"End Time"},"note":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Note"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","team_member_id","date","kind","start_time","end_time","note","created_at","updated_at"],"title":"ScheduleExceptionResponse"},"ScheduleRowInput":{"properties":{"day_of_week":{"type":"integer","maximum":6.0,"minimum":0.0,"title":"Day Of Week","description":"Monday=0 … Sunday=6"},"start_time":{"type":"string","pattern":"^[0-2]\\d:[0-5]\\d$","title":"Start Time"},"end_time":{"type":"string","pattern":"^[0-2]\\d:[0-5]\\d$","title":"End Time"},"effective_from":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Effective From"},"effective_until":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Effective Until"},"location_id":{"anyOf":[{"type":"string","maxLength":36},{"type":"null"}],"title":"Location Id"}},"type":"object","required":["day_of_week","start_time","end_time"],"title":"ScheduleRowInput","description":"One row in the bulk-replace weekly schedule payload."},"ScheduleRowResponse":{"properties":{"id":{"type":"string","title":"Id"},"team_member_id":{"type":"string","title":"Team Member Id"},"day_of_week":{"type":"integer","title":"Day Of Week"},"start_time":{"type":"string","title":"Start Time"},"end_time":{"type":"string","title":"End Time"},"effective_from":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Effective From"},"effective_until":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Effective Until"},"location_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","team_member_id","day_of_week","start_time","end_time","effective_from","effective_until","created_at","updated_at"],"title":"ScheduleRowResponse"},"ScrapeRequest":{"properties":{"url":{"type":"string","maxLength":2083,"minLength":1,"format":"uri","title":"Url"}},"type":"object","required":["url"],"title":"ScrapeRequest","description":"Scrape Request model."},"ScreeningAnswerOut":{"properties":{"question":{"type":"string","title":"Question"},"answer":{"title":"Answer"},"answered":{"type":"boolean","title":"Answered"},"variable":{"type":"string","title":"Variable"}},"type":"object","required":["question","answered","variable"],"title":"ScreeningAnswerOut","description":"One screening question and the patient's answer."},"ScreeningHistoryResponse":{"properties":{"sessions":{"items":{"$ref":"#/components/schemas/ScreeningSessionOut"},"type":"array","title":"Sessions"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["sessions","total"],"title":"ScreeningHistoryResponse","description":"Screening history for one patient, newest first."},"ScreeningSessionOut":{"properties":{"session_id":{"type":"string","title":"Session Id"},"channel":{"type":"string","title":"Channel"},"status":{"type":"string","title":"Status"},"started_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Started At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"selected_service":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Selected Service"},"answers":{"items":{"$ref":"#/components/schemas/ScreeningAnswerOut"},"type":"array","title":"Answers","default":[]},"eligible_date":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eligible Date"},"eligible_service":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Eligible Service"},"blocked_reason":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Blocked Reason"},"blocked_count":{"type":"integer","title":"Blocked Count","default":0},"is_blocking":{"type":"boolean","title":"Is Blocking","default":false}},"type":"object","required":["session_id","channel","status"],"title":"ScreeningSessionOut","description":"One screening episode (ILN-721 brief §6)."},"SearchNumberResult":{"properties":{"e164":{"type":"string","title":"E164"},"friendly_name":{"type":"string","title":"Friendly Name"},"country_code":{"type":"string","title":"Country Code"},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region"},"locality":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locality"},"number_type":{"type":"string","title":"Number Type"},"capabilities":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Capabilities"},"monthly_cost_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Monthly Cost Cents"}},"type":"object","required":["e164","friendly_name","country_code","area_code","region","locality","number_type","capabilities","monthly_cost_cents"],"title":"SearchNumberResult","description":"A single number from Telnyx inventory search."},"SearchNumbersResponse":{"properties":{"numbers":{"items":{"$ref":"#/components/schemas/SearchNumberResult"},"type":"array","title":"Numbers"},"count":{"type":"integer","title":"Count"}},"type":"object","required":["numbers","count"],"title":"SearchNumbersResponse","description":"Response for live number search."},"SearchRequest":{"properties":{"query":{"type":"string","title":"Query"},"limit":{"type":"integer","title":"Limit","default":5},"similarity_threshold":{"type":"number","title":"Similarity Threshold","default":0.7},"use_hybrid":{"type":"boolean","title":"Use Hybrid","default":true}},"type":"object","required":["query"],"title":"SearchRequest","description":"Request model for RAG document search."},"SearchResult":{"properties":{"id":{"type":"string","title":"Id"},"text":{"type":"string","title":"Text"},"meta":{"additionalProperties":true,"type":"object","title":"Meta"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"similarity":{"type":"number","title":"Similarity"}},"type":"object","required":["id","text","meta","created_at","similarity"],"title":"SearchResult","description":"Single document result from RAG search."},"SegmentListResponse":{"properties":{"segments":{"items":{"$ref":"#/components/schemas/SegmentResponse"},"type":"array","title":"Segments"}},"type":"object","required":["segments"],"title":"SegmentListResponse"},"SegmentRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":120,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Description"},"filters":{"anyOf":[{"$ref":"#/components/schemas/PatientAudienceFilter"},{"type":"null"}]}},"type":"object","title":"SegmentRequest","description":"Create or update a saved segment."},"SegmentResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"filters":{"additionalProperties":true,"type":"object","title":"Filters"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"},"updated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated At"},"estimated_count":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimated Count"}},"type":"object","required":["id","name"],"title":"SegmentResponse"},"SelectNumberRequest":{"properties":{"e164":{"type":"string","title":"E164","description":"E.164 number to purchase from Telnyx"},"country_code":{"type":"string","title":"Country Code","description":"ISO country code (US or CA)","default":"US"}},"type":"object","required":["e164"],"title":"SelectNumberRequest","description":"Request to purchase and add a number to pool."},"SelectNumberResponse":{"properties":{"id":{"type":"string","title":"Id"},"e164":{"type":"string","title":"E164"},"friendly_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Friendly Name"},"area_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Area Code"},"country_code":{"type":"string","title":"Country Code"},"provider":{"type":"string","title":"Provider"},"capabilities":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Capabilities"}},"type":"object","required":["id","e164","friendly_name","area_code","country_code","provider","capabilities"],"title":"SelectNumberResponse","description":"Response after purchasing a number."},"SendCodeResponse":{"properties":{"message":{"type":"string","title":"Message"},"email":{"type":"string","title":"Email"}},"type":"object","required":["message","email"],"title":"SendCodeResponse","description":"Response for send-verification-code endpoint."},"ServiceCandidateOut":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"duration_minutes":{"type":"integer","title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Price Cents"},"currency":{"type":"string","title":"Currency"},"already_exists":{"type":"boolean","title":"Already Exists"},"confidence":{"type":"string","title":"Confidence"}},"type":"object","required":["name","description","duration_minutes","price_cents","currency","already_exists","confidence"],"title":"ServiceCandidateOut","description":"One candidate service proposed by the KB extractor (not yet persisted)."},"ServiceCreateRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Description"},"duration_minutes":{"type":"integer","maximum":1440.0,"exclusiveMinimum":0.0,"title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Price Cents"},"currency":{"type":"string","maxLength":3,"minLength":3,"title":"Currency","default":"USD"},"buffer_before_min":{"type":"integer","maximum":240.0,"minimum":0.0,"title":"Buffer Before Min","default":0},"buffer_after_min":{"type":"integer","maximum":240.0,"minimum":0.0,"title":"Buffer After Min","default":0},"min_advance_minutes":{"type":"integer","minimum":0.0,"title":"Min Advance Minutes","default":0},"max_advance_days":{"type":"integer","maximum":730.0,"exclusiveMinimum":0.0,"title":"Max Advance Days","default":90},"is_active":{"type":"boolean","title":"Is Active","default":true},"sort_order":{"type":"integer","title":"Sort Order","default":0},"variants":{"anyOf":[{"items":{"$ref":"#/components/schemas/ServiceVariantInput"},"type":"array","maxItems":20},{"type":"null"}],"title":"Variants"}},"type":"object","required":["name","duration_minutes"],"title":"ServiceCreateRequest","description":"Request body for creating a new bookable service."},"ServiceEntry":{"properties":{"name":{"type":"string","maxLength":100,"minLength":1,"title":"Name"},"duration_minutes":{"type":"integer","maximum":480.0,"minimum":5.0,"title":"Duration Minutes","default":60},"duration_options":{"items":{"type":"integer"},"type":"array","title":"Duration Options"}},"type":"object","required":["name"],"title":"ServiceEntry","description":"A bookable service with duration options."},"ServiceListResponse":{"properties":{"services":{"items":{"$ref":"#/components/schemas/ServiceResponse"},"type":"array","title":"Services"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["services","total"],"title":"ServiceListResponse","description":"Response body for the services list endpoint."},"ServiceLocationsBody":{"properties":{"location_ids":{"items":{"type":"string"},"type":"array","maxItems":100,"title":"Location Ids"}},"type":"object","title":"ServiceLocationsBody","description":"PUT body. An empty list means the service is offered at every branch."},"ServiceLocationsResponse":{"properties":{"location_ids":{"items":{"type":"string"},"type":"array","title":"Location Ids"}},"type":"object","required":["location_ids"],"title":"ServiceLocationsResponse"},"ServiceResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"duration_minutes":{"type":"integer","title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Price Cents"},"currency":{"type":"string","title":"Currency"},"buffer_before_min":{"type":"integer","title":"Buffer Before Min"},"buffer_after_min":{"type":"integer","title":"Buffer After Min"},"min_advance_minutes":{"type":"integer","title":"Min Advance Minutes"},"max_advance_days":{"type":"integer","title":"Max Advance Days"},"is_active":{"type":"boolean","title":"Is Active"},"sort_order":{"type":"integer","title":"Sort Order"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"variants":{"items":{"$ref":"#/components/schemas/ServiceVariantResponse"},"type":"array","title":"Variants"}},"type":"object","required":["id","tenant_id","name","description","duration_minutes","price_cents","currency","buffer_before_min","buffer_after_min","min_advance_minutes","max_advance_days","is_active","sort_order","created_at","updated_at"],"title":"ServiceResponse","description":"Response body for a single service."},"ServiceTeamAssignmentInput":{"properties":{"team_member_id":{"type":"string","title":"Team Member Id"},"price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Price Cents"},"duration_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Minutes"}},"type":"object","required":["team_member_id"],"title":"ServiceTeamAssignmentInput","description":"One member assignment payload for the service-side editor.\n\nMirrors ``MemberServiceAssignmentInput`` but flipped: the URL identifies\nthe service, the payload identifies the member. ``None`` overrides mean\n\"use the catalog default for this service.\""},"ServiceTeamListResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/ServiceTeamMemberOut"},"type":"array","title":"Members"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["members","total"],"title":"ServiceTeamListResponse","description":"Response from GET /portal/services/{id}/team."},"ServiceTeamMemberOut":{"properties":{"team_member_id":{"type":"string","title":"Team Member Id"},"name":{"type":"string","title":"Name"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"color":{"type":"string","title":"Color"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"},"duration_minutes":{"type":"integer","title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Price Cents"},"override_duration_minutes":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Override Duration Minutes"},"override_price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Override Price Cents"}},"type":"object","required":["team_member_id","name","role","color","avatar_url","duration_minutes","price_cents","override_duration_minutes","override_price_cents"],"title":"ServiceTeamMemberOut","description":"One team member offering a specific service (for /services/{id}/team)."},"ServiceTeamPutRequest":{"properties":{"assignments":{"items":{"$ref":"#/components/schemas/ServiceTeamAssignmentInput"},"type":"array","title":"Assignments"}},"type":"object","required":["assignments"],"title":"ServiceTeamPutRequest","description":"Request for PUT /portal/services/{id}/team."},"ServiceUpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Description"},"duration_minutes":{"anyOf":[{"type":"integer","maximum":1440.0,"exclusiveMinimum":0.0},{"type":"null"}],"title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Price Cents"},"currency":{"anyOf":[{"type":"string","maxLength":3,"minLength":3},{"type":"null"}],"title":"Currency"},"buffer_before_min":{"anyOf":[{"type":"integer","maximum":240.0,"minimum":0.0},{"type":"null"}],"title":"Buffer Before Min"},"buffer_after_min":{"anyOf":[{"type":"integer","maximum":240.0,"minimum":0.0},{"type":"null"}],"title":"Buffer After Min"},"min_advance_minutes":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Min Advance Minutes"},"max_advance_days":{"anyOf":[{"type":"integer","maximum":730.0,"exclusiveMinimum":0.0},{"type":"null"}],"title":"Max Advance Days"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"sort_order":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Sort Order"},"variants":{"anyOf":[{"items":{"$ref":"#/components/schemas/ServiceVariantInput"},"type":"array","maxItems":20},{"type":"null"}],"title":"Variants"}},"type":"object","title":"ServiceUpdateRequest","description":"Request body for updating an existing service. All fields optional.\n\nWhen ``variants`` is provided (even as an empty list) the variant set is\nreplaced wholesale. Leaving it ``None`` keeps the current variants."},"ServiceVariantInput":{"properties":{"id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Id"},"name":{"type":"string","maxLength":120,"minLength":1,"title":"Name"},"duration_minutes":{"type":"integer","maximum":1440.0,"exclusiveMinimum":0.0,"title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer","minimum":0.0},{"type":"null"}],"title":"Price Cents"},"sort_order":{"type":"integer","title":"Sort Order","default":0},"is_active":{"type":"boolean","title":"Is Active","default":true}},"type":"object","required":["name","duration_minutes"],"title":"ServiceVariantInput","description":"One variant in a service's bulk-replace payload.\n\nA variant gives one bookable option (Haircut 30 / 60 / 90 min etc).\nWhen a service has no variants, the parent service's\n``duration_minutes`` / ``price_cents`` act as the implicit single option."},"ServiceVariantResponse":{"properties":{"id":{"type":"string","title":"Id"},"service_id":{"type":"string","title":"Service Id"},"name":{"type":"string","title":"Name"},"duration_minutes":{"type":"integer","title":"Duration Minutes"},"price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Price Cents"},"sort_order":{"type":"integer","title":"Sort Order"},"is_active":{"type":"boolean","title":"Is Active"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","service_id","name","duration_minutes","price_cents","sort_order","is_active","created_at","updated_at"],"title":"ServiceVariantResponse","description":"Response body for a single variant."},"SessionListResponse":{"properties":{"sessions":{"items":{"$ref":"#/components/schemas/SessionResponse"},"type":"array","title":"Sessions"}},"type":"object","required":["sessions"],"title":"SessionListResponse","description":"Response model for listing sessions."},"SessionResponse":{"properties":{"id":{"type":"string","title":"Id"},"device_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Device Name"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"is_current":{"type":"boolean","title":"Is Current","default":false},"last_active_at":{"type":"string","title":"Last Active At"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","last_active_at","created_at"],"title":"SessionResponse","description":"Response model for a user session."},"ShareInfoCapabilityOut":{"properties":{"has_telnyx_assigned":{"type":"boolean","title":"Has Telnyx Assigned","description":"Tenant has at least one PhoneNumber with provider=telnyx and status=ASSIGNED."},"has_whatsapp":{"type":"boolean","title":"Has Whatsapp","description":"Tenant has Gupshup WhatsApp credentials (gupshup_app_id + gupshup_app_token)."}},"type":"object","required":["has_telnyx_assigned","has_whatsapp"],"title":"ShareInfoCapabilityOut","description":"Outbound capability flags driving the Share Info action UI gating.\n\nILN-571: the portal Share Info form uses this to warn tenants that\ncreating a share_info action will silently fail at runtime unless the\ntenant has either an assigned Telnyx number (SMS/voice/webchat delivery)\nor Gupshup WhatsApp credentials (WA delivery)."},"SignUpRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email"},"password":{"type":"string","minLength":8,"title":"Password","description":"Password (minimum 8 characters)"},"tenant_name":{"type":"string","title":"Tenant Name"},"full_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Full Name","description":"Account owner's full name"},"owner_phone":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Owner Phone","description":"Account owner's phone number"},"business_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Type"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"accept_terms":{"type":"boolean","title":"Accept Terms","description":"Terms of service (auto-accepted)","default":true},"accept_privacy":{"type":"boolean","title":"Accept Privacy","description":"Privacy policy (auto-accepted)","default":true},"terms_version":{"type":"string","title":"Terms Version","description":"Version of terms accepted","default":"v1.0"},"partner_code":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Partner Code","description":"Partner referral code for attribution"}},"type":"object","required":["email","password","tenant_name"],"title":"SignUpRequest","description":"Request model for account + tenant creation"},"SmsChannelStatus":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"}},"type":"object","required":["enabled"],"title":"SmsChannelStatus","description":"SMS channel status."},"SourceInfo":{"properties":{"id":{"type":"string","title":"Id"},"title":{"type":"string","title":"Title"},"url":{"type":"string","title":"Url"},"similarity":{"type":"number","title":"Similarity"}},"type":"object","required":["id","title","url","similarity"],"title":"SourceInfo","description":"Source information for chat response attribution."},"StaffCreateRequest":{"properties":{"name":{"type":"string","maxLength":255,"minLength":1,"title":"Name"},"role":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Role"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"color":{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$","title":"Color","default":"#3B82F6"}},"type":"object","required":["name"],"title":"StaffCreateRequest"},"StaffListResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/StaffResponse"},"type":"array","title":"Members"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["members","total"],"title":"StaffListResponse"},"StaffResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"name":{"type":"string","title":"Name"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"color":{"type":"string","title":"Color"},"is_active":{"type":"boolean","title":"Is Active"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"},"user_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Id"},"booking_count":{"type":"integer","title":"Booking Count","default":0},"integrations":{"items":{"$ref":"#/components/schemas/IntegrationSummary"},"type":"array","title":"Integrations"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","tenant_id","name","role","email","phone","color","is_active","avatar_url","created_at","updated_at"],"title":"StaffResponse"},"StaffUpdateRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"color":{"anyOf":[{"type":"string","pattern":"^#[0-9A-Fa-f]{6}$"},{"type":"null"}],"title":"Color"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"avatar_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatar Url"}},"type":"object","title":"StaffUpdateRequest"},"StartDemoResponse":{"properties":{"can_start":{"type":"boolean","title":"Can Start"},"seconds_remaining":{"type":"integer","title":"Seconds Remaining"},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["can_start","seconds_remaining"],"title":"StartDemoResponse","description":"Response when checking/starting demo."},"StartOnboardingRequest":{"properties":{"name":{"type":"string","title":"Name","description":"Business name"},"business_type":{"anyOf":[{"type":"string","maxLength":100,"minLength":1},{"type":"null"}],"title":"Business Type","description":"Type of business"},"website":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Website","description":"Business website to scrape"}},"type":"object","required":["name"],"title":"StartOnboardingRequest","description":"Start Onboarding Request model."},"StartVerificationRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number","description":"E.164 phone number to verify"}},"type":"object","required":["phone_number"],"title":"StartVerificationRequest","description":"Request to start phone number verification."},"Step1CompleteData":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"membership_id":{"type":"string","title":"Membership Id"},"region":{"type":"string","title":"Region"},"onboarding_state":{"$ref":"#/components/schemas/OnboardingStateResponse"}},"type":"object","required":["access_token","tenant_id","role","membership_id","region","onboarding_state"],"title":"Step1CompleteData","description":"Step 1 complete response payload."},"Step1CompleteRequest":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"User email for signup/login"},"password":{"type":"string","minLength":8,"title":"Password","description":"User password"},"full_name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Full Name","description":"Account owner's full name"},"tenant_name":{"type":"string","maxLength":255,"minLength":1,"title":"Tenant Name","description":"Business/tenant name"},"business_type":{"type":"string","maxLength":100,"minLength":1,"title":"Business Type","description":"Type of business"},"country":{"type":"string","maxLength":2,"minLength":2,"title":"Country","description":"ISO 3166-1 alpha-2 country code (e.g., US, CA, AE)"},"website":{"anyOf":[{"type":"string","maxLength":2083,"minLength":1,"format":"uri"},{"type":"null"}],"title":"Website","description":"Business website (optional)"},"phone":{"type":"string","maxLength":20,"minLength":4,"title":"Phone","description":"Owner phone number (E.164 format)"},"partner_code":{"anyOf":[{"type":"string","maxLength":20},{"type":"null"}],"title":"Partner Code","description":"Partner referral code for attribution"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id","description":"Voice picked in the demo"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting","description":"Greeting written in the demo"}},"type":"object","required":["email","password","tenant_name","business_type","country","phone"],"title":"Step1CompleteRequest","description":"Step 1 complete request (signup + business info)."},"Step1CompleteResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"$ref":"#/components/schemas/Step1CompleteData"}},"type":"object","required":["data"],"title":"Step1CompleteResponse","description":"Step 1 complete response envelope."},"Step5CompleteRequest":{"properties":{"voice_id":{"type":"string","title":"Voice Id","description":"Selected voice preset key"},"phone_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Id","description":"ID of selected phone number from pool (for 'phone' mode)"},"voice_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Name","description":"Display name for the selected voice"},"voice_mode":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Mode","description":"Voice setup mode: 'phone' | 'widget' | 'local_pending'"},"widget_config":{"anyOf":[{"$ref":"#/components/schemas/CallMeWidgetConfig"},{"type":"null"}],"description":"Call Me Widget configuration (for 'widget' mode)"}},"type":"object","required":["voice_id"],"title":"Step5CompleteRequest","description":"Step 5 complete request (voice agent configuration).\n\nIncludes phone number selection from pool and voice persona choice.\nSupports different voice modes based on region (ILN-423)."},"StepDefinitionOut":{"properties":{"id":{"type":"string","title":"Id"},"display_name":{"type":"string","title":"Display Name"},"order":{"type":"integer","title":"Order"},"status":{"type":"string","title":"Status"},"required":{"type":"boolean","title":"Required"},"skippable":{"type":"boolean","title":"Skippable"},"visible":{"type":"boolean","title":"Visible","default":true},"blockers":{"items":{"type":"string"},"type":"array","title":"Blockers"}},"type":"object","required":["id","display_name","order","status","required","skippable"],"title":"StepDefinitionOut","description":"Step definition output for frontend step sequence."},"StripeInvoiceItem":{"properties":{"id":{"type":"string","title":"Id"},"number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Number"},"status":{"type":"string","title":"Status"},"amount_due":{"type":"integer","title":"Amount Due"},"amount_paid":{"type":"integer","title":"Amount Paid"},"currency":{"type":"string","title":"Currency"},"created":{"type":"string","format":"date-time","title":"Created"},"hosted_invoice_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hosted Invoice Url"},"invoice_pdf":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Invoice Pdf"}},"type":"object","required":["id","number","status","amount_due","amount_paid","currency","created","hosted_invoice_url","invoice_pdf"],"title":"StripeInvoiceItem","description":"Single Stripe invoice for display."},"SubscriptionDetailsResponse":{"properties":{"plan_id":{"type":"string","title":"Plan Id"},"plan_name":{"type":"string","title":"Plan Name"},"status":{"type":"string","title":"Status"},"interval":{"type":"string","title":"Interval"},"current_period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Period End"},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","default":false},"monthly_price":{"type":"integer","title":"Monthly Price"},"currency":{"type":"string","title":"Currency","default":"usd"},"monthly_total_minor":{"type":"integer","title":"Monthly Total Minor","default":0},"location_count":{"type":"integer","title":"Location Count","default":1},"features":{"items":{"type":"string"},"type":"array","title":"Features"},"limits":{"additionalProperties":{"anyOf":[{"type":"integer"},{"type":"string"}]},"type":"object","title":"Limits"},"campaign_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Tier"},"campaign_patient_cap":{"type":"integer","title":"Campaign Patient Cap","default":0},"has_voice":{"type":"boolean","title":"Has Voice","default":false},"trial_ends_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Trial Ends At"}},"type":"object","required":["plan_id","plan_name","status","interval","monthly_price","features","limits"],"title":"SubscriptionDetailsResponse","description":"Current subscription details for portal display."},"SubscriptionResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"plan":{"type":"string","title":"Plan"},"interval":{"type":"string","title":"Interval"},"status":{"type":"string","title":"Status"},"stripe_price_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Price Id"},"price_amount":{"type":"integer","title":"Price Amount"},"created_at":{"type":"string","title":"Created At"},"location_count":{"type":"integer","title":"Location Count","default":1},"campaign_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Campaign Tier"},"trial_ends_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trial Ends At"}},"type":"object","required":["id","tenant_id","plan","interval","status","price_amount","created_at"],"title":"SubscriptionResponse","description":"Subscription details response."},"SubscriptionResponseData":{"properties":{"subscription":{"anyOf":[{"$ref":"#/components/schemas/SubscriptionResponse"},{"type":"null"}]},"trial_days":{"type":"integer","title":"Trial Days","default":0}},"type":"object","required":["subscription"],"title":"SubscriptionResponseData","description":"Subscription response payload."},"SubscriptionResponseEnvelope":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"data":{"$ref":"#/components/schemas/SubscriptionResponseData"}},"type":"object","required":["data"],"title":"SubscriptionResponseEnvelope","description":"Subscription response envelope."},"SubscriptionStateResponse":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"cancel_at_period_end":{"type":"boolean","title":"Cancel At Period End","default":false},"current_period_end":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Current Period End"}},"type":"object","title":"SubscriptionStateResponse","description":"Cancel/resume result — the subscription's state after the change."},"SuggestFaqsResponse":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/FaqSuggestion"},"type":"array","title":"Suggestions"},"gaps_used":{"type":"integer","title":"Gaps Used","description":"Number of real customer gaps addressed."},"categories_filled":{"items":{"type":"string"},"type":"array","title":"Categories Filled","description":"Category IDs that received at least one suggestion."}},"type":"object","required":["suggestions","gaps_used","categories_filled"],"title":"SuggestFaqsResponse","description":"Response from the suggest-faqs endpoint."},"SuggestReorgResponse":{"properties":{"suggestions":{"items":{"$ref":"#/components/schemas/ReorgSuggestion"},"type":"array","title":"Suggestions"},"summary":{"$ref":"#/components/schemas/SuggestReorgSummary"}},"type":"object","required":["suggestions","summary"],"title":"SuggestReorgResponse","description":"Response from the suggest-reorganization endpoint."},"SuggestReorgSummary":{"properties":{"total_before":{"type":"integer","title":"Total Before"},"total_after":{"type":"integer","title":"Total After"},"merges":{"type":"integer","title":"Merges"},"recategorizations":{"type":"integer","title":"Recategorizations"}},"type":"object","required":["total_before","total_after","merges","recategorizations"],"title":"SuggestReorgSummary","description":"Counts summarizing the reorganization plan."},"SupportTicketRequest":{"properties":{"error_message":{"type":"string","title":"Error Message","description":"The error message that occurred"},"error_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Type","description":"Type of error (e.g., 'react_error', 'api_error')"},"error_stack":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error Stack","description":"Error stack trace (truncated)"},"source":{"type":"string","title":"Source","description":"Where the error occurred (e.g., 'onboarding', 'portal')"},"step":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Step","description":"Current step/page when error occurred"},"step_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Step Id","description":"Step ID for onboarding flows"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name","description":"Tenant's business name"},"contact_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Contact Email","description":"User's email address"},"user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Agent","description":"Browser user agent string"},"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url","description":"URL where error occurred"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp","description":"ISO timestamp of error"},"additional_context":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Additional Context","description":"Any additional context data"}},"type":"object","required":["error_message","source"],"title":"SupportTicketRequest","description":"Request body for creating a support ticket."},"SupportTicketResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"ticket_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ticket Id"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"SupportTicketResponse","description":"Response after creating a support ticket."},"SyncResponse":{"properties":{"imported":{"type":"integer","title":"Imported"},"existing":{"type":"integer","title":"Existing"},"total":{"type":"integer","title":"Total"},"refreshed":{"type":"integer","title":"Refreshed","default":0}},"type":"object","required":["imported","existing","total"],"title":"SyncResponse","description":"Response for sync operation."},"SystemStatus":{"properties":{"status":{"type":"string","enum":["operational","degraded","outage"],"title":"Status"},"environment":{"type":"string","title":"Environment"},"timestamp":{"type":"string","title":"Timestamp"},"components":{"items":{"$ref":"#/components/schemas/ComponentStatus"},"type":"array","title":"Components"}},"type":"object","required":["status","environment","timestamp","components"],"title":"SystemStatus","description":"Aggregated system status response."},"TeamActionResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"TeamActionResponse","description":"Generic success response for team actions."},"TeamMemberListResponse":{"properties":{"members":{"items":{"$ref":"#/components/schemas/TeamMemberResponse"},"type":"array","title":"Members"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["members","total"],"title":"TeamMemberListResponse","description":"List of team members."},"TeamMemberResponse":{"properties":{"membership_id":{"type":"string","title":"Membership Id"},"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"role":{"type":"string","title":"Role"},"joined_at":{"type":"string","title":"Joined At"}},"type":"object","required":["membership_id","user_id","email","role","joined_at"],"title":"TeamMemberResponse","description":"A team member with user details."},"TemplateResponse":{"properties":{"element_name":{"type":"string","title":"Element Name"},"category":{"type":"string","title":"Category"},"language_code":{"type":"string","title":"Language Code"},"body":{"type":"string","title":"Body"},"param_count":{"type":"integer","title":"Param Count"},"header":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Header"},"footer":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Footer"},"status":{"type":"string","title":"Status"}},"type":"object","required":["element_name","category","language_code","body","param_count","status"],"title":"TemplateResponse","description":"Parsed WhatsApp template returned by the template listing endpoint."},"TenantCostDetailResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"start_date":{"type":"string","format":"date","title":"Start Date"},"end_date":{"type":"string","format":"date","title":"End Date"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"},"commission_cost_cents":{"type":"integer","title":"Commission Cost Cents"},"daily":{"items":{"$ref":"#/components/schemas/DailyPoint"},"type":"array","title":"Daily"},"by_vendor":{"items":{"$ref":"#/components/schemas/VendorBreakdown"},"type":"array","title":"By Vendor"},"by_category":{"items":{"$ref":"#/components/schemas/CategoryBreakdown"},"type":"array","title":"By Category"}},"type":"object","required":["tenant_id","business_name","start_date","end_date","total_cost_cents","commission_cost_cents","daily","by_vendor","by_category"],"title":"TenantCostDetailResponse"},"TenantCostRow":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"},"commission_cost_cents":{"type":"integer","title":"Commission Cost Cents"},"by_vendor":{"items":{"$ref":"#/components/schemas/VendorBreakdown"},"type":"array","title":"By Vendor"},"by_category":{"items":{"$ref":"#/components/schemas/CategoryBreakdown"},"type":"array","title":"By Category"}},"type":"object","required":["tenant_id","business_name","total_cost_cents","commission_cost_cents","by_vendor","by_category"],"title":"TenantCostRow"},"TenantDetailResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"business_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Type"},"owner_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Phone"},"owner_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Email"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"voice_mode":{"type":"string","title":"Voice Mode","default":"none"},"voice_runtime":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Runtime"},"greeting_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting Message"},"transcription_language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transcription Language"},"stripe_customer_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stripe Customer Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"onboarding":{"anyOf":[{"$ref":"#/components/schemas/OnboardingSummary"},{"type":"null"}]},"onboarding_steps":{"items":{"$ref":"#/components/schemas/OnboardingStepDetail"},"type":"array","title":"Onboarding Steps","default":[]},"data_sources":{"items":{"$ref":"#/components/schemas/DataSourceDetail"},"type":"array","title":"Data Sources","default":[]},"recent_jobs":{"items":{"$ref":"#/components/schemas/JobDetail"},"type":"array","title":"Recent Jobs","default":[]},"total_documents":{"type":"integer","title":"Total Documents","default":0},"subscription_plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Plan"},"subscription_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Status"},"subscription_interval":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Interval"},"demo_seconds_used":{"type":"integer","title":"Demo Seconds Used","default":0},"demo_messages_used":{"type":"integer","title":"Demo Messages Used","default":0},"customer_count":{"type":"integer","title":"Customer Count","default":0},"booking_count":{"type":"integer","title":"Booking Count","default":0},"conversation_count":{"type":"integer","title":"Conversation Count","default":0},"whatsapp_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Whatsapp Phone"},"whatsapp_connected":{"type":"boolean","title":"Whatsapp Connected","default":false},"gupshup_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Gupshup Phone"},"integrations":{"items":{"$ref":"#/components/schemas/IntegrationDetail"},"type":"array","title":"Integrations","default":[]},"phone_numbers":{"items":{"$ref":"#/components/schemas/PhoneNumberDetail"},"type":"array","title":"Phone Numbers","default":[]},"payments":{"items":{"$ref":"#/components/schemas/PaymentDetail"},"type":"array","title":"Payments","default":[]},"usage":{"anyOf":[{"$ref":"#/components/schemas/UsageSummary"},{"type":"null"}]},"faq_summary":{"anyOf":[{"$ref":"#/components/schemas/FaqSummary"},{"type":"null"}]},"last_conversation_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Conversation At"},"conversation_by_channel":{"additionalProperties":{"type":"integer"},"type":"object","title":"Conversation By Channel","default":{}},"team_member_count":{"type":"integer","title":"Team Member Count","default":0},"widget_config":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Widget Config"},"business_hours":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Business Hours"},"booking_settings":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Booking Settings"},"ai_settings":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Ai Settings"},"intent_actions":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Intent Actions"}},"type":"object","required":["id","name","created_at","updated_at"],"title":"TenantDetailResponse"},"TenantGreetingRequest":{"properties":{"greeting_message":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Greeting Message","description":"Custom greeting message. Set to null to use default greeting."}},"type":"object","title":"TenantGreetingRequest","description":"Request to update tenant's greeting message."},"TenantGreetingResponse":{"properties":{"greeting_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting Message","description":"Custom greeting message for voice calls. Null = use default."},"uses_default":{"type":"boolean","title":"Uses Default","description":"Whether tenant is using the default system greeting"}},"type":"object","required":["uses_default"],"title":"TenantGreetingResponse","description":"Tenant's greeting message configuration."},"TenantLanguageRequest":{"properties":{"language":{"type":"string","pattern":"^(en|ar|es)$","title":"Language","description":"ISO 639-1 language code: en, ar, or es"}},"type":"object","required":["language"],"title":"TenantLanguageRequest","description":"Request to update tenant's default language."},"TenantLanguageResponse":{"properties":{"language":{"type":"string","title":"Language","description":"ISO 639-1 language code (en, ar, es)"}},"type":"object","required":["language"],"title":"TenantLanguageResponse","description":"Tenant default language configuration."},"TenantListItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"business_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Type"},"owner_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Phone"},"owner_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Email"},"country":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country"},"voice_mode":{"type":"string","title":"Voice Mode","default":"none"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"onboarding":{"anyOf":[{"$ref":"#/components/schemas/OnboardingSummary"},{"type":"null"}]},"has_website_datasource":{"type":"boolean","title":"Has Website Datasource","default":false},"website_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website Url"},"document_count":{"type":"integer","title":"Document Count","default":0},"customer_count":{"type":"integer","title":"Customer Count","default":0},"booking_count":{"type":"integer","title":"Booking Count","default":0},"conversation_count":{"type":"integer","title":"Conversation Count","default":0},"subscription_plan":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Plan"},"subscription_status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Subscription Status"},"demo_seconds_used":{"type":"integer","title":"Demo Seconds Used","default":0},"demo_messages_used":{"type":"integer","title":"Demo Messages Used","default":0},"whatsapp_connected":{"type":"boolean","title":"Whatsapp Connected","default":false}},"type":"object","required":["id","name","created_at","updated_at"],"title":"TenantListItem"},"TenantListResponse":{"properties":{"tenants":{"items":{"$ref":"#/components/schemas/TenantListItem"},"type":"array","title":"Tenants"},"total":{"type":"integer","title":"Total"},"offset":{"type":"integer","title":"Offset"},"limit":{"type":"integer","title":"Limit"}},"type":"object","required":["tenants","total","offset","limit"],"title":"TenantListResponse"},"TenantProfileResponse":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"business_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Type"},"uses_patient_vocabulary":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Uses Patient Vocabulary"},"owner_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Phone"},"escalation_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalation Phone"},"owner_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Email"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","name","created_at"],"title":"TenantProfileResponse","description":"Tenant profile information for settings display."},"TenantSummary":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"website":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Website"},"voice_mode":{"type":"string","title":"Voice Mode"}},"type":"object","required":["id","name","website","voice_mode"],"title":"TenantSummary","description":"Summary tenant info for verification list."},"TenantVoiceRequest":{"properties":{"voice_id":{"type":"string","title":"Voice Id","description":"Voice preset key"}},"type":"object","required":["voice_id"],"title":"TenantVoiceRequest","description":"Request to update tenant's voice."},"TenantVoiceResponse":{"properties":{"voice_id":{"type":"string","title":"Voice Id"},"voice_name":{"type":"string","title":"Voice Name"},"language":{"type":"string","title":"Language"},"model":{"type":"string","title":"Model"}},"type":"object","required":["voice_id","voice_name","language","model"],"title":"TenantVoiceResponse","description":"Tenant's voice configuration."},"TermsStatusResponse":{"properties":{"terms_accepted":{"type":"boolean","title":"Terms Accepted"},"terms_accepted_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Terms Accepted At"},"terms_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Terms Version"},"current_version":{"type":"string","title":"Current Version","default":"v1.0"},"needs_re_acceptance":{"type":"boolean","title":"Needs Re Acceptance","default":false}},"type":"object","required":["terms_accepted"],"title":"TermsStatusResponse","description":"Response for terms acceptance status."},"TextToSpeechRequest":{"properties":{"text":{"type":"string","maxLength":5000,"minLength":1,"title":"Text"},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id","description":"Voice preset key. Uses tenant's configured voice if not specified."},"use_cache":{"type":"boolean","title":"Use Cache","default":true},"language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Language","description":"Optional language hint (en, ar, es). Auto-detected if not provided."},"code_switching_expected":{"type":"boolean","title":"Code Switching Expected","description":"Set to true if text mixes multiple languages","default":false}},"type":"object","required":["text"],"title":"TextToSpeechRequest","description":"Request to synthesize speech from text."},"TimeSeriesDataPoint":{"properties":{"date":{"type":"string","title":"Date","description":"Date in YYYY-MM-DD format"},"total":{"type":"integer","title":"Total","default":0},"voice":{"type":"integer","title":"Voice","default":0},"whatsapp":{"type":"integer","title":"Whatsapp","default":0},"sms":{"type":"integer","title":"Sms","default":0},"webchat":{"type":"integer","title":"Webchat","default":0},"messages":{"type":"integer","title":"Messages","default":0}},"type":"object","required":["date"],"title":"TimeSeriesDataPoint","description":"Single data point in a time series."},"TimeSeriesResponse":{"properties":{"period":{"type":"string","title":"Period","description":"Period type: day, week, month"},"start_date":{"type":"string","title":"Start Date"},"end_date":{"type":"string","title":"End Date"},"data":{"items":{"$ref":"#/components/schemas/TimeSeriesDataPoint"},"type":"array","title":"Data"},"totals":{"$ref":"#/components/schemas/DashboardStats"}},"type":"object","required":["period","start_date","end_date","data","totals"],"title":"TimeSeriesResponse","description":"Time series analytics response."},"TimeSlotResponse":{"properties":{"start":{"type":"string","format":"date-time","title":"Start"},"end":{"type":"string","format":"date-time","title":"End"},"duration_minutes":{"type":"integer","title":"Duration Minutes"}},"type":"object","required":["start","end","duration_minutes"],"title":"TimeSlotResponse","description":"Available time slot."},"TokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","title":"Token Type","default":"bearer"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"membership_id":{"type":"string","title":"Membership Id"}},"type":"object","required":["access_token","tenant_id","role","membership_id"],"title":"TokenResponse","description":"Response carrying access token (refresh token sent via HttpOnly cookie only)."},"ToolId":{"type":"string","enum":["google_calendar","outlook_calendar","calendly","acuity","timely","hubspot","phorest","zenoti","mindbody","square"],"title":"ToolId","description":"Supported integration tool identifiers (stable IDs)."},"ToolOut":{"properties":{"id":{"type":"string","title":"Id"},"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"auth_type":{"type":"string","title":"Auth Type"},"description":{"type":"string","title":"Description"},"is_connected":{"type":"boolean","title":"Is Connected","default":false},"enabled":{"type":"boolean","title":"Enabled","default":true}},"type":"object","required":["id","name","category","auth_type","description"],"title":"ToolOut","description":"Tool listing item for a tenant."},"ToolsListResponse":{"properties":{"tools":{"items":{"$ref":"#/components/schemas/ToolOut"},"type":"array","title":"Tools"}},"type":"object","required":["tools"],"title":"ToolsListResponse","description":"Response for tenant tools list."},"TransferOwnershipRequest":{"properties":{"target_membership_id":{"type":"string","title":"Target Membership Id","description":"Membership ID of the admin to transfer to"}},"type":"object","required":["target_membership_id"],"title":"TransferOwnershipRequest","description":"Request to initiate ownership transfer to an admin."},"UnreadCountResponse":{"properties":{"count":{"type":"integer","title":"Count"}},"type":"object","required":["count"],"title":"UnreadCountResponse","description":"Unread notification count for polling/badge updates."},"UpdateAIBehaviorRequest":{"properties":{"personality":{"anyOf":[{"type":"string","pattern":"^(professional|friendly|warm|casual)$"},{"type":"null"}],"title":"Personality","description":"AI personality tone."},"language":{"anyOf":[{"type":"string","pattern":"^(en|ar|fr|es)$"},{"type":"null"}],"title":"Language","description":"Default AI language (ISO 639-1)."}},"type":"object","title":"UpdateAIBehaviorRequest","description":"Update AI personality and/or language (accessible on all plans)."},"UpdateAIModeRequest":{"properties":{"ai_mode":{"type":"string","enum":["classic","enhanced"],"title":"Ai Mode"}},"type":"object","required":["ai_mode"],"title":"UpdateAIModeRequest","description":"Request body for updating the AI engine mode."},"UpdateBookingRequest":{"properties":{"status":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Status"},"notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Notes"},"start_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Start Time"},"end_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"End Time"}},"type":"object","title":"UpdateBookingRequest","description":"Request to update a booking."},"UpdateCampaignRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"campaign_type":{"anyOf":[{"type":"string","pattern":"^(promotion|re_engagement|event_invite|follow_up)$"},{"type":"null"}],"title":"Campaign Type"},"channel":{"anyOf":[{"type":"string","pattern":"^(whatsapp|sms|voice|multi_touch)$"},{"type":"null"}],"title":"Channel"},"whatsapp_template_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Whatsapp Template Name"},"whatsapp_template_params":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Whatsapp Template Params"},"message_body":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message Body"},"voice_script":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Script"},"goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Goal"},"scheduled_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Scheduled At"},"voice_followup_delay_hours":{"anyOf":[{"type":"integer","maximum":720.0,"minimum":1.0},{"type":"null"}],"title":"Voice Followup Delay Hours"},"send_rate_per_minute":{"anyOf":[{"type":"integer","maximum":120.0,"minimum":1.0},{"type":"null"}],"title":"Send Rate Per Minute"},"segment_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Segment Id","description":"ILN-810: draw recipients from this saved segment. Resolved when the campaign starts sending, not when it is saved."}},"type":"object","title":"UpdateCampaignRequest","description":"Request to update a campaign (only allowed in draft/paused status)."},"UpdateConversationStatusRequest":{"properties":{"status":{"type":"string","enum":["completed","active"],"title":"Status"}},"type":"object","required":["status"],"title":"UpdateConversationStatusRequest","description":"Request body for updating conversation status."},"UpdateCustomInstructionsRequest":{"properties":{"custom_instructions":{"anyOf":[{"type":"string","maxLength":4000},{"type":"null"}],"title":"Custom Instructions","description":"Custom instructions for the AI agent. Set to null to clear."}},"type":"object","title":"UpdateCustomInstructionsRequest","description":"Request to update the AI's custom instructions.\n\nSet to null to clear instructions."},"UpdateDocumentRequest":{"properties":{"title":{"anyOf":[{"type":"string","maxLength":500},{"type":"null"}],"title":"Title"},"text":{"anyOf":[{"type":"string","maxLength":50000},{"type":"null"}],"title":"Text"}},"type":"object","title":"UpdateDocumentRequest","description":"Request to update an existing document."},"UpdateFaqRequest":{"properties":{"question":{"anyOf":[{"type":"string","maxLength":500,"minLength":1},{"type":"null"}],"title":"Question"},"answer":{"anyOf":[{"type":"string","maxLength":10000,"minLength":1},{"type":"null"}],"title":"Answer"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"is_active":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Active"},"priority":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Priority"}},"type":"object","title":"UpdateFaqRequest","description":"Request to update a custom FAQ."},"UpdateNoteRequest":{"properties":{"content":{"type":"string","maxLength":5000,"minLength":1,"title":"Content"}},"type":"object","required":["content"],"title":"UpdateNoteRequest","description":"Request to update a customer note."},"UpdateProfileRequest":{"properties":{"owner_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Owner Phone"},"escalation_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Escalation Phone"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"business_type":{"anyOf":[{"type":"string","maxLength":64,"minLength":1},{"type":"null"}],"title":"Business Type"},"website":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Website"},"uses_patient_vocabulary":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Uses Patient Vocabulary"}},"type":"object","title":"UpdateProfileRequest","description":"Request model for updating tenant profile.\n\nAll fields optional — only provided fields are applied (PATCH semantics)."},"UpdateRetentionPolicyRequest":{"properties":{"conversations_retention_days":{"type":"integer","maximum":730.0,"minimum":30.0,"title":"Conversations Retention Days","default":90},"recordings_retention_days":{"type":"integer","maximum":730.0,"minimum":30.0,"title":"Recordings Retention Days","default":180},"transcripts_retention_days":{"type":"integer","maximum":730.0,"minimum":30.0,"title":"Transcripts Retention Days","default":90},"analytics_retention_days":{"type":"integer","maximum":2555.0,"minimum":30.0,"title":"Analytics Retention Days","default":365},"auto_delete_enabled":{"type":"boolean","title":"Auto Delete Enabled","default":true}},"type":"object","title":"UpdateRetentionPolicyRequest","description":"Request model for updating retention policy."},"UpdateUserProfileRequest":{"properties":{"name":{"anyOf":[{"type":"string","maxLength":255},{"type":"null"}],"title":"Name","description":"User's display name"}},"type":"object","title":"UpdateUserProfileRequest","description":"Request model for updating user profile (PATCH /users/me)."},"UpdateVoiceStyleRequest":{"properties":{"voice_id":{"type":"string","title":"Voice Id","description":"Voice ID"},"voice_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Name","description":"Display name for the voice"}},"type":"object","required":["voice_id"],"title":"UpdateVoiceStyleRequest","description":"Request to update voice style."},"UsageLimitResponse":{"properties":{"current_usage":{"type":"integer","title":"Current Usage"},"limit":{"type":"integer","title":"Limit"},"remaining":{"type":"integer","title":"Remaining"},"percent_used":{"type":"number","title":"Percent Used"},"exceeded":{"type":"boolean","title":"Exceeded"},"warning_level":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Warning Level"},"tier":{"type":"string","title":"Tier"}},"type":"object","required":["current_usage","limit","remaining","percent_used","exceeded","tier"],"title":"UsageLimitResponse","description":"Usage limit status for a tenant."},"UsageStatisticsResponse":{"properties":{"period":{"type":"string","title":"Period"},"tenant_id":{"type":"string","title":"Tenant Id"},"total_requests":{"type":"integer","title":"Total Requests"},"total_characters":{"type":"integer","title":"Total Characters"},"billable_characters":{"type":"integer","title":"Billable Characters"},"total_cost_usd":{"type":"number","title":"Total Cost Usd"},"cache_hit_rate":{"type":"number","title":"Cache Hit Rate"},"by_voice":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Voice"},"by_day":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"By Day"}},"type":"object","required":["period","tenant_id","total_requests","total_characters","billable_characters","total_cost_usd","cache_hit_rate","by_voice","by_day"],"title":"UsageStatisticsResponse","description":"TTS usage statistics for a tenant."},"UsageSummary":{"properties":{"llm_total_requests":{"type":"integer","title":"Llm Total Requests","default":0},"llm_total_input_tokens":{"type":"integer","title":"Llm Total Input Tokens","default":0},"llm_total_output_tokens":{"type":"integer","title":"Llm Total Output Tokens","default":0},"llm_total_cost_cents":{"type":"number","title":"Llm Total Cost Cents","default":0.0},"voice_total_calls":{"type":"integer","title":"Voice Total Calls","default":0},"voice_total_minutes":{"type":"integer","title":"Voice Total Minutes","default":0},"voice_overage_minutes":{"type":"integer","title":"Voice Overage Minutes","default":0},"message_total":{"type":"integer","title":"Message Total","default":0},"message_overage":{"type":"integer","title":"Message Overage","default":0},"message_by_channel":{"additionalProperties":{"type":"integer"},"type":"object","title":"Message By Channel","default":{}}},"type":"object","title":"UsageSummary"},"UsageTrendResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"days":{"type":"integer","title":"Days"},"trend":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Trend"}},"type":"object","required":["tenant_id","days","trend"],"title":"UsageTrendResponse","description":"Usage trend data."},"UseTemplateRequest":{"properties":{"create_segment":{"type":"boolean","title":"Create Segment","default":true},"name":{"anyOf":[{"type":"string","maxLength":255,"minLength":1},{"type":"null"}],"title":"Name"}},"type":"object","title":"UseTemplateRequest"},"UserProfileResponse":{"properties":{"id":{"type":"string","title":"Id"},"email":{"type":"string","title":"Email"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email_verified":{"type":"boolean","title":"Email Verified"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["id","email","email_verified","created_at","updated_at"],"title":"UserProfileResponse","description":"Response model for user profile."},"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"},"VendorBreakdown":{"properties":{"vendor":{"type":"string","title":"Vendor"},"total_cost_cents":{"type":"integer","title":"Total Cost Cents"}},"type":"object","required":["vendor","total_cost_cents"],"title":"VendorBreakdown"},"VerificationListResponse":{"properties":{"documents":{"items":{"$ref":"#/components/schemas/VerificationResponse"},"type":"array","title":"Documents"},"count":{"type":"integer","title":"Count"},"offset":{"type":"integer","title":"Offset"},"limit":{"type":"integer","title":"Limit"},"total_pending":{"type":"integer","title":"Total Pending"}},"type":"object","required":["documents","count","offset","limit","total_pending"],"title":"VerificationListResponse","description":"Response for listing verifications."},"VerificationResponse":{"properties":{"id":{"type":"string","title":"Id"},"tenant_id":{"type":"string","title":"Tenant Id"},"tenant":{"anyOf":[{"$ref":"#/components/schemas/TenantSummary"},{"type":"null"}]},"document_type":{"type":"string","title":"Document Type"},"original_filename":{"type":"string","title":"Original Filename"},"content_type":{"type":"string","title":"Content Type"},"file_size_bytes":{"type":"integer","title":"File Size Bytes"},"hubspot_file_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hubspot File Id"},"hubspot_file_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hubspot File Url"},"hubspot_ticket_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hubspot Ticket Id"},"status":{"type":"string","title":"Status"},"reviewer_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewer Notes"},"reviewed_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Reviewed At"},"reviewed_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Reviewed By"},"country_code":{"type":"string","title":"Country Code"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["id","tenant_id","document_type","original_filename","content_type","file_size_bytes","hubspot_file_id","hubspot_file_url","hubspot_ticket_id","status","reviewer_notes","reviewed_at","reviewed_by","country_code","created_at","updated_at"],"title":"VerificationResponse","description":"Response for a verification document."},"VerificationStatsResponse":{"properties":{"total":{"type":"integer","title":"Total"},"by_status":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Status"},"by_country":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Country"},"pending_count":{"type":"integer","title":"Pending Count"},"avg_review_time_hours":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Avg Review Time Hours"}},"type":"object","required":["total","by_status","by_country","pending_count","avg_review_time_hours"],"title":"VerificationStatsResponse","description":"Statistics about verification documents."},"VerifyCodeRequest":{"properties":{"code":{"type":"string","maxLength":6,"minLength":6,"pattern":"^\\d{6}$","title":"Code"}},"type":"object","required":["code"],"title":"VerifyCodeRequest","description":"Request body for verify-code endpoint."},"VerifyCodeResponse":{"properties":{"message":{"type":"string","title":"Message"},"verified":{"type":"boolean","title":"Verified"}},"type":"object","required":["message","verified"],"title":"VerifyCodeResponse","description":"Response for verify-code endpoint."},"VerifyEmailRequest":{"properties":{"token":{"type":"string","title":"Token"}},"type":"object","required":["token"],"title":"VerifyEmailRequest","description":"Request model for email verification."},"VerifyEmailResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"VerifyEmailResponse","description":"Response model for email verification."},"VoiceChannelStatus":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"}},"type":"object","required":["enabled"],"title":"VoiceChannelStatus","description":"Voice/phone call channel status."},"VoiceConfigResponse":{"properties":{"tenant_id":{"type":"string","title":"Tenant Id"},"phone_number":{"anyOf":[{"$ref":"#/components/schemas/AvailableNumberResponse"},{"type":"null"}]},"voice_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Id"},"voice_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice Name"},"is_complete":{"type":"boolean","title":"Is Complete"}},"type":"object","required":["tenant_id","phone_number","voice_id","voice_name","is_complete"],"title":"VoiceConfigResponse","description":"Response for voice configuration."},"VoiceOptionResponse":{"properties":{"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name"},"language":{"type":"string","title":"Language"},"model":{"type":"string","title":"Model"},"description":{"type":"string","title":"Description"},"preview_url":{"type":"string","title":"Preview Url"},"provider":{"type":"string","title":"Provider","default":"openai_realtime"}},"type":"object","required":["key","name","language","model","description","preview_url"],"title":"VoiceOptionResponse","description":"Voice preset option."},"VoicePresetResponse":{"properties":{"key":{"type":"string","title":"Key"},"name":{"type":"string","title":"Name"},"language":{"type":"string","title":"Language"},"model":{"type":"string","title":"Model"},"description":{"type":"string","title":"Description"},"preview_url":{"type":"string","title":"Preview Url"},"provider":{"type":"string","title":"Provider","default":"legacy"}},"type":"object","required":["key","name","language","model","description","preview_url"],"title":"VoicePresetResponse","description":"Voice preset information."},"VoicePreviewRequest":{"properties":{"voice_id":{"type":"string","title":"Voice Id","description":"Voice preset key to preview"},"sample_text":{"type":"string","maxLength":200,"title":"Sample Text","default":"Hello! This is a preview of this voice personality."}},"type":"object","required":["voice_id"],"title":"VoicePreviewRequest","description":"Request to preview a voice."},"VoiceTokenRequest":{"properties":{"session_token":{"type":"string","title":"Session Token","description":"HMAC session token returned from create-session"}},"type":"object","required":["session_token"],"title":"VoiceTokenRequest","description":"Request body for obtaining a LiveKit voice token."},"VoiceTokenResponse":{"properties":{"token":{"type":"string","title":"Token"},"room_name":{"type":"string","title":"Room Name"},"livekit_url":{"type":"string","title":"Livekit Url"}},"type":"object","required":["token","room_name","livekit_url"],"title":"VoiceTokenResponse","description":"LiveKit access token + room info for browser voice calls."},"WebchatConfigUpdate":{"properties":{"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"primary_color":{"anyOf":[{"type":"string","pattern":"^#[0-9a-fA-F]{6}$"},{"type":"null"}],"title":"Primary Color"},"position":{"anyOf":[{"type":"string","pattern":"^(bottom-right|bottom-left)$"},{"type":"null"}],"title":"Position"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"bubble_text":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bubble Text"},"input_placeholder":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Input Placeholder"},"pre_chat_heading":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pre Chat Heading"},"pre_chat_subtitle":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pre Chat Subtitle"},"offline_message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Offline Message"},"auto_open_delay_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Auto Open Delay Ms"},"allowed_domains":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Allowed Domains"}},"type":"object","title":"WebchatConfigUpdate","description":"Update webchat widget configuration."},"WebhookUrlResponse":{"properties":{"webhook_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook Url"},"provider":{"type":"string","title":"Provider"}},"type":"object","required":["provider"],"title":"WebhookUrlResponse","description":"Webhook URL for integrations that use webhooks."},"WeeklyScheduleRequest":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/ScheduleRowInput"},"type":"array","maxItems":200,"title":"Rows"}},"type":"object","title":"WeeklyScheduleRequest","description":"PUT body — replaces the member's entire weekly schedule."},"WeeklyScheduleResponse":{"properties":{"rows":{"items":{"$ref":"#/components/schemas/ScheduleRowResponse"},"type":"array","title":"Rows"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["rows","total"],"title":"WeeklyScheduleResponse"},"WhatsAppChannelStatus":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"provider":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Provider"},"connected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Connected At"},"switched_off":{"type":"boolean","title":"Switched Off","default":false}},"type":"object","required":["enabled"],"title":"WhatsAppChannelStatus","description":"WhatsApp channel status."},"WhatsAppConnectRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number"},"phone_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Id"},"whatsapp_business_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Whatsapp Business Account Id"}},"type":"object","required":["phone_number"],"title":"WhatsAppConnectRequest","description":"Request to connect WhatsApp Business number."},"WhatsAppConnectResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"}},"type":"object","required":["success","message"],"title":"WhatsAppConnectResponse","description":"Response after connecting WhatsApp."},"WhatsAppStatusResponse":{"properties":{"connected":{"type":"boolean","title":"Connected"},"phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Number"},"phone_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone Id"},"business_account_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Account Id"},"token_expires_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Token Expires At"},"connected_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Connected At"}},"type":"object","required":["connected"],"title":"WhatsAppStatusResponse","description":"WhatsApp connection status."},"WhoAmIResponse":{"properties":{"user_id":{"type":"string","title":"User Id"},"email":{"type":"string","title":"Email"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"tenant_id":{"type":"string","title":"Tenant Id"},"role":{"type":"string","title":"Role"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region"}},"type":"object","required":["user_id","email","tenant_id","role"],"title":"WhoAmIResponse","description":"Identity + membership echo."},"WithdrawConsentRequest":{"properties":{"customer_phone":{"type":"string","title":"Customer Phone","description":"Customer phone number (E.164 format)"},"consent_type":{"type":"string","title":"Consent Type","description":"Type of consent to withdraw"}},"type":"object","required":["customer_phone","consent_type"],"title":"WithdrawConsentRequest","description":"Request model for withdrawing consent."},"WithdrawConsentResponse":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"}},"type":"object","required":["success","message"],"title":"WithdrawConsentResponse","description":"Response model for consent withdrawal."},"app__api__admin__AuditLogEntry":{"properties":{"id":{"type":"string","title":"Id"},"admin_email":{"type":"string","title":"Admin Email"},"action":{"type":"string","title":"Action"},"target_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Type"},"target_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Id"},"metadata":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Metadata"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Agent"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","admin_email","action","created_at"],"title":"AuditLogEntry"},"app__api__admin_tenant_data__CampaignListResponse":{"properties":{"campaigns":{"items":{"$ref":"#/components/schemas/CampaignListItem"},"type":"array","title":"Campaigns"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["campaigns","total"],"title":"CampaignListResponse"},"app__api__admin_tenant_data__CustomerListItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"primary_phone":{"type":"string","title":"Primary Phone"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"preferred_language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Language"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"},"total_conversations":{"type":"integer","title":"Total Conversations","default":0},"last_conversation_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Conversation At"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","primary_phone","created_at"],"title":"CustomerListItem"},"app__api__admin_tenant_data__CustomerListResponse":{"properties":{"customers":{"items":{"$ref":"#/components/schemas/app__api__admin_tenant_data__CustomerListItem"},"type":"array","title":"Customers"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["customers","total"],"title":"CustomerListResponse"},"app__api__admin_tenant_data__MessageItem":{"properties":{"id":{"type":"string","title":"Id"},"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","role","content","created_at"],"title":"MessageItem"},"app__api__channels__WebchatConfigResponse":{"properties":{"enabled":{"type":"boolean","title":"Enabled"},"widget_key":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Widget Key"},"config":{"additionalProperties":true,"type":"object","title":"Config"},"embed_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Embed Code"}},"type":"object","required":["enabled"],"title":"WebchatConfigResponse","description":"Webchat channel configuration."},"app__api__customers__ConversationsListResponse":{"properties":{"conversations":{"items":{"$ref":"#/components/schemas/ConversationItem"},"type":"array","title":"Conversations"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["conversations","total"],"title":"ConversationsListResponse","description":"List of conversations for a specific customer."},"app__api__customers__CustomerListItem":{"properties":{"id":{"type":"string","title":"Id"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"primary_phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Phone"},"total_conversations":{"type":"integer","title":"Total Conversations","default":0},"last_conversation_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Conversation At"},"preferred_language":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Language"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"},"status":{"type":"string","title":"Status","default":"lead"},"total_bookings":{"type":"integer","title":"Total Bookings","default":0},"created_at":{"type":"string","title":"Created At"},"preferred_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Preferred Name"},"display_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Display Id"},"tags":{"items":{"type":"string"},"type":"array","title":"Tags","default":[]},"assigned_practitioner_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Assigned Practitioner Id"},"archived_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Archived At"},"last_appointment_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Appointment At"},"next_appointment_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Next Appointment At"},"has_outstanding_intake":{"type":"boolean","title":"Has Outstanding Intake","default":false},"date_of_birth":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Date Of Birth"},"insurance_status":{"type":"string","title":"Insurance Status","default":"none"},"rx_status":{"type":"string","title":"Rx Status","default":"none"},"rx_expires_on":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rx Expires On"},"family_count":{"type":"integer","title":"Family Count","default":0}},"type":"object","required":["id","created_at"],"title":"CustomerListItem","description":"Summary of a customer for list views with conversation metrics."},"app__api__customers__CustomerListResponse":{"properties":{"customers":{"items":{"$ref":"#/components/schemas/app__api__customers__CustomerListItem"},"type":"array","title":"Customers"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["customers","total","page","page_size"],"title":"CustomerListResponse","description":"Paginated list of customers with total count."},"app__api__portal__ConversationsListResponse":{"properties":{"conversations":{"items":{"$ref":"#/components/schemas/ConversationSummary"},"type":"array","title":"Conversations"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"},"has_more":{"type":"boolean","title":"Has More"}},"type":"object","required":["conversations","total","page","page_size","has_more"],"title":"ConversationsListResponse","description":"Response model for conversations list."},"app__api__portal__MessageItem":{"properties":{"id":{"type":"string","title":"Id"},"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"},"attachment":{"anyOf":[{"$ref":"#/components/schemas/AttachmentInfo"},{"type":"null"}]},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["id","role","content","created_at"],"title":"MessageItem","description":"Single message in a conversation."},"app__api__portal__RecordingUrlResponse":{"properties":{"url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Url"},"duration_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Duration Seconds"},"transcript":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Transcript"},"content_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content Type"}},"type":"object","required":["url","duration_seconds","transcript","content_type"],"title":"RecordingUrlResponse","description":"Response model for recording URL."},"app__api__portal_phone__SearchResponse":{"properties":{"numbers":{"items":{"$ref":"#/components/schemas/AvailableNumberOut"},"type":"array","title":"Numbers"},"capabilities":{"$ref":"#/components/schemas/PlanCapabilities"}},"type":"object","required":["numbers","capabilities"],"title":"SearchResponse"},"app__api__webchat__MessageItem":{"properties":{"id":{"type":"string","title":"Id"},"role":{"type":"string","title":"Role"},"content":{"type":"string","title":"Content"},"timestamp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timestamp"},"meta":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Meta"}},"type":"object","required":["id","role","content"],"title":"MessageItem","description":"A single message in conversation history."},"app__api__webchat__WebchatConfigResponse":{"properties":{"primary_color":{"type":"string","title":"Primary Color"},"position":{"type":"string","title":"Position"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"logo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Logo Url"},"greeting":{"type":"string","title":"Greeting"},"bubble_text":{"type":"string","title":"Bubble Text"},"input_placeholder":{"type":"string","title":"Input Placeholder"},"pre_chat_heading":{"type":"string","title":"Pre Chat Heading"},"pre_chat_subtitle":{"type":"string","title":"Pre Chat Subtitle"},"offline_message":{"type":"string","title":"Offline Message"},"auto_open_delay_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Auto Open Delay Ms"}},"type":"object","required":["primary_color","position","greeting","bubble_text","input_placeholder","pre_chat_heading","pre_chat_subtitle","offline_message"],"title":"WebchatConfigResponse","description":"Public widget configuration (branding, text, position)."},"app__api__whatsapp_connect__VerificationStatusResponse":{"properties":{"phone_number":{"type":"string","title":"Phone Number"},"status":{"type":"string","title":"Status"},"otp":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Otp"},"message":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Message"}},"type":"object","required":["phone_number","status"],"title":"VerificationStatusResponse","description":"Response with verification status."},"app__schemas__auth__VerificationStatusResponse":{"properties":{"email_verified":{"type":"boolean","title":"Email Verified"},"email":{"type":"string","title":"Email"}},"type":"object","required":["email_verified","email"],"title":"VerificationStatusResponse","description":"Response model for verification status check."},"app__schemas__campaigns__CampaignListResponse":{"properties":{"campaigns":{"items":{"$ref":"#/components/schemas/CampaignSummary"},"type":"array","title":"Campaigns"},"total":{"type":"integer","title":"Total"},"page":{"type":"integer","title":"Page"},"page_size":{"type":"integer","title":"Page Size"}},"type":"object","required":["campaigns","total","page","page_size"],"title":"CampaignListResponse","description":"Paginated campaign list."},"app__schemas__compliance__AuditLogEntry":{"properties":{"id":{"type":"string","title":"Id"},"action":{"type":"string","title":"Action"},"resource_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Type"},"resource_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Id"},"performed_by":{"type":"string","title":"Performed By"},"details":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Details"},"ip_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Ip Address"},"created_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created At"}},"type":"object","required":["id","action","resource_type","resource_id","performed_by","details","ip_address","created_at"],"title":"AuditLogEntry","description":"Single audit log entry."},"app__schemas__compliance__RecordingUrlResponse":{"properties":{"url":{"type":"string","title":"Url"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["url","expires_in"],"title":"RecordingUrlResponse","description":"Response model for pre-signed recording URL."},"app__schemas__rag__SearchResponse":{"properties":{"query":{"type":"string","title":"Query"},"results":{"items":{"$ref":"#/components/schemas/SearchResult"},"type":"array","title":"Results"},"total":{"type":"integer","title":"Total"}},"type":"object","required":["query","results","total"],"title":"SearchResponse","description":"Response model for RAG search endpoint."}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}