Skip to navigation

Delete Uploaded Image (Cloudinary)

View as Markdown

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

ParameterData TypeRequiredDescription
publicIdstringYesCloudinary 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 KeyData TypeDescription
successbooleanIndicates whether deletion succeeded (true)
messagestringStatus message ("Image deleted successfully")

Response Examples

1. 200 OK — Image Deleted Successfully

{
"success": true,
"message": "Image deleted successfully"
}

2. 404 Not Found — Image Not Found on Cloudinary

When the specified publicId does not exist on Cloudinary:

{
"success": false,
"error": "Image not found on Cloudinary"
}

3. 400 Bad Request — Missing publicId

{
"success": false,
"error": "publicId is required"
}

4. 502 Bad Gateway — Cloudinary Service Error

{
"success": false,
"error": "Cloudinary service error or network timeout"
}

Status Codes Reference

HTTP Status CodeCondition
200 OKImage successfully removed from Cloudinary storage.
400 Bad RequestPath parameter publicId is missing or empty.
404 Not FoundNo image found on Cloudinary matching the provided publicId.
502 Bad GatewayCloudinary API error during deletion.

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.