Skip to main content

Surveys - Delete Survey

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/survey/delete

Overview

Deletes a Survey widget. Optionally removes linked response data.

Authentication

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

Permissions

  • Surveys: Delete 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
with_dataBoolean/StringNoAlso remove widget response data

Examples

/i/surveys/survey/delete?api_key=YOUR_API_KEY&app_id=YOUR_APP_ID&widget_id=67b9db56f67aab0012cd8899

Response

Success Response

{
"result": "Success"
}

Response Fields

FieldTypeDescription
resultStringDelete status

Error Responses

  • HTTP 404 - Widget not found:
{
"result": "Widget not found"
}

Behavior

  • Loads the widget from feedback_widgets by widget_id; missing widgets return Widget not found.
  • Deletes the widget logo file when appearance.logo is set.
  • Removes the widget document from feedback_widgets.
  • Deletes the linked cohort when cohortID exists.
  • If with_data is set, also removes related widget response/aggregate data; success emits surveys_removed_with_data.
  • Without with_data, only the widget record is removed; success emits surveys_widget_removed.
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.
countly_drill.drill_eventsDrill event recordsStores granular event rows queried or updated by this endpoint.