Environments

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.

Get all environments

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

Returns a list of all recorded environments in this project.

json
{ "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" } }

Get a single environment's details

bash
curl -u AUTH_TOKEN: https://app.honeybadger.io/v2/projects/PROJECT_ID/environments/ID
json
{ "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" }

Create an environment

bash
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 name Type Description
name string The name of the environment
notifications boolean (Optional) Enable notifications for this environment. Default: true.

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

Update an environment

bash
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 name Type Description
name string The name of the environment
notifications boolean Enable notifications for this environment

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

Delete an environment

bash
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.