---
title: "Update a secret"
method: PATCH
path: "/api/secrets/{id}"
tags: ["settings"]
---

# Update a secret

`PATCH /api/secrets/{id}`

[cloud-only] Updates an existing secret's name and/or value. Both fields are optional; only provided fields are updated.

## Path parameters

- `id` string, uuid, required

## Request body

- UpdateSecretRequest — [cloud-only] Request body for updating an existing user secret.
  - `name` string — New name for the secret
  - `secret_value` string — New secret value (API key, token, etc.)

## Response `200`

Secret updated

- SecretResponse — [cloud-only] User secret metadata (the secret value itself is never returned after creation).
  - `id` string, uuid, required — Unique identifier for the secret
  - `name` string, required — User-provided label for the secret
  - `provider` string — Provider identifier (e.g., huggingface, civitai)
  - `last_used_at` string, date-time — When the secret was last used for decryption
  - `created_at` string, date-time, required — When the secret was created
  - `updated_at` string, date-time, required — When the secret was last updated

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `403` — Forbidden - user does not own this secret
- `404` — Not found
- `409` — Conflict — a secret with this name already exists
- `500` — Internal server error
- `503` — Service unavailable - secrets feature disabled

## Changes

- **2026-05-22** `c4db9e1283df` — 2 info
  - the response property `created_at` became required for the status `200`
  - the response property `updated_at` became required for the status `200`
- **2026-05-22** `09a5075587c8` — 3 info
  - added the non-success response with the status `403`
  - added the non-success response with the status `500`
  - added the non-success response with the status `503`
- **2026-05-08** `c9640fded659` — 1 info
  - endpoint added

[Change history](https://skmtc.dev/comfy-org/apis/comfyui-api/changes/api/secrets/:id/patch.md)

---

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