Platform

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
POST
GET
PATCH
DELETE
POST

List all platform alerts

Required API key scopes

alert:read

Query parameters

  • legacy_configuration_id
    string
  • limit
    integer
  • offset
    integer

Response


Example request

GET /api/projects/:project_id/platform_alerts
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/platform_alerts/

Example response

Status 200
RESPONSE
{
"count": 123,
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"previous": "http://api.example.org/accounts/?offset=200&limit=100",
"results": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"enabled": true,
"source_kind": "logs",
"source_config": {},
"check_interval_minutes": 0,
"recurrence_unit": "day",
"anchor_time": "string",
"evaluation_periods": 0,
"datapoints_to_alarm": 0,
"cooldown_minutes": 0,
"schedule_restriction": {
"blocked_windows": [
{
"start": "string",
"end": "string"
}
]
},
"next_check_at": "2019-08-24T14:15:22Z",
"consecutive_failures": 0,
"legacy_configuration_id": "c5c22f76-e160-4adf-9790-fd4a93ed375d",
"grouping": {
"mode": "single",
"keys": [
"string"
],
"max_instances": 100,
"on_overflow": "degrade_visible"
},
"snooze_until": "2019-08-24T14:15:22Z",
"check_status": "ok",
"overflowed_groups": 0,
"overflow_is_lower_bound": true,
"owner": "source",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"alerts": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"grouping_key": "string",
"state": "not_firing",
"firing_started_at": "2019-08-24T14:15:22Z",
"last_notified_at": "2019-08-24T14:15:22Z",
"snooze_until": "2019-08-24T14:15:22Z",
"labels": {
"property1": "string",
"property2": "string"
}
}
]
}
]
}

Create platform alerts

Required API key scopes

alert:write


Response


Example request

Example response

Status 201
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"enabled": true,
"source_kind": "logs",
"source_config": {},
"check_interval_minutes": 0,
"recurrence_unit": "day",
"anchor_time": "string",
"evaluation_periods": 0,
"datapoints_to_alarm": 0,
"cooldown_minutes": 0,
"schedule_restriction": {
"blocked_windows": [
{
"start": "string",
"end": "string"
}
]
},
"next_check_at": "2019-08-24T14:15:22Z",
"consecutive_failures": 0,
"legacy_configuration_id": "c5c22f76-e160-4adf-9790-fd4a93ed375d",
"grouping": {
"mode": "single",
"keys": [
"string"
],
"max_instances": 100,
"on_overflow": "degrade_visible"
},
"snooze_until": "2019-08-24T14:15:22Z",
"check_status": "ok",
"overflowed_groups": 0,
"overflow_is_lower_bound": true,
"owner": "source",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"alerts": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"grouping_key": "string",
"state": "not_firing",
"firing_started_at": "2019-08-24T14:15:22Z",
"last_notified_at": "2019-08-24T14:15:22Z",
"snooze_until": "2019-08-24T14:15:22Z",
"labels": {
"property1": "string",
"property2": "string"
}
}
]
}
Status 400 The settings are invalid, or the source refused the create.
Status 403 The caller cannot write alerts of this source kind.
Status 409 The URL names an environment, whose alerts are created on its own page.

Retrieve platform alerts

Required API key scopes

alert:read

Path parameters

  • id
    string

Response


Example request

GET /api/projects/:project_id/platform_alerts/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/platform_alerts/:id/

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"enabled": true,
"source_kind": "logs",
"source_config": {},
"check_interval_minutes": 0,
"recurrence_unit": "day",
"anchor_time": "string",
"evaluation_periods": 0,
"datapoints_to_alarm": 0,
"cooldown_minutes": 0,
"schedule_restriction": {
"blocked_windows": [
{
"start": "string",
"end": "string"
}
]
},
"next_check_at": "2019-08-24T14:15:22Z",
"consecutive_failures": 0,
"legacy_configuration_id": "c5c22f76-e160-4adf-9790-fd4a93ed375d",
"grouping": {
"mode": "single",
"keys": [
"string"
],
"max_instances": 100,
"on_overflow": "degrade_visible"
},
"snooze_until": "2019-08-24T14:15:22Z",
"check_status": "ok",
"overflowed_groups": 0,
"overflow_is_lower_bound": true,
"owner": "source",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"alerts": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"grouping_key": "string",
"state": "not_firing",
"firing_started_at": "2019-08-24T14:15:22Z",
"last_notified_at": "2019-08-24T14:15:22Z",
"snooze_until": "2019-08-24T14:15:22Z",
"labels": {
"property1": "string",
"property2": "string"
}
}
]
}

Update platform alerts

Required API key scopes

alert:write

Path parameters

  • id
    string


Response


Example request

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"enabled": true,
"source_kind": "logs",
"source_config": {},
"check_interval_minutes": 0,
"recurrence_unit": "day",
"anchor_time": "string",
"evaluation_periods": 0,
"datapoints_to_alarm": 0,
"cooldown_minutes": 0,
"schedule_restriction": {
"blocked_windows": [
{
"start": "string",
"end": "string"
}
]
},
"next_check_at": "2019-08-24T14:15:22Z",
"consecutive_failures": 0,
"legacy_configuration_id": "c5c22f76-e160-4adf-9790-fd4a93ed375d",
"grouping": {
"mode": "single",
"keys": [
"string"
],
"max_instances": 100,
"on_overflow": "degrade_visible"
},
"snooze_until": "2019-08-24T14:15:22Z",
"check_status": "ok",
"overflowed_groups": 0,
"overflow_is_lower_bound": true,
"owner": "source",
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z",
"alerts": [
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"grouping_key": "string",
"state": "not_firing",
"firing_started_at": "2019-08-24T14:15:22Z",
"last_notified_at": "2019-08-24T14:15:22Z",
"snooze_until": "2019-08-24T14:15:22Z",
"labels": {
"property1": "string",
"property2": "string"
}
}
]
}
Status 403 The caller cannot write alerts of this source kind.
Status 404 No alert with this id that the caller can read.
Status 409 The source product owns this alert, so only its own API edits it.

Delete platform alerts

Required API key scopes

alert:write

Path parameters

  • id
    string

Example request

DELETE /api/projects/:project_id/platform_alerts/:id
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl -X DELETE \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/platform_alerts/:id/

Example response

Status 204 The alert, its source's own row and its destinations are deleted.
Status 403 The caller cannot write alerts of this source kind.
Status 404 No alert with this id that the caller can read.
Status 409 The source product owns this alert, so only its own API deletes it.

Create platform alerts snooze group

Required API key scopes

alert:write

Path parameters

  • id
    string

Request parameters

  • grouping_key
    string
  • snooze_until
    string | null

Response


Example request

POST /api/projects/:project_id/platform_alerts/:id/snooze_group
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/platform_alerts/:id/snooze_group/\
-d grouping_key="string",\
-d snooze_until="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"grouping_key": "string",
"state": "not_firing",
"firing_started_at": "2019-08-24T14:15:22Z",
"last_notified_at": "2019-08-24T14:15:22Z",
"snooze_until": "2019-08-24T14:15:22Z",
"labels": {
"property1": "string",
"property2": "string"
}
}
Status 400 The time is not in the future, or the alert is not grouped.
Status 403 The caller cannot write alerts of this source kind.
Status 404 No alert with this id that the caller can read, or no group with this key.
Status 409 The source product owns this alert, so only its own API changes it.