---
title: "Update a secret"
method: PUT
path: "/api/v1beta/secrets/default/keys/{key}"
tags: ["secrets"]
---

# Update a secret

`PUT /api/v1beta/secrets/default/keys/{key}`

Update an existing secret in the default provider (encrypted provider only)

## Path parameters

- `key` string, required

## Request body

- union
  - object
  - PkgApiV1UpdateSecretRequest — Request to update an existing secret
    - `value` string — New secret value

## Response `200`

OK

- PkgApiV1UpdateSecretResponse — Response after updating a secret
  - `key` string — Secret key that was updated
  - `message` string — Success message

## Other responses

- `400` — Bad Request
- `404` — Not Found - Provider not setup or secret not found
- `405` — Method Not Allowed - Provider doesn't support writing
- `500` — Internal Server Error

---

[API](https://skmtc.dev/stacklok/apis/toolhive-api.md) · [All operations](https://skmtc.dev/stacklok/apis/toolhive-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/stacklok/toolhive-api/revisions/e9f942effcda/schema)
