Skip to main content

Personal Access Token

Personal access tokens (PATs) provide an easy way for an individual to connect to Dremio using client tools or JDBC. The PAT is passed 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"
}

When to Use PATs

Dremio recommends using OAuth access tokens over PATs for most use cases, as they provide enhanced security through shorter lifespans and centralized management. PATs should primarily be used in scenarios where OAuth tokens are not supported or practical.

PATs may be appropriate for:

  • Legacy systems: Applications that cannot support OAuth authentication flows
  • Simple scripts: Quick automation tasks where OAuth setup overhead is not justified
  • Development and testing: Temporary access for development workflows
  • ODBC/JDBC connections: When OAuth is not supported by the client application

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, in milliseconds since epoch.

Example: 1623837492475


expiresAt Integer

The time when the token expires, in milliseconds since epoch.

Example: 1624701492475


tid String (UUID)

UUID of the token.


uid String (UUID)

UUID of the user for whom the token is generated.

List All Tokens

Method and URL
GET /v0/user/{user_id}/token

Parameters

user_id Path   String (UUID)

UUID of the user.

Example

Request
curl -X GET "https://api.dremio.cloud/v0/user/$USER_ID/token" \
-H "Authorization: Bearer $DREMIO_TOKEN" \
-H 'Content-Type: application/json'
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"
}
]
}

Response Status Codes

200   OK

400   Bad Request

401   Unauthorized

Create a Token

Method and URL
POST /v0/user/{user_id}/token

Parameters

user_id Path   String (UUID)

UUID of the user.


label Body   String

A user-defined description for the token.

Example: PAT for API


millisecondsToExpire Body   Integer

The lifespan of the token in milliseconds. The maximum expiry time is 15,552,000,000 milliseconds (180 days).

Example: 432000000

Example

Request
curl -X POST "https://api.dremio.cloud/v0/user/$USER_ID/token" \
-H "Authorization: Bearer $DREMIO_TOKEN" \
-H 'Content-Type: application/json' \
-d '{"label": "PAT for API", "millisecondsToExpire": 432000000}'
Response
CFL4XzlOStifBfZJVfTfOrrop6hOJuM4DN6TPtnpwRzWB995+tWQbC/GLn2MCQ==

Response Status Codes

200   OK

400   Bad Request

401   Unauthorized

403   Forbidden

404   Not Found

Delete a Specific Token

Method and URL
DELETE /v0/user/{user_id}/token/{id}

Parameters

user_id Path   String (UUID)

UUID of the user.


id Path   String (UUID)

UUID of the token to delete.

Example

Request
curl -X DELETE "https://api.dremio.cloud/v0/user/$USER_ID/token/$TOKEN_ID" \
-H "Authorization: Bearer $DREMIO_TOKEN" \
-H 'Content-Type: application/json'

A successful request returns an empty response body with HTTP status 204 No Content.

Response Status Codes

204   No Content

401   Unauthorized

403   Forbidden

404   Not Found

Delete All Tokens

Method and URL
DELETE /v0/user/{user_id}/token

Parameters

user_id Path   String (UUID)

UUID of the user.

Example

Request
curl -X DELETE "https://api.dremio.cloud/v0/user/$USER_ID/token" \
-H "Authorization: Bearer $DREMIO_TOKEN" \
-H 'Content-Type: application/json'

A successful request returns an empty response body with HTTP status 204 No Content.

Response Status Codes

204   No Content

401   Unauthorized

403   Forbidden

404   Not Found