Create a Token
This page explains how to request an authentication token in our system.
Grant Types
| Value | Grant Type | Description |
|---|---|---|
| 1 | ClientCredentials | Used for server-to-server authentication |
| 2 | AuthorizationCode | Used for OAuth2 authorization code flow |
| 3 | Password | Used for username/password authentication |
Request a Token
To authenticate with our API, you need to request an access token using your credentials. Below is an example of how to do this using cURL:
curl --request POST \
--url {{HOST}}/api/v1/oauth/token \
--header 'Content-Type: application/json' \
--header 'User-Agent: insomnia/11.1.0' \
--header 'X-Target-Server: authentication' \
--data '{
"client_id": "1626914093",
"client_secret": "54f5941c26074484a122fd3838e8c62d",
"grant_type": 1
}'
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
client_id | string | Yes | Your application's client ID |
client_secret | string | Yes | Your application's client secret |
grant_type | number | Yes | The type of grant being requested (see Grant Types table above) |
Response
Upon successful authentication, the server will respond with a JSON object containing the access token and related information:
{
"result": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 3600
},
"errors": null
}
Response Fields
| Field | Type | Description |
|---|---|---|
access_token | string | JWT token to be used for authenticated API requests |
expires_in | number | Token expiration timestamp |
token_type | string | Type of token, always "Bearer" |
Using the Token
For subsequent API requests, include the access token in the Authorization header:
curl --request GET \
--url https://api.example.com/resource \
--header 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ8.'