---
title: "Create a new user secret"
method: POST
path: "/api/v2/users/{user}/secrets"
tags: ["Secrets"]
---

# Create a new user secret

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

## Path parameters

- `user` string, required

## Request body

- CodersdkCreateUserSecretRequest
  - `description` string
  - `enabled` boolean
  - `env_name` string
  - `file_path` string
  - `name` string
  - `value` string

## Response `201`

Created

- 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

---

[API](https://skmtc.net/coder/apis/coder-api.md) · [All operations](https://skmtc.net/coder/apis/coder-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/coder/coder-api/versions/56b6e9f08540/schema)
