:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import { OnboardingComponentsContext, createInstallation } from 'scenes/onboarding/shared/OnboardingDocsContentWrapper'
import { StepDefinition } from '../steps'
export const getAPISteps = (ctx: OnboardingComponentsContext): StepDefinition[] => {
const { CodeBlock, Markdown, CalloutBox, dedent } = ctx
return [
{
title: 'Send events via the API',
badge: 'required',
content: (
<>
<Markdown>
You can send events directly to the PostHog API from any programming language or platform that
can make HTTP requests:
</Markdown>
<CodeBlock
blocks={[
{
language: 'http',
file: 'HTTP',
code: dedent`
POST <ph_client_api_host>/capture/
Content-Type: application/json
{
"api_key": "<ph_project_token>",
"event": "[event name]",
"properties": {
"distinct_id": "[your users' distinct id]",
"key1": "value1",
"key2": "value2"
},
"timestamp": "[optional timestamp in ISO 8601 format]"
}
`,
},
]}
/>
</>
),
},
{
title: 'Person profiles',
badge: 'optional',
content: (
<>
<Markdown>
By default, events are sent with person profile processing enabled. To disable this for specific
events, add the following property:
</Markdown>
<CodeBlock
blocks={[
{
language: 'json',
file: 'JSON',
code: dedent`
{
"api_key": "<ph_project_token>",
"event": "page_viewed",
"properties": {
"distinct_id": "user_123",
"$process_person_profile": false
}
}
`,
},
]}
/>
<CalloutBox type="fyi" title="Learn more">
<Markdown>
Read more about [person profiles](https://posthog.com/docs/data/persons) in our
documentation.
</Markdown>
</CalloutBox>
</>
),
},
]
}
export const APIInstallation = createInstallation(getAPISteps)