---
title: "Import user secrets from a file"
method: POST
path: "/api/v2/users/{user}/secrets/batch"
tags: ["Secrets"]
---

# Import user secrets from a file

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

## Path parameters

- `user` string, required

## Request body

- CodersdkImportUserSecretsRequest
  - `content` string, required
  - `format` 'env' | 'json' | 'yaml', required

## 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

## Other responses

- `400` — Bad Request
- `409` — Conflict
- `413` — Request Entity Too Large

---

[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)
