---
title: "Update a user secret"
method: PATCH
path: "/api/v2/users/{user}/secrets/{name}"
tags: ["Secrets"]
---

# Update a user secret

`PATCH /api/v2/users/{user}/secrets/{name}`

## Path parameters

- `user` string, required
- `name` string, required

## Request body

- CodersdkUpdateUserSecretRequest
  - `description` string
  - `enabled` boolean
  - `env_name` string
  - `file_path` string
  - `value` string

## Response `200`

OK

- CodersdkUserSecret
  - `created_at` string, date-time
  - `description` string
  - `enabled` boolean — Enabled controls whether the secret is injected into workspaces. Disabled secrets remain visible and editable, but are not added to the agent manifest, so they are not exposed as environment variables or written to secret files.
  - `env_name` string
  - `file_path` string
  - `id` string, uuid
  - `name` string
  - `updated_at` string, date-time

## Other responses

- `400` — Bad Request
- `409` — Conflict

## Changes

- **2026-09-02** `4700c8f6c359` — 2 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `409`

[Change history](https://skmtc.dev/coder/apis/coder-api/changes/api/v2/users/:user/secrets/:name/patch.md)

---

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