Surveys-2

For instructions on how to authenticate to use this endpoint, see API overview.

Endpoints

GET
GET

Retrieve surveys responses count

Get response counts for all surveys.

Args: exclude_archived: Optional boolean to exclude archived responses (default: false, includes archived) survey_ids: Optional comma-separated list of survey IDs to filter by

Returns: Dictionary mapping survey IDs to response counts

Required API key scopes

survey:read

Example request

GET /api/projects/:project_id/surveys/responses_count
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/responses_count/

Example response

Status 200 No response body

Retrieve surveys global stats

Get aggregated response statistics across all surveys.

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)

Returns: Aggregated statistics across all surveys including total counts and rates

Required API key scopes

survey:read

Query parameters

  • date_from
    string
  • date_to
    string

Response


Example request

GET /api/projects/:project_id/surveys/stats
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl \
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/stats/

Example response

Status 200
RESPONSE
{
"stats": {},
"rates": {}
}

Community questions

Questions about this page? or post a community question.