8.1 KiB
Use the influxdb3
CLI or the /api/v3
HTTP API to list admin tokens for your
{{% product-name %}} instance.
Admin tokens have permissions=*:*:*
, which allows access to all
data and resources in your InfluxDB 3 instance.
[!NOTE] Token metadata includes the hashed token string. InfluxDB 3 does not store the raw token string.
In the following examples, replace {{% code-placeholder-key %}}AUTH_TOKEN
{{% /code-placeholder-key %}} with your InfluxDB {{% token-link "admin" %}}
{{% show-in "enterprise" %}} or a token with read permission on the _internal
system database`{{% /show-in %}}.
List all tokens
The influxdb3 show tokens
CLI command lists all admin and resource tokens in your InfluxDB 3 instance.
influxdb3 show tokens
Query token metadata
To filter tokens and retrieve specific details using SQL, query the system.tokens
table in the
_internal
system database--for example:
Filter for admin tokens
{{% code-placeholders "AUTH_TOKEN" %}} {{< code-tabs-wrapper >}} {{% code-tabs %}} CLI HTTP API {{% /code-tabs %}} {{% code-tab-content %}}
influxdb3 query \
--database _internal \
--format csv \
"SELECT name, permissions FROM system.tokens WHERE permissions = '*:*:*'"
{{% /code-tab-content %}} {{% code-tab-content %}}
curl -G \
"http://{{< influxdb/host >}}/api/v3/query_sql" \
--data-urlencode "db=_internal" \
--data-urlencode "q=SELECT name, permissions FROM system.tokens WHERE permissions = '*:*:*'" \
--data-urlencode "format=csv" \
--header 'Accept: text/csv' \
--header "Authorization: Bearer AUTH_TOKEN"
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}} {{% /code-placeholders %}}
Filter by date
{{% code-placeholders "AUTH_TOKEN" %}} {{< code-tabs-wrapper >}} {{% code-tabs %}} CLI HTTP API {{% /code-tabs %}} {{% code-tab-content %}}
influxdb3 query \
--db _internal \
"SELECT name, permissions FROM system.tokens WHERE created_at > '2025-01-01 00:00:00'"
{{% /code-tab-content %}} {{% code-tab-content %}}
curl -G \
"http://{{< influxdb/host >}}/api/v3/query_sql" \
--data-urlencode "db=_internal" \
--data-urlencode "q=SELECT name, permissions FROM system.tokens WHERE created_at > '2025-01-01 00:00:00'" \
--header "Accept: application/json" \
--header "Authorization: Bearer AUTH_TOKEN"
{{% /code-tab-content %}} {{% /code-tabs-wrapper %}} {{% /code-placeholders %}}
Output formats
Use the format option to specify the output format for commands.
{{% product-name %}} commands used in this guide support the following output formats:
json
(default for HTTP API)pretty
(default for CLI)jsonl
csv
parquet
(output to a file)
{{% code-placeholders "AUTH_TOKEN" %}} {{< code-tabs-wrapper >}} {{% code-tabs %}} CLI HTTP API {{% /code-tabs %}} {{% code-tab-content %}}
influxdb3 show tokens \
--format jsonl
{{% /code-tab-content %}} {{% code-tab-content %}}
curl -G \
"http://{{< influxdb/host >}}/api/v3/query_sql" \
--data-urlencode "db=_internal" \
--data-urlencode "q=SELECT * FROM system.tokens" \
--data-urlencode "format=csv" \
--header 'Accept: text/csv' \
--header "Authorization: Bearer AUTH_TOKEN"
{{% /code-tab-content %}} {{% /code-tabs-wrapper %}} {{% /code-placeholders %}}
Output to a Parquet file
Parquet is a binary format.
To output to a Parquet file using the CLI, include the --output
option
with a destination path for the file.
To output a Parquet file using the HTTP API, your client must be able to handle binary data--for example,
using cURL's --output
option.
{{% code-placeholders "AUTH_TOKEN|(/PATH/TO/FILE.parquet)" %}} {{% code-tabs-wrapper %}} {{% code-tabs %}} CLI HTTP API {{% /code-tabs %}} {{% code-tab-content %}}
influxdb3 show tokens \
--format parquet \
--output /PATH/TO/FILE.parquet
{{% /code-tab-content %}} {{% code-tab-content %}}
curl -G \
"http://{{< influxdb/host >}}/api/v3/query_sql" \
--data-urlencode "db=_internal" \
--data-urlencode "q=SELECT * FROM system.tokens" \
--data-urlencode "format=parquet" \
--header "Accept: application/parquet" \
--header "Authorization: Bearer AUTH_TOKEN" \
--output /PATH/TO/FILE.parquet
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}} {{% /code-placeholders %}}
Replace {{% code-placeholder-key %}}/PATH/TO/FILE.parquet
{{% /code-placeholder-key %}}
with the path to the file where you want to save the Parquet data.
Filter the token list
Use command-line tools such as grep
or jq
to filter the output of the
influxdb3 show tokens
command or the HTTP API response--for example:
{{% code-placeholders "AUTH_TOKEN" %}} {{< code-tabs-wrapper >}} {{% code-tabs %}} CLI HTTP API {{% /code-tabs %}} {{% code-tab-content %}}
influxdb3 show tokens --format pretty |
grep _admin
{{% /code-tab-content %}} {{% code-tab-content %}}
curl -G \
"http://{{< influxdb/host >}}/api/v3/query_sql" \
--data-urlencode "db=_internal" \
--data-urlencode "q=SELECT * FROM system.tokens" \
--data-urlencode "format=pretty" \
--header "Accept: application/json" \
--header "Authorization: Bearer AUTH_TOKEN" |
grep _admin
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}} {{% /code-placeholders %}}
{{% code-placeholders "AUTH_TOKEN" %}} {{< code-tabs-wrapper >}} {{% code-tabs %}} CLI HTTP API {{% /code-tabs %}} {{% code-tab-content %}}
influxdb3 show tokens --format json |
jq '.[] | {name: .name, permissions: .permissions}'
{{% /code-tab-content %}} {{% code-tab-content %}}
curl -G \
"http://{{< influxdb/host >}}/api/v3/query_sql" \
--data-urlencode "db=_internal" \
--data-urlencode "q=SELECT name, created_at FROM system.tokens WHERE permissions = '*:*:*' AND created_at > '2025-01-01 00:00:00'" \
--data-urlencode "format=json" \
--header "Accept: application/json" \
--header "Authorization: Bearer AUTH_TOKEN" |
jq '.[] | {name: .name, created_at: .created_at}'
{{% /code-tab-content %}} {{< /code-tabs-wrapper >}} {{% /code-placeholders %}}