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

    1. From the API Tokens management page, click Generate and select a token type (Read/Write Token or All Access API Token).
    2. In the window that appears, enter a description for your token in the Description field.
    3. 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.
    4. 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.

    1. influx auth create \
    2. --org my-org \

    Create an Operator token

    Create a token with specified read permissions

    1. influx auth create \
    2. --org my-org \
    3. --read-bucket 03a2bbf46309a000 \
    4. --read-bucket 3a87c03ace269000 \
    5. --read-dashboards \
    6. --read-tasks \
    7. --read-telegrafs \
    8. --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:

    1. INFLUX_ORG_ID=YOUR_ORG_ID
    2. INFLUX_TOKEN=YOUR_API_TOKEN
    3. curl -v --request POST \
    4. http://localhost:8086/api/v2/authorizations \
    5. --header "Authorization: Token ${INFLUX_TOKEN}" \
    6. --header 'Content-type: application/json' \
    7. --data '{
    8. "status": "active",
    9. "description": "iot-center-device",
    10. "orgID": "'"${INFLUX_ORG_ID}"'",
    11. "permissions": [
    12. {
    13. "resource": {
    14. "orgID": "'"${INFLUX_ORG_ID}"'",
    15. "type": "authorizations"
    16. },
    17. {
    18. "action": "read",
    19. "resource": {
    20. "orgID": "'"${INFLUX_ORG_ID}"'",
    21. "type": "buckets"
    22. }
    23. },
    24. {
    25. "action": "write",
    26. "resource": {
    27. "orgID": "'"${INFLUX_ORG_ID}"'",
    28. "type": "buckets",
    29. "name": "iot-center"
    30. }
    31. }
    32. ]

    Create a token scoped to a user

    See the POST /api/v2/authorizations documentation for more information about options.