Event

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

Endpoints

GET
POST
GET
GET

Retrieve event filter

Returns the event filter config for the team, or null if not yet created.

Required API key scopes

event_filter:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mode": "disabled",
"filter_tree": null,
"test_cases": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Create event filter

Create or update the event filter config.

Required API key scopes

event_filter:write

Request parameters

  • mode
  • filter_tree
  • test_cases

Response


Example request

POST /api/environments/:project_id/event_filter
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/environments/:project_id/event_filter/\
-d mode=undefined

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"mode": "disabled",
"filter_tree": null,
"test_cases": null,
"created_at": "2019-08-24T14:15:22Z",
"updated_at": "2019-08-24T14:15:22Z"
}

Retrieve event filter metrics

Single event filter per team. GET /event_filter/ — returns the config (or null if not yet created) POST /event_filter/ — creates or updates the config (upsert) GET /event_filter/metrics/ — time-series metrics GET /event_filter/metrics/totals/ — aggregate totals

Required API key scopes

event_filter:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"labels": [
"string"
],
"series": [
{
"name": "string",
"values": [
0
]
}
]
}

Retrieve event filter metrics totals

Single event filter per team. GET /event_filter/ — returns the config (or null if not yet created) POST /event_filter/ — creates or updates the config (upsert) GET /event_filter/metrics/ — time-series metrics GET /event_filter/metrics/totals/ — aggregate totals

Required API key scopes

event_filter:read

Response


Example request

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

Example response

Status 200
RESPONSE
{
"totals": {
"property1": 0,
"property2": 0
}
}

Community questions

Questions about this page? or post a community question.