Update a token

This page documents an earlier version of InfluxDB. InfluxDB v2.7 is the latest stable version. View this page in the v2.7 documentation.

Update an API token’s description and status. using the InfluxDB user interface (UI).

Update a token in the InfluxDB UI

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

    Load Data

  2. Click the pencil icon next to the token’s name in the Description column.

  3. Update the token description, then click anywhere else to save.

Enable or disable a token in the InfluxDB UI

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

    Load Data

  2. Click the Status toggle.

Enable a token using the influx CLI

Use the influx auth active command to activate a token.

This command requires an authorization ID, which is available in the output of influx auth find.

  1. # Syntax
  2. influx auth active -i <auth-id>
  3. # Example
  4. influx auth active -i 0804f74142bbf000

To get the current status of a token, use the JSON output of the influx auth list command.

  1. influx auth find --json

Disable a token using the influx CLI

Use the influx auth inactive command to deactivate a token.

This command requires an authorization ID, which is available in the output of influx auth find.

  1. # Syntax
  2. influx auth inactive -i <auth-id>
  3. # Example
  4. influx auth inactive -i 0804f74142bbf000

To get the current status of a token, use the JSON output of the influx auth list command.

  1. influx auth find --json

Update a token using the InfluxDB API

Use the /api/v2/authorizations InfluxDB API endpoint to update the description and status of a token.

  1. PATCH http://localhost:8086/api/v2/authorizations/AUTH_ID

Include the following in your request:

RequirementInclude by
API token with the write: authorizations permissionUse the Authorization: Token YOUR_API_TOKEN header.
Authorization IDURL path parameter.
Description and/or StatusPass as description, status in the request body.

Disable a token

  1. # Update the description and status of the first authorization listed for the user.
  2. curl --request GET \
  3. "http://localhost:8086/api/v2/authorizations?user=user2" \
  4. --header "Authorization: Token ${INFLUX_TOKEN}" \
  5. --header 'Content-type: application/json' \
  6. | jq .authorizations[0].id \
  7. | xargs -I authid curl --request PATCH \
  8. http://localhost:8086/api/v2/authorizations/authid \
  9. --header "Authorization: Token ${INFLUX_TOKEN}" \
  10. --header 'Content-type: application/json' \
  11. --data '{
  12. "description": "deactivated_auth",
  13. "status": "inactive"
  14. }' | jq .