| title | Secrets |
|---|
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{user}/secrets \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'GET /api/v2/users/{user}/secrets
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user |
path | string | true | User ID, username, or me |
200 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"
}
]| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | array of codersdk.UserSecret |
Status Code 200
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
[array item] |
array | false | ||
» created_at |
string(date-time) | false | ||
» description |
string | false | ||
» enabled |
boolean | false | 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 | false | ||
» file_path |
string | false | ||
» id |
string(uuid) | false | ||
» name |
string | false | ||
» updated_at |
string(date-time) | false |
To perform this operation, you must be authenticated. Learn more.
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/{user}/secrets \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'POST /api/v2/users/{user}/secrets
Body parameter
{
"description": "string",
"enabled": true,
"env_name": "string",
"file_path": "string",
"name": "string",
"value": "string"
}| Name | In | Type | Required | Description |
|---|---|---|---|---|
user |
path | string | true | User ID, username, or me |
body |
body | codersdk.CreateUserSecretRequest | true | Create secret request |
201 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"
}| Status | Meaning | Description | Schema |
|---|---|---|---|
| 201 | Created | Created | codersdk.UserSecret |
To perform this operation, you must be authenticated. Learn more.
# Example request using curl
curl -X POST http://coder-server:8080/api/v2/users/{user}/secrets/batch \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'POST /api/v2/users/{user}/secrets/batch
Body parameter
{
"content": "string",
"format": "env"
}| Name | In | Type | Required | Description |
|---|---|---|---|---|
user |
path | string | true | User ID, username, or me |
body |
body | codersdk.ImportUserSecretsRequest | true | Import secrets request |
201 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"
}
]| Status | Meaning | Description | Schema |
|---|---|---|---|
| 201 | Created | Created | array of codersdk.UserSecret |
| 400 | Bad Request | Bad Request | codersdk.Response |
| 409 | Conflict | Conflict | codersdk.Response |
| 413 | Payload Too Large | Request Entity Too Large | codersdk.Response |
Status Code 201
| Name | Type | Required | Restrictions | Description |
|---|---|---|---|---|
[array item] |
array | false | ||
» created_at |
string(date-time) | false | ||
» description |
string | false | ||
» enabled |
boolean | false | 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 | false | ||
» file_path |
string | false | ||
» id |
string(uuid) | false | ||
» name |
string | false | ||
» updated_at |
string(date-time) | false |
To perform this operation, you must be authenticated. Learn more.
# Example request using curl
curl -X GET http://coder-server:8080/api/v2/users/{user}/secrets/{name} \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'GET /api/v2/users/{user}/secrets/{name}
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user |
path | string | true | User ID, username, or me |
name |
path | string | true | Secret name |
200 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"
}| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.UserSecret |
To perform this operation, you must be authenticated. Learn more.
# Example request using curl
curl -X DELETE http://coder-server:8080/api/v2/users/{user}/secrets/{name} \
-H 'Coder-Session-Token: API_KEY'DELETE /api/v2/users/{user}/secrets/{name}
| Name | In | Type | Required | Description |
|---|---|---|---|---|
user |
path | string | true | User ID, username, or me |
name |
path | string | true | Secret name |
| Status | Meaning | Description | Schema |
|---|---|---|---|
| 204 | No Content | No Content |
To perform this operation, you must be authenticated. Learn more.
# Example request using curl
curl -X PATCH http://coder-server:8080/api/v2/users/{user}/secrets/{name} \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-H 'Coder-Session-Token: API_KEY'PATCH /api/v2/users/{user}/secrets/{name}
Body parameter
{
"description": "string",
"enabled": true,
"env_name": "string",
"file_path": "string",
"value": "string"
}| Name | In | Type | Required | Description |
|---|---|---|---|---|
user |
path | string | true | User ID, username, or me |
name |
path | string | true | Secret name |
body |
body | codersdk.UpdateUserSecretRequest | true | Update secret request |
200 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"
}| Status | Meaning | Description | Schema |
|---|---|---|---|
| 200 | OK | OK | codersdk.UserSecret |
To perform this operation, you must be authenticated. Learn more.