Delete Uploaded Image (Cloudinary)
Delete Uploaded Image (Cloudinary)
# Delete Uploaded Image (Cloudinary)
Deletes an image stored on Cloudinary using its unique `publicId`. Express 5 wildcard routing supports full multi-segment paths including nested folders (e.g., `drivers/kyc/sample_image`).
---
### Endpoint Overview
- **Method:** `DELETE`
- **Route:** `/api/v1/upload/:publicId` (supports nested folder paths: `/api/v1/upload/{folder}/{image_id}`)
- **Authentication:** `None (Public)`
- **Content-Type:** `N/A`
---
### Path Parameters
| Parameter | Data Type | Required | Description |
| --- | --- | --- | --- |
| `publicId` | `string` | **Yes** | Cloudinary public ID including folder prefix (e.g. `drivers/kyc/drv_dl_sample`) |
#### Example Request URLs
- DELETE {{baseUrl}}/api/v1/upload/drivers/kyc/drv_dl_sample
- DELETE {{baseUrl}}/api/v1/upload/uploads/sample_photo
---
### Request Body Schema
_None (DELETE request)_
---
### Response Body Schema (`200 OK`)
| Top-Level Key | Data Type | Description |
| --- | --- | --- |
| `success` | `boolean` | Indicates whether deletion succeeded (`true`) |
| `message` | `string` | Status message (`"Image deleted successfully"`) |
---
### Response Examples
#### 1\. `200 OK` — Image Deleted Successfully
``` json
{
"success": true,
"message": "Image deleted successfully"
}
```
#### 2\. `404 Not Found` — Image Not Found on Cloudinary
When the specified `publicId` does not exist on Cloudinary:
``` json
{
"success": false,
"error": "Image not found on Cloudinary"
}
```
#### 3\. `400 Bad Request` — Missing `publicId`
``` json
{
"success": false,
"error": "publicId is required"
}
```
#### 4\. `502 Bad Gateway` — Cloudinary Service Error
``` json
{
"success": false,
"error": "Cloudinary service error or network timeout"
}
```
---
### Status Codes Reference
| HTTP Status Code | Condition |
| --- | --- |
| **`200 OK`** | Image successfully removed from Cloudinary storage. |
| **`400 Bad Request`** | Path parameter `publicId` is missing or empty. |
| **`404 Not Found`** | No image found on Cloudinary matching the provided `publicId`. |
| **`502 Bad Gateway`** | Cloudinary API error during deletion. |
Authentication
AuthorizationBearer
Bearer authentication of the form Bearer <token>, where token is your auth token.