3.3 KiB
3.3 KiB
PostHog Routing Reference
App name: posthog
Base URL proxied: {subdomain}.posthog.com
API Path Pattern
/posthog/api/{resource}
/posthog/api/projects/{project_id}/{resource}
Common Endpoints
Get Current User
GET /posthog/api/users/@me/
Get Current Organization
GET /posthog/api/organizations/@current/
List Projects
GET /posthog/api/projects/
Get Current Project
GET /posthog/api/projects/@current/
Run HogQL Query
POST /posthog/api/projects/{project_id}/query/
Content-Type: application/json
{
"query": {
"kind": "HogQLQuery",
"query": "SELECT event, count() FROM events GROUP BY event LIMIT 10"
}
}
List Persons
GET /posthog/api/projects/{project_id}/persons/?limit=10
Get Person
GET /posthog/api/projects/{project_id}/persons/{person_uuid}/
List Dashboards
GET /posthog/api/projects/{project_id}/dashboards/
Get Dashboard
GET /posthog/api/projects/{project_id}/dashboards/{dashboard_id}/
Create Dashboard
POST /posthog/api/projects/{project_id}/dashboards/
Content-Type: application/json
{
"name": "My Dashboard",
"description": "Analytics overview"
}
List Insights
GET /posthog/api/projects/{project_id}/insights/?limit=10
List Feature Flags
GET /posthog/api/projects/{project_id}/feature_flags/
Create Feature Flag
POST /posthog/api/projects/{project_id}/feature_flags/
Content-Type: application/json
{
"key": "my-feature-flag",
"name": "My Feature Flag",
"active": true,
"filters": {
"groups": [{"rollout_percentage": 100}]
}
}
Delete Feature Flag
Use soft delete by setting deleted: true:
PATCH /posthog/api/projects/{project_id}/feature_flags/{flag_id}/
Content-Type: application/json
{
"deleted": true
}
List Session Recordings
GET /posthog/api/projects/{project_id}/session_recordings/?limit=10
List Cohorts
GET /posthog/api/projects/{project_id}/cohorts/
List Actions
GET /posthog/api/projects/{project_id}/actions/
List Experiments
GET /posthog/api/projects/{project_id}/experiments/
List Surveys
GET /posthog/api/projects/{project_id}/surveys/
List Event Definitions
GET /posthog/api/projects/{project_id}/event_definitions/?limit=10
List Property Definitions
GET /posthog/api/projects/{project_id}/property_definitions/?limit=10
Notes
- Use
@currentas a shortcut for the current project ID (e.g.,/api/projects/@current/dashboards/) - Project IDs are integers (e.g.,
136209) - Person UUIDs are in standard UUID format
- The Events endpoint is deprecated; use the Query endpoint with HogQL instead
- All project-scoped endpoints require
{project_id}or@current - Pagination uses
limitandoffsetquery parameters - PostHog uses soft delete: use
PATCHwith{"deleted": true}instead of HTTP DELETE