Asset Metadata

Adds or clears contextual metadata on multiple assets

POST
/v1_1/{cloud_name}/{resource_type}/context

Applies a contextual-metadata command to the given assets, addressing them by public ID.

Authorization

AuthorizationBasic <token>

Basic authentication using Cloudinary API Key and API Secret.

In: header

Path Parameters

cloud_name*string

The cloud name of your product environment.

resource_type*string

The type of resource (image, video, or raw).

Value in

  • "image"
  • "video"
  • "raw"

Request Body

application/json

The context command, the metadata to apply, and the assets to apply it to.

A contextual-metadata command plus the assets it applies to.

public_ids*array<string>

The public IDs of the assets to apply the operation to. At most 1000 are processed per request; any beyond the first 1000 are ignored rather than rejected. Public IDs that do not exist, or that the caller lacks update permission for, are skipped rather than failing the request, so the returned public_ids may be shorter than the requested list.

Itemsitems <= 1000
type?|||||

All supported delivery types.

command*string

The contextual-metadata operation to apply.

  • add merges the given key-value pairs into each asset's existing context. Keys already present are overwritten; keys not mentioned are left intact. context is required.
  • remove_all clears all contextual metadata. The context field is ignored.

Value in

  • "add"
  • "remove_all"
context?string

The key-value pairs to merge. Required for add; ignored for remove_all. An empty value deletes that key rather than storing an empty string, so "alt=" removes alt while leaving other keys intact. Deletes and sets may be combined: "alt=|owner=new". A literal = or | inside a value must be escaped with a prepending backslash, and a literal backslash must be doubled. A double quote must not be escaped.

Response Body

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1_1/my_cloud/image/context" \  -H "Content-Type: application/json" \  -d '{    "command": "add",    "public_ids": [      "sample",      "product_image",      "banner_2023"    ],    "context": "alt=My image|caption=Nice photo"  }'
{  "public_ids": [    "sample",    "product_image",    "banner_2023"  ]}