Skip to main content

Surveys - Question Map

Enterprise

This endpoint is part of Countly Enterprise. To get access, contact sales or compare versions. Existing customers can reach the support portal with questions.

Endpoint

/o/surveys/survey/question_map

Overview

Returns survey question schema map by widget ID(s).

Authentication

Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.

Permissions

  • Surveys: Read permission.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApp ID
widget_idsString (JSON Array/String)NoWidget ID list or single ID

Examples

/o/surveys/survey/question_map?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID
/o/surveys/survey/question_map?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&widget_ids=["67b9db56f67aab0012cd8899"]

Response

Success Response

{
"67b9db56f67aab0012cd8899": {
"name": "Product Feedback",
"q1": {
"name": "How can we improve?",
"type": "text"
},
"q2": {
"name": "How satisfied are you?",
"type": "radio",
"choices": {
"1": "Very satisfied",
"2": "Satisfied"
}
}
}
}

Response Fields

FieldTypeDescription
<widgetId>ObjectWidget question mapping
<widgetId>.nameStringWidget name
<widgetId>.<questionId>ObjectQuestion metadata

Error Responses

  • HTTP 500 - Query failure:
{
"result": "Error finding survey widgets"
}

Behavior

  • Reads Survey widgets (type=survey) for the requested app_id.
  • If widget_ids is provided, parses it as JSON. It can be a widget ID string or an array of widget IDs.
  • Invalid widget_ids JSON is logged; the endpoint continues with the base app/type query.
  • Builds a map keyed by widget ID. Each widget entry includes name and one entry per question ID.
  • Each question entry includes question text as name, question type, and optional choices converted from an array into a key-value object.
Implementation details

Database Collections

CollectionUsed forData touched by this endpoint
countly.feedback_widgetsEndpoint data sourceStores endpoint-related records this endpoint reads or modifies.