POST: https://{{env}}.survey2connect.com/v2/api/surveys
The value of environment {{env}} variable depends upon your datacenter. Refer to the Environment page for more details.
"Content-Type": "application/json"
type: Api Key Key: x-api-key token: value from portal
Request Body
{ "title": "b", "brandType": "cx" }
Supported Request Payload
Field | Type | Mandatory | Description |
brandType | string | No |
Brandtype of the survey:
1. cx
2. mx
|
title | string | Yes |
Title of the survey
|
Request Sample
curl --location --request POST 'https://az1.survey2connect.com/v2/api/surveys/create' \
--header 'Authorization: Bearer eyJraWQiOiJzM3E1OWF2cFdIcXVKa0I0MjRpcFpqQVN0dXAzQzFkZEhVM3k2TjNZSXRjPSIsImFs' \
--header 'Content-Type: application/json' \
--header 'Content-Type: application/json' \
--data-raw '{
"title": "b",
"brandType": "cx"
}'
var myHeaders = new Headers(); myHeaders.append("Authorization", "Bearer eyJraWQiOiJzM3E1OWF2cFdIcXVKa0I0MjRpcFpqQVN0dXAzQzFkZEhVM3k2TjNZSXRjPSIsImFs”); myHeaders.append("Content-Type", "application/json"); var raw = JSON.stringify({ { "title": "b", "brandType": "cx" } }); var requestOptions = { method: 'POST', headers: myHeaders, body: raw, redirect: 'follow' }; fetch("https://az1.survey2connect.com/v2/api/surveys", requestOptions) .then(response => response.text()) .then(result => console.log(result)) .catch(error => console.log('error', error));
Responses
{ "data": { "settings": { "question_settings": { "single_ques_focus_desktop": 1, "single_ques_focus_tab_mobile": 1, "show_ques_prog_mob_tab": 1, "show_ques_num": 1, "show_ques_symbol": 1 }, "page_settings": { "show_title": 1, "show_page_number": 0, "show_exit": 0, "show_prog": { "has_prog": 0, "position": 0, "format": { "show_pages": 1 } }, "show_page_title": 1, "required": 1 }, "button_settings": { "auto_transition": 1, "show_next_button": 0, "show_prev_button": 0, "show_done_button": 0, "show_nav_buttons": 1 }, "other_settings": { "survey_title_on_lang_selection": 0, "disable_resp_edata": 0, "track_location": 0, "collect_over_mobile": 0, "theme_for_offline_app": 0, "survey_level_audio_recoding": false }, "buttons_text": { "done_button": "Done", "previous_button": "Prev", "ok_button": "Ok", "next_button": "Next", "exit_button": "Exit", "end_button": "Submit" } }, "title": "b", "take_title": "b", "project_id": "S100020108", "default_lang": { "theme": { "id": "612e5ad781986d80b58fbafe" }, "name": "English", "direction": "ltr", "langKey": "eng_us" }, "version": 0, "language": [], "category": "banking", "intro_page": { "title": "", "description": "Hello,\n\n In our continuous efforts to provide you with the best possible service, we would like to understand your feedback. Please take out approximately 2 minutes of your time to complete the survey.\n\n Start the survey by clicking the button below." }, "modified": "Wed Jul 05 2023 16:39:58", "created": "Wed Jul 05 2023 16:39:57", "favourite": 0, "survey_finish": { "disqualification_page": { "type": 0, "message": "Oops! You have been disqualified due to logic restrictions!", "url": "https://thankyou.survey2connect.com/", "keyMapping": [] }, "disqualification_page_quota": { "type": 0, "message": "Oops! You have been disqualified due to quota restrictions!", "url": "https://thankyou.survey2connect.com/", "keyMapping": [] }, "end_page": { "type": 1, "url": "https://thankyou.survey2connect.com/", "keyMapping": [] }, "exit_page": { "url": "https://thankyou.survey2connect.com/", "keyMapping": [] }, "quota_page": { "type": 1, "message": "Quota Full! This survey is currently closed.", "url": "https://thankyou.survey2connect.com/", "keyMapping": [] } }, "_id": "64a54f8502dabe1a7cce5e7c" } }
{ "error": { "name": "Unauthorized", "message": "The authorization token was not provided." } }
{ "error": { "name": "Internal Server Error", "message": "We were not able to process your request" } }
Note: Please do not share your tokens in publicly accessible areas or to anyone. Also, this token generated is valid for 24 hours only. After its expiry, you can regenerate the access token from the same API endpoint by passing the username and password or from the refresh token API with the help of refresh token.