class AdminApi

Enables Cloudinary Admin API functionality.

Learn more: Admin API Reference

Properties

ApiClient $apiClient Defined in AdminApi class. from MiscTrait
ApiClient $apiV2Client Defined in AdminApi class. from AnalysisTrait

Methods

assetTypes()

Lists available asset types.

assets(array $options = [])

Lists all uploaded assets filtered by any specified options.

assetsByTag(string $tag, array $options = [])

Lists assets with the specified tag.

assetsByContext(string $key, string $value = null, array $options = [])

Lists assets with the specified contextual metadata.

assetsByModeration(string $kind, string $status, array $options = [])

Lists assets currently in the specified moderation queue and status.

assetsByIds(string|array $publicIds, array $options = [])

Lists assets with the specified public IDs.

assetsByAssetIds(string|array $assetIds, array $options = [])

Lists assets with the specified asset IDs.

assetsByAssetFolder(string $assetFolder, array $options = [])

Lists assets in the specified asset folder.

visualSearch(array $options = [])

Find images based on their visual content.

asset(string $publicId, array $options = [])

Returns the details of the specified asset and all its derived assets.

assetByAssetId(string $assetId, array $options = [])

Returns the details of the specified asset and all its derived assets by asset id.

restore(string|array $publicIds, array $options = [])

Reverts to the latest backed up version of the specified deleted assets.

update(string|array $publicId, array $options = [])

Updates details of an existing asset.

deleteAssets(string|array $publicIds, array $options = [])

Deletes the specified assets.

deleteAssetsByPrefix(string $prefix, array $options = [])

Deletes assets by prefix.

deleteAllAssets(array $options = [])

Deletes all assets of the specified asset and delivery type, including their derived assets.

deleteAssetsByTag(string $tag, array $options = [])

Deletes assets with the specified tag, including their derived assets.

deleteDerivedAssets(string|array $derived_asset_ids)

Deletes the specified derived assets by derived asset ID.

deleteDerivedByTransformation(string|array $publicIds, string|array $transformations = [], array $options = [])

Deletes derived assets identified by transformation and public_ids.

addRelatedAssets(string $publicId, array $assetsToRelate, array $options = [])

Relates an asset to other assets by public IDs.

addRelatedAssetsByAssetIds(string $assetId, array $assetsToRelate)

Relates an asset to other assets by asset IDs.

deleteRelatedAssets(string $publicId, array $assetsToUnrelate, array $options = [])

Unrelates an asset from other assets by public IDs.

deleteRelatedAssetsByAssetIds(string $assetId, array $assetsToUnrelate)

Unrelates an asset from other assets by asset IDs.

rootFolders(array $options = [])

Lists all root folders.

subFolders(string $ofFolderPath, array $options = [])

Lists sub-folders.

createFolder(string $path)

Creates a new empty folder.

deleteFolder(string $path)

Deletes an empty folder.

transformations(array $options = [])

Lists stored transformations.

transformation(string|array $transformation, array $options = [])

Returns the details of a single transformation.

deleteTransformation(string|array $transformation, array $options = [])

Deletes the specified stored transformation.

updateTransformation(string|array $transformation, array $updates = [])

Updates the specified transformation.

createTransformation(string $name, Transformation|string|array $definition)

Creates a named transformation.

listStreamingProfiles()

Lists streaming profiles including built-in and custom profiles.

getStreamingProfile(string $name)

Gets details of a single streaming profile by name.

deleteStreamingProfile(string $name)

Deletes or reverts the specified streaming profile.

updateStreamingProfile(string $name, array $options = [])

Updates an existing streaming profile.

createStreamingProfile(string $name, array $options = [])

Creates a new, custom streaming profile.

uploadPresets(array $options = [])

Lists existing upload presets.

uploadPreset(string $name, array $options = [])

Retrieves the details of the specified upload preset.

deleteUploadPreset(string $name)

Deletes the specified upload preset.

updateUploadPreset(string $name, array $options = [])

Updates the specified upload preset.

createUploadPreset(array $options = [])

Creates a new upload preset.

uploadMappings(array $options = [])

Lists upload mappings by folder and its mapped template (URL).

uploadMapping(string $name)

Returns the details of the specified upload mapping.

deleteUploadMapping(string $name)

Deletes an upload mapping.

updateUploadMapping(string $name, array $options = [])

Updates an existing upload mapping with a new template (URL).

createUploadMapping(string $name, array $options = [])

Creates a new upload mapping.

ping()

Tests the reachability of the Cloudinary API.

pingAsync()

Tests the reachability of the Cloudinary API asynchronously.

usage(array $options = [])

Gets cloud usage details.

tags(array $options = [])

Lists all the tags currently used for a specified asset type.

analyze(string $inputType, string $analysisType, string $uri = null)

Analyzes an asset with the requested analysis type.

