trait AssetsTrait

Enables you to manage the assets in your cloud.

Learn more: Resources method - Admin API

Properties

ApiClient $apiClient Defined in AdminApi class.

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.

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