Skip to main content
PostHog provides a comprehensive REST API for programmatic access to your product analytics data, user management, feature flags, and more.

Base URLs

PostHog Cloud is available in two regions. Use the base URL that matches your deployment:
All API requests must use HTTPS. HTTP requests will be rejected.

Response format

The API returns JSON-formatted responses. Successful requests return a 200 status code along with the requested data.

Success response

Error response

Errors return appropriate HTTP status codes with details:

Common status codes

Pagination

List endpoints return paginated results. The response includes pagination metadata:
Use the offset and limit query parameters to navigate:

Making your first request

Here’s a simple example to list your projects:
Replace YOUR_API_KEY with your actual personal API key. Never commit API keys to version control.

API endpoint structure

API endpoints follow a consistent pattern:
For example:
  • /api/projects/123/insights/ - List insights for project 123
  • /api/projects/123/feature_flags/ - List feature flags for project 123
  • /api/projects/123/events/ - Query events for project 123
Some endpoints are scoped to your organization:

Next steps

Authentication

Learn how to create and use personal API keys

Rate limits

Understand rate limiting and best practices