Skip to main content

Surveys - Edit Survey

Endpoint

/i/surveys/survey/edit

Enterprise Only
This API is available exclusively in Countly Enterprise.

Overview

Updates an existing Survey widget.

Authentication

Authentication methods:

  • API Key (parameter): api_key=YOUR_API_KEY
  • Auth Token (parameter): auth_token=YOUR_AUTH_TOKEN
  • Auth Token (header): countly-token: YOUR_AUTH_TOKEN

Permissions

  • Surveys: Update permission.

Request Parameters

ParameterTypeRequiredDescription
api_keyStringYes (or auth_token)API key authentication
auth_tokenStringYes (or api_key)Auth token authentication
app_idStringYesApp ID
widget_idStringYesWidget ID
questionsString (JSON Array)YesSurvey questions
msgString (JSON Object)NoMessage config
appearanceString (JSON Object)NoAppearance config
statusBoolean/StringNoActive status

Response

Success Response

{
"result": "Success"
}

Response Fields

FieldTypeDescription
resultStringUpdate status

Error Responses

  • HTTP 400 - Invalid parameters:
{
"result": "Invalid params: ..."
}
  • HTTP 404 - Unknown widget:
{
"result": "Widget not found"
}

Behavior/Processing

  • Parses and preprocesses widget properties such as msg, appearance, targeting, and questions.
  • Survey edits require questions; missing questions return Missing params: 'questions'.
  • Validates question definitions before updating; invalid question structure returns Error in param 'questions'.
  • Updates feedback_widgets by widget_id. Appearance fields are stored under appearance.<field>.
  • If delete_logo is set and no new logo file is uploaded, deletes the stored logo and clears appearance.logo.
  • If targeting changes, updates, creates, or deletes the linked cohort and recalculates cohort steps when needed.
  • Returns Success after widget/cohort updates, or specific cohort/upload error messages when follow-up work fails.
  • Emits surveys_widget_edited and, when applicable, cohort_edited system log actions.

Database Collections

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

Examples

/i/surveys/survey/edit?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&widget_id=67b9db56f67aab0012cd8899&name=Product Feedback v2&questions=[{"id":"q1","type":"text","question":"How can we improve next?","required":false}]

Ⓔ Enterprise

This feature is part of Countly Enterprise.

Get Access:

Already a Customer? Use support portal if you have any questions.


Last Updated

2026-04-18