Account Recovery API
Base URL: https://api.asgardeo.io/t/<ORGANIZATION_NAME>/api/users/v2
The User Account Recovery API (version v2).
Download the OpenAPI definition (YAML)
Username Recovery
Initiate Username Recovery
POST /recovery/username/init
-
This API is used to initiate username recovery by user. The API will return available recovery information for username recovery with notifications.
-
Use the returned recoveryCode and the channelId with username recover api to confirm the username recovery and to receive recovery notifications via the channel specified by the user.
Scope(Permission) required: internal_user_recovery_create
Request body (required): application/json
Request to initate username recovery process. The request should contain the claims to identify the user. User claims are REQUIRED.
Schema: InitRequest
2 properties
Responses
| Code | Description | Schema |
|---|---|---|
200 | User is successfully identified for the given claims and returning available notification channels for the user. | array of AccountRecoveryType |
400 | Bad Request. The request cannot be processed by the server. | ErrorResponse |
403 | Username recovery is not enabled. | ErrorResponse |
404 | No user found for the given set of claims or no recovery channels are available for the user. | ErrorResponse |
409 | Multiple users found for the given claims. | ErrorResponse |
500 | Server Error. | ErrorResponse |
Get Recovery Information
POST /recovery/username/recover
- This API is used to confirm username recovery and send username recovery information to the user who matches the recovery code via the channel specified by the channel Id.
- NOTE: If the notification channel is EXTERNAL, the API will return the username of the user.
Scope(Permission) required: internal_user_recovery_create
Request body (required): application/json
- Request to confirm username recovery and receive recovery notifications.
recoveryCodeandchannelIdareREQUIRED.- NOTE
channelIdshould always be larger than 0.
Schema: RecoveryRequest
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
recoveryCode | string | Yes | Recovery code for the user |
channelId | string | Yes | Id of the notification channel that user prefers to get recovery notifications. |
properties | array of Property | (OPTIONAL) Additional META properties |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Username is successfully recovered and the notification channel is | UsernameRecoveryNotifyResponse |
202 | Username is successfully recovered. | UsernameRecoveryNotifyResponse |
400 | Bad Request. Request cannot be processed by the server. | ErrorResponse |
404 | Recovery code is not found. | ErrorResponse |
406 |
| ErrorResponse |
500 | Server Error. | ErrorResponse |
Password Recovery
Initiate password recovery
POST /recovery/password/init
-
This API is used to initiate password recovery by user. The API will return recovery information for password recovery with challenge questions and password recovery with notifications.
-
moderecoverWithNotifications contains recovery flow confirmation code, available communication channels and a recovery code for password recovery with notifications. The next API call will be returned in the response. -
If
password recovery with notificationsis not enabled, the response will not contain recoverWithNotifications mode. -
recoverWithChallengeQuestions contains the next API call to begin the recovery process via challenge questions.
-
If
password recovery with challenge questionsis not enabled, the response will not contain recoverWithChallengeQuestions mode.
Scope(Permission) required: internal_user_recovery_create
Request body (required): application/json
Request to initiate password recovery process. The request should contain the claims to identify the user. User claims are REQUIRED.
Schema: InitRequest
2 properties
Responses
| Code | Description | Schema |
|---|---|---|
200 | User is successfully identified for the given claims and returning available notification channels for the user. | array of AccountRecoveryType |
400 | Bad Request. The request cannot be processed by the server. | ErrorResponse |
404 | No user found for the given set of claims or no recovery channels are available for the user. | ErrorResponse |
409 | Multiple users found for the given claims. | ErrorResponse |
500 | Server Error. | ErrorResponse |
Get Recovery Information
POST /recovery/password/recover
-
This API is used to send recovery information to the user who matches the recovery code via the channel specified by the channel Id. The API will return the recovery flow confirmation code.
-
NOTE: If the notification channel is EXTERNAL, the API will return a confirmationCode.
-
Use the returned confirmation code with password recovery confirm API to verify the password recovery process.
-
The API will return the next API call.
Scope(Permission) required: internal_user_recovery_create
Request body (required): application/json
- Request to receive recovery notifications.
recoveryCodeandchannelIdareREQUIRED.- NOTE
channelIdshould always be larger than 0.
Schema: RecoveryRequest
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
recoveryCode | string | Yes | Recovery code for the user |
channelId | string | Yes | Id of the notification channel that user prefers to get recovery notifications. |
properties | array of Property | (OPTIONAL) Additional META properties |
Responses
| Code | Description | Schema |
|---|---|---|
200 |
| PasswordRecoveryExternalNotifyResponse |
202 |
| PasswordRecoveryInternalNotifyResponse |
400 | Bad Request. Request cannot be processed by the server. | ErrorResponse |
403 | Password recovery is not enabled. | ErrorResponse |
404 | Recovery code is not found. | ErrorResponse |
406 |
| ErrorResponse |
500 | Server Error. | ErrorResponse |
Resend password recovery confirmation details
POST /recovery/password/resend
-
This API is used to resend a confirmation code/OTP to the user via a user preferred channel defined at password recovery.
-
NOTE: The API cannot be used when the notification channel is external.
-
The API will return the next API calls.
Scope(Permission) required: internal_user_recovery_create
Request body (required): application/json
- Request to resend the
confirmationCode/otpto the user via a user preferred channel. - Can send additional properties.
Schema: ResendConfirmationRequest
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
resendCode | string | Resend code returned by the password recovery API | |
properties | array of Property | (OPTIONAL) Additional META properties |
Responses
| Code | Description | Schema |
|---|---|---|
200 |
| ResendConfirmationCodeExternalResponse |
202 |
| ResendConfirmationCodeInternalResponse |
400 | Bad Request. Request cannot be processed by the server. | ErrorResponse |
404 | Resend code is not found. | ErrorResponse |
406 | Resend code given in the request is not valid or expired. | ErrorResponse |
500 | Server Error. | ErrorResponse |
Confirm password recovery
POST /recovery/password/confirm
-
This API is used to validate the confirmationCode/otp given at password recovery.
-
Use the returned reset code with the password reset API to reset the password.
-
The API will return the next API call.
Scope(Permission) required: internal_user_recovery_create
Request body (required): application/json
- Request to confirm the password recovery.
confirmationCodeisREQUIRED.otpis required only for OTP based password recovery. The flowConfirmationCode returned from the password recovery request should be set as theconfirmationCodefor OTP based recovery.
Schema: ConfirmRequest
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
confirmationCode | string | Yes | Confirmation code of the recovery flow |
otp | string | OTP sent to the user | |
properties | array of Property | (OPTIONAL) Additional META properties |
Responses
| Code | Description | Schema |
|---|---|---|
200 |
| ResetCodeResponse |
400 | Bad Request. Request cannot be processed by the server. | ErrorResponse |
404 | Confirmation code is not found. | ErrorResponse |
406 | Confirmation code given in the request is not valid or expired. | ErrorResponse |
500 | Server Error. | ErrorResponse |
Reset password
POST /recovery/password/reset
This API is used to reset the password of the user who matches the flowConfirmationCode given by the recover API and the resetCode given by the confirmation API.
Scope(Permission) required: internal_user_recovery_create
Request body (required): application/json
- Request to reset the password.
resetCode,flowConfirmationCodeandpasswordare required.
Schema: ResetRequest
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
resetCode | string | Yes | resetCode given by the confirm API |
flowConfirmationCode | string | Confirmation code of the recovery flow | |
password | string | Yes | New password given by the user |
properties | array of Property | (OPTIONAL) Additional META properties |
Responses
| Code | Description | Schema |
|---|---|---|
200 | Successful password reset. | PasswordResetResponse |
400 | Bad Request. Request cannot be processed by the server. | ErrorResponse |
404 | Reset code is not found. | ErrorResponse |
406 | Reset code given in the request is not valid or expired. | ErrorResponse |
412 | Password policy violation. | RetryErrorResponse |
500 | Server Error. | ErrorResponse |
Schemas
RecoveryRequest
Type: object
Request to start the recovery for the user who matches the recovery code via the given channelID
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
recoveryCode | string | Yes | Recovery code for the user |
channelId | string | Yes | Id of the notification channel that user prefers to get recovery notifications. |
properties | array of Property | (OPTIONAL) Additional META properties |
ResendConfirmationRequest
Type: object
Request to resend the confirmation code in password recovery
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
resendCode | string | Resend code returned by the password recovery API | |
properties | array of Property | (OPTIONAL) Additional META properties |
ConfirmRequest
Type: object
Request to confirm password recovery
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
confirmationCode | string | Yes | Confirmation code of the recovery flow |
otp | string | OTP sent to the user | |
properties | array of Property | (OPTIONAL) Additional META properties |
ResetRequest
Type: object
Object to reset the password of a user
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
resetCode | string | Yes | resetCode given by the confirm API |
flowConfirmationCode | string | Confirmation code of the recovery flow | |
password | string | Yes | New password given by the user |
properties | array of Property | (OPTIONAL) Additional META properties |
PasswordRecoveryInternalNotifyResponse
Type: object
6 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Success status code | |
message | string | Success status message | |
flowConfirmationCode | string | Recovery flow confirmation code | |
notificationChannel | string | Channel that is used to send recovery information | |
resendCode | string | Code to resend the confirmation code to the user via user selected channel | |
links | array of APICall | Contains available api calls |
PasswordRecoveryExternalNotifyResponse
Type: object
7 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Success status code | |
message | string | Success status message | |
flowConfirmationCode | string | Recovery flow confirmation code | |
notificationChannel | string | Channel that is used to send recovery information | |
confirmationCode | string |
| |
resendCode | string | Code to get a new confirmation code. | |
links | array of APICall | Contains available api calls |
UsernameRecoveryNotifyResponse
Type: object
API response for successful username recovery
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Yes | Success status code |
message | string | Yes | Success status message |
notificationChannel | string | Yes | Channel which the recovery information is sent to the user |
username | string | Yes |
|
ResetCodeResponse
Type: object
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
resetCode | string | Password reset code to reset the password | |
links | array of APICall | Contains available api calls |
PasswordResetResponse
Type: object
API response for a successful password reset
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Operation code | |
message | string | Message regarding the operation. |
ResendConfirmationCodeExternalResponse
Type: object
Object encapsulate the details regarding resend confirmation code
7 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Success status code | |
message | string | Success status message | |
flowConfirmationCode | string | Recovery flow confirmation code | |
notificationChannel | string | Channel that is used to send recovery information | |
confirmationCode | string | Confirmation code to confirm the password recovery | |
resendCode | string | Resend code to resend the confirmation code | |
links | array of APICall | Contains available api calls |
ResendConfirmationCodeInternalResponse
Type: object
Object encapsulate the details regarding resend confirmation code
6 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Success status code | |
message | string | Success status message | |
flowConfirmationCode | string | Recovery flow confirmation code | |
notificationChannel | string | Channel that is used to send recovery information | |
resendCode | string | Resend code to resend the confirmation code | |
links | array of APICall | Contains available api calls |
RetryErrorResponse
Type: object
6 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Error code corresponding to the error | |
message | string | Error message | |
description | string | Error description | |
traceId | string | Some Correlation for Error Instance | |
resetCode | string | Password reset code used in the request | |
links | array of APICall | Contains available api calls |
ErrorResponse
Type: object
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
code | string | Error code corresponding to the error | |
message | string | Error message | |
description | string | Description about the error | |
traceId | string | Some Correlation for Error Instance |
AccountRecoveryType
Type: object
Object that encapsulates details of the account recovery channel
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
mode | string | ||
flowConfirmationCode | string | ||
channelInfo | RecoveryChannelInformation | Response with the recovery ID and the available recovery channels | |
links | array of APICall | Contains available api calls |
RecoveryChannelInformation
Type: object
Response with the recovery ID and the available recovery channels
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
recoveryCode | string | Code to recovery the user account | |
channels | array of RecoveryChannel | Available recovery channels for the user |
RecoveryChannel
Type: object
Object with notification channel attributes
4 properties
| Name | Type | Required | Description |
|---|---|---|---|
id | string | Id given to the channel | |
type | string | Type of the chanel | |
value | string | Masked channel value | |
preferred | boolean | Whether the channel is a user preferred channel |
UserClaim
Type: object
Object that holds a user claim and the corresponding value
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
uri | string | Claim uri | |
value | string | Value for the claim |
Property
Type: object
object that holds a property as a key, value pair
2 properties
| Name | Type | Required | Description |
|---|---|---|---|
key | string | Unique identifier as the key of the property | |
value | string | Value of the property |
APICall
Type: object
Object that holds next API call details
3 properties
| Name | Type | Required | Description |
|---|---|---|---|
rel | string | Next API call | |
href | string | Next API url | |
type | string | HTTP method type |
Was this page helpful?