Last updated: Apr-18-2024
There are a number of ways to update your media assets:
- Use the Explicit method of the Upload API to update a single asset. This method is not rate-limited and requires a signature to be generated on the server side.
- Use the Update resources method of the Admin API. This method is rate-limited and requires your API key and secret, so is not suitable for use in client-side code.
- Use the Media Explorer interface.
The explicit method
The explicit
method of the Upload API is used to update existing assets. The most common usage of this method is to pre-generate transformations for assets that have already been uploaded. This is particularly useful when Strict Transformations are enabled for your product environment and you cannot create transformed assets on the fly (for more information, see Control access to assets). To generate these transformations, the explicit
method uses the eager
parameter to define the list of transformations to create for the uploaded asset of a specified public ID (see the Transformation URL API Reference for more details on possible transformation values). The eager parameter accepts either a single transformation or an array of transformations, where each transformation is represented by a hash of parameters to create for the uploaded resource.
The explicit
method can also be used in client-side code, but it requires a signature to be generated on the server-side. See the Explicit method in the reference guide for all available parameters.
explicit
, the transformation is processed upon request (and counted in your transformation quota) even if an identical derived image already exists.Examples of other uses for the explicit
method include:
- Updating the meta data parameters stored with the image, such as
custom_coordinates
,face_coordinates
,tags
, etc. - Invalidating cached copies of a media asset on the CDN.
- Applying one of Cloudinary's add-ons to the image (e.g., removing the background).
The explicit
API method also requires specifying the type
of the resource: upload
, private
or authenticated
. For example, the following method will explicitly generate two transformations for the already uploaded JPG private
image named sample3
:
- Scale to a width of 200 pixels.
- Crop to a width of 360 pixels and a height of 200 pixels with north gravity.
The update method
The Update details of an existing resource method of the Admin API to update uploaded assets. Admin API methods require your API key and secret, so they shouldn't be used in client-side code. This method is rate-limited.
For example, to update the tags and moderation status of an uploaded image with the public ID of 'table':