API Reference
Environments
Environment management within projects
Environments
Environment management within projects
List environments
GET /api/v1/projects/{projectId}/environmentsReturns all environments in a project
Operation ID: listEnvironments · Authentication: Authorization: Bearer <token>
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | yes | Project UUID or slug (e.g., "my-project") |
Responses
| Status | Description | Body |
|---|---|---|
200 | List of environments | object |
401 | Authentication required | Error |
403 | Insufficient permissions | Error |
404 | Resource not found | Error |
Response body (200)
| Field | Type | Description |
|---|---|---|
environments | object[] |
Example
curl -X GET "https://api.keyenv.dev/api/v1/projects/{projectId}/environments" \
-H "Authorization: Bearer $KEYENV_TOKEN"Create environment
POST /api/v1/projects/{projectId}/environmentsCreates a new environment in a project. Can optionally inherit secrets from another environment.
Operation ID: createEnvironment · Authentication: Authorization: Bearer <token>
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | yes | Project UUID or slug (e.g., "my-project") |
Request body
application/json (required)
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | |
inherits_from | string (uuid) | no | Parent environment ID for secret inheritance |
Responses
| Status | Description | Body |
|---|---|---|
201 | Environment created | Environment |
400 | Invalid request | Error |
401 | Authentication required | Error |
403 | Insufficient permissions | Error |
429 | Plan limit exceeded | LimitError |
Response body (201)
| Field | Type | Description |
|---|---|---|
id | string (uuid) | |
project_id | string (uuid) | |
name | string | |
inherits_from | string (uuid) | |
created_at | string (date-time) |
Example
curl -X POST "https://api.keyenv.dev/api/v1/projects/{projectId}/environments" \
-H "Authorization: Bearer $KEYENV_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"string","inherits_from":"00000000-0000-0000-0000-000000000000"}'Get environment
GET /api/v1/projects/{projectId}/environments/{environmentId}Returns environment details
Operation ID: getEnvironment · Authentication: Authorization: Bearer <token>
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | yes | Project UUID or slug (e.g., "my-project") |
environmentId | string | yes | Environment UUID or name (e.g., "development", "staging", "production") |
Responses
| Status | Description | Body |
|---|---|---|
200 | Environment details | Environment |
401 | Authentication required | Error |
403 | Insufficient permissions | Error |
404 | Resource not found | Error |
Response body (200)
| Field | Type | Description |
|---|---|---|
id | string (uuid) | |
project_id | string (uuid) | |
name | string | |
inherits_from | string (uuid) | |
created_at | string (date-time) |
Example
curl -X GET "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}" \
-H "Authorization: Bearer $KEYENV_TOKEN"Delete environment
DELETE /api/v1/projects/{projectId}/environments/{environmentId}Deletes an environment and all its secrets. Cannot delete default environments (development, staging, production).
Operation ID: deleteEnvironment · Authentication: Authorization: Bearer <token>
Path parameters
| Name | Type | Required | Description |
|---|---|---|---|
projectId | string | yes | Project UUID or slug (e.g., "my-project") |
environmentId | string | yes | Environment UUID or name (e.g., "development", "staging", "production") |
Responses
| Status | Description | Body |
|---|---|---|
204 | Environment deleted | |
400 | Invalid request | Error |
401 | Authentication required | Error |
403 | Insufficient permissions | Error |
404 | Resource not found | Error |
Example
curl -X DELETE "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}" \
-H "Authorization: Bearer $KEYENV_TOKEN"