Generate Token
To interact with Accountability's API, you must first authenticate using the Generate Token endpoint. This endpoint issues authentication tokens that are required for all subsequent API requests.
🔐 Authentication Overview
The Generate Token request requires you to provide specific credentials to receive an access token and a refresh token. The type of credentials depends on the grant_type you're using.
Required Parameters
Parameter | Description |
---|---|
grant_type | Defines the authentication method. Use 'password' to authenticate with your credentials, or 'refresh_token' to obtain a new access token using a previously issued refresh token. |
username | Your login email address. Required when grant_type is 'password'. |
password | This the API token associated with your Accountability user account. |
tenantid | Your unique Tenant ID. Submit a support ticket in the Accountability system if you need help locating this. Required when grant_type is 'password'. |
refresh_token | Required only when using the 'refresh_token' grant type. Used to obtain a new access token after expiration. |
When using grant_type=refresh_token, you only need to supply the refresh_token parameter. Username, password, and tenant ID are not required.
🔄 Token Lifespan
- Access Token: Valid for 3600 seconds (1 hour).
- Refresh Token: Valid for up to 30 days.
✅ Using the Tokens
Once authenticated, use the access_token in the Authorization header for all API requests:
Authorization: Bearer your_access_token
When the access token expires, use the refresh_token to request a new one without re-authenticating with username and password.
🚨 Important
You must authenticate first before accessing any other endpoints. The access token or a valid refresh token is required to make authorized API requests.