{"openapi":"3.1.0","info":{"title":"sh-main-backend","description":"Sunny Health backend server application library for scheduling, user management, and AI interactions","license":{"name":"proprietary","identifier":"proprietary"},"version":"0.2.0"},"servers":[{"url":"https://api.sunnyhealth.ai","description":"Production server"},{"url":"https://api.sunnyhealth.live","description":"Staging server"},{"url":"http://localhost:9090","description":"Local development server"}],"paths":{"/health":{"get":{"tags":["health"],"summary":"Simple health check endpoint","operationId":"health_check","responses":{"200":{"description":"Service is healthy","content":{"text/plain":{"schema":{"type":"string"}}}}}}},"/v1/addresses":{"get":{"tags":["users"],"summary":"Get all addresses for a user","operationId":"handle_get_user_addresses","responses":{"200":{"description":"User addresses retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserAddress"}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]},"post":{"tags":["users"],"summary":"Create a new address for a user","operationId":"handle_create_address","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAddressRequest"}}},"required":true},"responses":{"201":{"description":"User address created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAddress"}}}},"400":{"description":"Invalid address data or missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/addresses/primary":{"get":{"tags":["users"],"summary":"Get a user's primary address","operationId":"handle_get_primary_address","responses":{"200":{"description":"User primary address retrieved successfully","content":{"application/json":{"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserAddress"}]}}}},"404":{"description":"User primary address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/addresses/{id}":{"put":{"tags":["users"],"summary":"Update an address by Address ID","operationId":"handle_update_address","parameters":[{"name":"id","in":"path","description":"Address ID to update","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserAddressData"}}},"required":true},"responses":{"200":{"description":"User address updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserAddress"}}}},"400":{"description":"Invalid address data or UUID format","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"User address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]},"delete":{"tags":["users"],"summary":"Delete an address by Address ID","operationId":"handle_delete_address","parameters":[{"name":"id","in":"path","description":"Address ID to delete","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"User address deleted successfully"},"404":{"description":"User address not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/auth/me":{"get":{"tags":["auth"],"summary":"Retrieves basic information about the currently authenticated user.\nThe user identity is determined by the validated JWT token provided in the\n`Authorization` header and processed by the `AuthenticatedUser` extractor.","description":"# Arguments\n* `authenticated_user` - Extracted user information from the validated JWT.\n\n# Returns\nA JSON response containing the user's `UserInfo`.","operationId":"get_current_user","responses":{"200":{"description":"Current user info retrieved","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfo"}}}},"401":{"description":"Unauthorized - Invalid or missing token"}},"security":[{"jwt":[]}]}},"/v1/elevenlabs/signed-url":{"get":{"tags":["elevenlabs"],"summary":"Get a signed URL for an ElevenLabs agent","description":"Generates a signed URL for the specified ElevenLabs agent that can be used\nfor conversational AI interactions. Falls back to a mock URL if the API fails.","operationId":"get_signed_url_handler","parameters":[{"name":"agent_id","in":"query","description":"The ElevenLabs agent ID to get a signed URL for","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Successfully retrieved signed URL","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetSignedUrlResponse"}}}},"400":{"description":"Invalid agent ID"},"401":{"description":"Authentication failed"},"500":{"description":"Internal server error"}}}},"/v1/insurance":{"get":{"tags":["users"],"summary":"Get all of a user's insurance plans","operationId":"handle_get_all_insurance_plans","responses":{"200":{"description":"User insurance plans retrieved successfully","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/UserInsurance"}}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]},"post":{"tags":["users"],"summary":"Create a new insurance plan for a user","operationId":"handle_create_insurance_plan","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInsurance"}}},"required":true},"responses":{"201":{"description":"User insurance created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInsurance"}}}},"400":{"description":"Invalid insurance data or missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/insurance/add_using_member_id":{"post":{"tags":["users"],"summary":"Add insurance using member ID, group ID, and payer ID","operationId":"handle_add_insurance_using_member_id","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddInsuranceUsingMemberIdRequest"}}},"required":true},"responses":{"201":{"description":"User insurance added successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInsurance"}}}},"400":{"description":"Invalid request data or missing required fields","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/insurance/payers":{"get":{"tags":["insurance"],"summary":"Get all payers with pagination","operationId":"handle_get_all_payers","parameters":[{"name":"limit","in":"query","description":"Maximum number of payers to return (default: 50, max: 200)","required":false,"schema":{"type":"integer","format":"int64"}},{"name":"offset","in":"query","description":"Number of records to skip for pagination (default: 0)","required":false,"schema":{"type":"integer","format":"int64"}}],"responses":{"200":{"description":"Payers retrieved successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GetAllPayersResponse"}}}},"400":{"description":"Invalid request parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/insurance/primary":{"get":{"tags":["users"],"summary":"Get a user's primary insurance","operationId":"handle_get_primary_insurance","responses":{"200":{"description":"User insurance retrieved successfully","content":{"application/json":{"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserInsurance"}]}}}},"404":{"description":"User insurance not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/insurance/{id}":{"put":{"tags":["users"],"summary":"Update an insurance plan by Insurance ID","operationId":"handle_update_insurance_plan","parameters":[{"name":"id","in":"path","description":"Insurance ID to update","required":true,"schema":{"type":"string","format":"uuid"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateUserInsuranceData"}}},"required":true},"responses":{"200":{"description":"User insurance updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInsurance"}}}},"400":{"description":"Invalid insurance data or UUID format","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"User insurance not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]},"delete":{"tags":["users"],"summary":"Delete an insurance plan by Insurance ID","operationId":"handle_delete_insurance_plan","parameters":[{"name":"id","in":"path","description":"Insurance ID to delete","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"204":{"description":"User insurance deleted successfully"},"404":{"description":"User insurance not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/profile":{"get":{"tags":["users"],"summary":"Get a user's profile","operationId":"handle_get_profile","responses":{"200":{"description":"User profile retrieved successfully","content":{"application/json":{"schema":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/UserProfile"}]}}}},"404":{"description":"User profile not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]},"put":{"tags":["users"],"summary":"Update or create a user's profile","operationId":"handle_update_profile","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateProfileRequest"}}},"required":true},"responses":{"200":{"description":"User profile updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserProfile"}}}},"400":{"description":"Invalid profile data (including invalid phone number format)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}},"/v1/stripe/create-checkout-session":{"post":{"tags":["stripe"],"summary":"Create Stripe checkout session","description":"Creates a Stripe checkout session for the authenticated user to subscribe to a plan.","operationId":"create_checkout_session_handler","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckoutSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successfully created checkout session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateCheckoutSessionResponse"}}}},"404":{"description":"User or Stripe customer not found"},"500":{"description":"Internal server error"}},"security":[{"jwt":[]}]}},"/v1/stripe/create-portal-session":{"post":{"tags":["stripe"],"summary":"Create Stripe portal session","description":"Creates a Stripe portal session for the authenticated user to manage their subscription.","operationId":"create_portal_session_handler","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePortalSessionRequest"}}},"required":true},"responses":{"200":{"description":"Successfully created portal session","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePortalSessionResponse"}}}},"404":{"description":"User or Stripe customer not found"},"500":{"description":"Internal server error"}},"security":[{"jwt":[]}]}},"/v1/stripe/subscription":{"get":{"tags":["stripe"],"summary":"Check user subscription plan","description":"Checks the authenticated user's subscription plan in Stripe.","operationId":"check_user_subscription_handler","responses":{"200":{"description":"Successfully retrieved subscription info","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SubscriptionResponse"}}}},"404":{"description":"User not found"},"500":{"description":"Internal server error"}},"security":[{"jwt":[]}]}},"/v1/support":{"post":{"tags":["support"],"summary":"Submit a support ticket","operationId":"handle_submit_support_ticket","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportRequest"}}},"required":true},"responses":{"200":{"description":"Support request submitted successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SupportResponse"}}}},"400":{"description":"Validation Error / Bad Request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"401":{"description":"Unauthorized","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal Server Error / Slack Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}},"security":[{"jwt":[]}]}}},"components":{"schemas":{"AddInsuranceUsingMemberIdRequest":{"type":"object","description":"Request structure for adding insurance using member ID, group ID, and payer ID.","required":["member_id","group_id","payer_id"],"properties":{"group_id":{"type":"string","description":"Group ID for the insurance plan."},"member_id":{"type":"string","description":"Member ID for the insurance plan."},"payer_id":{"type":"string","description":"Payer ID for the insurance plan."}}},"AddressType":{"type":"string","description":"Database enum for address types","enum":["home","work","other"]},"ApiError":{"type":"object","description":"API error response","enum":["BadRequest(String)","Unauthorized(String)","Forbidden(String)","NotFound(String)","Conflict(String)","InternalError(String)","NotImplemented(String)"]},"CreateCheckoutSessionRequest":{"type":"object","description":"Request payload for creating a Stripe Checkout session for subscribing to a plan.","required":["price_id","success_url","cancel_url"],"properties":{"cancel_url":{"type":"string","description":"The URL the user should be redirected to if they cancel the checkout process."},"price_id":{"type":"string","description":"The Stripe Price ID (e.g., `price_123`) of the plan the user is subscribing to."},"success_url":{"type":"string","description":"The URL the user should be redirected to after a successful checkout."}}},"CreateCheckoutSessionResponse":{"type":"object","description":"Response payload containing the URL for a Stripe Checkout session.","required":["url"],"properties":{"url":{"type":"string","description":"The generated URL for accessing the Stripe Checkout session."}}},"CreatePortalSessionRequest":{"type":"object","description":"Request payload for creating a Stripe Billing Portal session.","required":["return_url"],"properties":{"return_url":{"type":"string","description":"The URL the user should be redirected back to after finishing their session in the Stripe Portal."}}},"CreatePortalSessionResponse":{"type":"object","description":"Response payload containing the URL for a Stripe Billing Portal session.","required":["url"],"properties":{"url":{"type":"string","description":"The generated URL for accessing the Stripe Billing Portal session."}}},"ElevenLabsError":{"type":"object","description":"Error from the ElevenLabs domain","enum":["InvalidAgentId(String)","ApiRequestFailed(String)","AuthenticationFailed(String)","InvalidResponse(String)","NetworkError(String)","HttpClientError(reqwest::Error)","JsonError(serde_json::Error)","InternalError(String)"]},"GenderType":{"type":"string","description":"Database enum for gender types","enum":["male","female","other"]},"GetAllPayersRequest":{"type":"object","description":"Request structure for getting all payers with pagination.","properties":{"limit":{"type":"integer","format":"int64","description":"Maximum number of results to return (default: 50, max: 200)."},"offset":{"type":"integer","format":"int64","description":"Number of records to skip for pagination (default: 0)."}}},"GetAllPayersResponse":{"type":"object","description":"Response structure for getting all payers.","required":["payers","count","total","has_more"],"properties":{"count":{"type":"integer","description":"Total number of results returned in this response.","minimum":0},"has_more":{"type":"boolean","description":"Whether there are more results available."},"payers":{"type":"array","items":{"$ref":"#/components/schemas/InsurancePayer"},"description":"List of payers."},"total":{"type":"integer","format":"int64","description":"Total number of payers available (for pagination)."}}},"GetSignedUrlRequest":{"type":"object","description":"Request to get a signed URL for an ElevenLabs agent","required":["agent_id"],"properties":{"agent_id":{"type":"string","description":"The agent ID to get a signed URL for"}}},"GetSignedUrlResponse":{"type":"object","description":"Response containing the signed URL for an ElevenLabs agent","required":["signed_url","agent_id","expires_at"],"properties":{"agent_id":{"type":"string","description":"The agent ID"},"expires_at":{"type":"string","format":"date-time","description":"When the URL expires"},"signed_url":{"type":"string","description":"The signed URL for the agent"}}},"InsurancePayer":{"type":"object","description":"Represents an insurance payer from the insurance.payers table.","required":["id","name","display_name","created_at"],"properties":{"created_at":{"type":"string","format":"date-time","description":"Timestamp when the payer was created."},"display_name":{"type":"string","description":"Display name for the payer."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the payer."},"name":{"type":"string","description":"Name of the insurance payer."},"other_names":{"type":["array","null"],"items":{"type":"string"},"description":"Other names this payer might be known by."},"payer_id":{"type":["string","null"],"description":"The most commonly used ID for a payer."},"stedi_specific_payer_identifier":{"type":["string","null"],"description":"Stedi-specific payer identifier."}}},"InsurancePlan":{"type":"object","description":"Represents an insurance plan from the insurance.plans table.","required":["id","payer_id","ribbon_id","category","created_at"],"properties":{"category":{"type":"string","description":"Category of the plan (Group, Individual, Medicare, etc.)."},"created_at":{"type":"string","format":"date-time","description":"Timestamp when the plan was created."},"id":{"type":"string","format":"uuid","description":"Unique identifier for the plan."},"mrf_plan_id":{"type":["string","null"],"description":"MRF plan ID for this plan."},"name":{"type":["string","null"],"description":"Name of the insurance plan."},"payer_id":{"type":"string","format":"uuid","description":"Foreign key to the payer."},"ribbon_id":{"type":"string","format":"uuid","description":"Ribbon ID for this plan."},"updated_at":{"type":["string","null"],"format":"date-time","description":"Timestamp when the plan was last updated."}}},"PayerSearchRequest":{"type":"object","description":"Request structure for searching insurance payers.","required":["search_term"],"properties":{"limit":{"type":"integer","format":"int64","description":"Maximum number of results to return (default: 20, max: 100)."},"search_term":{"type":"string","description":"Search term to match against payer names."}}},"PayerSearchResponse":{"type":"object","description":"Response structure for payer search results.","required":["payers","count"],"properties":{"count":{"type":"integer","description":"Total number of results returned.","minimum":0},"payers":{"type":"array","items":{"$ref":"#/components/schemas/InsurancePayer"},"description":"List of matching payers."}}},"PayerWithPlansResponse":{"type":"object","description":"Combined response with payer and plan information.","required":["payer","plans"],"properties":{"payer":{"$ref":"#/components/schemas/InsurancePayer","description":"The payer information."},"plans":{"type":"array","items":{"$ref":"#/components/schemas/InsurancePlan"},"description":"Plans associated with this payer."}}},"PlanSearchRequest":{"type":"object","description":"Request structure for searching insurance plans.","required":["payer_id"],"properties":{"limit":{"type":"integer","format":"int64","description":"Maximum number of results to return (default: 20, max: 100)."},"payer_id":{"type":"string","format":"uuid","description":"The payer ID to search plans for."},"search_term":{"type":["string","null"],"description":"Optional search term to match against plan names."}}},"PlanSearchResponse":{"type":"object","description":"Response structure for plan search results.","required":["plans","count"],"properties":{"count":{"type":"integer","description":"Total number of results returned.","minimum":0},"plans":{"type":"array","items":{"$ref":"#/components/schemas/InsurancePlan"},"description":"List of matching plans."}}},"SubscriptionPlan":{"type":"object","description":"Detailed information about a user's subscription plan.","required":["id","status","plan_type","current_period_start","current_period_end","cancel_at_period_end"],"properties":{"cancel_at_period_end":{"type":"boolean","description":"Indicates if the subscription is scheduled to be canceled at the end of the current period."},"current_period_end":{"type":"string","format":"date-time","description":"The timestamp when the current billing period ends (and renewal occurs)."},"current_period_start":{"type":"string","format":"date-time","description":"The timestamp when the current billing period started."},"id":{"type":"string","description":"The unique identifier for the subscription in Stripe (e.g., `sub_123`)."},"plan_type":{"$ref":"#/components/schemas/SubscriptionPlanType","description":"The type or tier of the subscription plan."},"status":{"$ref":"#/components/schemas/SubscriptionStatus","description":"The current status of the subscription."}}},"SubscriptionPlanType":{"type":"string","description":"Represents the different subscription plan tiers offered.","enum":["free","plus","ultimate"]},"SubscriptionResponse":{"type":"object","description":"Response payload for checking a user's subscription status.","required":["has_active_subscription"],"properties":{"has_active_subscription":{"type":"boolean","description":"A flag indicating whether the user has at least one active subscription."},"subscription":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/SubscriptionPlan","description":"Detailed information about the user's current subscription plan, if one exists."}]}}},"SubscriptionStatus":{"type":"string","description":"Represents the various possible statuses of a Stripe subscription.","enum":["active","canceled","past_due","unpaid","incomplete","incomplete_expired","trialing","paused"]},"SupportError":{"type":"object","description":"Error from the support library","enum":["ValidationError(String)","SlackError(String)","InternalError(String)"]},"SupportRequest":{"type":"object","description":"Request payload for submitting a support ticket.\n\nContains the necessary information for a user to submit a support request,\nincluding their contact email, the subject of the request, the detailed message,\nand an optional category.","required":["email","subject","message"],"properties":{"category":{"type":["string","null"],"description":"An optional category for the support request (e.g., \"Billing\", \"Technical\")."},"email":{"type":"string","description":"The email address of the user submitting the request."},"message":{"type":"string","description":"The detailed description of the support issue."},"subject":{"type":"string","description":"A brief summary of the support issue."}}},"SupportResponse":{"type":"object","description":"Response payload confirming the receipt of a support request.\n\nProvides feedback to the user that their request has been successfully submitted.","required":["message"],"properties":{"message":{"type":"string","description":"A confirmation message indicating the request was received."}}},"UpdateProfileRequest":{"type":"object","description":"Data structure for receiving profile update requests.\nAll fields are optional, allowing partial updates.\nNote: Address fields are no longer part of the profile - use UserAddressRequest instead.","properties":{"date_of_birth":{"type":["string","null"],"format":"date","description":"Optional new date of birth."},"first_name":{"type":["string","null"],"description":"Optional new first name."},"gender":{"type":["string","null"],"description":"Optional new gender (male, female, other)."},"last_name":{"type":["string","null"],"description":"Optional new last name."},"phone":{"type":["string","null"],"description":"Optional new phone number (will be validated and converted to E.164 format).\nAccepts various formats like \"(555) 123-4567\", \"555-123-4567\", \"+15551234567\", etc.\nEmpty string will clear the existing phone number."},"test_mode_enabled":{"type":["boolean","null"],"description":"Optional flag to enable/disable test mode."}}},"UpdateUserAddressData":{"type":"object","description":"Data structure for updating an existing user address.\nAll fields are optional, allowing partial updates.","properties":{"address_line_1":{"type":["string","null"],"description":"Optional first line of the address."},"address_line_2":{"type":["string","null"],"description":"Optional second line of the address."},"address_name":{"type":["string","null"],"description":"Optional name/label for the address."},"address_type":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/AddressType","description":"Optional address type."}]},"city":{"type":["string","null"],"description":"Optional city name."},"country":{"type":["string","null"],"description":"Optional country."},"is_primary":{"type":["boolean","null"],"description":"Optional flag for primary address."},"latitude":{"type":["number","null"],"format":"double","description":"Optional latitude coordinate."},"longitude":{"type":["number","null"],"format":"double","description":"Optional longitude coordinate."},"state":{"type":["string","null"],"description":"Optional state or region."},"zip_code":{"type":["string","null"],"description":"Optional ZIP or postal code."}}},"UpdateUserInsuranceData":{"type":"object","description":"Data structure for updating an existing user insurance record.\nAll fields are optional, allowing partial updates.","properties":{"group_id":{"type":["string","null"],"description":"Optional group ID."},"insurance_payer_id":{"type":["string","null"],"format":"uuid","description":"Optional insurance payer ID (references insurance.payers table)."},"insurance_payer_name":{"type":["string","null"],"description":"Optional insurance payer name (will be populated from insurance.payers if not provided)."},"insurance_plan_id":{"type":["string","null"],"format":"uuid","description":"Optional insurance plan ID (references insurance.plans table)."},"insurance_plan_name":{"type":["string","null"],"description":"Optional insurance plan name (will be populated from insurance.plans if not provided)."},"member_id":{"type":["string","null"],"description":"Optional member ID."}}},"UserAddress":{"type":"object","description":"Represents a user's address information.","required":["id","user_id","address_type","is_primary","address_line_1","city","state","zip_code","country","created_at","updated_at"],"properties":{"address_line_1":{"type":"string","description":"First line of the address."},"address_line_2":{"type":["string","null"],"description":"Second line of the address (optional)."},"address_name":{"type":["string","null"],"description":"Optional name/label for the address."},"address_type":{"type":"string","description":"Type of address (home, work, other)."},"city":{"type":"string","description":"City name."},"country":{"type":"string","description":"Country (defaults to USA)."},"created_at":{"type":"string","format":"date-time","description":"Timestamp when the address was created."},"id":{"type":"string","format":"uuid","description":"Unique identifier for this address record."},"is_primary":{"type":"boolean","description":"Whether this is the primary address for the user."},"latitude":{"type":["number","null"],"format":"double","description":"Latitude coordinate (optional)."},"longitude":{"type":["number","null"],"format":"double","description":"Longitude coordinate (optional)."},"state":{"type":"string","description":"State or region."},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when the address was last updated."},"user_id":{"type":"string","format":"uuid","description":"Foreign key linking to the `User` record."},"zip_code":{"type":"string","description":"ZIP or postal code."}}},"UserAddressRequest":{"type":"object","description":"Data structure for receiving new user address requests.","required":["address_type","address_line_1","city","state","zip_code"],"properties":{"address_line_1":{"type":"string","description":"First line of the address."},"address_line_2":{"type":["string","null"],"description":"Second line of the address (optional)."},"address_name":{"type":["string","null"],"description":"Optional name/label for the address."},"address_type":{"$ref":"#/components/schemas/AddressType","description":"Type of address."},"city":{"type":"string","description":"City name."},"country":{"type":["string","null"],"description":"Country (optional, defaults to USA)."},"is_primary":{"type":["boolean","null"],"description":"Whether this should be the primary address."},"latitude":{"type":["number","null"],"format":"double","description":"Latitude coordinate (optional)."},"longitude":{"type":["number","null"],"format":"double","description":"Longitude coordinate (optional)."},"state":{"type":"string","description":"State or region."},"zip_code":{"type":"string","description":"ZIP or postal code."}}},"UserError":{"type":"object","description":"Error from the user library","enum":["NotFound(String)","InvalidProfile(String)","Database(String)","Internal(String)"]},"UserInfo":{"type":"object","description":"Represents the basic user information returned by the `/v1/auth/me` endpoint.","required":["id","auth0_user_id"],"properties":{"auth0_user_id":{"type":"string","description":"The Auth0 user ID string (e.g., \"auth0|123456789\")."},"email":{"type":["string","null"],"description":"The user's email address, if available in the JWT claims."},"id":{"type":"string","format":"uuid","description":"The unique UUID identifier of the user from the database."}}},"UserInsurance":{"type":"object","description":"Represents a user's insurance information.\nThis model works with the users.insurances table which references insurance.payers and insurance.plans.","required":["id","user_id","insurance_payer_id","insurance_plan_id","group_id","member_id","insurance_payer_name","insurance_plan_name","created_at","updated_at"],"properties":{"created_at":{"type":"string","format":"date-time","description":"Timestamp when the insurance record was created."},"group_id":{"type":"string","description":"Group ID for the insurance plan."},"id":{"type":"string","format":"uuid","description":"Unique identifier for this insurance record."},"insurance_payer_id":{"type":"string","format":"uuid","description":"Foreign key linking to insurance.payers table."},"insurance_payer_name":{"type":"string","description":"Insurance payer name (denormalized from insurance.payers)."},"insurance_plan_id":{"type":"string","format":"uuid","description":"Foreign key linking to insurance.plans table."},"insurance_plan_name":{"type":"string","description":"Insurance plan name (denormalized from insurance.plans)."},"member_id":{"type":"string","description":"Member ID for the insurance plan."},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when the insurance record was last updated."},"user_id":{"type":"string","format":"uuid","description":"Foreign key linking to the `User` record."}}},"UserProfile":{"type":"object","description":"Represents the detailed profile information associated with a user.\nNote: Address information is now stored separately in the users.addresses table.","required":["id","user_id","test_mode_enabled","created_at","updated_at"],"properties":{"created_at":{"type":"string","format":"date-time","description":"Timestamp when the profile was created."},"date_of_birth":{"type":["string","null"],"format":"date","description":"User's date of birth (optional)."},"first_name":{"type":["string","null"],"description":"User's first name (optional)."},"gender":{"oneOf":[{"type":"null"},{"$ref":"#/components/schemas/GenderType","description":"User's gender (optional, enum: male, female, other)."}]},"id":{"type":"string","format":"uuid","description":"Unique identifier for the profile record itself."},"last_name":{"type":["string","null"],"description":"User's last name (optional)."},"phone":{"type":["string","null"],"description":"User's phone number in E.164 format (optional).\nE.164 format: starts with '+' followed by country code and number (e.g., \"+15551234567\")."},"test_mode_enabled":{"type":"boolean","description":"Whether test mode is enabled for this user."},"updated_at":{"type":"string","format":"date-time","description":"Timestamp when the profile was last updated."},"user_id":{"type":"string","format":"uuid","description":"Foreign key linking to the `User` record."}}}},"securitySchemes":{"jwt":{"type":"http","scheme":"bearer"}}},"tags":[{"name":"health","description":"Health check endpoints"},{"name":"auth","description":"Authentication endpoints"},{"name":"conversations","description":"Conversation management endpoints"},{"name":"users","description":"User profile and insurance management endpoints"},{"name":"ribbon","description":"Ribbon Health insurance and provider endpoints"},{"name":"stripe","description":"Stripe billing endpoints"},{"name":"support","description":"Support endpoints"},{"name":"elevenlabs","description":"ElevenLabs voice AI endpoints"},{"name":"insurance","description":"Insurance payer and plan management endpoints"}]}