Surveys-2

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

Endpoints

POST
GET
POST
POST
GET
GET
GET

Create surveys responses unarchive

Required API key scopes

survey:write

Path parameters

  • id
    string
  • project_id
    string
  • response_uuid
    string

Request parameters

  • name
    string
  • description
    string
  • type
  • schedule
    string
  • linked_flag_id
    integer
  • linked_insight_id
    integer
  • targeting_flag_id
    integer
  • targeting_flag_filters
  • remove_targeting_flag
    boolean
  • questions
  • conditions
  • appearance
  • start_date
    string
  • end_date
    string
  • archived
    boolean
  • responses_limit
    integer
  • iteration_count
    integer
  • iteration_frequency_days
    integer
  • iteration_start_dates
    array
  • current_iteration
    integer
  • current_iteration_start_date
    string
  • response_sampling_start_date
    string
  • response_sampling_interval_type
  • response_sampling_interval
    integer
  • response_sampling_limit
    integer
  • response_sampling_daily_limits
  • enable_partial_responses
    boolean
  • _create_in_folder
    string

Example request

POST /api/projects/:project_id/surveys/:id/responses/:response_uuid/unarchive
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/:id/responses/:response_uuid/unarchive/\
-d name="string",\
-d type=undefined

Example response

Status 200 No response body

Create surveys responses unarchive

Required API key scopes

survey:write

Path parameters

  • id
    string
  • project_id
    string
  • response_uuid
    string

Request parameters

  • name
    string
  • description
    string
  • type
  • schedule
    string
  • linked_flag_id
    integer
  • linked_insight_id
    integer
  • targeting_flag_id
    integer
  • targeting_flag_filters
  • remove_targeting_flag
    boolean
  • questions
  • conditions
  • appearance
  • start_date
    string
  • end_date
    string
  • archived
    boolean
  • responses_limit
    integer
  • iteration_count
    integer
  • iteration_frequency_days
    integer
  • iteration_start_dates
    array
  • current_iteration
    integer
  • current_iteration_start_date
    string
  • response_sampling_start_date
    string
  • response_sampling_interval_type
  • response_sampling_interval
    integer
  • response_sampling_limit
    integer
  • response_sampling_daily_limits
  • enable_partial_responses
    boolean
  • _create_in_folder
    string

Example request

POST /api/projects/:project_id/surveys/:id/responses/:response_uuid/unarchive
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/:id/responses/:response_uuid/unarchive/\
-d name="string",\
-d type=undefined

Example response

Status 200 No response body

Retrieve surveys stats retrieve

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)

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

Required API key scopes

survey:read

Path parameters

  • id
    string
  • project_id
    string

Example request

GET /api/projects/:project_id/surveys/:id/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/:id/stats/

Example response

Status 200 No response body

Retrieve surveys stats retrieve

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)

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

Required API key scopes

survey:read

Path parameters

  • id
    string
  • project_id
    string

Example request

GET /api/projects/:project_id/surveys/:id/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/:id/stats/

Example response

Status 200 No response body

Create surveys summarize responses

Required API key scopes

survey:read

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • type
  • schedule
    string
  • linked_flag_id
    integer
  • linked_insight_id
    integer
  • targeting_flag_id
    integer
  • targeting_flag_filters
  • remove_targeting_flag
    boolean
  • questions
  • conditions
  • appearance
  • start_date
    string
  • end_date
    string
  • archived
    boolean
  • responses_limit
    integer
  • iteration_count
    integer
  • iteration_frequency_days
    integer
  • iteration_start_dates
    array
  • current_iteration
    integer
  • current_iteration_start_date
    string
  • response_sampling_start_date
    string
  • response_sampling_interval_type
  • response_sampling_interval
    integer
  • response_sampling_limit
    integer
  • response_sampling_daily_limits
  • enable_partial_responses
    boolean
  • _create_in_folder
    string

Example request

POST /api/projects/:project_id/surveys/:id/summarize_responses
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/:id/summarize_responses/\
-d name="string",\
-d type=undefined

Example response

Status 200 No response body

