This example shows you how you can use the API to effectively manage user app token expiry. The cadence in which the tokens are expired will be set by your internal policies.
Note: The Cutover instance token expiration period can be configured at a global level. By default, your instance does not have token expiration enabled. To enable global-level token expiration, you can request this through your Customer Success Manager (CSM). To programmatically manage user app token expiration using the API, please refer to the steps outlined in this article.
1. List users with Developer Role Access
Firstly you will need to identify all users that have Developer role access. Each user that has a Developer role will be assigned one or more user app tokens. Let’s start by making an authenticated call to List users. To filter the users by Developer role, you will need to add the Developer role ID to the following GET request:
core/users?role_type_id=developer
To retrieve the Developer role id, please use the List Role Types endpoint.
2. List User App Tokens
For each user identified in Step 1, you will need to execute the List User App Tokens API. This API will retrieve the token IDs associated with each user. A GET request will be used, and the URL will be structured as follows:
/core/users/{user_id}/user_app_tokens
Note : Please make sure to store the user IDs for each user, as they will be needed in steps 3 and step 4.
An example of the ID and where this can be found is shown below.
{
"data": [
{
"id": "337",
"type": "user_app_token",
"attributes": {
"created_at": "2024-12-04T10:07:07Z",
"expires_at": null,
"label": "Autogenerated for Developer Portal",
"last_accessed_at": "2024-12-04T12:54:47Z",
3. Delete User App Tokens
For each token associated with the user’s identified in Step 2, execute the Delete User App Token endpoint. This will be done using a DELETE request, and the URL will be structured as follows:
/core/users/{user_id}/user_app_tokens/{id}
Note: If the user has multiple user app tokens you will need to execute this API call to delete each user app token. The same will be applied to any other users identified in step 1.
4. Create User App Tokens
Now that you have deleted the user app tokens in your Cutover environment, you will need to use the Create User App Token endpoint to recreate the deleted tokens. Using the user ids from the api responses in Step 2, a POST request will be made, and the URL will be structured as follows:
/core/users/{user_id}/user_app_tokens
The request body would look like the following:
{
"data": {
"type": "user_app_token",
"attributes": {
"label": "A token"
}
}
}
Your new user app token has now been created. The same will need to be done for all other deleted tokens executed in step 3.