{"openapi":"3.1.0","info":{"title":"Payzone auth-svc","description":"OTP + JWT (RS256/JWKS) + social login (Google, Telegram)","version":"0.1.0"},"paths":{"/health/liveness":{"get":{"tags":["health"],"summary":"Liveness","operationId":"liveness_health_liveness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Liveness Health Liveness Get"}}}}}}},"/health/readiness":{"get":{"tags":["health"],"summary":"Readiness","operationId":"readiness_health_readiness_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Readiness Health Readiness Get"}}}}}}},"/health/startup":{"get":{"tags":["health"],"summary":"Startup","operationId":"startup_health_startup_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"type":"string"},"type":"object","title":"Response Startup Health Startup Get"}}}}}}},"/.well-known/jwks.json":{"get":{"tags":["jwks"],"summary":"Jwks Endpoint","description":"Public key JWK Set — boshqa service'lar JWT verify uchun ishlatadi.","operationId":"jwks_endpoint__well_known_jwks_json_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"additionalProperties":{"items":{"additionalProperties":true,"type":"object"},"type":"array"},"type":"object","title":"Response Jwks Endpoint  Well Known Jwks Json Get"}}}}}}},"/api/v1/auth/otp/request":{"post":{"tags":["auth"],"summary":"Otp Request","operationId":"otp_request_api_v1_auth_otp_request_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpRequestBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpRequestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/otp/verify":{"post":{"tags":["auth"],"summary":"Otp Verify","operationId":"otp_verify_api_v1_auth_otp_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OtpVerifyBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialLoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/social/google":{"post":{"tags":["auth"],"summary":"Google Login","operationId":"google_login_api_v1_auth_social_google_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GoogleLoginBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialLoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/social/telegram":{"post":{"tags":["auth"],"summary":"Telegram Login","operationId":"telegram_login_api_v1_auth_social_telegram_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramLoginBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialLoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/social/telegram-mini-app":{"post":{"tags":["auth"],"summary":"Telegram Mini App Login","operationId":"telegram_mini_app_login_api_v1_auth_social_telegram_mini_app_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/TelegramMiniAppLoginBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialLoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/social/vk":{"post":{"tags":["auth"],"summary":"Vk Login","description":"Exchange a VK ID auth code (from id.vk.com PKCE redirect) for a\nPayzone session. The frontend's VK ID JS SDK handles the popup +\nchallenge generation; we get the resulting code + verifier here.","operationId":"vk_login_api_v1_auth_social_vk_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/VkLoginBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SocialLoginResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/refresh":{"post":{"tags":["auth"],"summary":"Refresh","operationId":"refresh_api_v1_auth_refresh_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RefreshRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenPairResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/logout":{"post":{"tags":["auth"],"summary":"Logout","operationId":"logout_api_v1_auth_logout_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LogoutRequest"}}},"required":true},"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/email/otp/request":{"post":{"tags":["auth"],"summary":"Email Otp Request","operationId":"email_otp_request_api_v1_auth_email_otp_request_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpRequestBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpRequestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/email/otp/verify":{"post":{"tags":["auth"],"summary":"Email Otp Verify","operationId":"email_otp_verify_api_v1_auth_email_otp_verify_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpVerifyBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpVerifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/email/otp/resend":{"post":{"tags":["auth"],"summary":"Email Otp Resend","operationId":"email_otp_resend_api_v1_auth_email_otp_resend_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpResendBody"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EmailOtpResendResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/email/change/request":{"post":{"tags":["auth"],"summary":"Request Email Change","description":"Send an OTP to ``newEmail``. The token returned identifies the\npending change; pair it with the code on /verify.","operationId":"request_email_change_api_v1_auth_email_change_request_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/ChangeRequestBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeRequestResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/email/change/verify":{"post":{"tags":["auth"],"summary":"Verify Email Change","operationId":"verify_email_change_api_v1_auth_email_change_verify_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/VerifyBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/VerifyResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/email/change/resend":{"post":{"tags":["auth"],"summary":"Resend Email Change","operationId":"resend_email_change_api_v1_auth_email_change_resend_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/ResendBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResendResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/by-email":{"get":{"tags":["internal"],"summary":"Get User By Email","description":"Lookup user by email (HMAC hash). admin-svc bootstrap script uses this\nto resolve FOUNDER_EMAIL → user_id before granting super-admin overrides.","operationId":"get_user_by_email_api_v1_internal_users_by_email_get","parameters":[{"name":"email","in":"query","required":true,"schema":{"type":"string","minLength":3,"maxLength":254,"title":"Email"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/list":{"get":{"tags":["internal"],"summary":"List Users Paginated","description":"Paginated user list — admin panel browses everyone newest-first.\n\nNo free-text search: pgcrypto-encrypted phone/email don't support\nLIKE, and HMAC hashes only resolve exact matches (covered by\n/by-email). Phase 2 will add a hashed-prefix index if needed.","operationId":"list_users_paginated_api_v1_internal_users_list_get","parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":200,"minimum":1,"default":50,"title":"Limit"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"role","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Role"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserListPage"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/stats":{"get":{"tags":["internal"],"summary":"Users Stats","description":"Counts of live users (deleted_at IS NULL).\n\nSoft-deleted users are excluded everywhere — they're invisible to\noperators by spec. Banned/suspended users still count: the dashboard\nwants total reachable accounts, not just active ones.\n\nH14: \"today\" is operator-local Tashkent (UTC+5), not UTC. With UTC\nmidnight, the `new_today` count rolled over at 5am Tashkent —\noperators saw a sleepy night of sign-ups attributed to the previous\nday until lunchtime.","operationId":"users_stats_api_v1_internal_users_stats_get","parameters":[{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsersStats"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/{user_id}":{"get":{"tags":["internal"],"summary":"Get User Summary","description":"Full user record. admin-svc calls this on every authenticated request\nvia `current_admin` dependency (results cached 60s in admin-svc Redis).","operationId":"get_user_summary_api_v1_internal_users__user_id__get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/{user_id}/status":{"put":{"tags":["internal"],"summary":"Set User Status","description":"Set the active flag (and optional suspend deadline) for a user.\n\nUsed by admin-svc ban / unban / suspend handlers. Soft-deleted users\nare rejected — recovery happens through a separate undelete flow.","operationId":"set_user_status_api_v1_internal_users__user_id__status_put","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/{user_id}/role":{"put":{"tags":["internal"],"summary":"Set User Role","description":"Replace the user's single role slot.\n\nauth-svc currently stores one role per user; granting a new role\noverwrites the previous one. Multi-role support is a Phase 2\nschema change (separate user_roles table).\n\nChanging the role revokes the user's refresh tokens. Each refresh\nrecord carries the role it was minted with, and refresh tokens live\nfor 30 days — so without this a demoted admin would keep minting\nadmin access tokens for a month. Revoking costs them a re-login,\nwhich is the correct price for a privilege change.","operationId":"set_user_role_api_v1_internal_users__user_id__role_put","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RoleUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSummary"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/{user_id}/sessions/revoke":{"post":{"tags":["internal"],"summary":"Revoke User Sessions","description":"Force logout — purge every refresh token for this user from Redis.\n\nIssued access tokens still verify until their 15-min TTL elapses; new\naccess tokens cannot be obtained because the refresh family is gone.\nUsed by admin-svc `users.session_revoke` action and by auth-svc itself\nwhen a user is anonymized.","operationId":"revoke_user_sessions_api_v1_internal_users__user_id__sessions_revoke_post","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SessionsRevokedResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/{user_id}/phone":{"get":{"tags":["internal"],"summary":"Get User Phone","operationId":"get_user_phone_api_v1_internal_users__user_id__phone_get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserPhone"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/{user_id}/email":{"get":{"tags":["internal"],"summary":"Get User Email","description":"Decrypted email for the authenticating user (set when they signed\nup via email OTP). user-svc calls this to backfill Profile.email on\nfirst /me load so the frontend can render it without an extra hop on\nevery page view.","operationId":"get_user_email_api_v1_internal_users__user_id__email_get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserEmail"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/internal/users/{user_id}/social-identities":{"get":{"tags":["internal"],"summary":"Get User Social Identities","description":"All active social-login links for a user.\n\nnotification-svc calls this to discover the Telegram chat_id\n(`provider=\"telegram\"`, `external_id=<chat_id>`) so it can DM the\nuser via the bot. Other services may use it for richer identity\ndisplay (preferred social handle on profile cards, etc.).","operationId":"get_user_social_identities_api_v1_internal_users__user_id__social_identities_get","parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"X-Internal-Token","in":"header","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"X-Internal-Token"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserSocialIdentities"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me/social-accounts":{"get":{"tags":["auth"],"summary":"List Linked Accounts","operationId":"list_linked_accounts_api_v1_auth_me_social_accounts_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":{"$ref":"#/components/schemas/LinkedAccount"},"title":"Response List Linked Accounts Api V1 Auth Me Social Accounts Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me/social-accounts/google":{"post":{"tags":["auth"],"summary":"Link Google","description":"Verify a Google ID token and attach it to the calling user.\n\nThe same id_token format the login route consumes — the frontend\nruns the GIS popup, gets the credential, and posts it here so the\nserver can audience-verify against ``GOOGLE_CLIENT_ID`` before\ncreating the SocialIdentity row.","operationId":"link_google_api_v1_auth_me_social_accounts_google_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/GoogleLoginBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkedAccount"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me/social-accounts/telegram":{"post":{"tags":["auth"],"summary":"Link Telegram","description":"Verify a Telegram Login Widget payload and attach it to the\ncalling user. HMAC-validates with the bot token; auth_date older\nthan 5 min is rejected (re-runs of an old payload).","operationId":"link_telegram_api_v1_auth_me_social_accounts_telegram_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/TelegramLoginBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkedAccount"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me/social-accounts/vk":{"post":{"tags":["auth"],"summary":"Link Vk","description":"Exchange a VK ID auth code for a profile and attach it to the\ncalling user. Same PKCE payload the login route consumes.","operationId":"link_vk_api_v1_auth_me_social_accounts_vk_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/VkLoginBody"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LinkedAccount"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/v1/auth/me/social-accounts/{provider}":{"delete":{"tags":["auth"],"summary":"Unlink Account","description":"Soft-delete the link, fire ``user.user.identity_unlinked``, but\nrefuse if the user has no other way to log in.\n\nThe guard is server-side authoritative — the frontend's\n``canUnlinkProvider`` does the same accounting client-side as a UX\nhint, but a 409 here is the source of truth.","operationId":"unlink_account_api_v1_auth_me_social_accounts__provider__delete","parameters":[{"name":"provider","in":"path","required":true,"schema":{"type":"string","pattern":"^(google|telegram|apple|vk)$","title":"Provider"}},{"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/v1/auth/centrifugo-token":{"post":{"tags":["auth"],"summary":"Issue Centrifugo Token","description":"Mint a Centrifugo HS256 connection token for the calling user.\n\nThe `sub` claim becomes Centrifugo's `client.user`, which authorises\nthe user-limited `notifications:#<sub>` channel. The `channels` claim\npre-subscribes it server-side so the FE doesn't need a second\nround-trip after connecting.","operationId":"issue_centrifugo_token_api_v1_auth_centrifugo_token_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/CentrifugoTokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"AuthUserPayload":{"properties":{"id":{"type":"string","title":"Id"},"displayName":{"type":"string","title":"Displayname","default":""},"avatarUrl":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Avatarurl"},"primaryIdentityType":{"type":"string","enum":["phone","email","telegram","google","apple","vk"],"title":"Primaryidentitytype"},"tier":{"type":"string","enum":["bronze","silver","gold","platinum"],"title":"Tier","default":"bronze"},"psyCachedBalance":{"type":"string","title":"Psycachedbalance","default":"0"},"language":{"type":"string","enum":["uz","ru","en"],"title":"Language","default":"uz"},"role":{"type":"string","enum":["user","partner","support","admin"],"title":"Role","default":"user"},"partnerStatus":{"type":"string","enum":["none","pending","approved","rejected"],"title":"Partnerstatus","default":"none"}},"type":"object","required":["id","primaryIdentityType"],"title":"AuthUserPayload","description":"User shape mirroring `BackendAuthUser` in the frontend.\n\nPhase 1: display_name lives in user-svc Profile and isn't joined here\nto keep latency low — auth-svc returns an empty string and the\nfrontend's later `useProfile` fetch fills it in."},"CentrifugoTokenResponse":{"properties":{"token":{"type":"string","title":"Token"},"expires_at":{"type":"integer","title":"Expires At"}},"type":"object","required":["token","expires_at"],"title":"CentrifugoTokenResponse"},"ChangeRequestBody":{"properties":{"newEmail":{"type":"string","format":"email","title":"Newemail"}},"type":"object","required":["newEmail"],"title":"ChangeRequestBody"},"ChangeRequestResponse":{"properties":{"requestId":{"type":"string","title":"Requestid"},"field":{"type":"string","title":"Field","default":"email"},"maskedTarget":{"type":"string","title":"Maskedtarget"},"expiresAt":{"type":"string","title":"Expiresat"},"resendAvailableAt":{"type":"string","title":"Resendavailableat"}},"type":"object","required":["requestId","maskedTarget","expiresAt","resendAvailableAt"],"title":"ChangeRequestResponse","description":"Mirror of frontend ContactChangeResponse — camelCase field names\nvia aliases keep the FE TS types unchanged."},"EmailOtpRequestBody":{"properties":{"email":{"type":"string","maxLength":254,"minLength":5,"title":"Email"}},"type":"object","required":["email"],"title":"EmailOtpRequestBody"},"EmailOtpRequestResponse":{"properties":{"otp_token":{"type":"string","title":"Otp Token","description":"Opaque token, send back at verify"},"ttl_sec":{"type":"integer","title":"Ttl Sec"}},"type":"object","required":["otp_token","ttl_sec"],"title":"EmailOtpRequestResponse"},"EmailOtpResendBody":{"properties":{"otp_token":{"type":"string","maxLength":128,"minLength":8,"title":"Otp Token"}},"type":"object","required":["otp_token"],"title":"EmailOtpResendBody"},"EmailOtpResendResponse":{"properties":{"ttl_sec":{"type":"integer","title":"Ttl Sec"}},"type":"object","required":["ttl_sec"],"title":"EmailOtpResendResponse"},"EmailOtpVerifyBody":{"properties":{"otp_token":{"type":"string","maxLength":128,"minLength":8,"title":"Otp Token"},"code":{"type":"string","maxLength":8,"minLength":4,"title":"Code"}},"type":"object","required":["otp_token","code"],"title":"EmailOtpVerifyBody"},"EmailOtpVerifyResponse":{"properties":{"user":{"$ref":"#/components/schemas/AuthUserPayload"},"meta":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Meta"},"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"},"access_expires_at":{"type":"string","title":"Access Expires At"},"refresh_expires_at":{"type":"string","title":"Refresh Expires At"},"token_type":{"type":"string","title":"Token Type","default":"Bearer"}},"type":"object","required":["user","meta","access_token","refresh_token","access_expires_at","refresh_expires_at"],"title":"EmailOtpVerifyResponse","description":"Hybrid response — frontend uses (user, meta) and HTTP client uses tokens."},"GoogleLoginBody":{"properties":{"id_token":{"type":"string","minLength":20,"title":"Id Token","description":"Google Sign-In ID token"}},"type":"object","required":["id_token"],"title":"GoogleLoginBody"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"LinkedAccount":{"properties":{"provider":{"type":"string","title":"Provider"},"providerUserId":{"type":"string","title":"Provideruserid"},"linkedAt":{"type":"string","title":"Linkedat"},"displayLabel":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Displaylabel"}},"type":"object","required":["provider","providerUserId","linkedAt"],"title":"LinkedAccount","description":"Mirror of the frontend ``ConnectedAccount`` type — what the\nsecurity tab renders for each linked provider row."},"LogoutRequest":{"properties":{"refresh_token":{"type":"string","minLength":20,"title":"Refresh Token"},"all_devices":{"type":"boolean","title":"All Devices","default":false}},"type":"object","required":["refresh_token"],"title":"LogoutRequest"},"OtpRequestBody":{"properties":{"phone":{"type":"string","maxLength":20,"minLength":9,"title":"Phone","description":"UZ phone, +998XXXXXXXXX"}},"type":"object","required":["phone"],"title":"OtpRequestBody"},"OtpRequestResponse":{"properties":{"phone":{"type":"string","title":"Phone"},"expires_in_seconds":{"type":"integer","title":"Expires In Seconds"},"sent":{"type":"boolean","title":"Sent"}},"type":"object","required":["phone","expires_in_seconds","sent"],"title":"OtpRequestResponse"},"OtpVerifyBody":{"properties":{"phone":{"type":"string","maxLength":20,"minLength":9,"title":"Phone"},"code":{"type":"string","maxLength":8,"minLength":4,"title":"Code"}},"type":"object","required":["phone","code"],"title":"OtpVerifyBody"},"RefreshRequest":{"properties":{"refresh_token":{"type":"string","minLength":20,"title":"Refresh Token"}},"type":"object","required":["refresh_token"],"title":"RefreshRequest"},"ResendBody":{"properties":{"requestId":{"type":"string","title":"Requestid"}},"type":"object","required":["requestId"],"title":"ResendBody"},"ResendResponse":{"properties":{"ttlSec":{"type":"integer","title":"Ttlsec"}},"type":"object","required":["ttlSec"],"title":"ResendResponse"},"RoleUpdate":{"properties":{"role":{"type":"string","enum":["admin","support","partner","customer"],"title":"Role","description":"Single-role slot — 'customer' is the default."}},"type":"object","required":["role"],"title":"RoleUpdate"},"SessionsRevokedResponse":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"revoked_count":{"type":"integer","title":"Revoked Count"}},"type":"object","required":["user_id","revoked_count"],"title":"SessionsRevokedResponse"},"SocialIdentityBrief":{"properties":{"provider":{"type":"string","title":"Provider"},"external_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Username"},"external_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Email"}},"type":"object","required":["provider","external_username","external_email"],"title":"SocialIdentityBrief","description":"Minimal social-link summary suitable for chip rendering."},"SocialIdentityRead":{"properties":{"provider":{"type":"string","title":"Provider"},"external_id":{"type":"string","title":"External Id"},"external_username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Username"},"external_email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"External Email"}},"type":"object","required":["provider","external_id","external_username","external_email"],"title":"SocialIdentityRead"},"SocialLoginResponse":{"properties":{"user":{"$ref":"#/components/schemas/AuthUserPayload"},"meta":{"additionalProperties":{"type":"boolean"},"type":"object","title":"Meta"},"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"},"access_expires_at":{"type":"string","title":"Access Expires At"},"refresh_expires_at":{"type":"string","title":"Refresh Expires At"},"token_type":{"type":"string","title":"Token Type","default":"Bearer"}},"type":"object","required":["user","meta","access_token","refresh_token","access_expires_at","refresh_expires_at"],"title":"SocialLoginResponse","description":"Shared envelope for Telegram + Google + future social providers.\n\nMatches `EmailOtpVerifyResponse` so the frontend's `startSocialLogin`\nand `verifyEmailOtp` consumers parse the same fields."},"StatusUpdate":{"properties":{"is_active":{"type":"boolean","title":"Is Active"},"suspended_until":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Suspended Until"}},"type":"object","required":["is_active"],"title":"StatusUpdate"},"TelegramLoginBody":{"properties":{"id":{"type":"integer","title":"Id"},"hash":{"type":"string","title":"Hash"},"auth_date":{"type":"integer","title":"Auth Date"},"first_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"First Name"},"last_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Last Name"},"username":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Username"},"photo_url":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Photo Url"}},"additionalProperties":true,"type":"object","required":["id","hash","auth_date"],"title":"TelegramLoginBody","description":"Telegram Login Widget callback payload."},"TelegramMiniAppLoginBody":{"properties":{"init_data":{"type":"string","maxLength":8192,"minLength":20,"title":"Init Data"}},"type":"object","required":["init_data"],"title":"TelegramMiniAppLoginBody","description":"Raw Telegram Mini App initData query string."},"TokenPairResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"refresh_token":{"type":"string","title":"Refresh Token"},"access_expires_at":{"type":"string","format":"date-time","title":"Access Expires At"},"refresh_expires_at":{"type":"string","format":"date-time","title":"Refresh Expires At"},"token_type":{"type":"string","title":"Token Type","default":"Bearer"}},"type":"object","required":["access_token","refresh_token","access_expires_at","refresh_expires_at"],"title":"TokenPairResponse"},"UserEmail":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"locale":{"type":"string","title":"Locale"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["user_id","email","locale","is_active"],"title":"UserEmail"},"UserListPage":{"properties":{"items":{"items":{"$ref":"#/components/schemas/UserSummary"},"type":"array","title":"Items"},"total":{"type":"integer","title":"Total"},"limit":{"type":"integer","title":"Limit"},"offset":{"type":"integer","title":"Offset"}},"type":"object","required":["items","total","limit","offset"],"title":"UserListPage"},"UserPhone":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"phone":{"type":"string","title":"Phone"},"locale":{"type":"string","title":"Locale"},"is_active":{"type":"boolean","title":"Is Active"}},"type":"object","required":["user_id","phone","locale","is_active"],"title":"UserPhone"},"UserSocialIdentities":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"items":{"items":{"$ref":"#/components/schemas/SocialIdentityRead"},"type":"array","title":"Items"}},"type":"object","required":["user_id","items"],"title":"UserSocialIdentities"},"UserSummary":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"email":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Email"},"phone":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Phone"},"status":{"type":"string","title":"Status"},"roles":{"items":{"type":"string"},"type":"array","title":"Roles"},"locale":{"type":"string","title":"Locale"},"is_active":{"type":"boolean","title":"Is Active"},"suspended_until":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Suspended Until"},"social_identities":{"items":{"$ref":"#/components/schemas/SocialIdentityBrief"},"type":"array","title":"Social Identities","default":[]},"created_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created At"},"last_login_at":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Last Login At"}},"type":"object","required":["user_id","email","phone","status","roles","locale","is_active"],"title":"UserSummary","description":"Full-shape user record used by admin-svc.\n\n`roles` is always a list (even though auth-svc currently stores a single\nstring `role`) so the contract is forward-compatible when multi-role\nsupport lands in Phase 2 — admin-svc can grow its array consumer\nwithout coordinating a new auth-svc release."},"UsersStats":{"properties":{"total":{"type":"integer","title":"Total","default":0},"new_today":{"type":"integer","title":"New Today","default":0},"new_7d":{"type":"integer","title":"New 7D","default":0},"by_role":{"additionalProperties":{"type":"integer"},"type":"object","title":"By Role"}},"type":"object","title":"UsersStats","description":"Aggregate metrics for the admin Users widget."},"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"},"VerifyBody":{"properties":{"requestId":{"type":"string","title":"Requestid"},"code":{"type":"string","title":"Code"}},"type":"object","required":["requestId","code"],"title":"VerifyBody"},"VerifyResponse":{"properties":{"success":{"type":"boolean","title":"Success","default":true},"newEmail":{"type":"string","title":"Newemail"}},"type":"object","required":["newEmail"],"title":"VerifyResponse","description":"Frontend invalidates its profile query and re-fetches /me, so we\nonly need to surface the new email here for optimistic UI updates."},"VkLoginBody":{"properties":{"code":{"type":"string","minLength":10,"title":"Code","description":"Auth code from id.vk.com redirect"},"code_verifier":{"type":"string","maxLength":128,"minLength":43,"title":"Code Verifier"},"device_id":{"type":"string","minLength":1,"title":"Device Id"},"state":{"type":"string","minLength":1,"title":"State"},"redirect_uri":{"type":"string","minLength":10,"title":"Redirect Uri"}},"type":"object","required":["code","code_verifier","device_id","state","redirect_uri"],"title":"VkLoginBody","description":"VK ID OAuth 2.1 PKCE redirect payload, as forwarded by the\nfrontend after the VK ID SDK handles the popup flow."}}}}