Survey
For instructions on how to authenticate to use this endpoint, see API overview.
Endpoints
GET | |
POST | |
GET | |
PATCH | |
DELETE | |
GET | |
GET | |
POST | |
POST | |
POST | |
GET | |
POST | |
POST | |
GET | |
POST | |
POST | |
POST | |
GET | |
GET |
List all surveys
Also available via the PostHog MCP server:
surveys-get-all— List surveys in the project (server-side search + filters).
Required API key scopes
survey:readQuery parameters
- archivedboolean
- idsarray
- limitinteger
- offsetinteger
- searchstring
- typestringOne of:
"api""external_survey""popover""widget"
Response
Example request
GET /api /projects /:project_id /surveysExample response
Status 200
Create surveys
Required API key scopes
survey:writeRequest parameters
- namestring
- descriptionstring
- type
- schedule
- linked_flag_idintegernull
- linked_insight_idintegernull
- targeting_flag_idinteger
- targeting_flag_filters
- remove_targeting_flagbooleannull
- questionsarraynull
- conditions
- appearance
- start_datestringnull
- end_datestringnull
- archivedboolean
- responses_limitintegernull
- iteration_countintegernull
- iteration_frequency_daysintegernull
- iteration_start_datesarraynull
- current_iterationintegernull
- current_iteration_start_datestringnull
- response_sampling_start_datestringnull
- response_sampling_interval_type
- response_sampling_intervalintegernull
- response_sampling_limitintegernull
- response_sampling_daily_limits
- enable_partial_responsesbooleannull
- enable_iframe_embeddingbooleannull
- base_languagestring
- translations
- _create_in_folderstring
- form_content
Response
Example request
POST /api /projects /:project_id /surveysExample response
Status 201
Retrieve surveys
Required API key scopes
survey:readPath parameters
- idstring
Response
Example request
GET /api /projects /:project_id /surveys /:idExample response
Status 200
Update surveys
Required API key scopes
survey:writePath parameters
- idstring
Request parameters
- namestring
- descriptionstring
- type
- schedule
- linked_flag_idintegernull
- linked_insight_idintegernull
- targeting_flag_idinteger
- targeting_flag_filters
- remove_targeting_flagbooleannull
- questionsarraynull
- conditions
- appearance
- start_datestringnull
- end_datestringnull
- archivedboolean
- responses_limitintegernull
- iteration_countintegernull
- iteration_frequency_daysintegernull
- iteration_start_datesarraynull
- current_iterationintegernull
- current_iteration_start_datestringnull
- response_sampling_start_datestringnull
- response_sampling_interval_type
- response_sampling_intervalintegernull
- response_sampling_limitintegernull
- response_sampling_daily_limits
- enable_partial_responsesbooleannull
- enable_iframe_embeddingbooleannull
- base_languagestring
- translations
- _create_in_folderstring
- form_content
Response
Example request
PATCH /api /projects /:project_id /surveys /:idExample response
Status 200
Delete surveys
Required API key scopes
survey:writePath parameters
- idstring
Example request
DELETE /api /projects /:project_id /surveys /:idExample response
Status 204 No response body
Retrieve surveys activity
Required API key scopes
activity_log:readPath parameters
- idstring
Example request
GET /api /projects /:project_id /surveys /:id /activityExample response
Status 200 No response body
Retrieve surveys archived response uuids
Get list of archived response UUIDs for HogQL filtering.
Returns list of UUIDs that the frontend can use to filter out archived responses in HogQL queries.
Required API key scopes
survey:readPath parameters
- idstring
Example request
GET /api /projects /:project_id /surveys /:id /archived-response-uuidsExample response
Status 200 No response body
Create surveys duplicate to projects
Duplicate a survey to multiple projects in a single transaction.
Accepts a list of target team IDs and creates a copy of the survey in each project. Uses an all-or-nothing approach - if any duplication fails, all changes are rolled back.
Required API key scopes
survey:writePath parameters
- idstring
Request parameters
- namestring
- descriptionstring
- type
- schedulestringnull
- linked_flag_idintegernull
- linked_insight_idintegernull
- targeting_flag_idinteger
- targeting_flag_filters
- remove_targeting_flagbooleannull
- questions
- conditions
- appearance
- start_datestringnull
- end_datestringnull
- archivedboolean
- responses_limitintegernull
- iteration_countintegernull
- iteration_frequency_daysintegernull
- iteration_start_datesarraynull
- current_iterationintegernull
- current_iteration_start_datestringnull
- response_sampling_start_datestringnull
- response_sampling_interval_type
- response_sampling_intervalintegernull
- response_sampling_limitintegernull
- response_sampling_daily_limits
- enable_partial_responsesbooleannull
- enable_iframe_embeddingbooleannull
- base_languagestring
- translations
- _create_in_folderstring
- form_content
Example request
POST /api /projects /:project_id /surveys /:id /duplicate_to_projectsExample response
Status 200 No response body
Create surveys generate translations
Required API key scopes
survey:writePath parameters
- idstring
Request parameters
- target_languagestring
- source_languagestring
- overwritebooleanDefault:
false - surveyobject
Response
Example request
POST /api /projects /:project_id /surveys /:id /generate_translationsExample response
Status 200
Create surveys
Launch a survey by setting start_date to the current time. No-op if the survey is already launched (start_date set in the past) — returns the existing state unchanged. Does not affect archived surveys or surveys with an end_date in the past; unarchive or extend the end_date first.
Required API key scopes
survey:writePath parameters
- idstring
Response
Example request
POST /api /projects /:project_id /surveys /:id /launchExample response
Status 200
List all surveys responses
List survey responses for a specific survey, with question text resolved server-side so callers do not have to map opaque $survey_response_<id> keys. Each row carries distinct_id, session_id, submitted_at, and an extra block (device, browser, OS, geoip, current_url, iteration) so agents can cross-pivot to recordings, persons, or paths in a single follow-up call. For person properties at event time, follow up with persons-get using the returned distinct_id — keeps scopes scoped. Use question_id + score_lte to fetch NPS detractors and similar score-filtered cohorts.
Required API key scopes
survey:readquery:readPath parameters
- idstring
Query parameters
- exclude_archivedbooleanDefault:
false - limitintegerDefault:
100 - offsetintegerDefault:
0 - question_idstring
- score_gtenumber
- score_ltenumber
- sincestring
- untilstring
Response
Example request
GET /api /projects /:project_id /surveys /:id /responsesExample response
Status 200
Create surveys responses archive
Archive a single survey response.
Required API key scopes
survey:writePath parameters
- idstring
- response_uuidstring
Request parameters
- namestring
- descriptionstring
- type
- schedulestringnull
- linked_flag_idintegernull
- linked_insight_idintegernull
- targeting_flag_idinteger
- targeting_flag_filters
- remove_targeting_flagbooleannull
- questions
- conditions
- appearance
- start_datestringnull
- end_datestringnull
- archivedboolean
- responses_limitintegernull
- iteration_countintegernull
- iteration_frequency_daysintegernull
- iteration_start_datesarraynull
- current_iterationintegernull
- current_iteration_start_datestringnull
- response_sampling_start_datestringnull
- response_sampling_interval_type
- response_sampling_intervalintegernull
- response_sampling_limitintegernull
- response_sampling_daily_limits
- enable_partial_responsesbooleannull
- enable_iframe_embeddingbooleannull
- base_languagestring
- translations
- _create_in_folderstring
- form_content
Example request
POST /api /projects /:project_id /surveys /:id /responses /:response_uuid /archiveExample response
Status 200 No response body
Create surveys responses unarchive
Unarchive a single survey response.
Required API key scopes
survey:writePath parameters
- idstring
- response_uuidstring
Request parameters
- namestring
- descriptionstring
- type
- schedulestringnull
- linked_flag_idintegernull
- linked_insight_idintegernull
- targeting_flag_idinteger
- targeting_flag_filters
- remove_targeting_flagbooleannull
- questions
- conditions
- appearance
- start_datestringnull
- end_datestringnull
- archivedboolean
- responses_limitintegernull
- iteration_countintegernull
- iteration_frequency_daysintegernull
- iteration_start_datesarraynull
- current_iterationintegernull
- current_iteration_start_datestringnull
- response_sampling_start_datestringnull
- response_sampling_interval_type
- response_sampling_intervalintegernull
- response_sampling_limitintegernull
- response_sampling_daily_limits
- enable_partial_responsesbooleannull
- enable_iframe_embeddingbooleannull
- base_languagestring
- translations
- _create_in_folderstring
- form_content
Example request
POST /api /projects /:project_id /surveys /:id /responses /:response_uuid /unarchiveExample response
Status 200 No response body
Retrieve surveys stats
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
Required API key scopes
survey:readPath parameters
- idstring
Query parameters
- date_fromstring
- date_tostring
- include_per_question_statsboolean
Response
Example request
GET /api /projects /:project_id /surveys /:id /statsExample response
Status 200
Create surveys
Stop a survey by setting end_date to the current time. No new responses are accepted after this; existing responses remain available. No-op if the survey already has an end_date in the past.
Required API key scopes
survey:writePath parameters
- idstring
Response
Example request
POST /api /projects /:project_id /surveys /:id /stopExample response
Status 200
Create surveys summarize responses
Summarize survey responses. When question_index or question_id is provided, returns a per-question theme summary using cached survey.question_summaries when fresh. When neither is provided, returns the survey-wide headline summary (delegates to summary_headline). Pass force_refresh=true in the body to bypass caches.
Required API key scopes
survey:readPath parameters
- idstring
Query parameters
- question_idstring
- question_indexinteger
Request parameters
- force_refreshbooleanDefault:
false
Example request
POST /api /projects /:project_id /surveys /:id /summarize_responsesExample response
Status 200 No response body
Create surveys summary headline
Required API key scopes
survey:readPath parameters
- idstring
Request parameters
- namestring
- descriptionstring
- type
- schedulestringnull
- linked_flag_idintegernull
- linked_insight_idintegernull
- targeting_flag_idinteger
- targeting_flag_filters
- remove_targeting_flagbooleannull
- questions
- conditions
- appearance
- start_datestringnull
- end_datestringnull
- archivedboolean
- responses_limitintegernull
- iteration_countintegernull
- iteration_frequency_daysintegernull
- iteration_start_datesarraynull
- current_iterationintegernull
- current_iteration_start_datestringnull
- response_sampling_start_datestringnull
- response_sampling_interval_type
- response_sampling_intervalintegernull
- response_sampling_limitintegernull
- response_sampling_daily_limits
- enable_partial_responsesbooleannull
- enable_iframe_embeddingbooleannull
- base_languagestring
- translations
- _create_in_folderstring
- form_content
Example request
POST /api /projects /:project_id /surveys /:id /summary_headlineExample response
Status 200 No response body
Retrieve surveys all activity
Required API key scopes
activity_log:readExample request
GET /api /projects /:project_id /surveys /activityExample response
Status 200 No response body
Retrieve surveys question
Return a slim list of question labels for the team's surveys. Used by the frontend to resolve $survey_response_<question_id> property keys into human-readable question text without loading the full survey payload.
Required API key scopes
survey:readResponse
Example request
GET /api /projects /:project_id /surveys /question_labels