Create an access token for the authenticated user. 

Version:  v4

Required Permissions

Request

Request Type: POST

Endpoint:

/v4/apiAccessTokens

Request Header:

Request Body:

 

{
  "lifetimeSeconds": 100,
  "description": "My 100-second token"
}

Response

Response Status Code - Success:  201 - Created

NOTE: If you receive a Route doesn't exist error message, please verify that the API access token feature has been enabled in your instance of the platform. For more information, see Enable API Access Tokens.

Response Body Example:

{
    "tokenValue": "eyJ0b2tlbklkIjoiYmFiOTA4ZjctZGNjMi00OTYyLTg1YmQtYzFlOTZkMGNhY2JkIiwic2VjcmV0IjoiOWIyNjQ5MWJiODM4ZWY0OWE1NzdhYzYxOWEwYTFkNjc4ZmE4NmE5MzBhZWFiZDk3OGRlOTY0ZWI0MDUyODhiOCJ9",
    "tokenInfo": {
        "tokenId": "bab908f7-dcc2-4962-85bd-c1e96d0cacbd",
        "description": "My 100-second token",
        "expiredAt": "2019-01-16T00:06:41.743Z",
        "lastUsed": null,
        "createdAt": "2019-01-16T00:05:01.743Z"
    }
}

Reference

Request reference:

PropertyDescription
lifetimeSeconds

Lifetime in seconds for the access token.

Set this value to -1 to create a non-expiring token.

descriptionUser-friendly description of the token

Response reference:
PropertyDescription
tokenValue

The token itself.

NOTE: This value must be retained and provided with each subsequent request for the user.

tokenInfo.tokenId

Internal identifier for the token.

NOTE: This value is unique within this instance of the platform. When performing requests on a specific token, its tokenId must be provided as the object identifier.

tokenInfo.descriptionUser-friendly description for the access token
tokenInfo.expiredAt

Timestamp for when the access token expires.

null value indicates that the access token never expires.

tokenInfo.lastUsed

Timestamp for when the access token was last used.

null value indicates that the access token has never been used.

tokenInfo.createdAtTimestamp for when the access token was created