feat(influxdb3): Core and Enterprise: add create admin token API examples

pull/6005/head
Jason Stirnaman 2025-04-21 13:51:10 -05:00
parent 487a6d046b
commit 80de38933c
3 changed files with 43 additions and 7 deletions

View File

@ -14,6 +14,12 @@ list_code_example: |
```bash
influxdb3 create token --admin
```
#### HTTP API
```bash
curl -X POST "http://{{< influxdb/host >}}/api/v3/configure/token/admin" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```
alt_links:
cloud-dedicated: /influxdb3/cloud-dedicated/admin/tokens/create-token/
cloud-serverless: /influxdb3/cloud-serverless/admin/tokens/create-token/

View File

@ -14,6 +14,12 @@ list_code_example: |
```bash
influxdb3 create token --admin
```
#### HTTP API
```bash
curl -X POST "http://{{< influxdb/host >}}/api/v3/enterprise/configure/token/admin" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```
alt_links:
cloud-dedicated: /influxdb3/cloud-dedicated/admin/tokens/create-token/
cloud-serverless: /influxdb3/cloud-serverless/admin/tokens/create-token/

View File

@ -9,14 +9,17 @@ An admin token grants full access to all actions for your InfluxDB 3 instance.
>
> Token strings are returned _only_ on token creation.
> We recommend storing database tokens in a **secure secret store**.
> Anyone with access to the admin token has full control over your {{< product-name >}} instance.
> If you lose the admin token string, you must regenerate the token.
## Create an admin token
- [Use the influxdb3 CLI](#use-the-influxdb3-cli)
- [Use the HTTP API](#use-the-http-api)
### Use the influxdb3 CLI
{{< tabs-wrapper >}}
{{% tabs %}}
[CLI](#use-the-influxdb3-cli)
[HTTP API](#use-the-http-api)
{{% /tabs %}}
{{% tab-content %}}
Use the `influxdb3 create token --admin` command:
@ -24,10 +27,31 @@ Use the `influxdb3 create token --admin` command:
influxdb3 create token --admin
```
The command returns the token string in plain text.
The output contains the token string in plain text.
To use the token as the default for later commands, and to persist the token
across sessions, assign the token string to the `INFLUXDB3_AUTH_TOKEN` environment variable.
{{% /tab-content %}}
{{% tab-content %}}
Use the following endpoint to create an admin token:
> [!Caution]
> Protect your admin token. Anyone with access to the admin token has full control over your {{< product-name >}} instance.
{{% show-in "core" %}}
{{% api-endpoint method="POST" endpoint="/api/v3/configure/token/admin" api-ref="/influxdb3/version/api/v3/#operation/PostCreateAdminToken" %}}
```bash
curl -X POST "http://{{< influxdb/host >}}/api/v3/configure/token/admin" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```
{{% /show-in %}}
{{% show-in "enterprise" %}}
{{% api-endpoint method="POST" endpoint="/api/v3/enterprise/configure/token/admin" api-ref="/influxdb3/version/api/v3/#operation/PostCreateAdminToken" %}}
```bash
curl -X POST "http://{{< influxdb/host >}}/api/v3/{{< product-key >}}/configure/token/admin" \
--header 'Accept: application/json' \
--header 'Content-Type: application/json'
```
{{% /show-in %}}
{{% /tab-content %}}
{{< /tabs-wrapper >}}