Skip to content

Environments API reference

In Honeybadger, errors are grouped by the environment they occurred in. When an error is reported with a new environment, the environment is automatically stored, so you can search and filter by it in the future. You can also add, remove and manage your projects’ environments via the API.

Terminal window
curl -u AUTH_TOKEN: https://app.honeybadger.io/v2/projects/PROJECT_ID/environments

Returns a list of all recorded environments in this project.

{
"results": [
{
"id": 1,
"project_id": 1,
"name": "production",
"notifications": true,
"created_at": "2021-08-10T13:56:29.513358Z",
"updated_at": "2021-08-10T13:56:29.513358Z"
}
],
"links": {
"self": "http://localhost:3000/v2/projects/1/environments"
}
}
Terminal window
curl -u AUTH_TOKEN: https://app.honeybadger.io/v2/projects/PROJECT_ID/environments/ID
{
"id": 1,
"project_id": 1,
"name": "production",
"notifications": true,
"created_at": "2021-08-10T13:56:29.513358Z",
"updated_at": "2021-08-10T13:56:29.513358Z"
}
Terminal window
curl -u AUTH_TOKEN: -X POST -H 'Content-type: application/json' \
-d '{
"environment": {
"name": "Test",
"notifications": true
}
}' https://app.honeybadger.io/v2/projects/PROJECT_ID/environments

You can specify these fields within the environment object:

Field nameTypeDescription
namestringThe name of the environment
notificationsboolean(Optional) Enable notifications for this environment. Default: true.

Returns a 201 Created response containing the created environment’s details.

Terminal window
curl -u AUTH_TOKEN: -X PUT -H 'Content-type: application/json' \
-d '{
"environment": {
"name": "Staging",
"notifications": false
}
}' https://app.honeybadger.io/v2/projects/PROJECT_ID/environments/ID

You can specify any of these fields within the environment object:

Field nameTypeDescription
namestringThe name of the environment
notificationsbooleanEnable notifications for this environment

Returns an empty response (204 No Content) if successful.

Terminal window
curl -u AUTH_TOKEN: -X DELETE https://app.honeybadger.io/v2/projects/PROJECT_ID/environments/ID

Returns an empty response (204 No Content) if successful.