Skip to content
Skip to Content
Coder Docs

Import user secrets from a file

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

Authorization

CoderSessionToken
headerCoder-Session-Token<token>

Path Parameters

user*string

User ID, username, or me

Request Body

Import secrets request

application/json
  1. body
content*string
format*codersdk.SecretsFileFormat
Value in"env""json""yaml"

Response Body

Created

application/json
  1. response
[index: integer]?

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

curl -X POST \	"$CODER_URL/api/v2/users/{user}/secrets/batch" \	-H "Coder-Session-Token: $CODER_SESSION_TOKEN" \	-H "Content-Type: application/json" \	-d '{  "content": "string",  "format": "env"}'
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"  }]