{"openapi":"3.0.3","info":{"title":"PremiumIdentity API","version":"1.0.0","description":"SvelteKit rewrite of the PremiumIdentity authentication and enrollment API."},"servers":[{"url":"/","description":"Current SvelteKit host"}],"tags":[{"name":"Client","description":"Subscription/client lookup endpoints"},{"name":"User","description":"User management endpoints"},{"name":"Enrollment","description":"Subscription enrollment endpoints"},{"name":"Auth","description":"Token refresh and branch token endpoints"}],"components":{"securitySchemes":{"apiKey":{"type":"apiKey","in":"header","name":"x-api-key"},"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"string"}}},"SuccessResponse":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}},"TokenResponse":{"type":"object","properties":{"token":{"type":"string"},"refreshToken":{"type":"string"}}},"User":{"type":"object","properties":{"id":{"type":"integer"},"guid":{"type":"string","format":"uuid"},"userName":{"type":"string"},"email":{"type":"string","format":"email"},"firstName":{"type":"string"},"middleName":{"type":"string","nullable":true},"lastName":{"type":"string"},"phone":{"type":"string"},"role":{"type":"string"},"isTfaEnabled":{"type":"boolean"},"profilePicture":{"type":"string"}}},"Subscription":{"type":"object","properties":{"id":{"type":"integer"},"name":{"type":"string"},"address":{"type":"string"},"slogan":{"type":"string","nullable":true},"logo":{"type":"string","nullable":true},"image":{"type":"string","nullable":true},"bannerImage":{"type":"string","nullable":true},"isOpenApp":{"type":"boolean"},"guid":{"type":"string"},"redirectUrl":{"type":"string"},"jwtExpiry":{"type":"integer"},"referId":{"type":"integer"},"jwtAudience":{"type":"string"},"clientId":{"type":"integer"},"productId":{"type":"integer"},"branches":{"type":"array","items":{"$ref":"#/components/schemas/SubscriptionBranch"}}}},"SubscriptionBranch":{"type":"object","properties":{"id":{"type":"integer"},"referId":{"type":"integer"},"name":{"type":"string"}}},"UserCreateRequest":{"type":"object","required":["firstName","lastName","userName","email","phone"],"properties":{"firstName":{"type":"string"},"middleName":{"type":"string","nullable":true},"lastName":{"type":"string"},"userName":{"type":"string"},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"password":{"type":"string"},"clientCode":{"type":"string"},"referId":{"type":"integer"}}},"UserUpdateRequest":{"type":"object","required":["guid"],"properties":{"guid":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"firstName":{"type":"string"},"middleName":{"type":"string","nullable":true},"lastName":{"type":"string"},"phone":{"type":"string"},"userName":{"type":"string"}}},"ChangePasswordRequest":{"type":"object","required":["userGuid","newPassword"],"properties":{"userGuid":{"type":"string","format":"uuid"},"currentPassword":{"type":"string"},"newPassword":{"type":"string"}}},"ChangeUserDpRequest":{"type":"object","required":["userGuid","url"],"properties":{"userGuid":{"type":"string","format":"uuid"},"url":{"type":"string"}}},"InviteUserRequest":{"type":"object","required":["userId","referId","subscriptionId"],"properties":{"userId":{"type":"integer"},"referId":{"type":"integer"},"subscriptionId":{"type":"integer"},"subscriptionName":{"type":"string"}}},"RevokeUsersRequest":{"type":"object","required":["subscriptionId","users"],"properties":{"subscriptionId":{"type":"integer"},"users":{"type":"array","items":{"type":"integer"}}}},"PageRequest":{"type":"object","properties":{"page":{"type":"integer","default":1},"pageSize":{"type":"integer","default":20},"search":{"type":"string"}}},"EnrollmentImportRequest":{"type":"array","items":{"$ref":"#/components/schemas/InviteUserRequest"}}}},"paths":{"/api/client/{clientId}":{"get":{"tags":["Client"],"summary":"Get subscription by client GUID","parameters":[{"name":"clientId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Subscription","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Subscription"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/client/subs/{productId}":{"get":{"tags":["Client"],"summary":"Get subscriptions by product ID","parameters":[{"name":"productId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Subscriptions","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Subscription"}}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/client/revoke":{"post":{"tags":["Client"],"summary":"Revoke subscription users","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/RevokeUsersRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/{id}":{"get":{"tags":["User"],"summary":"Get user by ID","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/filter/{searchText}":{"get":{"tags":["User"],"summary":"Search users by text","security":[{"apiKey":[]}],"parameters":[{"name":"searchText","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Users","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/username/{username}":{"get":{"tags":["User"],"summary":"Get user by username","security":[{"apiKey":[]}],"parameters":[{"name":"username","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/guid/{guid}":{"get":{"tags":["User"],"summary":"Get user by GUID","security":[{"apiKey":[]}],"parameters":[{"name":"guid","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/subscription-id/{subscriptionId}":{"get":{"tags":["User"],"summary":"Get enrolled users by subscription ID","security":[{"apiKey":[]}],"parameters":[{"name":"subscriptionId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Users","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/User"}}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/page":{"post":{"tags":["User"],"summary":"Get paginated user list","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PageRequest"}}}},"responses":{"200":{"description":"Paged result"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user":{"post":{"tags":["User"],"summary":"Create a user","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCreateRequest"}}}},"responses":{"200":{"description":"User","content":{"application/json":{"schema":{"$ref":"#/components/schemas/User"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/update":{"put":{"tags":["User"],"summary":"Update a user","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserUpdateRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/invite":{"post":{"tags":["User"],"summary":"Enroll a user in a subscription","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/InviteUserRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/change-password":{"post":{"tags":["User"],"summary":"Change a user password","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangePasswordRequest"}}}},"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/change-user-dp":{"post":{"tags":["User"],"summary":"Change a user profile picture URL","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ChangeUserDpRequest"}}}},"responses":{"200":{"description":"Updated"},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/user/toggle-mfa/{userId}":{"get":{"tags":["User"],"summary":"Toggle MFA for a user","security":[{"apiKey":[]}],"parameters":[{"name":"userId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"New MFA state","content":{"application/json":{"schema":{"type":"boolean"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/enrollment/{subscriptionId}":{"get":{"tags":["Enrollment"],"summary":"Get enrollments by subscription ID","security":[{"apiKey":[]}],"parameters":[{"name":"subscriptionId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Enrollment list"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/enrollment/import":{"post":{"tags":["Enrollment"],"summary":"Import enrollments","security":[{"apiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EnrollmentImportRequest"}}}},"responses":{"200":{"description":"Import summary"},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/api/enrollment/delete/{id}":{"delete":{"tags":["Enrollment"],"summary":"Delete enrollment by ID","security":[{"apiKey":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Success","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SuccessResponse"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/login/token/{branchId}":{"get":{"tags":["Auth"],"summary":"Issue a JWT for another branch","security":[{"bearerAuth":[]}],"parameters":[{"name":"branchId","in":"path","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Token response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}},"/refresh/{refreshToken}":{"get":{"tags":["Auth"],"summary":"Refresh an access token","security":[{"bearerAuth":[]}],"parameters":[{"name":"refreshToken","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Token response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"400":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"401":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}