View tokens

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

Tokens are visible to the user who created the token. Users who own a token with Operator permissions also have access to all tokens. Tokens stop working when the user who created the token is deleted.

We recommend creating a generic user to create and manage tokens for writing data.

View tokens in the InfluxDB UI

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

    Load Data

  2. Click a token name in the list to view the token and a summary of access permissions.

View tokens using the influx CLI

Use the influx auth list command to view tokens.

  1. influx auth list

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 /authorizations endpoint of the InfluxDB API to view tokens and permissions.

  1. GET /api/v2/authorizations

Include the following in your request:

RequirementInclude by
API token with the read: authorizations permissionUse the Authorization: Token YOUR_API_TOKEN header.
  1. INFLUX_TOKEN=YOUR_API_TOKEN
  2. curl --request GET \
  3. "http://localhost:8086/api/v2/authorizations" \
  4. --header "Authorization: Token ${INFLUX_TOKEN}" \
  5. --header 'Content-type: application/json'

View a single token

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

  1. GET /api/v2/authorizations/{authID}

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.

  1. # The example below uses the common `curl` and `jq` command-line tools
  2. # with the InfluxDB API to do the following:
  3. # 1. Find a user by username and extract the user ID.
  4. # 2. Find the user's authorizations by user ID.
  5. # 3. Filter for `active` authorizations that have `write` permission.
  6. INFLUX_TOKEN=YOUR_API_TOKEN
  7. function list_write_auths() {
  8. curl "http://localhost:8086/api/v2/users/?name=$1" \
  9. --header "Authorization: Token ${INFLUX_TOKEN}" \
  10. --header 'Content-type: application/json' | \
  11. jq --arg USER $1 '.users[] | select(.name == $USER) | .id' | \
  12. xargs -I '%' \
  13. curl "http://localhost:8086/api/v2/authorizations/?userID=%" \
  14. --header "Authorization: Token ${INFLUX_TOKEN}" \
  15. --header 'Content-type: application/json' | \
  16. jq '.authorizations[]
  17. | select(.permissions[] | select(.action=="write"))
  18. | select(.status=="active")'
  19. }
  20. list_write_auths 'iot_user_1'

Operator tokens have access to all organizations’ authorizations. To filter authorizations by organization when using an operator token, include an org or orgID query parameter in your request.

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