---
title: Secrets
description: Create and manage secrets (key-value pairs) for use in InfluxDB Cloud Flux scripts and tasks.
url: https://docs.influxdata.com/influxdb/cloud/api/secrets/
estimated_tokens: 5378
product: InfluxDB Cloud (TSM)
version: cloud
---

[Download InfluxDB Cloud (TSM) API Spec](/openapi/influxdb-cloud-v2-api.yml)

Create and manage secrets (key-value pairs) for use in InfluxDB Cloud Flux scripts and tasks.

GET `/api/v2/orgs/{orgID}/secrets`

### List all secret keys for an organization

#### Parameters

##### Path parameters

`orgID` required string

The organization ID.

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

Example request [Ask AI about this](#)

```sh
curl --request GET \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/orgs/{orgID}/secrets" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200 A list of all secret keys

default Unexpected error

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.

PATCH `/api/v2/orgs/{orgID}/secrets`

### Update secrets in an organization

#### Parameters

##### Path parameters

`orgID` required string

The organization ID.

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

#### Request body required

Secret key value pairs to update/add

Content-Type: `application/json`

Example request body

```json
{
  "apikey": "abc123xyz"
}
```

Example request [Ask AI about this](#)

```sh
curl --request PATCH \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/orgs/{orgID}/secrets" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{"apikey":"abc123xyz"}'
```

#### Responses

204 Keys successfully patched

default Unexpected error

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.

DELETE `/api/v2/orgs/{orgID}/secrets/{secretID}`

### Delete a secret from an organization

#### Parameters

##### Path parameters

`orgID` required string

The organization ID.

`secretID` required string

The secret ID.

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

Example request [Ask AI about this](#)

```sh
curl --request DELETE \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/orgs/{orgID}/secrets/{secretID}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

204 Keys successfully deleted

default Non 2XX error response from server.

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.

POST `/api/v2/orgs/{orgID}/secrets/delete`

### Delete secrets from an organization

#### Parameters

##### Path parameters

`orgID` required string

The organization ID.

##### Header parameters

`Zap-Trace-Span` string

OpenTracing span context

#### Request body required

Secret key to delete

Content-Type: `application/json`

`secrets` string\[\]

Example request [Ask AI about this](#)

```sh
curl --request POST \
  "https://us-east-1-1.aws.cloud2.influxdata.com/api/v2/orgs/{orgID}/secrets/delete" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "secrets": [
    "example"
  ]
}'
```

#### Responses

204 Keys successfully patched

default Unexpected error

`code` required string

code is the machine-readable error code.

Allowed: `internal error` , `not implemented` , `not found` , `conflict` , `invalid` , `unprocessable entity` , `empty value` , `unavailable` , `forbidden` , `too many requests` , `unauthorized` , `method not allowed` , `request too large` , `unsupported media type`

`err` string

Stack of errors that occurred during processing of the request. Useful for debugging.

`message` string

Human-readable message.

`op` string

Describes the logical code operation when the error occurred. Useful for debugging.