Create surveys summarize responses

Required API key scopes

survey:read

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • type
  • schedule
    string
  • linked_flag_id
    integer
  • linked_insight_id
    integer
  • targeting_flag_id
    integer
  • targeting_flag_filters
  • remove_targeting_flag
    boolean
  • questions
  • conditions
  • appearance
  • start_date
    string
  • end_date
    string
  • archived
    boolean
  • responses_limit
    integer
  • iteration_count
    integer
  • iteration_frequency_days
    integer
  • iteration_start_dates
    array
  • current_iteration
    integer
  • current_iteration_start_date
    string
  • response_sampling_start_date
    string
  • response_sampling_interval_type
  • response_sampling_interval
    integer
  • response_sampling_limit
    integer
  • response_sampling_daily_limits
  • enable_partial_responses
    boolean
  • _create_in_folder
    string

Example request

POST /api/projects/:project_id/surveys/:id/summarize_responses
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/:id/summarize_responses/\
-d name="string",\
-d type=undefined

Example response

Status 200 No response body

Create surveys summary headline

Required API key scopes

survey:read

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • type
  • schedule
    string
  • linked_flag_id
    integer
  • linked_insight_id
    integer
  • targeting_flag_id
    integer
  • targeting_flag_filters
  • remove_targeting_flag
    boolean
  • questions
  • conditions
  • appearance
  • start_date
    string
  • end_date
    string
  • archived
    boolean
  • responses_limit
    integer
  • iteration_count
    integer
  • iteration_frequency_days
    integer
  • iteration_start_dates
    array
  • current_iteration
    integer
  • current_iteration_start_date
    string
  • response_sampling_start_date
    string
  • response_sampling_interval_type
  • response_sampling_interval
    integer
  • response_sampling_limit
    integer
  • response_sampling_daily_limits
  • enable_partial_responses
    boolean
  • _create_in_folder
    string

Example request

POST /api/projects/:project_id/surveys/:id/summary_headline
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/:id/summary_headline/\
-d name="string",\
-d type=undefined

Example response

Status 200 No response body

Create surveys summary headline

Required API key scopes

survey:read

Path parameters

  • id
    string
  • project_id
    string

Request parameters

  • name
    string
  • description
    string
  • type
  • schedule
    string
  • linked_flag_id
    integer
  • linked_insight_id
    integer
  • targeting_flag_id
    integer
  • targeting_flag_filters
  • remove_targeting_flag
    boolean
  • questions
  • conditions
  • appearance
  • start_date
    string
  • end_date
    string
  • archived
    boolean
  • responses_limit
    integer
  • iteration_count
    integer
  • iteration_frequency_days
    integer
  • iteration_start_dates
    array
  • current_iteration
    integer
  • current_iteration_start_date
    string
  • response_sampling_start_date
    string
  • response_sampling_interval_type
  • response_sampling_interval
    integer
  • response_sampling_limit
    integer
  • response_sampling_daily_limits
  • enable_partial_responses
    boolean
  • _create_in_folder
    string

Example request

POST /api/projects/:project_id/surveys/:id/summary_headline
export POSTHOG_PERSONAL_API_KEY=[your personal api key]
curl
-H 'Content-Type: application/json'\
-H "Authorization: Bearer $POSTHOG_PERSONAL_API_KEY" \
<ph_app_host>/api/projects/:project_id/surveys/:id/summary_headline/\
-d name="string",\
-d type=undefined

Example response

Status 200 No response body

Retrieve surveys activity

Required API key scopes

activity_log:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/surveys/activity
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/activity/

Example response

Status 200 No response body

Retrieve surveys activity

Required API key scopes

activity_log:read

Path parameters

  • project_id
    string

Example request

GET /api/projects/:project_id/surveys/activity
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/activity/

Example response

Status 200 No response body

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

Path parameters

  • project_id
    string

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

Path parameters

  • project_id
    string

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

Path parameters

  • project_id
    string

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 No response body

Retrieve surveys 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

Path parameters

  • project_id
    string

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 No response body

Community questions

Questions about this page? or post a community question.