Skip to main content

Surveys - Edit NPS

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

/i/surveys/nps/edit

Overview

Updates an existing NPS widget.

Authentication

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

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
msgString (JSON Object)NoNPS message config
appearanceString (JSON Object)NoAppearance config
statusBoolean/StringNoActive status
followUpTypeStringNoFollow-up mode

Examples

/i/surveys/nps/edit?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&widget_id=67b9db56f67aab0012cd8899&name=NPS Q2

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

  • Parses and preprocesses widget properties such as msg, appearance, and targeting.
  • 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.
Implementation details

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.