surveys

Get survey response statistics for a specific survey.

Args: date_from: Optional ISO timestamp for start date (e.g. 2024-01-01T00:00:00Z) date_to: Optional ISO timestamp for end date (e.g. 2024-01-31T23:59:59Z) exclude_archived: Optional boolean to exclude archived responses (default: false, includes archived) include_per_question_stats: Optional boolean to include per-question response counts and distributions

Returns: Survey statistics including event counts, unique respondents, and conversion rates

get/api/projects/{project_id}/surveys/{id}/stats/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/surveys/{id}/stats/
  • Auth: HTTP bearer

Path parameters

idstring uuid required

A UUID string identifying this survey.

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/.

Query parameters

date_fromstring date-time

Optional ISO timestamp for start date (e.g. 2024-01-01T00:00:00Z)

date_tostring date-time

Optional ISO timestamp for end date (e.g. 2024-01-31T23:59:59Z)

include_per_question_statsboolean

When true, also return per-question response counts and answer distributions. Adds one extra HogQL query per question, so leave off unless you need the breakdown.

Response

survey_idstring required

The survey ID these stats belong to.

start_datestring date-time nullable required

When the survey started collecting responses.

end_datestring date-time nullable required

When the survey stopped collecting responses.

statsobject required

Event counts keyed by event name (survey shown, survey dismissed, survey sent).

ratesobject required

Calculated response and dismissal rates.

Changes

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