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.
Get all environments
Section titled “Get all environments”curl -u AUTH_TOKEN: https://app.honeybadger.io/v2/projects/PROJECT_ID/environmentsReturns 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" }}Get a single environment’s details
Section titled “Get a single environment’s details”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"}Create an environment
Section titled “Create an environment”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/environmentsYou 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
Section titled “Update an environment”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/IDYou 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
Section titled “Delete an environment”curl -u AUTH_TOKEN: -X DELETE https://app.honeybadger.io/v2/projects/PROJECT_ID/environments/IDReturns an empty response (204 No Content) if successful.