Skip to content
Skip to Content
Coder Docs

Create a new user secret

POST
/api/v2/users/{user}/secrets

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

user*string

User ID, username, or me

Request Body

Create secret request

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

Response Body

Created

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 POST \	"$CODER_URL/api/v2/users/{user}/secrets" \	-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"}