Create a token
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.
To manage InfluxDB API Tokens in the InfluxDB UI, navigate to the API Tokens management page.
Load Data
- From the API Tokens management page, click Generate and select a token type (Read/Write Token or All Access API Token).
- In the window that appears, enter a description for your token in the Description field.
- If generating a read/write token:
- Search for and select buckets to read from in the Read pane.
- Search for and select buckets to write to in the Write pane.
- Click Save.
Use the to create a token. Include flags with the command to grant specific permissions to the token. See the available flags. Only tokens with the write: authorizations
permission can create tokens.
Create an All-Access token
Create an All-Access token to grant permissions to all resources in an organization.
influx auth create \
--org my-org \
Create an Operator token
Create a token with specified read permissions
influx auth create \
--org my-org \
--read-bucket 03a2bbf46309a000 \
--read-bucket 3a87c03ace269000 \
--read-dashboards \
--read-tasks \
--read-telegrafs \
--read-user
See the influx auth create documentation for information about other available flags.
Use the /api/v2/authorizations
InfluxDB API endpoint to create a token.
Include the following in your request:
INFLUX_ORG_ID=YOUR_ORG_ID
INFLUX_TOKEN=YOUR_API_TOKEN
curl -v --request POST \
http://localhost:8086/api/v2/authorizations \
--header "Authorization: Token ${INFLUX_TOKEN}" \
--header 'Content-type: application/json' \
--data '{
"status": "active",
"description": "iot-center-device",
"orgID": "'"${INFLUX_ORG_ID}"'",
"permissions": [
{
"resource": {
"orgID": "'"${INFLUX_ORG_ID}"'",
"type": "authorizations"
},
{
"action": "read",
"resource": {
"orgID": "'"${INFLUX_ORG_ID}"'",
"type": "buckets"
}
},
{
"action": "write",
"resource": {
"orgID": "'"${INFLUX_ORG_ID}"'",
"type": "buckets",
"name": "iot-center"
}
}
]
Create a token scoped to a user
See the POST /api/v2/authorizations documentation for more information about options.