surveys

Mixin for ViewSets to handle approval-gate exceptions raised from decorated serializers.

Intercepts ApprovalRequired (409) and PolicyConflict (400) raised by the @approval_gate decorator on serializer methods and converts them into the same responses the viewset path produces (see decorators._result_to_response), so both paths share one contract.

put/api/projects/{project_id}/surveys/{id}/

Request

  • Base URL: https://us.posthog.com
  • URL: https://us.posthog.com/api/projects/{project_id}/surveys/{id}/
  • 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/.

Request body

idstring uuid required
namestring required

Survey name. Anyone can read it. In-app surveys send it to every visitor's browser alongside the questions and appearance text, and a hosted survey shows it on its public page. Keep customer names and other private details out of it.

descriptionstring

Survey description. Internal only: unlike the name and questions, it is never delivered to visitors.

type'popover' | 'widget' | 'external_survey' | 'api' required
  • popover - popover
  • widget - widget
  • external_survey - external survey
  • api - api
linked_flag_idinteger nullable

The feature flag linked to this survey.

linked_insight_idinteger nullable
targeting_flag_idinteger

An existing targeting flag to use for this survey.

remove_targeting_flagboolean nullable

Set to true to completely remove all targeting filters from the survey, making it visible to all users (subject to other display conditions like URL matching).

created_atstring date-time required
start_datestring date-time nullable

Setting this will launch the survey immediately. Don't add a start_date unless explicitly requested to do so.

end_datestring date-time nullable

When the survey stopped being shown to users. Setting this will complete the survey.

archivedboolean

Archive state for the survey.

responses_limitinteger nullable

The maximum number of responses before automatically stopping the survey.

iteration_countinteger nullable

For a recurring schedule, this field specifies the number of times the survey should be shown to the user. Use 1 for 'once every X days', higher numbers for multiple repetitions. Works together with iteration_frequency_days to determine the overall survey schedule.

iteration_frequency_daysinteger nullable

For a recurring schedule, this field specifies the interval in days between each survey instance shown to the user, used alongside iteration_count for precise scheduling.

iteration_start_datesstring[] nullable
current_iterationinteger nullable
current_iteration_start_datestring date-time nullable
response_sampling_start_datestring date-time nullable
response_sampling_intervalinteger nullable
response_sampling_limitinteger nullable
response_sampling_daily_limitsunknown
enable_partial_responsesboolean nullable

When at least one question is answered, the response is stored (true). The response is stored when all questions are answered (false).

enable_iframe_embeddingboolean nullable
base_languagestring

BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in translations.

translationsunknown
_create_in_folderstring
form_contentunknown

Response

idstring uuid required
namestring required
descriptionstring
type'popover' | 'widget' | 'external_survey' | 'api' required
  • popover - popover
  • widget - widget
  • external_survey - external survey
  • api - api
schedulestring nullable
linked_flag_idinteger nullable
linked_insight_idinteger nullable
targeting_flag_idinteger
targeting_flag_filtersunknown
remove_targeting_flagboolean nullable
questionsunknown
conditionsunknown
appearanceunknown
created_atstring date-time required
start_datestring date-time nullable
end_datestring date-time nullable
archivedboolean
responses_limitinteger nullable
iteration_countinteger nullable
iteration_frequency_daysinteger nullable
iteration_start_datesstring[] nullable
current_iterationinteger nullable
current_iteration_start_datestring date-time nullable
response_sampling_start_datestring date-time nullable
response_sampling_intervalinteger nullable
response_sampling_limitinteger nullable
response_sampling_daily_limitsunknown
enable_partial_responsesboolean nullable
enable_iframe_embeddingboolean nullable
base_languagestring

BCP-47 language code (e.g. 'en', 'es', 'es-MX') describing the language of the survey's untranslated text. Defaults to 'en'. Cannot also appear as a key in translations.

translationsunknown
_create_in_folderstring
form_contentunknown

Changes

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