analyzeAsync(string $inputType, string $analysisType, string $uri = null)

Analyzes an asset with the requested analysis type asynchronously.

__construct(mixed $configuration = null)

AdminApi constructor.

Details

ApiResponse assetTypes()

Lists available asset types.

Return Value

ApiResponse

ApiResponse assets(array $options = [])

Lists all uploaded assets filtered by any specified options.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_resources

ApiResponse assetsByTag(string $tag, array $options = [])

Lists assets with the specified tag.

This method does not return matching deleted assets, even if they have been backed up.

Parameters

Name Type Description
$tag string The tag value.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_resources_by_tag

ApiResponse assetsByContext(string $key, string $value = null, array $options = [])

Lists assets with the specified contextual metadata.

This method does not return matching deleted assets, even if they have been backed up.

Parameters

Name Type Description
$key string Only assets with this context key are returned.
$value string Only assets with this context value for the specified context key are returned. If this parameter is not provided, all assets with the specified context key are returned, regardless of the key value.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_resources_by_context

ApiResponse assetsByModeration(string $kind, string $status, array $options = [])

Lists assets currently in the specified moderation queue and status.

Parameters

Name Type Description
$kind string Type of image moderation queue to list. Valid values: "manual", "webpurify", "aws_rek", or "metascan".
$status string Only assets with this moderation status will be returned. Valid values: "pending", "approved", "rejected".
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_resources_in_moderation_queues

ApiResponse assetsByIds(string|array $publicIds, array $options = [])

Lists assets with the specified public IDs.

Parameters

Name Type Description
$publicIds string|array The requested public_ids (up to 100).
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_resources

ApiResponse assetsByAssetIds(string|array $assetIds, array $options = [])

Lists assets with the specified asset IDs.

Parameters

Name Type Description
$assetIds string|array The requested asset IDs.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_resources

ApiResponse assetsByAssetFolder(string $assetFolder, array $options = [])

Lists assets in the specified asset folder.

Parameters

Name Type Description
$assetFolder string The asset folder.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/dynamic_folders

ApiResponse visualSearch(array $options = [])

Find images based on their visual content.

Parameters

Name Type Description
$options array The optional parameters. See the AdminAPI documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#visual_search_for_resources

ApiResponse asset(string $publicId, array $options = [])

Returns the details of the specified asset and all its derived assets.

Note that if you only need details about the original asset, you can also use the Uploader::upload or Uploader::explicit methods, which return the same information and are not rate limited.

Parameters

Name Type Description
$publicId string The public ID of the asset.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_the_details_of_a_single_resource

ApiResponse assetByAssetId(string $assetId, array $options = [])

Returns the details of the specified asset and all its derived assets by asset id.

Note that if you only need details about the original asset, you can also use the Uploader::upload or Uploader::explicit methods, which return the same information and are not rate limited.

Parameters

Name Type Description
$assetId string The Asset ID of the asset.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_the_details_of_a_single_resource

ApiResponse restore(string|array $publicIds, array $options = [])

Reverts to the latest backed up version of the specified deleted assets.

Parameters

Name Type Description
$publicIds string|array The public IDs of the backed up assets to restore. They can be existing or deleted assets.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#restore_resources

ApiResponse update(string|array $publicId, array $options = [])

Updates details of an existing asset.

Update one or more of the attributes associated with a specified asset. Note that you can also update most attributes of an existing asset using the Uploader::explicit method, which is not rate limited.

Parameters

Name Type Description
$publicId string|array The public ID of the asset to update.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#update_details_of_an_existing_resource

ApiResponse deleteAssets(string|array $publicIds, array $options = [])

Deletes the specified assets.

Parameters

Name Type Description
$publicIds string|array The public IDs of the assets to delete (up to 100).
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_resources

ApiResponse deleteAssetsByPrefix(string $prefix, array $options = [])

Deletes assets by prefix.

Delete up to 1000 original assets, along with their derived assets, where the public ID starts with the specified prefix.

Parameters

Name Type Description
$prefix string The Public ID prefix.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_resources

ApiResponse deleteAllAssets(array $options = [])

Deletes all assets of the specified asset and delivery type, including their derived assets.

Supports deleting up to a maximum of 1000 original assets in a single call.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError https://cloudinary.com/documentation/admin_api#delete_resources

ApiResponse deleteAssetsByTag(string $tag, array $options = [])

Deletes assets with the specified tag, including their derived assets.

Supports deleting up to a maximum of 1000 original assets in a single call.

Parameters

Name Type Description
$tag string The tag value of the assets to delete.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_resources_by_tags

ApiResponse deleteDerivedAssets(string|array $derived_asset_ids)

Deletes the specified derived assets by derived asset ID.

The derived asset IDs for a particular original asset are returned when calling the asset method to return the details of a single asset.

