Generate an access token
Exchanges a Call AI authorization code for a bearer access token and a refresh token.
Prerequisites
- Authentication: Client credentials and the authentication base URL from Mindtickle Support.
- Get an authorization code: The authorization code, which expires 10 minutes after it is issued.
Endpoint
Section titled “Endpoint”POST /tokenBase URL: the authentication base URL Mindtickle Support provides for issuing tokens.
Headers: Content-Type: application/json.
Request
Section titled “Request”| Parameter | Type | Required | Description |
|---|---|---|---|
client_id |
string | Not specified | Your unique client identifier. |
client_secret |
string | Not specified | Your client secret. |
grant_type |
string | Required | Must be set to authorization_code for this step. |
code |
string | Required | The authorization code returned by the authorization grant call. |
Request example
Section titled “Request example”{ "client_id": "CLIENT_ID", "client_secret": "CLIENT_SECRET", "grant_type": "authorization_code", "code": "AUTHORIZATION_CODE"}Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
status |
number | Status code in the response body. Check the HTTP status separately. |
access_token |
string | The bearer token to send with Call AI requests. |
refresh_token |
string | The token used to regenerate an access token. |
token_type |
string | The token type, Bearer. |
expires_in |
Not specified | Time until the access token expires. Confirm the value type and unit with Mindtickle Support before using this field to schedule token renewal. |
Response example
Section titled “Response example”Token values and EXPIRES_IN are placeholders. Do not infer the type or unit of expires_in from this example.
{ "status": 200, "access_token": "ACCESS_TOKEN", "refresh_token": "REFRESH_TOKEN", "token_type": "Bearer", "expires_in": "EXPIRES_IN"}- Limits:
access_tokenis valid for 1 day.refresh_tokenis valid for 365 days. - Expiration behavior: An expired token can appear as an authentication error inside the GraphQL
errorsarray, even when the HTTP status is 200. Check the token-expiration error, then refresh the access token.