KeyEnvKeyEnv
API Reference

Rotations

Automated credential rotation for database secrets

Rotations

Automated credential rotation for database secrets

List rotations

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

Lists all rotation configurations for an environment

Operation ID: listRotations · 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
200List of rotationsRotationConfigListResponse
401Authentication requiredError
403Insufficient permissionsError

Response body (200)

FieldTypeDescription
rotationsobject[]

Example

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

Create rotation

POST /api/v1/projects/{projectId}/environments/{environmentId}/rotations

Creates a new automated credential rotation configuration

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

Path parameters

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

Request body

application/json (required)

FieldTypeRequiredDescription
namestringyes
integration_typeenum (postgresql, mysql)yes
connection_methodenum (direct, proxied)yes
connectionobjectyes
proxyobjectno
rotation_interval_daysintegeryes
permission_levelstringno

Responses

StatusDescriptionBody
201Rotation createdRotationConfigResponse
400Invalid requestError
401Authentication requiredError
403Insufficient permissionsError

Response body (201)

FieldTypeDescription
idstring (uuid)
environment_idstring (uuid)
namestring
integration_typeenum (postgresql, mysql)
rotation_interval_daysinteger
connection_methodenum (direct, proxied)
statusenum (active, paused, disabled, error)
last_rotation_atstring (date-time)
next_rotation_atstring (date-time)
error_messagestring
injected_secretsstring[]
created_atstring (date-time)
updated_atstring (date-time)

Example

curl -X POST "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}/rotations" \
  -H "Authorization: Bearer $KEYENV_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"name":"string","integration_type":"postgresql","connection_method":"direct","connection":{"host":"string","port":0,"database":"string","admin_username":"string","admin_password":"string","ssl_mode":"string"},"proxy":{"lambda_arn":"string","region":"string","shared_secret":"string"},"rotation_interval_days":0,"permission_level":"string"}'

Test connection

POST /api/v1/projects/{projectId}/environments/{environmentId}/rotations/test

Tests database connection without saving the rotation config

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

Path parameters

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

Request body

application/json (required)

FieldTypeRequiredDescription
integration_typeenum (postgresql, mysql)yes
connection_methodenum (direct, proxied)yes
connectionobjectyes
proxyobjectno

Responses

StatusDescriptionBody
200Connection test resultobject
400Invalid requestError
401Authentication requiredError
403Insufficient permissionsError

Response body (200)

FieldTypeDescription
successboolean
messagestring

Example

curl -X POST "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}/rotations/test" \
  -H "Authorization: Bearer $KEYENV_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"integration_type":"postgresql","connection_method":"direct","connection":{"host":"string","port":0,"database":"string","admin_username":"string","admin_password":"string","ssl_mode":"string"},"proxy":{"lambda_arn":"string","region":"string","shared_secret":"string"}}'

Get rotation

GET /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}

Returns a rotation configuration by name

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

Path parameters

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

Responses

StatusDescriptionBody
200Rotation detailsRotationConfigResponse
401Authentication requiredError
403Insufficient permissionsError
404Resource not foundError

Response body (200)

FieldTypeDescription
idstring (uuid)
environment_idstring (uuid)
namestring
integration_typeenum (postgresql, mysql)
rotation_interval_daysinteger
connection_methodenum (direct, proxied)
statusenum (active, paused, disabled, error)
last_rotation_atstring (date-time)
next_rotation_atstring (date-time)
error_messagestring
injected_secretsstring[]
created_atstring (date-time)
updated_atstring (date-time)

Example

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

Update rotation

PUT /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}

Updates rotation interval or status

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

Path parameters

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

Request body

application/json (required)

FieldTypeRequiredDescription
rotation_interval_daysintegerno
statusenum (active, paused)no

Responses

StatusDescriptionBody
200Rotation updatedRotationConfigResponse
400Invalid requestError
401Authentication requiredError
403Insufficient permissionsError

Response body (200)

