Delete asset
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/content/asset-delete
Overview
Deletes an uploaded asset from GridFS storage.
Authentication
Pass api_key or auth_token as a query parameter, or send countly-token as a header. See Authentication.
Permissions
- Required permission:
Deleteon thecontentfeature
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| api_key | String | Yes (or auth_token) | API key for authentication |
| auth_token | String | Yes (or api_key) | Auth token for authentication |
| app_id | String | Yes | Application identifier |
| asset_id | String | Yes | GridFS ObjectID of the asset to delete |
Examples
Example 1: Delete an Asset
/i/content/asset-delete?api_key=YOUR_API_KEY&app_id=5be987d7b93798516eb5289a&asset_id=507f1f77bcf86cd799439011
Response
Success Response
{
"result": "Success"
}
Response Fields
| Field | Type | Description |
|---|---|---|
| result | String | Success confirmation |
Error Responses
| HTTP Status | Response |
|---|---|
| 400 | "Missing asset_id or app_id" |
| 400 | "There is an error while deleting the asset" |
| 400 | "Invalid request" |
Behavior
- Validates request authentication and permissions.
- Verifies
asset_idandapp_idare present. - Deletes the file from GridFS.
- Returns success.
Limitations
- Deletion is permanent.
- This endpoint does not validate whether the asset is still referenced by content blocks.
Related Endpoints
- Assets - Read: List assets
- Assets - Upload: Upload an asset
- Assets - Update: Update asset metadata
Implementation details
Database Collections
| Collection | Used for | Data touched by this endpoint |
|---|---|---|
countly_fs.content_assets{app_id}.files | Endpoint data source | ** - GridFS file metadata (deleted) |
countly_fs.content_assets{app_id}.chunks | Endpoint data source | ** - GridFS binary chunks (deleted) |