Skip to main content

Token

Personal access tokens (PATs) provide an easy way for an individual to connect to Dremio Cloud securely using client tools or JDBC. The PAT gets passed in in place of a password. If the client tool requires a username, enter $token as the username and the generated PAT in the password field.

Token Object
{
"label": "PATforAPI",
"createdAt": 1623837492475,
"expiresAt": 1624701492475,
"tid": "6c2cda83-f2be-43ea-bf51-adda9c101023",
"uid": "f3cf7b44-69c6-4008-b319-b297559c9040"
}

Token Attributes

label String

A user-defined description of the token.

Example: PAT for this week


createdAt Integer

The time at which the token was created.

Example: 1623837492475


expiresAt Integer

The time when the token expires.

Example: 1624701492475


tid String (UUID)

The generated UUID to identify a token.

Example: 6c2cda83-f2be-43ea-bf51-adda9c101023


uid String

The ID of the user for whom the token is generated.

Example: f3cf7b44-69c6-4008-b319-b297559c9040

Listing All Tokens

List tokens associated with the specified user.

note

You cannot view tokens for another user. Tokens may only be viewed for the user performing the API call.

Listing All Tokens
GET /v0/user/{user-id}/token

Parameters

user-id Path   String

The ID of the user whose tokens you want to retrieve.

Example: f3cf7b44-69c6-4008-b319-b297559c9040

Example Request
curl -X GET \
'https://api.dremio.cloud/v0/user/f3cf7b44-69c6-4008-b319-b297559c9040/token' \
-H 'Authorization: Bearer <personal access token>' \
-H 'Content-Type: application/json'
Example Response
{
"data": [
{
"label": "PATforAPI",
"createdAt": 1623837492475,
"expiresAt": 1624701492475,
"tid": "6c2cda83-f2be-43ea-bf51-adda9c101023",
"uid": "f3cf7b44-69c6-4008-b319-b297559c9040"
},
{
"label": "PAT for today",
"createdAt": 1623846858124,
"expiresAt": 1624710858124,
"tid": "f95ae8f7-5634-49d7-ba38-f77f3ce45341",
"uid": "f3cf7b44-69c6-4008-b319-b297559c9040"
},
{
"label": "PAT for the account",
"createdAt": 1623862177513,
"expiresAt": 1624294177513,
"tid": "0852f85f-394e-4ad8-9f05-f64955f4df3a",
"uid": "f3cf7b44-69c6-4008-b319-b297559c9040"
}
]
}

Responses

200   OK

400   Bad Request

401   Unauthorized

Creating a Token

Create a token associated with a specific user.

Creating a Token
POST /v0/user/{user-id}/token

Parameters

user-id Path   String (UUID)

The ID of the user for whom you want to create a token.

Example: f3cf7b44-69c6-4008-b319-b297559c9040


label Body   String

A user-defined description for your token.

Example: Pat for API


millisecondsToExpire Body   Integer

The lifespan of the token in milliseconds. The maximum expiry time is 15552000000 milliseconds (180 days).

Example: 432000000

Example Request
curl -X POST 'https://api.dremio.cloud/v0/user/f3cf7b44-69c6-4008-b319-b297559c9040/token' \
-H 'Authorization: Bearer <personal access token>' \
-H 'Content-Type: application/json' \
-d '{"label": "Pat for API", "millisecondsToExpire": 432000000 }'
Example Response
CFL4XzlOStifBfZJVfTfOrrop6hOJuM4DN6TPtnpwRzWB995+tWQbC/GLn2MCQ==

Responses

403   Forbidden

404   Not Found

Deleting a Token

Delete a specific token for a user.

Deleting a Token
DELETE /v0/user/{user-id}/token/{id}

Parameters

user-id Path   String (UUID)

The ID of the user whose token you want to delete.

Example: f3cf7b44-69c6-4008-b319-b297559c9040


id Path   String

The ID of the token that you want to delete.

Example: 0852f85f-394e-4ad8-9f05-f64955f4df3a

Example Request
curl -X DELETE \
'https://api.dremio.cloud/v0/user/f3cf7b44-69c6-4008-b319-b297559c9040/token/0852f85f-394e-4ad8-9f05-f64955f4df3a' \
-H 'Authorization: Bearer <personal access token>' \
-H 'Content-Type: application/json'
Example Response
No response

Responses

403   Forbidden

404   Not Found

Deleting All Tokens

Delete all tokens associated with a user.

Deleting All Tokens
DELETE /v0/user/{user-id}/token

Parameters

user-id Path   String (UUID)

The ID of the user whose tokens you want to delete.

Example: f3cf7b44-69c6-4008-b319-b297559c9040

Example Request
curl -X DELETE \
'https://api.dremio.cloud/v0/user/f3cf7b44-69c6-4008-b319-b297559c9040/token' \
-H 'Authorization: Bearer <personal access token>' \
-H 'Content-Type: application/json'
Example Response
No response

Responses

403   Forbidden

404   Not Found