Parameters

Name Type Description
$derived_asset_ids string|array The derived asset IDs (up to 100 ids).

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api##delete_resources

ApiResponse deleteDerivedByTransformation(string|array $publicIds, string|array $transformations = [], array $options = [])

Deletes derived assets identified by transformation and public_ids.

Parameters

Name Type Description
$publicIds string|array The public IDs for which you want to delete derived assets.
$transformations string|array The transformation(s) associated with the derived assets to delete.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

ApiResponse addRelatedAssets(string $publicId, array $assetsToRelate, array $options = [])

Relates an asset to other assets by public IDs.

Parameters

Name Type Description
$publicId string The public ID of the asset to update.
$assetsToRelate array The array of up to 10 fully_qualified_public_ids given as resource_type/type/public_id.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

ApiResponse addRelatedAssetsByAssetIds(string $assetId, array $assetsToRelate)

Relates an asset to other assets by asset IDs.

Parameters

Name Type Description
$assetId string The asset ID of the asset to update.
$assetsToRelate array The array of up to 10 asset IDs.

Return Value

ApiResponse

ApiResponse deleteRelatedAssets(string $publicId, array $assetsToUnrelate, array $options = [])

Unrelates an asset from other assets by public IDs.

Parameters

Name Type Description
$publicId string The public ID of the asset to update.
$assetsToUnrelate array The array of up to 10 fully_qualified_public_ids given as resource_type/type/public_id.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

ApiResponse deleteRelatedAssetsByAssetIds(string $assetId, array $assetsToUnrelate)

Unrelates an asset from other assets by asset IDs.

Parameters

Name Type Description
$assetId string The asset ID of the asset to update.
$assetsToUnrelate array The array of up to 10 asset IDs.

Return Value

ApiResponse

ApiResponse rootFolders(array $options = [])

Lists all root folders.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_root_folders

ApiResponse subFolders(string $ofFolderPath, array $options = [])

Lists sub-folders.

Returns the name and path of all the sub-folders of a specified parent folder. Limited to 2000 results.

Parameters

Name Type Description
$ofFolderPath string The parent folder
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#get_subfolders

ApiResponse createFolder(string $path)

Creates a new empty folder.

Parameters

Name Type Description
$path string The full path of the new folder to create.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#create_folder

ApiResponse deleteFolder(string $path)

Deletes an empty folder.

The specified folder cannot contain any assets, but can have empty descendant sub-folders.

Parameters

Name Type Description
$path string The full path of the empty folder to delete.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_folder

ApiResponse transformations(array $options = [])

Lists stored transformations.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_transformations

ApiResponse transformation(string|array $transformation, array $options = [])

Returns the details of a single transformation.

Parameters

Name Type Description
$transformation string|array The transformation. Can be either a string or an array of parameters. For example: "w_150,h_100,c_fill" or array("width" => 150, "height" => 100,"crop" => "fill").
$options array The optional parameters. See the admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_transformation_details

ApiResponse deleteTransformation(string|array $transformation, array $options = [])

Deletes the specified stored transformation.

Deleting a transformation also deletes all the stored derived assets based on this transformation (up to 1000). The method returns an error if there are more than 1000 derived assets based on this transformation.

Parameters

Name Type Description
$transformation string|array The transformation to delete. Can be either a string or an array of parameters. For example: "w_150,h_100,c_fill" or ["width" => 150, "height" => 100,"crop" => "fill"].
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_transformation

ApiResponse updateTransformation(string|array $transformation, array $updates = [])

Updates the specified transformation.

Parameters

Name Type Description
$transformation string|array The transformation. Can be either a string or an array of parameters. For example: "w_150,h_100,c_fill" or array("width" => 150, "height" => 100,"crop" => "fill").
$updates array The update parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#update_transformation

ApiResponse createTransformation(string $name, Transformation|string|array $definition)

Creates a named transformation.

Parameters

Name Type Description
$name string The name of the transformation.
$definition Transformation|string|array The transformation. Can be either a defined Transformation, a string or an array of parameters. For example: "w_150,h_100,c_fill" or ["width" => 150, "height" => 100, "crop" => "fill"].

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#create_named_transformation

ApiResponse listStreamingProfiles()

Lists streaming profiles including built-in and custom profiles.

Return Value

ApiResponse An array with a "data" key for results.

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#get_adaptive_streaming_profiles

ApiResponse getStreamingProfile(string $name)

Gets details of a single streaming profile by name.

Parameters

Name Type Description
$name string The identification name of the streaming profile

Return Value

ApiResponse An array with a "data" key for results.

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#get_details_of_a_single_streaming_profile

ApiResponse deleteStreamingProfile(string $name)

Deletes or reverts the specified streaming profile.

