Skip to main content
Version: current [24.3.x]

User Tokens Enterprise

Use the User API to create and retrieve personal access tokens for the current Dremio user and delete personal access tokens for any Dremio user.

note

You must enable the use of personal access tokens to make API requests for user tokens.

User Tokens Object
{
"data": [
{
"tid": "98ec8f42-7764-4d9d-af5a-693f1f1cc444",
"uid": "b9dbebc7-bc3b-4d56-9154-31762ab65a43",
"label": "Tableau",
"createdAt": "2023-02-19T15:41:15.323Z",
"expiresAt": "2023-03-21T15:41:15.323Z"
},
{
"tid": "3b76a1e4-6539-46de-8f06-b7c41c71b61e",
"uid": "b9dbebc7-bc3b-4d56-9154-31762ab65a43",
"label": "Test Nessie Source",
"createdAt": "2023-03-02T19:39:52.159Z",
"expiresAt": "2023-04-01T19:39:52.159Z"
},
{
"tid": "9376ef58-7b4c-2419-b1cb-a4ce4c53dfa7",
"uid": "b9dbebc7-bc3b-4d56-9154-31762ab65a43",
"label": "Feature Testing",
"createdAt": "2023-03-07T14:47:08.211Z",
"expiresAt": "2023-09-03T14:47:08.211Z"
}
]
}

User Tokens Attributes

data Array of Object

Information about the user's tokens. Each object in the data array describes a different token of the user.

Attributes of the data Object

tid String (UUID)

Unique identifier of the token.

Example: 98ec8f42-7764-4d9d-af5a-693f1f1cc444


uid String (UUID)

Unique identifier of the user.

Example: b9dbebc7-bc3b-4d56-9154-31762ab65a43


label String

User-provided name of the token.

Example: Tableau


createdAt String

Date and time that the token was created, in UTC format.

Example: 2023-02-19T15:41:15.323Z


expiresAt String

Date and time that the token will expire, in UTC format.

Example: 2023-03-21T15:41:15.323Z

Creating a Token for a User

Create a personal access token for the current user.

note

You can create personal access tokens only for your own user account, and only you may use the tokens you create. Administrators cannot create tokens for other users or distribute tokens to other users.

Method and URL
POST /api/v3/user/{id}/token

Parameters

id Path   String (UUID)

Unique identifier of the user.

Example: b9dbebc7-bc3b-4d56-9154-31762ab65a43


label Body   String

User-provided name for the token

Example: Feature Testing


millisecondsToExpire Body   String

Number of milliseconds until the token should expire. Maximum value is 15552000000, which is equivalent to 180 days. If you omit the millisecondsToExpire parameter, the new token's expireAt setting will default to the time that the token is created and the token will immediately expire.

Example: 15552000000

Example Request
curl -X POST 'https://{hostname}/api/v3/user/b9dbebc7-bc3b-4d56-9154-31762ab65a43/token' \
--header 'Authorization: Bearer <PersonalAccessToken>' \
--header 'Content-Type: application/json' \
--data-raw '{
"label": "Feature Testing",
"millisecondsToExpire": 15552000000
}'

The response contains the personal access token:

Example Response
EXAMPLETOKEN7TjB3mfPS6AZQ5aPcXPmJS2ofXpLL86dmpDXRbKKi52BQdthnk==

Response Status Codes

200   OK

401   Unauthorized

403   Forbidden

404   Not Found

405   Method Not Allowed

Retrieving All Tokens for a User

Retrieve all tokens for the current user.

note

You can only retrieve personal access tokens for your own user account. Administrators cannot retrieve other users' tokens.

Method and URL
GET /api/v3/user/{id}/token

Parameters

id Path   String (UUID)

Unique identifier of the current user. You can only retrieve personal access tokens for your own user account.

Example: b9dbebc7-bc3b-4d56-9154-31762ab65a43

Example Request
curl -X GET 'https://{hostname}/api/v3/user/b9dbebc7-bc3b-4d56-9154-31762ab65a43/token' \
--header 'Authorization: Bearer <PersonalAccessToken>' \
--header 'Content-Type: application/json'
Example Response
{
"data": [
{
"tid": "98ec8f42-7764-4d9d-af5a-693f1f1cc444",
"uid": "b9dbebc7-bc3b-4d56-9154-31762ab65a43",
"label": "Tableau",
"createdAt": "2023-02-19T15:41:15.323Z",
"expiresAt": "2023-03-21T15:41:15.323Z"
},
{
"tid": "3b76a1e4-6539-46de-8f06-b7c41c71b61e",
"uid": "b9dbebc7-bc3b-4d56-9154-31762ab65a43",
"label": "Test Nessie Source",
"createdAt": "2023-03-02T19:39:52.159Z",
"expiresAt": "2023-04-01T19:39:52.159Z"
},
{
"tid": "9376ef58-7b4c-2419-b1cb-a4ce4c53dfa7",
"uid": "b9dbebc7-bc3b-4d56-9154-31762ab65a43",
"label": "Feature Testing",
"createdAt": "2023-03-07T14:47:08.211Z",
"expiresAt": "2023-09-03T14:47:08.211Z"
}
]
}
note

If the user has no personal access tokens, the response contains an empty data array.

Response Status Codes

200   OK

401   Unauthorized

404   Not Found

405   Method Not Allowed

Deleting All Tokens for a User

Delete all tokens for the specified user.

note

You must be a member of the ADMIN role to delete other users' tokens.

Method and URL
DELETE /api/v3/user/{id}/token

Parameters

id Path   String (UUID)

Unique identifier of the user whose tokens you want to delete.

Example: b9dbebc7-bc3b-4d56-9154-31762ab65a43

Example Request
curl -X DELETE 'https://{hostname}/api/v3/user/b9dbebc7-bc3b-4d56-9154-31762ab65a43/token' \
--header 'Authorization: Bearer <PersonalAccessToken>' \
--header 'Content-Type: application/json'
Example Response
No response

Response Status Codes

204   No Content

401   Unauthorized

404   Not Found

405   Method Not Allowed

Deleting a Token for a User

Delete the specified token for the specified user.

note

You must be a member of the ADMIN role to delete other users's tokens.

Method and URL
DELETE /api/v3/user/{id}/token/{token-id}

Parameters

id Path   String (UUID)

Unique identifier of the user whose token you want to delete.

Example: b9dbebc7-bc3b-4d56-9154-31762ab65a43


token-id Path   String (UUID)

Unique identifier of the token you want to delete.

Example: 98ec8f42-7764-4d9d-af5a-693f1f1cc444

Example Request
curl -X DELETE 'https://{hostname}/api/v3/user/b9dbebc7-bc3b-4d56-9154-31762ab65a43/token/98ec8f42-7764-4d9d-af5a-693f1f1cc444' \
--header 'Authorization: Bearer <PersonalAccessToken>' \
--header 'Content-Type: application/json'
Example Response
No response

Response Status Codes

204   No Content

401   Unauthorized

404   Not Found

405   Method Not Allowed