Token API

The Token API allows any user to create, list, and revoke tokens that can be used to authenticate and access Azure Databricks REST APIs.

Initial authentication to this API is the same as for all of the Azure Databricks API endpoints: you must first authenticate as described in Authentication.

Table of Contents


Create

Endpoint HTTP Method
2.0/token/create POST

Create and return a token. This call returns the error QUOTA_EXCEEDED if the caller exceeds the token quota, which is 600.

Request example:

{
  "lifetime_seconds": 100,
  "comment": "this is an example token"
}

Response example:

{
  "token_value":"dapi6ae4581e3ad7da8ee5ca8ead95e9bf9c",
  "token_info": {
    "token_id":"5715498424f15ee0213be729257b53fc35a47d5953e3bdfd8ed22a0b93b339f4",
    "creation_time":1513120516294,
    "expiry_time":1513120616294,
    "comment":"this is an example token"
  }
}

Request Structure

Field Name Type Description
lifetime_seconds LONG The lifetime of the token, in seconds. If no lifetime is specified, the token remains valid indefinitely.
comment STRING Optional description to attach to the token.

Response Structure

Field Name Type Description
token_value STRING The value of the newly-created token.
token_info Public Token Info The public metadata of the newly-created token.

List

Endpoint HTTP Method
2.0/token/list GET

List all the valid tokens for a user-workspace pair.

Response example:

{
  "token_infos": [
    {
      "token_id":"5715498424f15ee0213be729257b53fc35a47d5953e3bdfd8ed22a0b93b339f4",
      "creation_time":1513120516294,
      "expiry_time":1513120616294,
      "comment":"this is an example token"
    },
    {
      "token_id":"902eb9ac42c9bef80d0097a2d1746533103c88593add482a331500187946ceb5",
      "creation_time":1512684023036,
      "expiry_time":-1,
      "comment":"this is another example token"
    }
  ]
}

Response Structure

Field Name Type Description
token_infos An array of Public Token Info A list of token information for a user-workspace pair.

Revoke

Endpoint HTTP Method
2.0/token/delete POST

Revoke an access token. This call returns the error RESOURCE_DOES_NOT_EXIST if a token with the specified ID is not valid.

Request example:

{"token_id":"5715498424f15ee0213be729257b53fc35a47d5953e3bdfd8ed22a0b93b339f4"}

Request Structure

Field Name Type Description
token_id STRING The ID of the token to be revoked.

Data Structures

Public Token Info

A data structure that describes the public metadata of an access token.

Field Name Type Description
token_id STRING The ID of the token.
creation_time LONG Server time (in epoch milliseconds) when the token was created.
expiry_time LONG Server time (in epoch milliseconds) when the token will expire, or -1 if not applicable.
comment STRING Comment the token was created with, if applicable.