Skip to main content
You are viewing the documentation of release 26.1, which is no longer the current one. Go to the documentation of the current release 26.2.

Login with Recovery Code

Recovery codes provide an emergency access method when you cannot use your standard Multi-Factor Authentication (MFA) methods. This scenario demonstrates how to authenticate using a recovery code when MFA is enabled on your account. Key benefits:
  • Emergency access when standard MFA factors are unavailable
  • One-time use codes that are consumed after successful authentication
  • Alternative authentication path that still maintains security

Prerequisites

This scenario assumes:
  1. The user has active MFA on their account
  2. Recovery codes have been generated beforehand
Recovery codes must be generated in advance. Each recovery code can only be used once and is consumed after successful authentication.
Recovery codes should be stored securely. They are intended for emergency use only when you cannot access your primary MFA methods.

Step 1 - Login with MFA-enabled account

Authenticate with your username and password to obtain a session token. Since your account has MFA enabled, the token will be returned in a locked state.
  • This initial authentication verifies your first factor (something you know - your password)
  • The returned token will be locked and requires additional verification
  • Instead of using standard MFA factors, we’ll use a recovery code in the next step
Endpoint
Request
Response
The response contains the following important properties:
  • token - Located at token in the response.
    • The authentication token that should be included in subsequent API requests. This token identifies your session and provides access to authorized resources.
    • Example value: o0OkzzNi1Q8PNsZWCLkdUTGlHfUaHQzN3Fx2DTnCkdyFp3jbCbRR9XAf1fehyFBF
Note: The token is locked initially. To access other endpoints, unlocking is required.

Step 2 - Unlock the session token using a recovery code

When you cannot access your standard MFA methods (email, SMS, or authenticator app), you can use a recovery code to unlock your session token. Recovery codes are emergency backup codes that you should have generated and stored securely before needing them.
Each recovery code can only be used once. After successful authentication, the code is consumed and cannot be used again.
Endpoint
Request
Response
Your session token is now unlocked using the recovery code. The recovery code has been consumed and cannot be used again.

Step 3 - Test the session token by retrieving available documents (Optional)

This endpoint demonstrates how to use your unlocked session token to perform an actual operation - in this case, searching for available documents in the system.
  • The session token is passed in the query parameters
  • The search operation returns documents the authenticated user has access to
  • This pattern applies to all token protected API endpoints - include your session token in each request
This is a practical example of how to use your session token for API operations. Do not call this endpoint if you don’t wish to perform a search operation.
Endpoint
Request
Response
The search operation was successful, demonstrating that your session token is now fully unlocked and working correctly. The response includes a list of documents that the authenticated user has access to.

Step 4 - Terminate the session (Optional)

Invalidates the current session token, effectively logging the user out of the system. This is an important security practice to prevent unauthorized access after a session is no longer needed.
  • Invalidates the token provided in the request
  • Prevents the token from being used for any future API requests
  • Should be called when a session is no longer needed
  • Does not affect other active sessions for the same user
This endpoint only invalidates the specific token provided in the request. Other active sessions for the same user will remain valid.
Endpoint
Request
The session has been successfully terminated. The token is now invalid and cannot be used for further API requests.

Recovery Code Login Summary

Recovery codes provide an emergency authentication method when standard MFA factors are unavailable:
  • Recovery codes must be generated in advance
  • Each recovery code can only be used once and is consumed after successful authentication
  • Recovery codes should be stored securely and used only in emergency situations

Example Recovery Code Login Flow

See our OpenAPI documentation to learn about the full set of API endpoints and parameters.
Please use proper exception handling and function decomposition in your own code. The code is provided for illustrative purposes only and is not intended for production use.