API product analytics installation

  1. Send events via the API

    Required

    You can send events directly to the PostHog API from any programming language or platform that can make HTTP requests:

    HTTP
    POST https://us.i.posthog.com/capture/
    Content-Type: application/json
    {
    "api_key": "<ph_project_api_key>",
    "event": "[event name]",
    "properties": {
    "distinct_id": "[your users' distinct id]",
    "key1": "value1",
    "key2": "value2"
    },
    "timestamp": "[optional timestamp in ISO 8601 format]"
    }
  2. Person profiles

    Optional

    By default, events are sent with person profile processing enabled. To disable this for specific events, add the following property:

    JSON
    {
    "api_key": "<ph_project_api_key>",
    "event": "page_viewed",
    "properties": {
    "distinct_id": "user_123",
    "$process_person_profile": false
    }
    }
    Learn more

    Read more about person profiles in our documentation.

Community questions

Was this page useful?

Questions about this page? or post a community question.