FieldTypeDescription
idstring (uuid)
environment_idstring (uuid)
namestring
integration_typeenum (postgresql, mysql)
rotation_interval_daysinteger
connection_methodenum (direct, proxied)
statusenum (active, paused, disabled, error)
last_rotation_atstring (date-time)
next_rotation_atstring (date-time)
error_messagestring
injected_secretsstring[]
created_atstring (date-time)
updated_atstring (date-time)

Example

curl -X PUT "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}" \
  -H "Authorization: Bearer $KEYENV_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"rotation_interval_days":0,"status":"active"}'

Delete rotation

DELETE /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}

Deletes a rotation configuration

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

Path parameters

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

Responses

StatusDescriptionBody
204Rotation deleted
401Authentication requiredError
403Insufficient permissionsError

Example

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

Trigger rotation

POST /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}/rotate

Manually triggers a credential rotation

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

Path parameters

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

Responses

StatusDescriptionBody
200Rotation triggeredRotationHistory
401Authentication requiredError
403Insufficient permissionsError

Response body (200)

FieldTypeDescription
idstring (uuid)
rotation_config_idstring (uuid)
versioninteger
triggered_bystring (uuid)
trigger_typeenum (scheduled, manual)
statusenum (success, failed, rolled_back)
started_atstring (date-time)
completed_atstring (date-time)
error_messagestring

Example

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

Test existing rotation

POST /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}/test

Tests database connection for an existing rotation

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

Path parameters

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

Responses

StatusDescriptionBody
200Test resultobject
401Authentication requiredError
403Insufficient permissionsError

Response body (200)

FieldTypeDescription
successboolean
messagestring

Example

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

Get rotation history

GET /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}/history

Returns rotation execution history

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

Path parameters

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

Responses

StatusDescriptionBody
200Rotation historyobject[]
401Authentication requiredError
403Insufficient permissionsError

Response body (200)

FieldTypeDescription
idstring (uuid)
rotation_config_idstring (uuid)
versioninteger
triggered_bystring (uuid)
trigger_typeenum (scheduled, manual)
statusenum (success, failed, rolled_back)
started_atstring (date-time)
completed_atstring (date-time)
error_messagestring

Example

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

List rotation webhooks

GET /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}/webhooks

Lists webhooks for a rotation configuration

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

Path parameters

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

Responses

StatusDescriptionBody
200List of webhooksobject[]
401Authentication requiredError
403Insufficient permissionsError

Response body (200)

FieldTypeDescription
idstring (uuid)
rotation_config_idstring (uuid)
urlstring (uri)
eventsenum (rotation.started, rotation.completed, rotation.failed)[]
enabledboolean
created_atstring (date-time)

Example

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

Create rotation webhook

POST /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}/webhooks

Creates a webhook for rotation events

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

Path parameters

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

Request body

application/json (required)

FieldTypeRequiredDescription
urlstring (uri)yes
eventsenum (rotation.started, rotation.completed, rotation.failed)[]yes

Responses

StatusDescriptionBody
201Webhook createdRotationWebhook
400Invalid requestError
401Authentication requiredError
403Insufficient permissionsError

Response body (201)

FieldTypeDescription
idstring (uuid)
rotation_config_idstring (uuid)
urlstring (uri)
eventsenum (rotation.started, rotation.completed, rotation.failed)[]
enabledboolean
created_atstring (date-time)

Example

curl -X POST "https://api.keyenv.dev/api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}/webhooks" \
  -H "Authorization: Bearer $KEYENV_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"url":"string","events":["rotation.started"]}'

Delete rotation webhook

DELETE /api/v1/projects/{projectId}/environments/{environmentId}/rotations/{rotationName}/webhooks/{webhookId}

Deletes a rotation webhook

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

Path parameters

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

Responses

StatusDescriptionBody
204Webhook deleted
401Authentication requiredError
403Insufficient permissionsError

Example

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

On this page