---
title: Secrets
description: Create and manage secrets (key-value pairs) for use in InfluxDB OSS v2 Flux scripts and tasks.
url: https://docs.influxdata.com/influxdb/v2/api/secrets/
estimated_tokens: 1219
product: InfluxDB OSS v2
version: v2
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v2/api/secrets/
---

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

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

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

### List all secret keys for an organization

#### Parameters

##### Path parameters

`orgID`requiredstring

The organization ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request GET \
  "http://localhost:8086/api/v2/orgs/{orgID}/secrets" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

200A list of all secret keys

defaultUnexpected error

`code`requiredstring

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`requiredstring

The organization ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request bodyrequired

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 \
  "http://localhost:8086/api/v2/orgs/{orgID}/secrets" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{"apikey":"abc123xyz"}'
```

#### Responses

204Keys successfully patched

defaultUnexpected error

`code`requiredstring

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`requiredstring

The organization ID.

`secretID`requiredstring

The secret ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

Example request[Ask AI about this](#)

```sh
curl --request DELETE \
  "http://localhost:8086/api/v2/orgs/{orgID}/secrets/{secretID}" \
  --header "Authorization: Bearer INFLUX_TOKEN"
```

#### Responses

204Keys successfully deleted

defaultNon 2XX error response from server.

`code`requiredstring

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`requiredstring

The organization ID.

##### Header parameters

`Zap-Trace-Span`string

OpenTracing span context

#### Request bodyrequired

Secret key to delete

Content-Type:`application/json`

`secrets`string[]

Example request[Ask AI about this](#)

```sh
curl --request POST \
  "http://localhost:8086/api/v2/orgs/{orgID}/secrets/delete" \
  --header "Authorization: Bearer INFLUX_TOKEN" \
  --header "Content-Type: application/json" \
  --data-raw '{
  "secrets": [
    "example"
  ]
}'
```

#### Responses

204Keys successfully patched

defaultUnexpected error

`code`requiredstring

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.
