Admin API
Overview
The administrative API allows full control of all uploaded raw files and images, fetched social profile pictures, generated transformations and more. The admin API supports the following actions:
- Listing all uploaded images and raw files.
- Receiving details and metadata for uploaded images, including timestamps, format, dimensions, etc.
- Listing the derived images of uploaded images.
- Finding all images that share a given tag.
- Listing all transformations.
- Listing tags.
- Receiving transformation details.
- Creating named transformations.
- Deleting images, raw files, derived images and transformations.
Protocol and authentication
The API is accessed using HTTPS to endpoints in the following format:
https://api.cloudinary.com/v1_1/:cloud_name/:action
For example, image listing of the 'demo' account:
https://api.cloudinary.com/v1_1/demo/resources/images
You can try the following cURL command after setting the correct cloud name, API key and API secret of your account:
curl 'https://API_KEY:API_SECRET@api.cloudinary.com/v1_1/CLOUD_NAME/resources/image'
Authentication is done using Basic Authentication over secure HTTP. Your Cloudinary API Key and API Secret are used for the authentication.
Request parameters are appended to the URL. The response is in a simple JSON snippet. Like any REST API, read-only requests are sent in HTTP GET while write requests are sent in PUT, POST and DELETE.
Pagination
Listing methods of the API return a limited set of results ordered by the creation time of the relevant entities. You can control the number of results returned in a single request by specifying the max_results parameter. The default is 10 for most listing. There is a maximum number of results you can request for a single API call (either 100 or 500 for the various methods).
When a listing request has more results to return than max_results, the next_cursor value is returned as part of the response. You can then specify this value as the next_cursor parameter of the following listing request. This way you can browse through the full lists of uploaded images, transformations and tags of your Cloudinary account.
Error handling
The API returns the status of requests using the HTTP status code:
- 200 - OK. Successful.
- 400 - Bad request.
- 401 - Authorization required.
- 403 - Not allowed.
- 404 - Not found
- 409 - Already exists
- 420 - Rate limited
The API wrapping of Cloudinary's client libraries report errors by raising applicative exception.
In addition, a JSON with an informative message is returned. For example:
{ "error": { "message": "Resource not found - strange_name" } }
Usage limits
You can use the Admin API quite extensively. We ask for that you keep your ongoing API requests to 500 per hour (12,000 daily). If you require more flexible limits, don’t hesitate to contact us.
Note: This limit refers only to Admin API requests for listing & deleting images and resources. There is NO limit on the rate of image uploads.
For each API call, standard HTTP headers are returned with details on your current usage statistics, including your per-hour limit, remaining number of actions and the time the hourly count will be reset.
Here is how these headers might look like:
X-FeatureRateLimit-Limit: 500
X-FeatureRateLimit-Remaining: 499
X-FeatureRateLimit-Reset: Wed, 03 Oct 2012 08:00:00 GMT
Framework integration
Our client libraries provide an easy to use wrapper for this URL-based API, utilizing your native programming language of choice. Request building and authentication are done automatically, and the JSON response is parsed and returned.
require 'cloudinary' result = Cloudinary::Api.resources
require "cloudinary.php"; require "api.php"; $api = new \Cloudinary\Api(); $result = $api->resources();
import cloudinary.api result = cloudinary.api.resources()
var cloudinary = require('cloudinary'); cloudinary.api.resources(function(result) { console.log(result) });
$ result = Cloudinary::Api.resources $ result.rate_limit_allowed => 500 $ result.rate_limit_remaining => 499 $ result.rate_limit_reset_at => 2012-10-03 10:00:00 +0200
php > $result = $api->resources(); php > var_dump($result->rate_limit_allowed); int(500) php > var_dump($result->rate_limit_allowed); int(500) php > var_dump($result->rate_limit_remaining); int(499) php > var_dump($result->rate_limit_reset_at); int(1349622000)
>>> result = cloudinary.api.resources() >>> result.rate_limit_allowed 500 >>>result.rate_limit_remaining 499 >>>result.rate_limit_reset_at (2012, 10, 7, 15, 0, 0, 0, 1, -1)
> cloudinary.api.resources( function(result) { console.log(result.rate_limit_allowed, result.rate_limit_remaining, result.rate_limit_reset_at) }); > 500 499 Sun, 07 Oct 2012 15:00:00 GMT
Browse resources
List resources
- prefix - Optional. Find all resources that their public ID starts with the given prefix.
- max_results - Optional. Max number of resources to return. Default=10. Maximum=500.
- next_cursor - Optional.
{
"resources": [
{
"public_id": "face_center",
"format": "jpg",
"version": 1333013579,
"resource_type": "image",
"type": "upload",
"created_at": "2012-03-29T09:32:59Z",
"bytes": 128891,
"width": 283,
"height": 424,
"url": "http://res.cloudinary.com/demo/image/upload/v1333013579/face_center.jpg",
"secure_url": "https://.../image/upload/v1333013579/face_center.jpg"
},
{
"public_id": "zuck",
"format": "jpg",
"resource_type": "image",
"type": "facebook",
"created_at": "2012-10-06T17:18:52Z",
"bytes": 0,
"url": "http://res.cloudinary.com/demo/image/facebook/zuck.jpg",
"secure_url": "https://.../image/facebook/zuck.jpg"
},
]
}Cloudinary::Api.resources
$api->resources();cloudinary.api.resources()
cloudinary.api.resources(function(result) { console.log(result) });Cloudinary::Api.resources(:type => :upload)
$api->resources(array("type" => "upload"));
cloudinary.api.resources(type = "upload")cloudinary.api.resources(function(result){}, { type: 'upload' });
Cloudinary::Api.resources(:type => :upload, :prefix => "sampl")
$api->resources(array("type" => "upload", "prefix" => "sampl"));
cloudinary.api.resources(type = "upload", prefix = "sampl")
cloudinary.api.resources(function(result){}, { type: 'upload', prefix: 'sampl' });
Cloudinary::Api.resources(:type => :facebook)
$api->resources(array("type" => "facebook"));
cloudinary.api.resources(type = "facebook))cloudinary.api.resources(function(result){}, { type: 'facebook' });
Cloudinary::Api.resources(:resource_type => :raw)
$api->resources(array("resource_type" => "raw"));
cloudinary.api.resources(resource_type = "raw")cloudinary.api.resources(function(result){}, { resource_type: 'raw' });
List resources by tag
- max_results - Optional. Max number of resources to return. Default=10. Maximum=500.
- next_cursor - Optional.
Cloudinary::Api.resources_by_tag('mytag')
$api->resources_by_tag("mytag");
cloudinary.api.resources_by_tag("mytag")cloudinary.api.resources_by_tag("mytag", function(result){});
Cloudinary::Api.resources_by_tag('mytag', :resource_type => :raw)
$api->resources_by_tag("mytag"), array("resource_type" => "raw"));
cloudinary.api.resources_by_tag("mytag"), resource_type = "raw")
cloudinary.api.resources_by_tag("mytag", function(result){}, { resource_type: 'raw' });
List tags
- prefix - Optional. Find all tags that start with the given prefix.
- max_results - Optional. Max number of tags to return. Default=10. Maximum=500.
- next_cursor - Optional.
{
"tags": [
"arrow_animation",
"logo"
]
}Cloudinary::Api.tags
$api->tags();cloudinary.api.tags()
cloudinary.api.tags(function(result){});Details of a single resource
- colors - Optional (Boolean, default: false). If true, include color information: predominant colors and histogram of 32 leading colors.
- exif - Optional (Boolean, default: false). If true, include image metadata (e.g., camera details).
- faces - Optional (Boolean, default: false). If true, include a list of coordinates of detected faces.
{
"public_id": "sample",
"format": "jpg",
"version": 1312461204,
"resource_type": "image",
"type": "upload",
"created_at": "2011-08-04T12:33:24Z",
"bytes": 120253,
"width": 864,
"height": 576,
"url": "http://res.cloudinary.com/demo/image/upload/v1312461204/sample.jpg",
"secure_url": "https://.../image/upload/v1312461204/sample.jpg",
"next_cursor": "041a39fc10971b9eabd4993470f6bfaf",
"derived": [
{
"transformation": "c_fill,w_100,h_100",
"format": "jpg",
"bytes": 7112,
"id": "8267a869b62a93a59248f35d7f124c1f",
"url": "http://.../demo/image/upload/c_fill,w_100,h_100/v1312461204/sample.jpg",
"secure_url": "https://.../image/upload/c_fill,w_100,h_100/v1312461204/sample.jpg"
},
{
"transformation": "w_230,h_168,c_fit",
"format": "jpg",
"bytes": 19173,
"id": "383e22a57167445552a3cdc16f0a0c85",
"url": "http://.../demo/image/upload/w_230,h_168,c_fit/v1312461204/sample.jpg",
"secure_url": "https://.../image/upload/w_230,h_168,c_fit/v1312461204/sample.jpg"
}
],
"faces": [[98,74,61,83], [140,130,52,71]],
"colors": [["#162E02",6.7], ["#385B0C",6.3], ["#F3285C",5.0], ["#B3CB6E",5.0], ["#688F1C",4.4], ["#324D07",4.4], ["#8EAA34",4.3], ["#4F6D0D",4.2], ["#789446",4.1], ["#DF1327",3.9], ["#A10B12",3.7], ["#273804",3.4], ["#0D1802",3.4], ["#D5E191",3.2], ["#646E20",3.1], ["#94AF4D",2.9], ["#FB54A9",2.8], ["#48570B",2.7], ["#ACC655",2.7], ["#FCA2D9",2.7], ["#63110A",2.6], ["#E9B327",2.2], ["#6D644D",2.1], ["#6D8D12",2.0], ["#8F9F27",1.9], ["#C3573E",1.8], ["#CFD76E",1.6], ["#A0B058",1.6], ["#FCD0E9",1.6], ["#728F2D",1.4], ["#F958A1",1.4], ["#D1B694",1.0]],
"predominant": {
"google": [
[
"yellow",
52.9
],
[
"pink",
13.5
],
[
"red",
12.0
],
[
"black",
10.1
],
[
"green",
6.3
]
]
},
"exif": {
"ApertureValue": "4281/1441",
"ColorSpace": "1",
"ComponentsConfiguration": "1, 2, 3, 0",
"Compression": "6",
"DateTime": "2010:12:27 11:17:34",
"DateTimeDigitized": "2010:12:27 11:17:34",
"DateTimeOriginal": "2010:12:27 11:17:34",
"ExifImageLength": "1936",
"ExifImageWidth": "2592",
"ExifOffset": "204",
"ExifVersion": "48, 50, 50, 49",
"ExposureMode": "0",
"ExposureProgram": "2",
"ExposureTime": "1/4309",
"Flash": "24",
"FlashPixVersion": "48, 49, 48, 48",
"FNumber": "14/5",
"FocalLength": "77/20",
"GPSAltitude": "20723/924",
"GPSAltitudeRef": "0",
"GPSImgDirection": "42155/344",
"GPSImgDirectionRef": "T",
"GPSInfo": "574",
"GPSLatitude": "21/1, 768/100, 0/1",
"GPSLatitudeRef": "N",
"GPSLongitude": "86/1, 4500/100, 0/1",
"GPSLongitudeRef": "W",
"GPSTimeStamp": "17/1, 17/1, 3326/100",
"ISOSpeedRatings": "80",
"JPEGInterchangeFormat": "870",
"JPEGInterchangeFormatLength": "9932",
"Make": "Apple",
"MeteringMode": "1",
"Model": "iPhone 4",
"Orientation": "6",
"ResolutionUnit": "2",
"SceneCaptureType": "0",
"SensingMethod": "2",
"Sharpness": "2",
"ShutterSpeedValue": "4781/396",
"Software": "4.2.1",
"SubjectArea": "1295, 967, 699, 696",
"WhiteBalance": "0",
"XResolution": "72/1",
"YCbCrPositioning": "1",
"YResolution": "72/1"
},
}Cloudinary::Api.resource('sample')
$api->resource("sample");
cloudinary.api.resource("sample")cloudinary.api.resource('sample', function(result) { console.log(result) });
Cloudinary::Api.resource('sample', :faces => true, :colors => true, :exif => true)
$api->resource("sample", array("faces" => TRUE, "colors" => TRUE, "exif" => TRUE));
cloudinary.api.resource("sample", faces = True, colors = True, exif = True)
cloudinary.api.resource('sample', function(result) { console.log(result) }, { faces: true, colors: true, exif: true });
Cloudinary::Api.resource('zuck', :type => :facebook)
$api->resource("zuck", array("type" => "facebook"));
cloudinary.api.resource("zuck", type = "facebook")
cloudinary.api.resource('zuck', function(result){}, { type: 'facebook' });
Cloudinary::Api.resource('rwkaliebnufp3bxyrvyo.txt', :resource_type => :raw)
$api->resource("rwkaliebnufp3bxyrvyo.txt", array("resource_type" => "raw"));
cloudinary.api.resource("rwkaliebnufp3bxyrvyo.txt", resource_type = "raw")
cloudinary.api.resource('rwkaliebnufp3bxyrvyo.txt', function(result){}, { resource_type: 'raw' });
Delete resources
Delete resources by public ID or prefix
- public_ids - Delete all resources with the given public IDs (comma-separated)
- prefix - Delete all resources that their public ID starts with the given prefix.
- keep_original - Optional (Boolean, default: false). If true, delete only the derived images of the matching resources.
{
"deleted": {
"image1": "deleted",
"image2": "deleted"
}
}Cloudinary::Api.delete_resources(['image1', 'image2'])
$api->delete_resources(array("image1", "image2"));
cloudinary.api.delete_resources(["image1", "image2"])
cloudinary.api.delete_resources(['image1', 'image2'], function(result){});
Cloudinary::Api.delete_resources(['zuck'], :type => :facebook)
$api->delete_resources(array("zuck"), array("type" => "facebook"));
cloudinary.api.delete_resources(["zuck"], type = "facebook")
cloudinary.api.delete_resources(['zuck'], function(result){}, { type: 'facebook' });
Cloudinary::Api.delete_resources_by_prefix('sunday')
$api->delete_resources_by_prefix("sunday");
cloudinary.api.delete_resources_by_prefix("sunday")cloudinary.api.delete_resources_by_prefix('sunday', function(result){});
Cloudinary::Api.delete_resources(['image1', 'image2'], :keep_original => true)
$api->delete_resources(array("image1", "image2"), array("keep_original" => TRUE));
cloudinary.api.delete_resources(["image1", "image2"], keep_original = True)
cloudinary.api.delete_resources(['image1', 'image2'], function(result){}, { keep_original: true });
Delete derived resources
- derived_resource_ids - Delete all derived resources with the given IDs (comma-separated)
{
"deleted": {
"cb4eaaf650": "deleted",
"a7b2a2756a": "deleted"
}
}Cloudinary::Api.delete_derived_resources(['cb4eaaf6503', 'a7b2a2756ab'])
$api->delete_derived_resources(array("cb4eaaf6503", "a7b2a2756ab"));
cloudinary.api.delete_derived_resources(["cb4eaaf6503", "a7b2a2756ab"])
cloudinary.api.delete_derived_resources(['cb4eaaf6503', 'a7b2a2756ab'], function(result){});
Manage transformations
List transformations
- max_results - Optional. Max number of transformations to return. Default=10. Maximum=500.
- next_cursor - Optional.
{
"transformations": [
{
"name": "w_120,h_100,c_fill",
"allowed_for_strict": false,
"used": false
},
{
"name": "w_110,h_100,c_fill",
"allowed_for_strict": false,
"used": false
},
{
"name": "c_thumb,g_face,h_100,w_80",
"allowed_for_strict": false,
"used": true
},
{
"name": "c_fill,h_75,w_75/jpg",
"allowed_for_strict": false,
"used": true
}
],
"next_cursor": "8edbc61040178db60b0973ca9494bf3a"
}Details of a single transformation
- max_results - Optional. Max number of derived resources to return. Default=10. Maximum=100.
{
"name": "w_150,h_100,c_fill",
"allowed_for_strict": false,
"used": true,
"info": [
{
"width": 150,
"height": 100,
"crop": "fill"
}
],
"derived": [
{
"public_id": "sample",
"resource_type": "image",
"type": "upload",
"format": "jpg",
"url":
"http://.../demo/image/upload/w_150,h_100,c_fill/v1341141057/sample.jpg",
"secure_url":
"https://.../demo/image/upload/w_150,h_100,c_fill/v1341141057/sample.jpg",
"bytes": 10202,
"id": "2adf1841874c7b2326d1f90cbedbc914"
}
]
}Cloudinary::Api.transformation('w_150,h_100,c_fill')
$api->transformation("w_150,h_100,c_fill");
cloudinary.api.transformation("w_150,h_100,c_fill")cloudinary.api.transformation('w_150,h_100,c_fill', function(result) { console.log(result) });
Cloudinary::Api.transformation(:width => 150, :height => 100, :crop => :fill)
$api->transformation(array("width" => 150, "height" => 100, "crop" => "fill"));
cloudinary.api.transformation(dict(width = 150, height = 100, crop = "fill"))
cloudinary.api.transformation({width: 150, height: 100, crop: 'fill'},
function(result) { console.log(result) });Delete transformation
{
"message": "deleted"
}Cloudinary::Api.delete_transformation('w_150,h_100,c_fill')
$api->delete_transformation("w_150,h_100,c_fill");
cloudinary.api.delete_transformation("w_150,h_100,c_fill")cloudinary.api.delete_transformation('w_150,h_100,c_fill', function(result) { console.log(result) });
Cloudinary::Api.delete_transformation(:width => 150, :height => 100, :crop => :fill)
$api->delete_transformation(array("width" => 150, "height" => 100, "crop" => "fill"));
cloudinary.api.delete_transformation(dict(width = 150, height = 100, crop = "fill"))
cloudinary.api.delete_transformation(
{width: 150, height: 100, crop: 'fill'},
function(result) { console.log(result) });Update transformation
- allowed_for_strict - Boolean. Whether this transformation is allowed when Strict Transformations are enabled.
{
"message": "updated"
}Cloudinary::Api.update_transformation('w_150,h_100,c_fill', :allowed_for_strict => true)
$api->update_transformation("w_150,h_100,c_fill", array("allowed_for_strict" => 1));
cloudinary.api.update_transformation("w_150,h_100,c_fill", allowed_for_strict = True)
cloudinary.api.update_transformation('w_150,h_100,c_fill', { allowed_for_strict: true }, function(result) { console.log(result) })
Cloudinary::Api.update_transformation({:width => 150, :height => 100, :crop => :fill}, {:allowed_for_strict => false})
$api->update_transformation( array("width" => 150, "height" => 100,"crop" => "fill") array("allowed_for_strict" => 0));
cloudinary.api.update_transformation(dict(width = 150, height = 100, crop = "fill"), dict( allowed_for_strict = False))
cloudinary.api.update_transformation(
{ width: 150, height: 100, crop: 'fill' },
{ allowed_for_strict: false },
function(result) { console.log(result) });Create named transformation
- transformation - Strinct representation of transformation parameters.
{
"message": "created"
}Cloudinary::Api.create_transformation('small_fill', 'w_150,h_100,c_fill')
$api->create_transformation("small_fill", "w_150,h_100,c_fill");
cloudinary.api.create_transformation("small_fill", "w_150,h_100,c_fill")
cloudinary.api.create_transformation('small_fill', 'w_150,h_100,c_fill', function(result) { console.log(result) })
Cloudinary::Api.create_transformation('small_fill2', {:width => 150, :height => 100, :crop => :fill})
$api->create_transformation("small_fill2", array("width" => 150, "height" => 100, "crop" => "fill"));
cloudinary.api.create_transformation("small_fill2", dict(width = 150, height = 100, crop = "fill"))
cloudinary.api.create_transformation('small_fill2', { width: 150, height: 100, crop: 'fill' }, function(result) { console.log(result) });