Authenticate and obtain access tokens
const url = 'https://open-api.replyco.com/openapi/auth/token';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json-patch+json'}, body: '{ "grantType": "password", "email": "integration@example.com", "password": "<your-password>" }'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://open-api.replyco.com/openapi/auth/token \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json-patch+json' \ --data '{ "grantType": "password", "email": "integration@example.com", "password": "<your-password>" }'Authenticates a user and returns JWT access token and refresh token. Supports two authentication flows:
1. Password Authentication (grant_type: “password”):
POST /auth/token
{
"grantType": "password",
"email": "user@example.com",
"password": "SecurePassword123!"
}
2. Refresh Token Authentication (grant_type: “refresh_token”):
POST /auth/token
{
"grantType": "refresh_token",
"refreshToken": "your-refresh-token-here"
}
Response includes:
accessToken: JWT token for API authentication (short-lived)expiresIn: Token expiration timestamprefreshToken: Token for obtaining new access tokens (long-lived)
Token Lifetime:
- Access Token: Configurable (default: hours)
- Refresh Token: Configurable (default: 60 days)
Usage:
- Include the access token in subsequent requests:
Authorization: Bearer {accessToken} - Use refresh token to obtain new access token before expiration
- Refresh tokens are single-use and will be rotated
Security Notes:
- Store tokens securely (never in localStorage for web apps)
- Tokens are tied to the authenticated user and company
- Failed authentication attempts may be rate-limited
Authorizations
Section titled “Authorizations”Request Body
Section titled “Request Body”Authentication credentials (email/password or refresh token)
object
The email address of the registered user account
The user’s password for authentication
Registration token from the invitation email sent to new users. Only required for first-time sign-in after invitation. Ignore for existing users
Two-factor authentication method identifier (e.g., “totp”, “sms”). Required if 2FA is enabled for the account
Verification code from the two-factor authentication method. Required if 2FA is enabled for the account
The date and time of the authentication attempt. Used for audit logging
The OAuth 2.0 grant type. Use “password” for email/password authentication or “refresh_token” to obtain a new access token using a refresh token
The refresh token value obtained from a previous successful authentication. Required when GrantType is “refresh_token”. Should be empty when GrantType is “password”
Example
{ "grantType": "password", "email": "integration@example.com", "password": "<your-password>"}object
The email address of the registered user account
The user’s password for authentication
Registration token from the invitation email sent to new users. Only required for first-time sign-in after invitation. Ignore for existing users
Two-factor authentication method identifier (e.g., “totp”, “sms”). Required if 2FA is enabled for the account
Verification code from the two-factor authentication method. Required if 2FA is enabled for the account
The date and time of the authentication attempt. Used for audit logging
The OAuth 2.0 grant type. Use “password” for email/password authentication or “refresh_token” to obtain a new access token using a refresh token
The refresh token value obtained from a previous successful authentication. Required when GrantType is “refresh_token”. Should be empty when GrantType is “password”
Example generated
{ "email": "example", "password": "example", "registrationToken": "example", "twoFactorAuthenticator": "example", "verificationCode": "example", "date": "2026-04-15T12:00:00Z", "grantType": "example", "refreshToken": "example"}object
The email address of the registered user account
The user’s password for authentication
Registration token from the invitation email sent to new users. Only required for first-time sign-in after invitation. Ignore for existing users
Two-factor authentication method identifier (e.g., “totp”, “sms”). Required if 2FA is enabled for the account
Verification code from the two-factor authentication method. Required if 2FA is enabled for the account
The date and time of the authentication attempt. Used for audit logging
The OAuth 2.0 grant type. Use “password” for email/password authentication or “refresh_token” to obtain a new access token using a refresh token
The refresh token value obtained from a previous successful authentication. Required when GrantType is “refresh_token”. Should be empty when GrantType is “password”
Example generated
{ "email": "example", "password": "example", "registrationToken": "example", "twoFactorAuthenticator": "example", "verificationCode": "example", "date": "2026-04-15T12:00:00Z", "grantType": "example", "refreshToken": "example"}object
The email address of the registered user account
The user’s password for authentication
Registration token from the invitation email sent to new users. Only required for first-time sign-in after invitation. Ignore for existing users
Two-factor authentication method identifier (e.g., “totp”, “sms”). Required if 2FA is enabled for the account
Verification code from the two-factor authentication method. Required if 2FA is enabled for the account
The date and time of the authentication attempt. Used for audit logging
The OAuth 2.0 grant type. Use “password” for email/password authentication or “refresh_token” to obtain a new access token using a refresh token
The refresh token value obtained from a previous successful authentication. Required when GrantType is “refresh_token”. Should be empty when GrantType is “password”
Example generated
{ "email": "example", "password": "example", "registrationToken": "example", "twoFactorAuthenticator": "example", "verificationCode": "example", "date": "2026-04-15T12:00:00Z", "grantType": "example", "refreshToken": "example"}Responses
Section titled “Responses”Authentication successful, returns tokens
object
Present on admin sign-in: whether this admin can view the audit trail in the console.
Example
{ "accessToken": "<access-token>", "refreshToken": "<refresh-token>", "expiresIn": "2026-10-24T09:15:00Z"}Invalid credentials, missing fields, or unsupported grant type
Authentication failed (wrong password, expired token, etc.)
Too many authentication attempts, please try again later