For custom streaming profiles, deletes the specified profile. For built-in streaming profiles, if the built-in profile was modified, reverts the profile to the original settings. For built-in streaming profiles that have not been modified, the Delete method returns an error.

Parameters

Name Type Description
$name string The name of the streaming profile to delete or revert.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_or_revert_the_specified_streaming_profile

ApiResponse updateStreamingProfile(string $name, array $options = [])

Updates an existing streaming profile.

You can update both custom and built-in profiles. The specified list of representations replaces the previous list.

Parameters

Name Type Description
$name string The name of the streaming profile to update.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#create_a_streaming_profile

ApiResponse createStreamingProfile(string $name, array $options = [])

Creates a new, custom streaming profile.

Parameters

Name Type Description
$name string The name to assign to the new streaming profile. The name is case-insensitive and can contain alphanumeric characters, underscores (_) and hyphens (-). If the name is of a predefined profile, the profile will be modified.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

StreamingProfilesTrait::createStreamingProfile
https://cloudinary.com/documentation/admin_api#create_a_streaming_profile

ApiResponse uploadPresets(array $options = [])

Lists existing upload presets.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_upload_presets

ApiResponse uploadPreset(string $name, array $options = [])

Retrieves the details of the specified upload preset.

Parameters

Name Type Description
$name string The name of the upload preset.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_the_details_of_a_single_upload_preset

ApiResponse deleteUploadPreset(string $name)

Deletes the specified upload preset.

Parameters

Name Type Description
$name string The name of the upload preset to delete.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_an_upload_preset

ApiResponse updateUploadPreset(string $name, array $options = [])

Updates the specified upload preset.

Parameters

Name Type Description
$name string The name of the upload preset.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#update_an_upload_preset

ApiResponse createUploadPreset(array $options = [])

Creates a new upload preset.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#create_an_upload_preset

ApiResponse uploadMappings(array $options = [])

Lists upload mappings by folder and its mapped template (URL).

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_upload_mappings

ApiResponse uploadMapping(string $name)

Returns the details of the specified upload mapping.

Retrieve the mapped template (URL) of a specified upload mapping folder.

Parameters

Name Type Description
$name string The name of the upload mapping folder.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#get_the_details_of_a_single_upload_mapping

ApiResponse deleteUploadMapping(string $name)

Deletes an upload mapping.

Parameters

Name Type Description
$name string The name of the upload mapping folder to delete.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#delete_an_upload_mapping

ApiResponse updateUploadMapping(string $name, array $options = [])

Updates an existing upload mapping with a new template (URL).

Parameters

Name Type Description
$name string The name of the upload mapping folder to remap.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#update_an_upload_mapping

ApiResponse createUploadMapping(string $name, array $options = [])

Creates a new upload mapping.

Parameters

Name Type Description
$name string The name of the folder to map.
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

See also

https://cloudinary.com/documentation/admin_api#create_an_upload_mapping

ApiResponse ping()

Tests the reachability of the Cloudinary API.

Return Value

ApiResponse

See also

AdminApi::pingAsync()
https://cloudinary.com/documentation/admin_api#ping

PromiseInterface pingAsync()

Tests the reachability of the Cloudinary API asynchronously.

Return Value

PromiseInterface

See also

https://cloudinary.com/documentation/admin_api#ping

ApiResponse usage(array $options = [])

Gets cloud usage details.

Returns a report detailing your current Cloudinary cloud usage details, including storage, bandwidth, requests, number of assets, and add-on usage. Note that numbers are updated periodically.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#usage

ApiResponse tags(array $options = [])

Lists all the tags currently used for a specified asset type.

Parameters

Name Type Description
$options array The optional parameters. See the Admin API documentation.

Return Value

ApiResponse

Exceptions

ApiError

See also

https://cloudinary.com/documentation/admin_api#get_tags

ApiResponse analyze(string $inputType, string $analysisType, string $uri = null)

Analyzes an asset with the requested analysis type.

Parameters

Name Type Description
$inputType string The type of input for the asset to analyze ('uri').
$analysisType string The type of analysis to run ('google_tagging', 'captioning', 'fashion').
$uri string The URI of the asset to analyze.

Return Value

ApiResponse

See also

AdminApi::analyzeAsync()
https://cloudinary.com/documentation/media_analyzer_api_reference

PromiseInterface analyzeAsync(string $inputType, string $analysisType, string $uri = null)

Analyzes an asset with the requested analysis type asynchronously.

Parameters

Name Type Description
$inputType string The type of input for the asset to analyze ('uri').
$analysisType string The type of analysis to run ('google_tagging', 'captioning', 'fashion').
$uri string The URI of the asset to analyze.

Return Value

PromiseInterface

See also

https://cloudinary.com/documentation/media_analyzer_api_reference

__construct(mixed $configuration = null)

AdminApi constructor.

Parameters

Name Type Description
$configuration mixed