Skip to main content

Tokens CLI (legacy)

important

This documentation has been retired and might not be updated.

This information applies to legacy Databricks CLI versions 0.18 and below. Databricks recommends that you use newer Databricks CLI version 0.205 or above instead. See What is the Databricks CLI?. To find your version of the Databricks CLI, run databricks -v.

To migrate from Databricks CLI version 0.18 or below to Databricks CLI version 0.205 or above, see Databricks CLI migration.

You run Databricks Tokens CLI subcommands by appending them to databricks tokens. These subcommands call the Token API.

Bash
databricks tokens --help
Usage: databricks tokens [OPTIONS] COMMAND [ARGS]...

Utility to interact with Databricks tokens.

Options:
-v, --version [VERSION]
--debug Debug mode. Shows full stack trace on error.
--profile TEXT CLI connection profile to use. The default profile is
"DEFAULT".

-h, --help Show this message and exit.

Commands:
create Creates a token.
list Lists tokens for the calling user.
revoke Revokes an access token.

Create a token

To display usage documentation, run databricks tokens create --help.

Bash
databricks tokens create --lifetime-seconds 129600 --comment "My comment."
Console
{
"token_value": "dapi12345678901234567890123456789012",
"token_info": {
"token_id": "1ab23cd45678e90123f4567abc8d9e012345fa67890123b45678cde90fa123b4",
"creation_time": 1621287738473,
"expiry_time": 1621417338473,
"comment": "My comment."
}
}
important

Store the token_value value in a secure location. You will not be able to see it again.

List tokens

To display usage documentation, run databricks tokens list --help.

Bash
databricks tokens list
Console
{
"token_infos": [
{
"token_id": "1ab23cd45678e90123f4567abc8d9e012345fa67890123b45678cde90fa123b4",
"creation_time": 1621287738473,
"expiry_time": 1621417338473,
"comment": "My comment."
}
]
}

Revoke a token

To display usage documentation, run databricks tokens revoke --help.

Bash
databricks tokens revoke --token-id 1ab23cd45678e90123f4567abc8d9e012345fa67890123b45678cde90fa123b4
Console
{}