Booting the PostHog experience

Property definitions

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

Endpoints

GET
GET
PATCH
DELETE
GET

List all property definitions

Required API key scopes

property_definition:read

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Query parameters

  • event_names
    string

    If sent, response value will have is_seen_on_filtered_events populated. JSON-encoded

  • exclude_core_properties
    boolean
    Default: false

    Whether to exclude core properties

  • exclude_hidden
    boolean
    Default: false

    Whether to exclude properties marked as hidden

  • excluded_properties
    string

    JSON-encoded list of excluded properties

  • filter_by_event_names
    boolean

    Whether to return only properties for events in event_names

  • group_type_index
    integer

    What group type is the property for. Only should be set if type=group

  • is_feature_flag
    boolean

    Whether to return only (or excluding) feature flag properties

  • is_numerical
    boolean

    Whether to return only (or excluding) numerical property definitions

  • limit
    integer

    Number of results to return per page.

  • offset
    integer

    The initial index from which to return the results.

  • properties
    string

    Comma-separated list of properties to filter

  • search
    string

    Searches properties by name

  • type
    string
    Default: event
    One of: "event""person""group""session"

    What property definitions to return

    • event - event
    • person - person
    • group - group
    • session - session

Response


Example request

GET /api/projects/:project_id/property_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/property_definitions/

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",
"is_numerical": true,
"property_type": "DateTime",
"tags": [
null
],
"is_seen_on_filtered_events": "string"
}
]
}

Retrieve property definitions

Required API key scopes

property_definition:read

Path parameters

  • id
    string

    A UUID string identifying this property definition.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Response


Example request

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

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"is_numerical": true,
"property_type": "DateTime",
"tags": [
null
],
"is_seen_on_filtered_events": "string"
}

Update property definitions

Required API key scopes

property_definition:write

Path parameters

  • id
    string

    A UUID string identifying this property definition.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Request parameters

  • name
    string
  • is_numerical
    boolean
  • property_type
  • tags
    array

Response


Example request

PATCH /api/projects/:project_id/property_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/property_definitions/:id/\
-d name="string"

Example response

Status 200
RESPONSE
{
"id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",
"name": "string",
"is_numerical": true,
"property_type": "DateTime",
"tags": [
null
],
"is_seen_on_filtered_events": "string"
}

Delete property definitions

Required API key scopes

property_definition:write

Path parameters

  • id
    string

    A UUID string identifying this property definition.

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

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

Example response

Status 204 No response body

Retrieve property definitions seen together

Allows a caller to provide a list of event names and a single property name Returns a map of the event names to a boolean representing whether that property has ever been seen with that event_name

Required API key scopes

property_definition:read

Path parameters

  • project_id
    string

    Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.


Example request

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

Example response

Status 200 No response body

Community questions

Questions about this page? or post a community question.