Documentation

View tokens

View API tokens and permissions using the InfluxDB user interface (UI), the influx command line interface (CLI), or the InfluxDB API.

To follow best practices for secure API token generation and retrieval, InfluxDB Cloud Serverless enforces access restrictions on API tokens.

  • InfluxDB UI only allows access to the API token value immediately after the token is created.
  • You can’t change access (read/write) permissions for an API token after it’s created.
  • Tokens stop working when the user who created the token is deleted.

We recommend the following for managing your tokens:

  • Create a generic user to create and manage tokens for writing data.
  • Store your tokens in a secure password vault for future access.

View tokens in the InfluxDB UI

  1. In the navigation menu on the left, select Load Data > API Tokens.

  2. Click a token description in the list to view the token status and a list of access permissions.

View tokens using the influx CLI

Use the influx auth list command to view tokens.

Provide the following flags:

  • --token: API token with permission to read authorizations
influx auth list --token 
API_TOKEN

Filtering options such as filtering by authorization ID, username, or user ID are available. See the influx auth list documentation for information about other available flags.

View tokens using the InfluxDB API

Use the /api/v2/authorizations InfluxDB API endpoint to view tokens and permissions.

GET https://cloud2.influxdata.com/api/v2/authorizations

Include the following in your request:

  • Headers:
    • Authorization: Token API_TOKEN (API token with the read: authorizations permission)
    • Content-type: application/json
curl --request GET \
	"https://cloud2.influxdata.com/api/v2/authorizations" \
  --header "Authorization: Token 
API_TOKEN
"
\
--header 'Content-type: application/json'

View a single token

To view a specific authorization and token, include the authorization ID in the URL path.

GET https://cloud2.influxdata.com/api/v2/authorizations/{authID}

Include the following in your request:

  • Headers:
    • Authorization: Token API_TOKEN (API token with the read: authorizations permission)
    • Content-type: application/json
curl --request GET \
	"https://us-west-2-1.aws.cloud2.influxdata.com/api/v2/authorizations/
AUTHORIZATION_ID
"
\
--header "Authorization: Token
API_TOKEN
"
\
--header 'Content-type: application/json'

Filter the token list

InfluxDB returns authorizations from the same organization as the token used in the request. To filter tokens by user, include userID as a query parameter in your request.

# The example below uses the common `curl` and `jq` command-line tools
# with the InfluxDB API to do the following:
# 1. Find a user by username and extract the user ID.
# 2. Find the user's authorizations by user ID.
# 3. Filter for `active` authorizations that have `write` permission.

function list_write_auths() {
  curl "https://cloud2.influxdata.com/api/v2/users/?name=$1" \
    --header "Authorization: Token 
API_TOKEN
"
\
--header 'Content-type: application/json' | \ jq --arg USER $1 '.users[] | select(.name == $USER) | .id' | \ xargs -I '%' \ curl "https://cloud2.influxdata.com/api/v2/authorizations/?userID=%" \ --header "Authorization: Token
API_TOKEN
"
\
--header 'Content-type: application/json' | \ jq '.authorizations[] | select(.permissions[] | select(.action=="write")) | select(.status=="active")' } list_write_auths 'iot_user_1'

See the /authorizations endpoint documentation for more information about available parameters.


Was this page helpful?

Thank you for your feedback!


Introducing InfluxDB Clustered

A highly available InfluxDB 3.0 cluster on your own infrastructure.

InfluxDB Clustered is a highly available InfluxDB 3.0 cluster built for high write and query workloads on your own infrastructure.

InfluxDB Clustered is currently in limited availability and is only available to a limited group of InfluxData customers. If interested in being part of the limited access group, please contact the InfluxData Sales team.

Learn more
Contact InfluxData Sales

The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Flux is going into maintenance mode and will not be supported in InfluxDB 3.0. This was a decision based on the broad demand for SQL and the continued growth and adoption of InfluxQL. We are continuing to support Flux for users in 1.x and 2.x so you can continue using it with no changes to your code. If you are interested in transitioning to InfluxDB 3.0 and want to future-proof your code, we suggest using InfluxQL.

For information about the future of Flux, see the following:

InfluxDB Cloud Serverless