---
title: rpk ai secret update
latest-operator-version: v26.2.6
latest-console-tag: v3.14.0
latest-connect-version: 4.118.0
latest-redpanda-tag: v26.2.7
docname: rpk/rpk-ai/rpk-ai-secret-update
page-component-name: agentic-data-plane
page-version: master
page-component-version: master
page-component-title: Agentic Data Plane
page-relative-src-path: rpk/rpk-ai/rpk-ai-secret-update.adoc
page-edit-url: https://github.com/redpanda-data/adp-docs/edit/main/modules/reference/pages/rpk/rpk-ai/rpk-ai-secret-update.adoc
description: Update a secret. Only the values you pass change.
page-git-created-date: "2026-10-21"
page-git-modified-date: "2026-10-21"
page-generated-sources:
  - include: streaming:reference:partial$rpk-ai/rpk-ai-secret-update.adoc
    generator: rpk-docs
    version: null
    source: the rpk command help in redpanda-data/streaming-enterprise
page-generated-content: partial
---

# rpk ai secret update

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [agentic-data-plane-full.txt](https://docs.redpanda.com/agentic-data-plane-full.txt)

<!-- Source: https://docs.redpanda.com/agentic-data-plane/reference/rpk/rpk-ai/rpk-ai-secret-update.md -->

Update a secret. Only the values you pass change.

You can pass any of the following:

-   `--value` or `--value-file`: Replace the value. Omit both to keep the stored value.

-   `--tag KEY=VALUE`: Add or overwrite a tag.

-   `--remove-tag KEY`: Remove a tag.


A tag change reads the secret first and sends the merged tag set. If another edit changes the secret in between, the update fails instead of overwriting that edit. A value-only update doesn’t read the secret first.

> 📝 **NOTE**
>
> This command was introduced in ai version 0.2.92.

## Usage

```bash
rpk ai secret update <id> [flags]
```

## Examples

This section provides examples of how to use `rpk ai secret update`.

```bash
printf %s "$NEW_KEY" | rpk ai secret update OPENAI_API_KEY --value-file=-
rpk ai secret update OPENAI_API_KEY --tag env=prod --remove-tag stale
```

## Flags

| Value | Type | Description |
| --- | --- | --- |
| `--remove-tag` | stringArray | tag key to remove (`repeatable`). |
| `--tag` | stringArray | tag to add or overwrite, KEY=VALUE (`repeatable`). |
| `--value` | string | secret value, inline. Visible in shell history and the process list; prefer `--value-file`. |
| `--value-file` | string | read the secret value from a file, or "-" for stdin (write `--value-file=-` under `rpk ai`). One trailing newline is stripped. |

## Global flags

| Value | Type | Description |
| --- | --- | --- |
| `--config` | string | Redpanda or `rpk` config file; default search paths are `~/.config/rpk/rpk.yaml`, `$PWD/redpanda.yaml`, and `/etc/redpanda/redpanda.yaml`. |
| `-X, --config-opt` | stringArray | Override `rpk` configuration settings; `-X help` for detail or `-X list` for terser detail. |
| `--ignore-profile` | bool | Ignore `rpk.yaml` and `redpanda.yaml`; use default settings. |
| `--profile` | string | `rpk` profile to use. |
| `-v, --verbose` | bool | Enable verbose logging. |