Manage database tokens
InfluxDB Cloud Dedicated database tokens grant read and write permissions to one or more databases and allow for actions like writing and querying data.
Create a database token
Use the influxctl token create
command or the Management HTTP API to database token for reading and writing data in your InfluxDB Cloud Dedicated cluster. Provide a token description and permissions for databases.
CLI
influxctl token create \
--read-database DATABASE1_NAME \
--read-database DATABASE2_NAME \
--write-database DATABASE2_NAME \
"Read-only on DATABASE1_NAME, Read/write on DATABASE2_NAME"
API
curl \
--location "https://console.influxdata.com/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/tokens" \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer MANAGEMENT_TOKEN" \
--data '{
"description": "Read/write token for DATABASE_NAME",
"permissions": [
{
"action": "write",
"resource": "DATABASE_NAME"
},
{
"action": "read",
"resource": "DATABASE_NAME"
}
]
}'
Update a database token
Use the influxctl token update
command
or the Management HTTP API
to update a database token’s permissions in your InfluxDB Cloud Dedicated cluster.
CLI
influxctl token update \
--read-database <DATABASE_NAME> \
--read-database <DATABASE2_NAME> \
--write-database <DATABASE2_NAME> \
<TOKEN_ID>
API
curl \
--location "https://console.influxdata.com/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/tokens/TOKEN_ID" \
--request PATCH \
--header "Accept: application/json" \
--header 'Content-Type: application/json' \
--header "Authorization: Bearer MANAGEMENT_TOKEN" \
--data '{
"permissions": [
{
"action": "read",
"resource": "DATABASE_NAME"
},
{
"action": "read",
"resource": "DATABASE2_NAME"
},
{
"action": "read",
"resource": "DATABASE2_NAME"
}
]
}'
List database tokens
Use the influxctl token list
command or the Management HTTP API to list database tokens in your InfluxDB Cloud Dedicated cluster.
CLI
influxctl token list
API
curl \
--location "https://console.influxdata.com/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/tokens" \
--header "Accept: application/json" \
--header "Authorization: Bearer MANAGEMENT_TOKEN"
curl \
--location "https://console.influxdata.com/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/tokens/TOKEN_ID" \
--header "Accept: application/json" \
--header "Authorization: Bearer MANAGEMENT_TOKEN"
Delete a database token
Use the influxctl token delete
command or the Management HTTP API to delete a database token from your InfluxDB Cloud Dedicated cluster and revoke all permissions associated with the token. Provide the ID of the database token you want to delete.
CLI
influxctl token delete <TOKEN_ID>
API
curl \
--location "https://console.influxdata.com/api/v0/accounts/ACCOUNT_ID/clusters/CLUSTER_ID/tokens/TOKEN_ID" \
--request DELETE \
--header "Accept: application/json" \
--header "Authorization: Bearer $MANAGEMENT_TOKEN" \
Was this page helpful?
Thank you for your feedback!
Support and feedback
Thank you for being part of our community! We welcome and encourage your feedback and bug reports for InfluxDB and this documentation. To find support, use the following resources:
Customers with an annual or support contract can contact InfluxData Support.