API Reference
Environments Environment management within projects
Environment management within projects
GET /api/v1/projects/{projectId}/environments
Returns all environments in a project
Operation ID: listEnvironments · Authentication: Authorization: Bearer <token>
Name Type Required Description projectIdstringyes Project UUID or slug (e.g., "my-project")
Status Description Body 200List of environments object401Authentication required Error403Insufficient permissions Error404Resource not found Error
Field Type Description environmentsobject[]
curl -X GET "https://api.keyenv.dev/api/v1/projects/{projectId}/environments" \
-H "Authorization: Bearer $KEYENV_TOKEN "
POST /api/v1/projects/{projectId}/environments
Creates a new environment in a project. Can optionally inherit secrets from another environment.
Requires team admin role. The name is normalized to a slug (lowercase letters, numbers,
hyphens and underscores, e.g. "QA Env" becomes "qa-env") so it is safe in URLs and CLI commands.
Operation ID: createEnvironment · Authentication: Authorization: Bearer <token>
Name Type Required Description projectIdstringyes Project UUID or slug (e.g., "my-project")
application/json (required)
Field Type Required Description namestringyes Environment name, normalized to a slug (lowercase letters, numbers, hyphens and underscores) inherits_fromstring (uuid)no Parent environment ID for secret inheritance
Status Description Body 201Environment created Environment400Invalid request Error401Authentication required Error403Insufficient permissions Error409Resource already exists Error429Plan limit exceeded LimitError
Field Type Description idstring (uuid)project_idstring (uuid)namestringinherits_fromstring (uuid)created_atstring (date-time)
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 /api/v1/projects/{projectId}/environments/{environmentId}
Returns environment details
Operation ID: getEnvironment · Authentication: Authorization: Bearer <token>
Name Type Required Description projectIdstringyes Project UUID or slug (e.g., "my-project") environmentIdstringyes Environment UUID or name (e.g., "development", "staging", "production")
Status Description Body 200Environment details Environment401Authentication required Error403Insufficient permissions Error404Resource not found Error
Field Type Description idstring (uuid)project_idstring (uuid)namestringinherits_fromstring (uuid)created_atstring (date-time)
curl -X GET "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}" \
-H "Authorization: Bearer $KEYENV_TOKEN "
PATCH /api/v1/projects/{projectId}/environments/{environmentId}
Renames a custom environment. Requires team admin role. The new name is normalized to a slug.
Default environments (development, staging, production) cannot be renamed.
Secrets, permissions and inheritance are kept because they reference the environment ID.
Logs an environment.updated audit event.
Operation ID: updateEnvironment · Authentication: Authorization: Bearer <token>
Name Type Required Description projectIdstringyes Project UUID or slug (e.g., "my-project") environmentIdstringyes Environment UUID or name (e.g., "development", "staging", "production")
application/json (required)
Field Type Required Description namestringyes New name, normalized to a slug (lowercase letters, numbers, hyphens and underscores)
Status Description Body 200Environment renamed Environment401Authentication required Error403Insufficient permissions Error404Resource not found Error409Resource already exists Error
Field Type Description idstring (uuid)project_idstring (uuid)namestringinherits_fromstring (uuid)created_atstring (date-time)
curl -X PATCH "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}" \
-H "Authorization: Bearer $KEYENV_TOKEN " \
-H "Content-Type: application/json" \
-d '{"name":"string"}'
DELETE /api/v1/projects/{projectId}/environments/{environmentId}
Deletes an environment with its secrets, permissions, overrides and rotation configs. Requires team admin role.
Cannot delete default environments (development, staging, production).
Returns 409 if other environments inherit from it; change or delete those first.
Operation ID: deleteEnvironment · Authentication: Authorization: Bearer <token>
Name Type Required Description projectIdstringyes Project UUID or slug (e.g., "my-project") environmentIdstringyes Environment UUID or name (e.g., "development", "staging", "production")
Status Description Body 204Environment deleted 400Invalid request Error401Authentication required Error403Insufficient permissions Error404Resource not found Error409Resource already exists Error
curl -X DELETE "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}" \
-H "Authorization: Bearer $KEYENV_TOKEN "