How to Get Authorization Token (Access Token)

If you want get an Authorization Token (Access Token) to do API integration, You can use the following mechanism :
1. Using Passwords.
2. Using Refresh Token.


1. Password

Log in using your password.

Method : POST
API Endpoint : [[baseurl]]/api/integration/v1/login

HEADER

X-TenantID: [[tenantid]]
BODY PAYLOAD (JSON)

{
  "username": "[[username]]",
  "password": "[[password]]",
  "grantType": "password"
}


CONSUME VIA CURL

curl --location --request POST  '[[baseurl]]/api/integration/v1/login' \
--header 'X-TenantID: [[tenantid]]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "username":"[[username]]",
    "password":"[[password]]",
    "grantType": "password"
}'

๐Ÿ“Notes To find out [[baseurl]], [[tenantid]], [[username]], And [[password]], You can learn about it on the page Integration Credential.

API Response :

{
  "access_token": "access token",
  "expires_in": 604800,
  "refresh_expires_in": 604800,
  "refresh_token": "refresh token",
  "token_type": "Bearer",
  "session_state": "963b2fcf-e016-41c0-9264-b0441bc8355e",
  "scope": "gitscope"
}

2. Refresh Token

Login using the Refresh Token.

Method : POST
API Endpoint : [[baseurl]]/api/integration/v1/login

HEADER

X-TenantID: [[tenantid]]
BODY PAYLOAD (JSON)

{
  "username": "[[username]]",
  "grantType": "refresh_token",
  "refreshToken": "[[refreshtoken]]"
}


CONSUME VIA CURL

curl --location --request POST '[[baseurl]]/api/integration/v1/login' \
--header 'X-TenantID: [[tenantid]]' \
--header 'Content-Type: application/json' \
--data-raw '{
    "username":"[[username]]",
    "grantType":"refresh_token",
    "refreshToken":"[[refreshtoken]]"
}'

๐Ÿ“Notes To find out [[baseurl]], [[tenantid]], And [[username]], You can learn about it on the page Integration Credential. And for [[refreshtoken]] obtained by logging in using Password first.