Overview
Endpoints enable you to create predefined queries from PostHog insights or SQL queries and expose them as API endpoints. You can use endpoints to:
- Build embedded analytics. Show analytics to your customers in your own application.
- Data on your landing page. Expose live metrics on your landing page in minutes.
- Pull aggregated PostHog data into your app. Use PostHog data to create feeds with top content, recommended items or more.
- Integrate your users' behavior data in internal tools. Make a simple API call from your Retool app and show your users' behavior data right next to your admin tools.
Endpoints offers a number of advantages over our query API, such as improved performance, more control and better developer experience.


How endpoints work
Endpoints follow a simple workflow:
- Define your data Create an insight or SQL query in PostHog that returns the data you want to expose.
- Create an endpoint from that insight or query and get back a URL to retrieve your data.
- Retrieve the data via a simple API endpoint with improved performance and higher rate limits.
Endpoints vs Query API?
You should use endpoints when you need:
- Better performance: We can make them run faster when we know the query in advance.
- Higher rate limits: More requests per minute/hour than standard API queries
- Stable URLs: Consistent endpoint names that don't change
If you need to run ad-hoc queries or don't have predefined queries, API queries may be a better fit, but it will come at a cost.
