---
title: Database tokens
description: Create and manage database tokens that authorize read and write access to InfluxDB 3 Cloud Dedicated databases.
url: https://docs.influxdata.com/influxdb3/cloud-dedicated/api/management-api/database-tokens/
estimated_tokens: 12582
product: InfluxDB Cloud Dedicated
version: cloud-dedicated
---

[Download Cloud Dedicated Management API Spec](/openapi/influxdb-cloud-dedicated-management-api.yml)

Create and manage database tokens that authorize read and write access to InfluxDB 3 Cloud Dedicated databases.

GET `/accounts/{accountId}/clusters/{clusterId}/tokens`

### Get all database tokens for a cluster

#### Parameters

##### Path parameters

`accountId` required string

The ID of the account to get the database tokens for

`clusterId` required string

The ID of the cluster to get the database tokens for

Example request [Ask AI about this](#)

```sh
curl --request GET \
  "https://console.influxdata.com/api/v0/accounts/{accountId}/clusters/{clusterId}/tokens" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200 The database tokens were successfully retrieved

400 Bad Request

`code` required integer

`message` required string

401 Unauthorized

`code` required integer

`message` required string

403 Forbidden

`code` required integer

`message` required string

404 Not Found

`code` required integer

`message` required string

500 Internal Server Error

`code` required integer

`message` required string

POST `/accounts/{accountId}/clusters/{clusterId}/tokens`

### Create a database token

Create a database token for a cluster.

The token returned on the `accessToken` property in the response can be used to authenticate query and write requests to the cluster.

### Notable behaviors

-   InfluxDB might take some time–from a few seconds to a few minutes–to activate and synchronize new tokens. If a new database token doesn’t immediately work (you receive a `401 Unauthorized` error) for querying or writing, wait and then try your request again.
    
-   Token strings are viewable *only* on token creation and aren’t stored by InfluxDB; you can’t recover a lost token.
    

#### Store secure tokens in a secret store

We recommend storing database tokens in a **secure secret store**. For example, see how to authenticate Telegraf using tokens in your OS secret store.

If you lose a token, delete the token from InfluxDB and create a new one.

#### Parameters

##### Path parameters

`accountId` required string

The ID of the account to create the database token for

`clusterId` required string

The ID of the cluster to create the database token for

#### Request body required

Content-Type: `application/json`

`description` required string

`expiresAt` string

`permissions` string

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "https://console.influxdata.com/api/v0/accounts/{accountId}/clusters/{clusterId}/tokens" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "description": "DESCRIPTION",
  "expiresAt": "EXPIRESAT",
  "permissions": []
}'
```

#### Responses

200 The database token was successfully created

`accessToken` required string

`accountId` required string

The ID of the account that the database token belongs to

`clusterId` required string

The ID of the cluster that the database token belongs to

`createdAt` required string

`description` required string

`expiresAt` string

`id` required string

The ID of the database token

`permissions` required string

`revokedAt` string

400 Bad Request

`code` required integer

`message` required string

401 Unauthorized

`code` required integer

`message` required string

403 Forbidden

`code` required integer

`message` required string

404 Not Found

`code` required integer

`message` required string

409 Conflict

`code` required integer

`message` required string

500 Internal Server Error

`code` required integer

`message` required string

GET `/accounts/{accountId}/clusters/{clusterId}/tokens/{tokenId}`

### Get a database token

Retrieve metadata details for a database token.

#### Store secure tokens in a secret store

We recommend storing database tokens in a **secure secret store**.

Token strings are viewable *only* on token creation and aren’t stored by InfluxDB; you can’t recover a lost token.

#### Parameters

##### Path parameters

`accountId` required string

The ID of the account that the database token belongs to

`clusterId` required string

The ID of the cluster that the database token belongs to

`tokenId` required string

The ID of the database token to get

Example request [Ask AI about this](#)

```sh
curl --request GET \
  "https://console.influxdata.com/api/v0/accounts/{accountId}/clusters/{clusterId}/tokens/{tokenId}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200 The database token was successfully retrieved.

`accountId` required string

The ID of the account that the database token belongs to

`clusterId` required string

The ID of the cluster that the database token belongs to

`createdAt` required string

`description` required string

`expiresAt` string

`id` required string

The ID of the database token

`permissions` required string

`revokedAt` string

400 Bad Request

`code` required integer

`message` required string

401 Unauthorized

`code` required integer

`message` required string

403 Forbidden

`code` required integer

`message` required string

404 Not Found

`code` required integer

`message` required string

500 Internal Server Error

`code` required integer

`message` required string

PATCH `/accounts/{accountId}/clusters/{clusterId}/tokens/{tokenId}`

### Update a database token

Update the description and permissions of a database token.

#### Parameters

##### Path parameters

`accountId` required string

The ID of the account that the database token belongs to

`clusterId` required string

The ID of the cluster that the database token belongs to

`tokenId` string

The ID of the database token to update

#### Request body required

Content-Type: `application/json`

`description` string

`permissions` string

Example request [Ask AI about this](#)

```sh
curl --request PATCH \
  "https://console.influxdata.com/api/v0/accounts/{accountId}/clusters/{clusterId}/tokens/{tokenId}" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "description": "DESCRIPTION",
  "permissions": []
}'
```

#### Responses

200 The database token was successfully updated

`accountId` required string

The ID of the account that the database token belongs to

`clusterId` required string

The ID of the cluster that the database token belongs to

`createdAt` required string

`description` required string

`expiresAt` string

`id` required string

The ID of the database token

`permissions` required string

`revokedAt` string

400 Bad Request

`code` required integer

`message` required string

401 Unauthorized

`code` required integer

`message` required string

403 Forbidden

`code` required integer

`message` required string

404 Not Found

`code` required integer

`message` required string

409 Conflict

`code` required integer

`message` required string

500 Internal Server Error

`code` required integer

`message` required string

DELETE `/accounts/{accountId}/clusters/{clusterId}/tokens/{tokenId}`

### Delete a database token

#### Parameters

##### Path parameters

`accountId` required string

The ID of the account that the database token belongs to

`clusterId` required string

The ID of the cluster that the database token belongs to

`tokenId` required string

The ID of the database token to delete

Example request [Ask AI about this](#)

```sh
curl --request DELETE \
  "https://console.influxdata.com/api/v0/accounts/{accountId}/clusters/{clusterId}/tokens/{tokenId}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

204 No Content

400 Bad Request

`code` required integer

`message` required string

401 Unauthorized

`code` required integer

`message` required string

403 Forbidden

`code` required integer

`message` required string

404 Not Found

`code` required integer

`message` required string

500 Internal Server Error

`code` required integer

`message` required string

#### Related

-   [Manage database tokens](/influxdb3/cloud-dedicated/admin/tokens/database/)
-   [Delete a database token](/influxdb3/cloud-dedicated/admin/tokens/database/delete/)
-   [Authenticate Telegraf using tokens in your OS secret store](https://github.com/influxdata/telegraf/tree/master/plugins/secretstores/os)
-   [InfluxDB 3 API client libraries](/influxdb3/cloud-dedicated/reference/client-libraries/v3/)
