getUsernameAvailability

@GET(value = "users/usernameAvailability")
abstract suspend fun getUsernameAvailability(@Query(value = "username") username: String, @Query(value = "credentialType") credentialType: String? = null): Response<UsernameAvailabilityResponseDto>

Check for the availability of a username. This endpoint allows you to check whether a particular username to register a new account is available or not before you register a new user. If the given username is available, then this endpoint will return back a JSON object with the property available set to true. If the username is taken, then this endpoint will return back the property available set to false.

This endpoint can be used with either a client token or a user token.

In order to use this endpoint, you must have that policy explicitly enabled on your account. It is disabled by default. Please contact the Sensibill team in order to have this enabled. Responses:

  • 200: Success. This status code will be issued both when the username is available, and when it is taken. You need to check the body of the response to see whether or not the username is available.

  • 400: Bad Request. This will occur if you omit the username.

  • 401: Unauthorized. This will occur if you do not supply an access-token to this endpoint, or if you provide an expired or invalid access token.

Return

UsernameAvailabilityResponseDto

Parameters

username

The username to the user's account.

credentialType

The credential type for your client's users that you wish to check. If your client only has one credential type, this parameter may be omitted. (optional)