# Managing Secrets

URL: https://docs.usestitch.ai/docs/resources/secrets/managing



Secrets belong to your active organization. Check that you are in the correct organization
before making changes. Saved values are not shown again.

## Using the UI [#using-the-ui]

Open [Secrets in the Stitch app](https://app.usestitch.ai/secrets).

### Add a Secret [#add-a-secret]

1. Select **Add secret**.
2. Enter a name and value. You can also add a description.
3. Save the secret.

### Update a Secret [#update-a-secret]

Open a secret to edit its name or description. To replace its value, enter the new credential
in **Rotate value** and save. Leave that field blank to keep the current value.

If you rename a secret, update any factory configuration that references its old name.

### Delete a Secret [#delete-a-secret]

Organization owners and admins can delete secrets. Check that no factories need the secret
before deleting it.

## Using the CLI [#using-the-cli]

| Command                        | Purpose                                    |
| ------------------------------ | ------------------------------------------ |
| `stitch secrets list`          | List secret names and metadata, not values |
| `stitch secrets add <name>`    | Create a secret through a hidden prompt    |
| `stitch secrets remove <name>` | Delete a secret; owner or admin only       |

For example, add an OpenAI API key:

```sh
stitch secrets add OPENAI_API_KEY
```

Enter the value in your private terminal when prompted. To update an existing secret,
use the UI. The CLI does not have an update command.

<Callout type="warning">
  `stitch secrets remove`

   deletes immediately without confirmation.
</Callout>

## Names and Values [#names-and-values]

| Field       | Requirements                                               |
| ----------- | ---------------------------------------------------------- |
| Name        | 1–64 characters; letters, numbers, underscores, or hyphens |
| Value       | Non-empty; up to 8192 characters                           |
| Description | Optional                                                   |

<Callout type="warning">
  Do not put secret values in chat, factory files, command arguments, or logs.
</Callout>
