---
title: Update secrets
description: Update secrets using the influx CLI or the InfluxDB API.
url: https://docs.influxdata.com/influxdb/v2/admin/secrets/update/
estimated_tokens: 551
product: InfluxDB OSS v2
version: v2
publisher: InfluxData
canonical: https://docs.influxdata.com/influxdb/v2/admin/secrets/update/
date: '2023-11-06T15:53:12-07:00'
lastmod: '2023-11-06T15:53:12-07:00'
---

This page documents an earlier version of InfluxDB OSS.[InfluxDB 3 Core](/influxdb3/core/) is the latest stable version.

#### API token hashing is enabled by default in InfluxDB OSS 2.9.0

Stronger token security: tokens are stored as hashes on disk, so a
copy of the database file doesn’t expose usable tokens. Existing
tokens are hashed on first startup and the original strings can’t
be recovered afterward — **capture any plaintext tokens you still
need before you upgrade**.

For more information, see [Token hashing](/influxdb/v2/admin/tokens/#token-hashing).

Update secrets using the `influx` command line interface (CLI) or the InfluxDB API.

* [Update a secret using the influx CLI](#update-a-secret-using-the-influx-cli)
* [Update a secret using the InfluxDB API](#update-a-secret-using-the-influxdb-api)

## Update a secret using the influx CLI

Use the [`influx secret update` command](/influxdb/v2/reference/cli/influx/secret/update/)to update a secret in your organization.
Provide the secret key to update with the `-k` or `--key` flag.
You may also provide the secret value with the `-v` or `--value` flag.
If you do not provide the secret value with the `-v` or `--value` flag,
enter the value when prompted.

Providing a secret value with the `-v` or `--value` flag may expose the secret
in your command history.

```sh
# Syntax
influx secret update -k <secret-key>

# Example
influx secret update -k foo
```

## Update a secret using the InfluxDB API

Use the `PATCH` request method and the InfluxDB `/orgs/{orgID}/secrets` API endpoint
to update a secret in your organization.

**Include the following:**

* Your [organization ID](/influxdb/v2/admin/organizations/view-orgs/#view-your-organization-id) in the request URL
* Your [API token](/influxdb/v2/admin/tokens/view-tokens/) in the `Authorization` header
* The updated secret key-value pair in the request body

```sh
curl --request PATCH http://localhost:8086/api/v2/orgs/<org-id>/secrets \
  --header 'Authorization: Token YOURAUTHTOKEN' \
  --header 'Content-type: application/json' \
  --data '{
	"<secret-key>": "<secret-value>"
}'
```

[secrets](/influxdb/v2/tags/secrets/)[security](/influxdb/v2/tags/security/)
