User credentials
Multi-factor authentication (MFA) is enforced for all enterprise users and cannot be disabled. If your account has MFA enabled, authenticating via the API requires handling the multi-step MFA flow, which can complicate automated integrations.
Application tokens are recommended for most API integrations. However, user credentials are required for operations that span multiple Workspaces:
- Switching between Workspaces using
/api/v1/authenticate/workspace - Transferring SIMs between Workspaces
Application tokens are scoped to a single Workspace and cannot access other Workspaces.
The /api/v1/authenticate API is used to generate a JSON Web Token (JWT) auth_token which authenticates subsequent API calls.
You must provide a username (typically the email address used when signing up) and a SHA-1 hashed password in the request body.
In turn, you receive an auth_token and refresh_token.
The password needs to be a SHA-1 hashed string. You can generate a SHA-1 hashed password online or in the terminal via the following command:
Refresh token
The server responds with an auth_token and refresh_token after you successfully authenticate.
The auth_token is valid for 240 minutes for this token and so the refresh_token can be used to obtain a new auth_token without providing user credentials again.
Important:
- The
auth_tokenis valid for 240 minutes and the refresh token is valid for 350 minutes. - The
refresh_tokencan only be used once and becomes invalid if you log in from somewhere else (for example, different web client). - When the
auth_tokenhas expired, you need to re-authenticate with the refresh token or again with the user credentials for a newauth_token. If both the authentication and refresh tokens have expired, you need to authenticate again.