Skip to content
Skip to Content
Coder Docs

Update a user secret

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

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

user*string

User ID, username, or me

name*string

Secret name

Request Body

Update secret request

application/json
  1. body
description?string
enabled?boolean
env_name?string
file_path?string
value?string

Response Body

OK

application/json
  1. response
created_at?string
Formatdate-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
Formatuuid
name?string
updated_at?string
Formatdate-time

The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.

curl -X PATCH \	"$CODER_URL/api/v2/users/{user}/secrets/{name}" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN" \	-H "Content-Type: application/json" \	-d '{  "description": "string",  "enabled": true,  "env_name": "string"}'
Example Response
{  "created_at": "2019-08-24T14:15:22Z",  "description": "string",  "enabled": true,  "env_name": "string",  "file_path": "string",  "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",  "name": "string",  "updated_at": "2019-08-24T14:15:22Z"}