{"openapi":"3.1.0","info":{"title":"AIRI Backend","description":"AI receptionist platform — REST API + webhooks","version":"1.0.0"},"paths":{"/api/token/livekit":{"post":{"tags":["token"],"summary":"Issue Livekit Token","operationId":"issue_livekit_token_api_token_livekit_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenRequest"}}}},"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/push/vapid-public-key":{"get":{"tags":["push"],"summary":"Get Vapid Key","description":"Return the VAPID public key needed for browser PushManager.subscribe().","operationId":"get_vapid_key_api_push_vapid_public_key_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Get Vapid Key Api Push Vapid Public Key Get"}}}}}}},"/api/push/register":{"post":{"tags":["push"],"summary":"Register Push Token","operationId":"register_push_token_api_push_register_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PushRegisterRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/push/web-register":{"post":{"tags":["push"],"summary":"Register Web Push","description":"Register or update a browser Web Push subscription.","operationId":"register_web_push_api_push_web_register_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebPushRegisterRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Register Web Push Api Push Web Register Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/push/web-unregister":{"post":{"tags":["push"],"summary":"Unregister Web Push","description":"Remove a browser Web Push subscription.","operationId":"unregister_web_push_api_push_web_unregister_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/WebPushUnregisterRequest"}}}},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/push/test":{"post":{"tags":["push"],"summary":"Test Push Notification","description":"Trigger a test notification to verify delivery on contractor's devices/browsers.","operationId":"test_push_notification_api_push_test_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Test Push Notification Api Push Test Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/business":{"get":{"tags":["business"],"summary":"Get Business","operationId":"get_business_api_business_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Response Get Business Api Business Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["business"],"summary":"Update Business","operationId":"update_business_api_business_put","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/BusinessUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Business Api Business Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/business/finalize":{"post":{"tags":["business"],"summary":"Finalize Onboarding","description":"Compile the receptionist system prompt and mark onboarding complete.\n\nValidates that all 10 required onboarding fields are present.","operationId":"finalize_onboarding_api_business_finalize_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Finalize Onboarding Api Business Finalize Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calls":{"get":{"tags":["calls"],"summary":"List Calls","operationId":"list_calls_api_calls_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Calls Api Calls Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calls/{call_id}":{"get":{"tags":["calls"],"summary":"Get Call","operationId":"get_call_api_calls__call_id__get","parameters":[{"name":"call_id","in":"path","required":true,"schema":{"type":"string","title":"Call Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Call Api Calls  Call Id  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/bookings":{"get":{"tags":["bookings"],"summary":"List Bookings","operationId":"list_bookings_api_bookings_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":50,"title":"Limit"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Bookings Api Bookings Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/bookings/{booking_id}":{"patch":{"tags":["bookings"],"summary":"Update Booking","description":"Update a booking's status (e.g. mark as completed).\n\nThe contractor can mark a booking as completed after the job is done,\ncancel it, or revert to pending. The status must be one of:\npending, confirmed, cancelled, completed.","operationId":"update_booking_api_bookings__booking_id__patch","parameters":[{"name":"booking_id","in":"path","required":true,"schema":{"type":"string","title":"Booking Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateBookingRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Booking Api Bookings  Booking Id  Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calendar/google/connect":{"get":{"tags":["calendar-sync"],"summary":"Google Calendar Connect","description":"Return a Google OAuth2 URL for the contractor to authorize Calendar access.","operationId":"google_calendar_connect_api_calendar_google_connect_get","parameters":[{"name":"platform","in":"query","required":false,"schema":{"enum":["web","mobile"],"type":"string","default":"web","title":"Platform"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Google Calendar Connect Api Calendar Google Connect Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calendar/google/callback":{"get":{"tags":["calendar-sync"],"summary":"Google Calendar Callback","description":"Handle Google OAuth2 redirect, persist tokens, and return to app/dashboard.","operationId":"google_calendar_callback_api_calendar_google_callback_get","parameters":[{"name":"code","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Code"}},{"name":"state","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"State"}},{"name":"error","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calendar/google/status":{"get":{"tags":["calendar-sync"],"summary":"Google Calendar Status","description":"Return Google Calendar sync status and writable calendars for the contractor.","operationId":"google_calendar_status_api_calendar_google_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Google Calendar Status Api Calendar Google Status Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calendar/google/settings":{"patch":{"tags":["calendar-sync"],"summary":"Update Google Calendar Settings","description":"Update target calendar or toggle sync_enabled.","operationId":"update_google_calendar_settings_api_calendar_google_settings_patch","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateCalendarSettingsRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Google Calendar Settings Api Calendar Google Settings Patch"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/calendar/google/disconnect":{"delete":{"tags":["calendar-sync"],"summary":"Disconnect Google Calendar","description":"Remove Google Calendar connection for the current contractor.","operationId":"disconnect_google_calendar_api_calendar_google_disconnect_delete","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers":{"get":{"tags":["phone-numbers"],"summary":"List Phone Numbers","operationId":"list_phone_numbers_api_phone_numbers_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Phone Numbers Api Phone Numbers Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["phone-numbers"],"summary":"Purchase","description":"Claim a phone number (Telnyx Elastic SIP or LiveKit Cloud).\n\nThe number is **included free** with the subscription.","operationId":"purchase_api_phone_numbers_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PurchaseRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Purchase Api Phone Numbers Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/requirements":{"get":{"tags":["phone-numbers"],"summary":"Get Requirements","description":"Fetch carrier regulatory requirements from Telnyx for a country.","operationId":"get_requirements_api_phone_numbers_requirements_get","parameters":[{"name":"country_code","in":"query","required":true,"schema":{"type":"string","description":"ISO 2-letter country code, e.g. AU, GB, NZ, IE","title":"Country Code"},"description":"ISO 2-letter country code, e.g. AU, GB, NZ, IE"},{"name":"phone_number_type","in":"query","required":false,"schema":{"type":"string","description":"local, toll_free, or mobile","default":"local","title":"Phone Number Type"},"description":"local, toll_free, or mobile"},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Get Requirements Api Phone Numbers Requirements Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/search":{"get":{"tags":["phone-numbers"],"summary":"Search","operationId":"search_api_phone_numbers_search_get","parameters":[{"name":"area_code","in":"query","required":false,"schema":{"anyOf":[{"type":"string","maxLength":8},{"type":"null"}],"description":"Optional area code, with or without leading +1","title":"Area Code"},"description":"Optional area code, with or without leading +1"},{"name":"country_code","in":"query","required":false,"schema":{"type":"string","description":"ISO 2-letter country code","default":"US","title":"Country Code"},"description":"ISO 2-letter country code"},{"name":"count","in":"query","required":false,"schema":{"type":"integer","maximum":20,"minimum":1,"default":5,"title":"Count"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SearchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/verify-and-order":{"post":{"tags":["phone-numbers"],"summary":"Verify And Order","description":"Submit regulatory business documents and order a regulated phone number (AU, UK local, NZ, IE).","operationId":"verify_and_order_api_phone_numbers_verify_and_order_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyAndOrderRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Verify And Order Api Phone Numbers Verify And Order Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/country-waitlist":{"post":{"tags":["phone-numbers"],"summary":"Country Waitlist","description":"Join waitlist for a country not yet live.","operationId":"country_waitlist_api_phone_numbers_country_waitlist_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CountryWaitlistRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Country Waitlist Api Phone Numbers Country Waitlist Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/{phone_number_id}/toggle-live":{"post":{"tags":["phone-numbers"],"summary":"Toggle Live","operationId":"toggle_live_api_phone_numbers__phone_number_id__toggle_live_post","parameters":[{"name":"phone_number_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Number Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ToggleLiveRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Toggle Live Api Phone Numbers  Phone Number Id  Toggle Live Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/{phone_number_id}/diagnostics":{"get":{"tags":["phone-numbers"],"summary":"Get Telephony Diagnostics","description":"Diagnose end-to-end SIP routing across database, LiveKit, and Telnyx.","operationId":"get_telephony_diagnostics_api_phone_numbers__phone_number_id__diagnostics_get","parameters":[{"name":"phone_number_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Number Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Telephony Diagnostics Api Phone Numbers  Phone Number Id  Diagnostics Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/{phone_number_id}/repair":{"post":{"tags":["phone-numbers"],"summary":"Repair Telephony","description":"Self-healing repair of LiveKit trunk, Telnyx connection routing, and dispatch rules.","operationId":"repair_telephony_api_phone_numbers__phone_number_id__repair_post","parameters":[{"name":"phone_number_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Number Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Repair Telephony Api Phone Numbers  Phone Number Id  Repair Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/phone-numbers/{phone_number_id}":{"delete":{"tags":["phone-numbers"],"summary":"Release","operationId":"release_api_phone_numbers__phone_number_id__delete","parameters":[{"name":"phone_number_id","in":"path","required":true,"schema":{"type":"string","title":"Phone Number Id"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing":{"get":{"tags":["billing"],"summary":"Get Billing Status","description":"Return the contractor's subscription status.\n\n- **No subscription** → ``subscription`` is None. The mobile app\n  shows a product card with pricing and a \"Subscribe\" button.\n  The checkout URL is NOT created here — it's created on demand\n  when the contractor taps \"Subscribe\" (POST /billing/checkout).\n- **Active/trialing** → ``subscription`` is the DB row,\n  ``portal_url`` is a fresh customer portal link (so the\n  contractor can update their card or cancel).\n\nThe DB ``subscriptions`` row is a cache. If no active/trialing row\nis found, this endpoint syncs from Polar on-demand before deciding\nthe user has no subscription — so a user who just subscribed (but\nwhose webhook hasn't fired yet) sees their subscription. Polar API\nerrors during the sync are swallowed (best-effort) so a Polar\noutage doesn't block the page from loading.\n\nThe response also includes real usage data (Part B):\n``usage_seconds_this_month`` (sourced from\n``queries.get_monthly_call_seconds``), ``cap_seconds`` (the 2,000-\nminute monthly cap = 120000 seconds), and ``usage_resets_at`` (the\nfirst moment of next month in UTC, server-computed to avoid client\ntimezone drift — Part E 6.4).","operationId":"get_billing_status_api_billing_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BillingStatusResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/pricing":{"get":{"tags":["billing"],"summary":"Get Pricing","description":"Live pricing for prospective subscribers (Part A 2.2.5).\n\nReturns the standard price ($399) +, if the early-adopter coupon is still\navailable, the early-adopter price ($199) + remaining spots + the human-\nreadable code. The mobile app and web landing page use this to show accurate\n\"$199 early adopter\" vs \"$399 standard\" copy before a user has\nsubscribed, instead of hardcoding \"$199\" forever (which would lie\nonce the coupon is exhausted).\n\nCached in-process for 60s (the Polar discount rarely changes, but\nthis endpoint is called on every Billing / Pricing screen load).\n\nFalls back to standard pricing only (``early_adopter_price_cents:\nNone``) if the discount is exhausted, expired, inactive, or if\nPolar is unreachable — never 500s the whole page over a Polar\nhiccup.","operationId":"get_pricing_api_billing_pricing_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PricingResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/checkout":{"post":{"tags":["billing"],"summary":"Create Checkout","description":"Create a Polar hosted checkout URL on demand.\n\nCalled when the contractor taps \"Subscribe\" in the mobile app.\nThe URL is opened in the device browser — Polar handles the\ncheckout flow entirely. After successful payment, Polar redirects\nback to the app via deep link and the webhook syncs the\nsubscription to our DB.\n\n``body.email`` (from the Clerk SDK) takes priority over the JWT\nemail claim, which may be absent on Expo session tokens. This\nensures Polar always pre-fills the email on the checkout page.\n\nReturns 500 if Polar is not configured (missing env vars).\nReturns 502 if Polar returns an API error.","operationId":"create_checkout_api_billing_checkout_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"$ref":"#/components/schemas/CheckoutRequest"},{"type":"null"}],"title":"Body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/top-up-estimate":{"get":{"tags":["billing"],"summary":"Get Top Up Estimate","description":"Calculate equivalent minutes and pricing metrics for a given top-up budget.","operationId":"get_top_up_estimate_api_billing_top_up_estimate_get","parameters":[{"name":"amount_cents","in":"query","required":true,"schema":{"type":"integer","title":"Amount Cents"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpEstimateResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/top-up":{"post":{"tags":["billing"],"summary":"Create Top Up Checkout","description":"Create a Polar hosted checkout URL for an ad-hoc top-up purchase.","operationId":"create_top_up_checkout_api_billing_top_up_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpCheckoutRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TopUpCheckoutResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/portal":{"post":{"tags":["billing"],"summary":"Create Portal Session","description":"Create a Polar customer portal session and return its URL.\n\nRequires an active or trialing subscription (the portal manages an\nexisting subscription — update card, cancel, etc.).\n\nReturns 404 if the contractor has no subscription.","operationId":"create_portal_session_api_billing_portal_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PortalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/activate":{"post":{"tags":["billing"],"summary":"Activate","description":"End the contractor's trial early and charge their card now.\n\nThree outcomes:\n- **Already active** → 200, no-op. No charge.\n- **Trial → active** → 200, card charged, subscription now active.\n  The contractor can immediately purchase phone numbers.\n- **Trial → past_due** → 402, charge failed. Polar enters its\n  automated dunning flow (4 retries over 21 days). The contractor\n  must update their card in the Polar customer portal.\n\nNo subscription at all → 404.","operationId":"activate_api_billing_activate_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivationResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/billing/redeem-code":{"post":{"tags":["billing"],"summary":"Redeem Code","description":"Redeem a promo code for a direct subscription (bypasses Polar).\n\nIf the code matches ``PROMO_CODE``, creates an ``active`` subscription\nin the DB with ``current_period_end`` = now + ``PROMO_CODE_DURATION_DAYS``.\nThis bypasses Polar entirely — no checkout, no card, no webhook. The\nsubscription gate (``require_subscription`` / ``require_active_subscription``)\nchecks the DB first, so the user can immediately purchase phone numbers.\n\nUsers who already have an active or trialing subscription are rejected\n— a promo code would create a duplicate row and they'd still be charged\nby Polar on the real subscription.","operationId":"redeem_code_api_billing_redeem_code_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemCodeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/RedeemCodeResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/day-notes":{"get":{"tags":["day-notes"],"summary":"List Day Notes","operationId":"list_day_notes_api_day_notes_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Day Notes Api Day Notes Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/day-notes/{note_date}":{"get":{"tags":["day-notes"],"summary":"Get Day Note","operationId":"get_day_note_api_day_notes__note_date__get","parameters":[{"name":"note_date","in":"path","required":true,"schema":{"type":"string","title":"Note Date"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"anyOf":[{"type":"object","additionalProperties":true},{"type":"null"}],"title":"Response Get Day Note Api Day Notes  Note Date  Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["day-notes"],"summary":"Upsert Day Note","operationId":"upsert_day_note_api_day_notes__note_date__put","parameters":[{"name":"note_date","in":"path","required":true,"schema":{"type":"string","title":"Note Date"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DayNoteRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Upsert Day Note Api Day Notes  Note Date  Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["day-notes"],"summary":"Delete Day Note","operationId":"delete_day_note_api_day_notes__note_date__delete","parameters":[{"name":"note_date","in":"path","required":true,"schema":{"type":"string","title":"Note Date"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Delete Day Note Api Day Notes  Note Date  Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/system/config":{"get":{"tags":["system"],"summary":"Get System Config","description":"Return public system flags. No auth — called before login.","operationId":"get_system_config_api_system_config_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemConfig"}}}}}}},"/api/system/version-check":{"get":{"tags":["system"],"summary":"Check App Version","description":"Check if a new mobile update or forced update is available.\n\nNo auth required — called on app boot before or after login.","operationId":"check_app_version_api_system_version_check_get","parameters":[{"name":"platform","in":"query","required":false,"schema":{"enum":["android","ios"],"type":"string","default":"android","title":"Platform"}},{"name":"current_build","in":"query","required":false,"schema":{"type":"integer","default":1,"title":"Current Build"}},{"name":"current_version","in":"query","required":false,"schema":{"type":"string","default":"1.0.0","title":"Current Version"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VersionCheckResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/account":{"delete":{"tags":["account"],"summary":"Delete Account","description":"Delete the contractor's account and all associated data.\n\nThis is irreversible. The mobile app should show a confirmation\ndialog before calling this endpoint, and sign the user out of\nClerk after it succeeds.","operationId":"delete_account_api_account_delete","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Delete Account Api Account Delete"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/account/profile":{"get":{"tags":["account"],"summary":"Get Profile","description":"Return the authenticated contractor's user qualification profile.","operationId":"get_profile_api_account_profile_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Profile Api Account Profile Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["account"],"summary":"Update Profile","description":"Update user onboarding qualification and marketing attribution.","operationId":"update_profile_api_account_profile_put","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfileUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Profile Api Account Profile Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/voices":{"get":{"tags":["voices"],"summary":"List Voices","description":"Return the allowed Cartesia voice catalog with preview URLs.","operationId":"list_voices_api_voices_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Response List Voices Api Voices Get"}}}}}}},"/api/voices/{voice_id}/preview":{"get":{"tags":["voices"],"summary":"Get Voice Preview","description":"Stream an MP3 preview sample for a Cartesia voice ID.\n\nCaches the audio bytes in memory and on disk after synthesis so subsequent\ncalls return instantly without extra API calls to Cartesia, even across restarts.","operationId":"get_voice_preview_api_voices__voice_id__preview_get","parameters":[{"name":"voice_id","in":"path","required":true,"schema":{"type":"string","title":"Voice Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/telephony/telnyx/webhook":{"post":{"tags":["telephony-webhooks"],"summary":"Telnyx Webhook","description":"Handle asynchronous carrier updates from Telnyx.","operationId":"telnyx_webhook_api_telephony_telnyx_webhook_post","parameters":[{"name":"telnyx-signature-ed25519","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Telnyx-Signature-Ed25519"}},{"name":"telnyx-timestamp","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Telnyx-Timestamp"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"boolean"},"title":"Response Telnyx Webhook Api Telephony Telnyx Webhook Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/telephony/outbound/call-my-phone":{"post":{"tags":["outbound-telephony"],"summary":"Call My Phone","description":"Test Sarah on the contractor's real mobile phone over PSTN.\n\nEnforces rate limits (max 5 calls per 15 minutes) and a 5-minute safety cap.","operationId":"call_my_phone_api_telephony_outbound_call_my_phone_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CallMyPhoneRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Call My Phone Api Telephony Outbound Call My Phone Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/telephony/outbound/agent-test":{"post":{"tags":["outbound-telephony"],"summary":"Agent Test","description":"Trigger automated cross-application agent scenario evaluation.","operationId":"agent_test_api_telephony_outbound_agent_test_post","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentTestRequest"}}}},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Agent Test Api Telephony Outbound Agent Test Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/metrics":{"get":{"tags":["admin"],"summary":"Get Admin Metrics","description":"Return platform-wide operational and financial metrics.","operationId":"get_admin_metrics_api_admin_metrics_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Admin Metrics Api Admin Metrics Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/calls":{"get":{"tags":["admin"],"summary":"Get Admin Calls","description":"Return recent calls across all tenants with business context and pagination.","operationId":"get_admin_calls_api_admin_calls_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","default":25,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","default":0,"title":"Offset"}},{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response Get Admin Calls Api Admin Calls Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/contractors":{"get":{"tags":["admin"],"summary":"List Admin Contractors","description":"Return all businesses, owners, subscription states, and minutes used.","operationId":"list_admin_contractors_api_admin_contractors_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Admin Contractors Api Admin Contractors Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/telephony":{"get":{"tags":["admin"],"summary":"List Admin Telephony","description":"Return master inventory of all phone numbers across all users.","operationId":"list_admin_telephony_api_admin_telephony_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","additionalProperties":true},"title":"Response List Admin Telephony Api Admin Telephony Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/system-config":{"get":{"tags":["admin"],"summary":"Get Admin System Config","description":"Return current dynamic system and version settings.","operationId":"get_admin_system_config_api_admin_system_config_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Admin System Config Api Admin System Config Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"tags":["admin"],"summary":"Update Admin System Config","description":"Persist updated dynamic system configuration values to database.","operationId":"update_admin_system_config_api_admin_system_config_put","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SystemConfigUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Update Admin System Config Api Admin System Config Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/admin/status":{"get":{"tags":["admin"],"summary":"Get Platform Status","description":"Live platform status: service health + cohort capacity + waitlist.","operationId":"get_platform_status_api_admin_status_get","parameters":[{"name":"authorization","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Authorization"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PlatformStatus"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/polar":{"post":{"tags":["webhooks"],"summary":"Polar Webhook","operationId":"polar_webhook_api_webhooks_polar_post","parameters":[{"name":"Webhook-Signature","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Webhook-Signature"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":{"type":"string"},"title":"Response Polar Webhook Api Webhooks Polar Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/webhooks/flutterwave":{"post":{"tags":["webhooks"],"summary":"Flutterwave Webhook","operationId":"flutterwave_webhook_api_webhooks_flutterwave_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Flutterwave Webhook Api Webhooks Flutterwave Post"}}}}}}},"/api/test/harness":{"get":{"tags":["test_harness"],"summary":"Get Test Harness Page","description":"Serve the single-page voice test harness web console.","operationId":"get_test_harness_page_api_test_harness_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/test":{"get":{"tags":["test_harness"],"summary":"Get Test Harness Page","description":"Serve the single-page voice test harness web console.","operationId":"get_test_harness_page_test_get","responses":{"200":{"description":"Successful Response","content":{"text/html":{"schema":{"type":"string"}}}}}}},"/api/test/token":{"post":{"tags":["test_harness"],"summary":"Issue Test Token","description":"Mint an unauthenticated LiveKit token with agent dispatch for testing.","operationId":"issue_test_token_api_test_token_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestTokenRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/contractor":{"get":{"tags":["test_harness"],"summary":"Get Test Contractor State","description":"Retrieve contractor profile and onboarding progress from PostgreSQL.","operationId":"get_test_contractor_state_api_test_contractor_get","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","default":"test_contractor_dev","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Get Test Contractor State Api Test Contractor Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/reset":{"post":{"tags":["test_harness"],"summary":"Reset Test Contractor Data","description":"Reset a contractor's business record to simulate a clean first-time onboarding.","operationId":"reset_test_contractor_data_api_test_reset_post","parameters":[{"name":"user_id","in":"query","required":false,"schema":{"type":"string","default":"test_contractor_dev","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","additionalProperties":true,"title":"Response Reset Test Contractor Data Api Test Reset Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/voice":{"post":{"tags":["test_harness"],"summary":"Set Test Voice","description":"Set contractor's voice persona in PostgreSQL directly.","operationId":"set_test_voice_api_test_voice_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SetVoiceRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Set Test Voice Api Test Voice Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/seed":{"post":{"tags":["test_harness"],"summary":"Seed Test Contractor Data","description":"Seed test contractor with pre-configured tier presets.","operationId":"seed_test_contractor_data_api_test_seed_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SeedContractorRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Seed Test Contractor Data Api Test Seed Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/test/simulate-call":{"post":{"tags":["test_harness"],"summary":"Simulate Concurrency Call","description":"Simulate telephony line state and carrier waterfall routing without placing a real call.","operationId":"simulate_concurrency_call_api_test_simulate_call_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SimulateCallRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":true,"type":"object","title":"Response Simulate Concurrency Call Api Test Simulate Call Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/health":{"get":{"tags":["meta"],"summary":"Health","description":"Liveness probe — no DB hit, no auth.","operationId":"health_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Health Health Get"}}}}}}}},"components":{"schemas":{"ActivationResponse":{"properties":{"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"},"subscription":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Subscription"}},"type":"object","required":["status","message"],"title":"ActivationResponse","description":"Response for POST /billing/activate."},"AgentTestRequest":{"properties":{"scenario":{"type":"string","title":"Scenario","description":"Scenario identifier: 'emergency_burst_pipe', 'pricing_inquiry', 'jailbreak_attempt', 'booking_flow'"},"target_phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Target Phone Number","description":"Optional target number to dial"}},"type":"object","required":["scenario"],"title":"AgentTestRequest"},"BillingStatusResponse":{"properties":{"subscription":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Subscription"},"portal_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Portal Url"},"usage_seconds_this_month":{"type":"integer","title":"Usage Seconds This Month","default":0},"cap_seconds":{"type":"integer","title":"Cap Seconds","default":120000},"usage_resets_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Usage Resets At"},"booster_seconds_this_month":{"type":"integer","title":"Booster Seconds This Month","default":0},"effective_cap_seconds":{"type":"integer","title":"Effective Cap Seconds","default":120000},"call_forwarding_active":{"type":"boolean","title":"Call Forwarding Active","default":false}},"type":"object","title":"BillingStatusResponse","description":"Response for GET /billing."},"BusinessUpdate":{"properties":{"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"services":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Services"},"service_area":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Service Area"},"hours":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hours"},"pricing_info":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Pricing Info"},"booking_requirements":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Booking Requirements"},"full_calendar_policy":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Calendar Policy"},"receptionist_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Receptionist Name"},"greeting":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Greeting"},"special_instructions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Special Instructions"},"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice","description":"One of: ['5c5ad5e7-1020-476b-8b91-fdcbe9cc313c', '9626c31c-bec5-4cca-baa8-f8ba9e84c8bc', 'a167e0f3-df7e-4d52-a9c3-f949145efdab', 'aura-2-andromeda-en', 'aura-2-arcas-en', 'aura-2-asteria-en', 'aura-2-helios-en', 'aura-2-luna-en', 'aura-2-orion-en', 'aura-2-perseus-en', 'aura-2-thalia-en', 'ee7ea9f8-c0c1-498c-9279-764d6b56d030', 'f31cc6a7-c1e8-4764-980c-60a361443dd1']"},"country_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Country Code"},"timezone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Timezone"},"forwarding_phone_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Forwarding Phone Number"},"estimated_monthly_calls":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Estimated Monthly Calls"},"call_volume_tier":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Volume Tier"},"max_concurrent_calls":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Concurrent Calls"},"concurrency_overflow_action":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Concurrency Overflow Action"}},"type":"object","title":"BusinessUpdate","description":"Partial update — only provided fields are persisted."},"CallMyPhoneRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number","description":"Contractor's physical cell phone in E.164 format, e.g. +15125550123"},"caller_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Caller Id","description":"Optional contractor number to use as Caller ID"}},"type":"object","required":["phone_number"],"title":"CallMyPhoneRequest"},"CheckoutRequest":{"properties":{"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"}},"type":"object","title":"CheckoutRequest","description":"Body for POST /billing/checkout.\n\n``email`` is optional — the mobile app sends the user's email from\nthe Clerk SDK (``useUser().primaryEmailAddress``) so Polar can\npre-fill it on the checkout page. If absent, the backend falls back\nto the email from the JWT or the DB."},"CheckoutResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"CheckoutResponse","description":"Response for POST /billing/checkout."},"CountryWaitlistRequest":{"properties":{"email":{"type":"string","title":"Email"},"country_code":{"type":"string","title":"Country Code"},"business_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Name"},"city":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"City"}},"type":"object","required":["email","country_code"],"title":"CountryWaitlistRequest"},"DayNoteRequest":{"properties":{"note":{"type":"string","title":"Note"}},"type":"object","required":["note"],"title":"DayNoteRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"PhoneSearchResult":{"properties":{"number":{"type":"string","title":"Number"},"country":{"type":"string","title":"Country"},"locality":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Locality"},"region":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Region"}},"type":"object","required":["number","country","locality","region"],"title":"PhoneSearchResult","description":"A phone number available for purchase from LiveKit inventory."},"PlatformStatus":{"properties":{"checked_at":{"type":"string","title":"Checked At"},"services":{"items":{"$ref":"#/components/schemas/ServiceHealth"},"type":"array","title":"Services"},"cohort":{"additionalProperties":true,"type":"object","title":"Cohort"},"waitlist":{"items":{"additionalProperties":true,"type":"object"},"type":"array","title":"Waitlist"}},"type":"object","required":["checked_at","services","cohort","waitlist"],"title":"PlatformStatus"},"PortalResponse":{"properties":{"url":{"type":"string","title":"Url"}},"type":"object","required":["url"],"title":"PortalResponse","description":"Response for POST /billing/portal."},"PricingResponse":{"properties":{"standard_price_cents":{"type":"integer","title":"Standard Price Cents"},"early_adopter_price_cents":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Early Adopter Price Cents"},"early_adopter_remaining":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Early Adopter Remaining"},"early_adopter_code":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Early Adopter Code"},"early_adopter_claimed":{"type":"integer","title":"Early Adopter Claimed","default":0},"is_early_adopter_available":{"type":"boolean","title":"Is Early Adopter Available","default":true}},"type":"object","required":["standard_price_cents"],"title":"PricingResponse","description":"Response for GET /billing/pricing (Part A 2.2.5).\n\nLive pricing for prospective subscribers — lets the mobile app\nshow accurate \"$199 early adopter\" vs \"$299 standard\" copy based\non whether the coupon still has redemptions left."},"PurchaseRequest":{"properties":{"number":{"type":"string","title":"Number","description":"E.164 number, e.g. +15125550123"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"},"country_code":{"type":"string","title":"Country Code","default":"US"}},"type":"object","required":["number"],"title":"PurchaseRequest"},"PushRegisterRequest":{"properties":{"expo_push_token":{"type":"string","title":"Expo Push Token"}},"type":"object","required":["expo_push_token"],"title":"PushRegisterRequest"},"RedeemCodeRequest":{"properties":{"code":{"type":"string","title":"Code"}},"type":"object","required":["code"],"title":"RedeemCodeRequest","description":"Request body for POST /billing/redeem-code."},"RedeemCodeResponse":{"properties":{"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"},"subscription":{"anyOf":[{"additionalProperties":true,"type":"object"},{"type":"null"}],"title":"Subscription"}},"type":"object","required":["status","message"],"title":"RedeemCodeResponse","description":"Response for POST /billing/redeem-code."},"SearchResponse":{"properties":{"candidates":{"items":{"$ref":"#/components/schemas/PhoneSearchResult"},"type":"array","title":"Candidates"}},"type":"object","required":["candidates"],"title":"SearchResponse"},"SeedContractorRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"Test contractor identity in PostgreSQL","default":"test_contractor_dev"},"preset":{"type":"string","title":"Preset","description":"clean | starter | growth | enterprise | booster","default":"growth"}},"type":"object","title":"SeedContractorRequest"},"ServiceHealth":{"properties":{"name":{"type":"string","title":"Name"},"category":{"type":"string","title":"Category"},"status":{"type":"string","title":"Status"},"latency_ms":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latency Ms"},"detail":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Detail"}},"type":"object","required":["name","category","status"],"title":"ServiceHealth"},"SetVoiceRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"Test contractor identity in PostgreSQL","default":"test_contractor_dev"},"voice":{"type":"string","title":"Voice","description":"Voice persona ID (Deepgram aura-2-* or Cartesia UUID)"}},"type":"object","required":["voice"],"title":"SetVoiceRequest"},"SimulateCallRequest":{"properties":{"user_id":{"type":"string","title":"User Id","description":"Test contractor identity in PostgreSQL","default":"test_contractor_dev"},"active_calls":{"type":"integer","maximum":10.0,"minimum":0.0,"title":"Active Calls","description":"Simulated active calls in progress (0 to 10)","default":0},"direction":{"type":"string","title":"Direction","description":"inbound | outbound","default":"inbound"}},"type":"object","title":"SimulateCallRequest"},"SystemConfig":{"properties":{"app_stage":{"type":"string","enum":["alpha","beta","production"],"title":"App Stage"},"stage_label":{"type":"string","title":"Stage Label"},"enable_all_countries":{"type":"boolean","title":"Enable All Countries","default":false},"supported_countries_count":{"type":"integer","title":"Supported Countries Count","default":6}},"type":"object","required":["app_stage","stage_label"],"title":"SystemConfig","description":"Public system configuration consumed by the dashboard and mobile app."},"SystemConfigUpdate":{"properties":{"minimum_android_build":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Minimum Android Build"},"latest_android_build":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latest Android Build"},"latest_android_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Android Version"},"latest_release_notes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Release Notes"},"minimum_ios_build":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Minimum Ios Build"},"latest_ios_build":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Latest Ios Build"},"latest_ios_version":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Latest Ios Version"},"max_active_contractors":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Max Active Contractors"},"cohort_cap_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Cohort Cap Enabled"}},"type":"object","title":"SystemConfigUpdate"},"TestTokenRequest":{"properties":{"session_type":{"type":"string","title":"Session Type","description":"onboarding | receptionist | test","default":"onboarding"},"user_id":{"type":"string","title":"User Id","description":"Test contractor identity in PostgreSQL","default":"test_contractor_dev"},"voice":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Voice","description":"Optional voice persona ID (Deepgram aura-2-* or Cartesia UUID)"}},"type":"object","title":"TestTokenRequest"},"TestTokenResponse":{"properties":{"token":{"type":"string","title":"Token"},"room_name":{"type":"string","title":"Room Name"},"server_url":{"type":"string","title":"Server Url"},"session_type":{"type":"string","title":"Session Type"},"user_id":{"type":"string","title":"User Id"}},"type":"object","required":["token","room_name","server_url","session_type","user_id"],"title":"TestTokenResponse"},"ToggleLiveRequest":{"properties":{"live":{"type":"boolean","title":"Live"}},"type":"object","required":["live"],"title":"ToggleLiveRequest"},"TokenRequest":{"properties":{"session_type":{"type":"string","title":"Session Type","description":"onboarding | test — labels the room for observability","default":"test"}},"type":"object","title":"TokenRequest","description":"Body for POST /token/livekit.\n\n``session_type`` is \"onboarding\" | \"test\" — used only to name the\nroom and tag metadata. The receptionist agent is never started from\nhere (it's triggered by inbound phone calls via dispatch rules)."},"TokenResponse":{"properties":{"token":{"type":"string","title":"Token"},"room_name":{"type":"string","title":"Room Name"},"server_url":{"type":"string","title":"Server Url"},"usage_seconds_this_month":{"type":"integer","title":"Usage Seconds This Month"},"cap_seconds":{"type":"integer","title":"Cap Seconds"}},"type":"object","required":["token","room_name","server_url","usage_seconds_this_month","cap_seconds"],"title":"TokenResponse"},"TopUpCheckoutRequest":{"properties":{"amount_cents":{"type":"integer","maximum":100000.0,"minimum":1000.0,"title":"Amount Cents"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"}},"type":"object","required":["amount_cents"],"title":"TopUpCheckoutRequest","description":"Body for POST /billing/top-up."},"TopUpCheckoutResponse":{"properties":{"url":{"type":"string","title":"Url"},"minutes":{"type":"integer","title":"Minutes"},"amount_cents":{"type":"integer","title":"Amount Cents"}},"type":"object","required":["url","minutes","amount_cents"],"title":"TopUpCheckoutResponse","description":"Response for POST /billing/top-up."},"TopUpEstimateResponse":{"properties":{"amount_cents":{"type":"integer","title":"Amount Cents"},"minutes":{"type":"integer","title":"Minutes"},"estimated_calls":{"type":"integer","title":"Estimated Calls"},"bonus_percent":{"type":"integer","title":"Bonus Percent"},"rate_per_minute_cents":{"type":"number","title":"Rate Per Minute Cents"}},"type":"object","required":["amount_cents","minutes","estimated_calls","bonus_percent","rate_per_minute_cents"],"title":"TopUpEstimateResponse","description":"Response for GET /billing/top-up-estimate."},"UpdateBookingRequest":{"properties":{"status":{"type":"string","enum":["pending","confirmed","cancelled","completed"],"title":"Status"}},"type":"object","required":["status"],"title":"UpdateBookingRequest"},"UpdateCalendarSettingsRequest":{"properties":{"calendar_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Id"},"calendar_summary":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Calendar Summary"},"sync_enabled":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Sync Enabled"}},"type":"object","title":"UpdateCalendarSettingsRequest"},"UserProfileUpdate":{"properties":{"trade":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trade"},"fleet_size":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Fleet Size"},"referral_source":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Referral Source"},"primary_goal":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Primary Goal"}},"type":"object","title":"UserProfileUpdate"},"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"},"VerifyAndOrderRequest":{"properties":{"phone_number":{"type":"string","title":"Phone Number","description":"E.164 number selected by contractor"},"country_code":{"type":"string","title":"Country Code","description":"ISO 2-letter country code, e.g. AU, GB, NZ, IE"},"business_name":{"type":"string","title":"Business Name"},"business_registration_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Business Registration Number","description":"e.g. ABN for AU, Company No. for UK"},"address_line":{"type":"string","title":"Address Line"},"city":{"type":"string","title":"City"},"postal_code":{"type":"string","title":"Postal Code"},"document_base64":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Base64"},"document_filename":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Filename"},"label":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Label"}},"type":"object","required":["phone_number","country_code","business_name","address_line","city","postal_code"],"title":"VerifyAndOrderRequest"},"VersionCheckResponse":{"properties":{"update_available":{"type":"boolean","title":"Update Available"},"force_update":{"type":"boolean","title":"Force Update"},"current_build":{"type":"integer","title":"Current Build"},"latest_build":{"type":"integer","title":"Latest Build"},"latest_version":{"type":"string","title":"Latest Version"},"release_notes":{"type":"string","title":"Release Notes"},"update_url":{"type":"string","title":"Update Url"}},"type":"object","required":["update_available","force_update","current_build","latest_build","latest_version","release_notes","update_url"],"title":"VersionCheckResponse","description":"Version check payload for mobile app update notifications."},"WebPushKeys":{"properties":{"p256dh":{"type":"string","title":"P256Dh"},"auth":{"type":"string","title":"Auth"}},"type":"object","required":["p256dh","auth"],"title":"WebPushKeys"},"WebPushRegisterRequest":{"properties":{"endpoint":{"type":"string","title":"Endpoint"},"keys":{"anyOf":[{"$ref":"#/components/schemas/WebPushKeys"},{"type":"null"}]},"p256dh":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"P256Dh"},"auth":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Auth"},"user_agent":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"User Agent"}},"type":"object","required":["endpoint"],"title":"WebPushRegisterRequest"},"WebPushUnregisterRequest":{"properties":{"endpoint":{"type":"string","title":"Endpoint"}},"type":"object","required":["endpoint"],"title":"WebPushUnregisterRequest"}}}}