Events

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

The events API is deprecated

The events API is deprecated. If you're using the events API to export data, you need to migrate to data pipeline batched exports ASAP.

Currently, the events have the following restrictions imposed:

  • Pagination offset values larger than 50000 are disabled
  • If no after parameter is specified, only events in the last 24 hours are returned
  • The maximum range between before and after is limited to less than 1 year

The API is due for removal at a future date, migrate to data pipeline batched exports.


Endpoints

GET
GET
GET

List all events

Required API key scopes

query:read

Path parameters

  • project_id
    string

Query parameters

  • after
    string
  • before
    string
  • distinct_id
    integer
  • event
    string
  • format
    string
    One of: "csv""json"
  • limit
    integer
  • offset
    integer
  • person_id
    integer
  • properties
    Click to open
    array
  • select
    array
  • where
    array

Response


Example request

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

Example response

Status 200
RESPONSE
{
"next": "http://api.example.org/accounts/?offset=400&limit=100",
"results": [
{
"id": "string",
"distinct_id": "string",
"properties": "string",
"event": "string",
"timestamp": "string",
"person": "string",
"elements": "string",
"elements_chain": "string"
}
]
}

Retrieve events

Required API key scopes

query:read

Path parameters

  • id
    string
  • project_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Response


Example request

GET /api/projects/:project_id/events/: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/events/:id/

Example response

Status 200
RESPONSE
{
"id": "string",
"distinct_id": "string",
"properties": "string",
"event": "string",
"timestamp": "string",
"person": "string",
"elements": "string",
"elements_chain": "string"
}

Retrieve events values

Required API key scopes

query:read

Path parameters

  • project_id
    string

Query parameters

  • format
    string
    One of: "csv""json"

Example request

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

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.