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:
Deletepermission.
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
api_key | String | Yes (or auth_token) | API key authentication |
auth_token | String | Yes (or api_key) | Auth token authentication |
app_id | String | Yes | App ID |
widget_id | String | Yes | Widget ID |
with_data | Boolean/String | No | Also 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
| Field | Type | Description |
|---|---|---|
result | String | Delete status |
Error Responses
- HTTP 404 - Widget not found:
{
"result": "Widget not found"
}
Behavior
- Loads the widget from
feedback_widgetsbywidget_id; missing widgets returnWidget not found. - Deletes the widget logo file when
appearance.logois set. - Removes the widget document from
feedback_widgets. - Deletes the linked cohort when
cohortIDexists. - If
with_datais set, also removes related widget response/aggregate data; success emitssurveys_removed_with_data. - Without
with_data, only the widget record is removed; success emitssurveys_widget_removed.
Related Endpoints
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly.feedback_widgets | Endpoint data source | Stores endpoint-related records this endpoint reads or modifies. |
countly.cohorts | Endpoint data source | Stores endpoint-related records this endpoint reads or modifies. |
countly_drill.drill_events | Drill event records | Stores granular event rows queried or updated by this endpoint. |