Surveys: insert

Requires authorization

Creates a survey. Try it now.

Request

HTTP request

POST https://www.googleapis.com/surveys/v2/surveys

Authorization

This request requires authorization with at least one of the following scopes (read more about authentication and authorization).

Scope
https://www.googleapis.com/auth/userinfo.email
https://www.googleapis.com/auth/surveys

Request body

In the request body, supply a Surveys resource with the following properties:

Property name Value Description Notes
Required Properties
audience.country string Required country code that surveys should be targeted to. Accepts standard ISO 3166-1 2 character language codes. For instance, 'US' for the United States, and 'GB' for the United Kingdom. writable
audience.languages[] list Language code that surveys should be targeted to. For instance, 'en-US'. Surveys may target bilingual users by specifying a list of language codes (for example, 'de' and 'en-US'). In that case, all languages will be used for targeting users but the survey content (which is displayed) must match the first language listed. Accepts standard BCP47 language codes. See specification. writable
owners[] list List of email addresses for survey owners. Must contain at least the address of the user making the API call. writable
questions[] list List of questions defining the survey. writable
questions[].type string Required field defining the question type. For details about configuring different type of questions, consult the question configuration guide.

Acceptable values are:
  • "largeImageChoice"
  • "menuWithImage"
  • "multipleAnswers"
  • "multipleAnswersWithImage"
  • "numericOpenEnded"
  • "openEnded"
  • "openEndedWithImage"
  • "ratingScale"
  • "ratingScaleWithImage"
  • "ratingScaleWithText"
  • "sideBySideImages"
  • "singleAnswer"
  • "singleAnswerWithImage"
  • "video"
writable
Optional Properties
audience nested object Targeting-criteria message containing demographic information writable
audience.ages[] list Optional list of age buckets to target. Supported age buckets are: ['18-24', '25-34', '35-44', '45-54', '55-64', '65+'] writable
audience.countrySubdivision string Country subdivision (states/provinces/etc) that surveys should be targeted to. For all countries except GB, ISO-3166-2 subdivision code is required (eg. 'US-OH' for Ohio, United States). For GB, NUTS 1 statistical region codes for the United Kingdom is required (eg. 'UK-UKC' for North East England). writable
audience.gender string Optional gender to target.

Acceptable values are:
  • "female"
  • "male"
writable
audience.mobileAppPanelId string Key for predefined panel that causes survey to be sent to a predefined set of Opinion Rewards App users. You must set PopulationSource to ANDROID_APP_PANEL to use this field. writable
audience.populationSource string Online population source where the respondents are sampled from.

Acceptable values are:
  • "androidAppPanel"
  • "general"
writable
customerData bytes Additional information to store on behalf of the API consumer and associate with this question. This binary blob is treated as opaque. This field is limited to 64K bytes. writable
description string Text description of the survey. writable
questions[].answerOrder string The randomization option for multiple choice and multi-select questions. If not specified, this option defaults to randomize.

Acceptable values are:
  • "randomize"
  • "randomlyReverse"
  • "sorted"
writable
questions[].answers[] list Required list of answer options for a question. writable
questions[].hasOther boolean Option to allow open-ended text box for Single Answer and Multiple Answer question types. This can be used with SINGLE_ANSWER, SINGLE_ANSWER_WITH_IMAGE, MULTIPLE_ANSWERS, and MULTIPLE_ANSWERS_WITH_IMAGE question types. writable
questions[].highValueLabel string For rating questions, the text for the higher end of the scale, such as 'Best'. For numeric questions, a string representing a floating-point that is the maximum allowed number for a response. writable
questions[].images[].altText string The alt text property used in image tags is required for all images. writable
questions[].images[].data bytes Inline jpeg, gif, tiff, bmp, or png image raw bytes for an image question types. writable
questions[].lastAnswerPositionPinned boolean Currently only support pinning an answer option to the last position. writable
questions[].lowValueLabel string For rating questions, the text for the lower end of the scale, such as 'Worst'. For numeric questions, a string representing a floating-point that is the minimum allowed number for a response. writable
questions[].numStars string Number of stars to use for ratings questions.

Acceptable values are:
  • "eleven"
  • "five"
  • "seven"
  • "ten"
writable
questions[].openTextPlaceholder string Placeholder text for an open text question. writable
questions[].openTextSuggestions[] list A list of suggested answers for open text question auto-complete. This is only valid if single_line_response is true. writable
questions[].question string Required question text shown to the respondent. writable
questions[].sentimentText string Used by the Rating Scale with Text question type. This text goes along with the question field that is presented to the respondent, and is the actual text that the respondent is asked to rate. writable
questions[].singleLineResponse boolean Option to allow multiple line open text responses instead of a single line response. Note that we don't show auto-complete suggestions with multiple line responses. writable
questions[].thresholdAnswers[] list The threshold/screener answer options, which will screen a user into the rest of the survey. These will be a subset of the answer option strings. writable
questions[].unitOfMeasurementLabel string Optional unit of measurement for display (for example: hours, people, miles). writable
questions[].videoId string The YouTube video ID to be show in video questions. writable
title string Optional name that will be given to the survey. writable
wantedResponseCount integer Number of responses desired for the survey. writable

Response

If successful, this method returns a Surveys resource in the response body.

Try it!

Use the APIs Explorer below to call this method on live data and see the response.

Send feedback about...

Google Surveys
Google Surveys