Skip to Content
AuthenticationGet & Refresh Token

Authentication

POST/api/public/auth/token
Gets a Bearer token using a username and password.

Request Body

{ "username": "[email protected]", "password": "YourPassword" }

Parameters

FieldTypeRequiredDescription
usernamestringYesUsername or email address
passwordstringYesUser password

Example cURL

curl --request POST 'https://public-api.thinkvoice.ai/api/public/auth/token' \
--header 'Content-Type: application/json' --data-raw '{
  "username": "[email protected]",
  "password": "YourPassword"
}'

Responses

200Success
{ "token_type": "Bearer", "access_token": "<ACCESS_TOKEN>", "expires_in": 7200, "refresh_token": "<REFRESH_TOKEN>", "scope": "ThinkVoice.Public offline_access" }
400Invalid username/password, or the user has no Public API access
{ "error": "invalid_grant", "error_description": "The user name or password is incorrect." }
403The requesting IP address is not allowed for the tenant
IP not allowed for tenant.

The access token lifetime is 2 hours (expires_in: 7200 seconds). The refresh token lifetime is 7 days. All protected requests must include the Authorization: Bearer <access_token> header.

The token endpoint accepts at most 5 requests per minute. Instead of logging in on every request, store the token until it expires and renew it with refresh_token before it does.

Only users granted Public API access by our team can obtain a token. Regular application credentials do not work on this endpoint; without that access, invalid_grant is returned even if the credentials are correct.

Refreshing the Token

POST/connect/token
Gets a new access token using a refresh token.
curl --request POST 'https://public-api.thinkvoice.ai/connect/token' \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data-urlencode 'grant_type=refresh_token' \ --data-urlencode 'client_id=ThinkVoicePublic_App' \ --data-urlencode 'refresh_token=<REFRESH_TOKEN>'

The response has the same structure as the initial token response: a new access_token, expires_in and refresh_token are returned.

If the refresh token (7 days) has also expired, log in again with POST /api/public/auth/token.

Authenticating with an API Key

As an alternative to a Bearer token, you can also send requests with the API key and API secret values provided by our team. In this case you do not need to get a token; add the following two headers to every request:

X-Api-Key: <API_KEY> X-Api-Secret: <API_SECRET>
curl --request POST 'https://public-api.thinkvoice.ai/api/app/public-calls/get-calls' \
--header 'X-Api-Key: <API_KEY>' \
--header 'X-Api-Secret: <API_SECRET>' \
--header 'Content-Type: application/json' \
--data-raw '{ "startTime": "2026-04-01T00:00:00", "endTime": "2026-04-10T23:59:59" }'

Both X-Api-Key and X-Api-Secret are required; if either is missing or invalid, the request is rejected with 401. Store these values on the server side only — never put them in browser or mobile app code.

Last updated: