Skip to content


The lists of methods below contain the client-side methods that you can use to interact with the API. Use these methods within Unity to create or manage accounts.

Swagger Documentation

You can check out, or even try out some of the endpoints here:

Account Endpoints

These methods are used for account-related operations such as account creation, authentication, session management, account updates, password recovery, and more.

// Creates a new account with optional two-factor authentication
Task<string?> CreateAccountAsync(string email, string username, string password, 
    bool use2Fa = false, CredentialsValidator? credentialsValidator = null);

// Logs in the user. If 2FA is enabled, starts the 2FA login process
Task<LoginResult> LoginAsync(string id, string password);

// Completes the login process with a 2FA code.
// Must call LoginAsync first to get the 2FA code
Task<string> LoginTwoFactorAsync(uint code);

// Sends a request to the server to refresh the JWT, preventing it from expiring
Task<string> RefreshTokenAsync();

// Logs out the user by clearing the JWT token
Task LogoutAsync();

// Changes the user's email. Requires the user to be logged in
Task ChangeEmailAsync(string newEmail, string password);

// Changes the user's password. Requires the user to be logged in
Task ChangePasswordAsync(string oldPassword, string newPassword);

// Initiates a password reset for users who have forgotten their password
Task ForgotPasswordAsync(string id);

// Retrieves the roles associated with the logged-in user
Task<IEnumerable<string>> GetRolesAsync();

// Fetches information for the logged-in user
Task<UserDto> GetUserAsync();

// Retrieves username for a valid token.
Task<string> IdentifyAsync(string token);

// Updates current user's 2FA preferences.
Task SetTwoFactorAuthenticationAsync(bool enabled)

Admin Endpoints

These endpoints are designated for administrative tasks, offering functionalities to manage user roles, delete accounts, handle custom user data, and oversee user status, including banning or unbanning users. Access to these endpoints requires logging in as an administrator (using the Account endpoints above).

// Sets the roles for a specific user. Requires admin privileges
Task SetRoleAsync();

// Removes a specific role from a user if they have it. Requires admin privileges
Task RemoveRoleAsync();

// Deletes a user account. Requires confirmation and admin privileges
Task DeleteAccountAsync();

// Retrieves the roles assigned to a specific user. Requires admin privileges
Task<HashSet<string>> GetRolesAsync();

// Sets custom data for a specific user. Can be used for storing 
// additional information about users
Task SetCustomDataAsync();

// Gets the custom data associated with a specific user.
// Returns null if not found
Task<T?> GetCustomDataAsync<T>();

// Deletes the custom data associated with a specific user.
// Useful for cleaning up or resetting user data
Task DeleteCustomDataAsync();

// Fetches detailed information for a specific user.
// Useful for admin panels or user management features
Task<UserDto?> GetUserAsync();

// Retrieves a list of all users. 
// Useful for admin purposes like audits, user management, or analytics
Task<IEnumerable<UserDto>> GetUsersAsync();

// Bans or unbans a user by setting the banned until date. 
// Setting a past date effectively unbans the user
Task SetBannedUntilAsync();

// Verifies the validity of the token and returns the user information if the token is valid or null if not.
Task<UserDto?> VerifyTokenAsync(string token);