Event definitions

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

Endpoints

GET
POST
GET
PATCH
DELETE
GET
GET
GET
GET

Retrieve event definitions

Required API key scopes

event_definition:read

Path parameters

  • project_id
    string

Example request

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

Example response

Status 200 No response body

Create event definitions

Required API key scopes

event_definition:write

Path parameters

  • project_id
    string

Example request

POST /api/projects/:project_id/event_definitions
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/event_definitions/

Example response

Status 201 No response body

Retrieve event definitions retrieve

Required API key scopes

event_definition:read

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Update event definitions

Required API key scopes

event_definition:write

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Delete event definitions

Required API key scopes

event_definition:write

Path parameters

  • id
    string
  • project_id
    string

Example request

DELETE /api/projects/:project_id/event_definitions/: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/event_definitions/:id/

Example response

Status 204 No response body

Retrieve event definitions metrics

Path parameters

  • id
    string
  • project_id
    string

Example request

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

Example response

Status 200 No response body

Retrieve event definitions golang

Required API key scopes

event_definition:read

Path parameters

  • project_id
    string

Example request

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

Example response

Status 200 No response body

Retrieve event definitions python

Required API key scopes

event_definition:read

Path parameters

  • project_id
    string

Example request

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

Example response

Status 200 No response body

Retrieve event definitions typescript

Required API key scopes

event_definition:read

Path parameters

  • project_id
    string

Example request

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

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.