KeyEnvKeyEnv
API Reference

Environments

Environment management within projects

Environments

Environment management within projects

List environments

GET /api/v1/projects/{projectId}/environments

Returns all environments in a project

Operation ID: listEnvironments · Authentication: Authorization: Bearer <token>

Path parameters

NameTypeRequiredDescription
projectIdstringyesProject UUID or slug (e.g., "my-project")

Responses

StatusDescriptionBody
200List of environmentsobject
401Authentication requiredError
403Insufficient permissionsError
404Resource not foundError

Response body (200)

FieldTypeDescription
environmentsobject[]

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}/environments

Creates a new environment in a project. Can optionally inherit secrets from another environment.

Operation ID: createEnvironment · Authentication: Authorization: Bearer <token>

Path parameters

NameTypeRequiredDescription
projectIdstringyesProject UUID or slug (e.g., "my-project")

Request body

application/json (required)

FieldTypeRequiredDescription
namestringyes
inherits_fromstring (uuid)noParent environment ID for secret inheritance

Responses

StatusDescriptionBody
201Environment createdEnvironment
400Invalid requestError
401Authentication requiredError
403Insufficient permissionsError
429Plan limit exceededLimitError

Response body (201)

FieldTypeDescription
idstring (uuid)
project_idstring (uuid)
namestring
inherits_fromstring (uuid)
created_atstring (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

NameTypeRequiredDescription
projectIdstringyesProject UUID or slug (e.g., "my-project")
environmentIdstringyesEnvironment UUID or name (e.g., "development", "staging", "production")

Responses

StatusDescriptionBody
200Environment detailsEnvironment
401Authentication requiredError
403Insufficient permissionsError
404Resource not foundError

Response body (200)

FieldTypeDescription
idstring (uuid)
project_idstring (uuid)
namestring
inherits_fromstring (uuid)
created_atstring (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

NameTypeRequiredDescription
projectIdstringyesProject UUID or slug (e.g., "my-project")
environmentIdstringyesEnvironment UUID or name (e.g., "development", "staging", "production")

Responses

StatusDescriptionBody
204Environment deleted
400Invalid requestError
401Authentication requiredError
403Insufficient permissionsError
404Resource not foundError

Example

curl -X DELETE "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}" \
  -H "Authorization: Bearer $KEYENV_TOKEN"

On this page