Back to Top

libraries > Cloudinary.js

new Cloudinary(cloudName, apiKey, apiSecret)

Methods to interact with the Cloudinary API.

Parameters

Name Type Description
cloudName string

The account's Cloudinary cloud name.

apiKey string

The API Key from the Cloudinary dashboard.

apiSecret string

the API secret from the Cloudinary dashboard. *

Examples

const Cloudinary = require('vendor/Cloudinary.js');
const cloudinary = new Cloudinary(cloudName, api, secret);
const response = cloudinary.upload('https://api.cloudinaryapi.com/2/files/save_url', {
  eager: 'w_400,h_300,c_pad',
});

Returns

class

Cloudinary.upload()

Upload a file to Cloudinary, and optionally perform eager transformations.

Properties

Name Type Description
The url

full URL of the file to upload to Cloudinary.

data Data

Data to post to the Cloudinary API.

options Options

Additional options to pass in the API call.

Examples

const cloudinary = new Cloudinary(cloudName, api, secret);
const response = cloudinary.request('http://google.com/favicon.png', {
  eager: 'w_400,h_300,c_pad',
});

Returns

Void

Cloudinary.search()

Search a file in Cloudinary by public ID

Properties

Name Type Description
The url

full URL of the file to upload to Cloudinary.

data Data

Data to post to the Cloudinary API.

options Options

Additional options to pass in the API call.

Returns

Void

Cloudinary.request()

Make a generic request to the Cloudinary API

Properties

Name Type Description
method string

The HTTP request method (POST, GET, etc).

The path

Cloudinary API to call.

data Data

Data to post to the Cloudinary API.

options Options

Additional options to pass in the API call.

Examples

const cloudinary = new Cloudinary(cloudName, api, secret);
const response = cloudinary.request('POST', 'upload', {file: 'http://google.com/favicon.png'});

Returns

Void

{Object} Data

data parameter for Cloudinary API calls

Properties

Name Type Description
eager string

Cloudinary Transformation string. See URL examples from https://cloudinary.com/documentation/image_transformations.

Optional
headers object

Headers to send to the request.

Optional

{Object} Options

options parameter for Cloudinary API calls

Properties

Name Type Description
query object

Parameters to append to the querystring.

Optional
headers object

Headers to send to the request.

Optional