endpoints

Execute endpoint with optional materialization. Supports version parameter, runs latest version if not set.

post/api/projects/{project_id}/endpoints/{name}/run/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/endpoints/{name}/run/
  • Auth: HTTP bearer

Path parameters

namestring required

URL-safe name for the endpoint

project_idstring required

Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/.

Request body

client_query_idstring nullable

Client provided query ID. Can be used to retrieve the status or cancel the query.

debugboolean nullable

Whether to include debug information (such as the executed HogQL) in the response.

limitinteger nullable

Maximum number of results to return. If not provided, returns all results.

offsetinteger nullable

Number of results to skip. Must be used together with limit. Only supported for HogQL endpoints.

refresh'cache' | 'force' | 'direct'
variablesobject nullable

Variables to parameterize the endpoint query. The key is the variable name and the value is the variable value.

For HogQL endpoints: Keys must match a variable code_name defined in the query (referenced as {variables.code_name}). Example: {"event_name": "$pageview"}

For non-materialized insight endpoints (e.g. TrendsQuery): - date_from and date_to are built-in variables that filter the date range. Example: {"date_from": "2024-01-01", "date_to": "2024-01-31"}

For materialized insight endpoints: - Use the breakdown property name as the key to filter by breakdown value. Example: {"$browser": "Chrome"} - date_from/date_to are not supported on materialized insight endpoints.

Unknown variable names will return a 400 error.

versioninteger nullable

Specific endpoint version to execute. If not provided, the latest version is used.

Response

namestring required

URL-safe endpoint name that was executed.

execution_idstring uuid

Unique identifier for this execution. Use it to find the matching entry in the endpoint's logs.

columnsstring[]

Column names from the query SELECT clause.

hasMoreboolean

Whether more results are available beyond the limit.

endpoint_versioninteger

Version number of the endpoint that was executed.

Changes

No recorded changes to this operation across all 1 revision of this API.