MakePhotos Docs
SDK Reference

Upload

Upload images to use with MakePhotos generation endpoints.

Upload

Upload local images to get a URL you can use with generate and removeBg.

Usage

import { readFileSync } from 'fs';

const uploaded = await client.upload.create({
  file: readFileSync('./product-photo.jpg'),
  filename: 'product-photo.jpg',
});

console.log(uploaded.imageUrl);
// https://res.cloudinary.com/.../makephotos/inputs/.../product-photo.jpg

Parameters

ParameterTypeRequiredDescription
fileUint8Array | ArrayBufferYesThe image file contents
filenamestringYesFilename (used for Cloudinary storage)

Response

interface UploadResult {
  imageUrl: string; // Cloudinary URL of the uploaded image
}

How it works

The SDK uses a two-step signed upload process under the hood:

  1. Requests signed upload parameters from GET /api/v1/upload/signed
  2. Uploads the file directly to Cloudinary using those params

This means there is no file size limit — the file goes straight to Cloudinary, bypassing any server-side body limits.

Upload then generate

const uploaded = await client.upload.create({
  file: readFileSync('./sneaker.jpg'),
  filename: 'sneaker.jpg',
});

const result = await client.generate.create({
  imageUrl: uploaded.imageUrl,
  type: 'product',
  style: 'lifestyle',
  aspectRatio: '1:1',
});

No credits consumed

Uploading an image does not cost any credits. You only pay credits when you generate or remove a background.

Supported formats

JPEG, PNG, WebP, and other common image formats supported by Cloudinary.

On this page