Skip to navigation

Upload Multiple Images (Batch Cloudinary Upload)

View as Markdown

Uploads multiple images in a single batch request to Cloudinary storage. Returns an array of uploaded image details with direct URLs and any failed uploads with error reasons.


Endpoint Overview

  • Method: POST

  • Route: /api/v1/upload/multiple

  • Authentication: None (Public)

  • Content-Type: multipart/form-data


Request Headers

HeaderTypeRequiredDescription
Content-TypestringYesMust be multipart/form-data

Request Body Schema (multipart/form-data)

Form FieldData TypeRequiredDefaultAllowed Values / ConstraintsDescription
imagesFiles (Binary Array)Yes—Max: 10 files, 10MB per file.
Allowed: .jpg, .jpeg, .png, .webp, .gif, .avif, .heic, .heif
Repeat images field for each file
foldertextNo"uploads"e.g. "vehicles", "documents"Cloudinary destination folder

Response Body Schema (201 Created / 207 Multi-Status)

Top-Level KeyData TypeDescription
successbooleantrue if all files uploaded without error, false if any file failed
uploadedarrayList of successfully uploaded images
failedarrayList of files that failed to upload with error descriptions

`uploaded` Item Fields

FieldData TypeDescription
urlstringSecure HTTPS Cloudinary URL
publicIdstringUnique Cloudinary public ID
widthintegerWidth in pixels
heightintegerHeight in pixels
formatstringFile format (e.g. "jpg", "png")
bytesintegerFile size in bytes

`failed` Item Fields

FieldData TypeDescription
originalNamestringFile name as submitted by client
errorstringFailure error message

Response Examples

1. `201 Created` — All Images Uploaded Successfully

{
"success": true,
"uploaded": [
{
"url": "https://res.cloudinary.com/goride/image/upload/v1758429900/vehicles/car_front.jpg",
"publicId": "vehicles/car_front",
"width": 1920,
"height": 1080,
"format": "jpg",
"bytes": 450120
},
{
"url": "https://res.cloudinary.com/goride/image/upload/v1758429901/vehicles/car_back.jpg",
"publicId": "vehicles/car_back",
"width": 1920,
"height": 1080,
"format": "jpg",
"bytes": 420800
}
],
"failed": []
}

2. `207 Multi-Status` — Partial Success (Some Succeeded, Some Failed)

{
"success": false,
"uploaded": [
{
"url": "https://res.cloudinary.com/goride/image/upload/v1758429900/vehicles/car_front.jpg",
"publicId": "vehicles/car_front",
"width": 1920,
"height": 1080,
"format": "jpg",
"bytes": 450120
}
],
"failed": [
{
"originalName": "corrupted_file.png",
"error": "Failed to upload file to Cloudinary"
}
]
}

3. `400 Bad Request` — Missing `images` Form Field

{
"success": false,
"error": "No files provided (field name: 'images')"
}

4. `400 Bad Request` — Exceeded Maximum Files Limit (Max 10)

{
"success": false,
"error": "Too many files in one request."
}

5. `400 Bad Request` — Unsupported File Format

{
"success": false,
"error": "Unsupported file type \"application/pdf\". Allowed: image/jpeg, image/png, image/webp, image/gif, image/avif, image/heic, image/heif"
}

6. `502 Bad Gateway` — All Uploads Failed

{
"success": false,
"uploaded": [],
"failed": [
{
"originalName": "file1.jpg",
"error": "Cloudinary connection timeout"
}
]
}

Status Codes Reference

HTTP Status CodeCondition
201 CreatedAll images were uploaded successfully to Cloudinary.
207 Multi-StatusPartial batch success — some files uploaded, others failed.
400 Bad RequestMissing images field, too many files (>10), file too large (>10MB), or invalid MIME type.
502 Bad GatewayAll images in the batch failed to upload to Cloudinary.

Authentication

AuthorizationBearer

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