younifyd
Menu

Link Media Library Asset

Link a Media Library asset to a dataset

POST/media-library-link/{dataset}

Use it in a workflow

  1. Add a step and choose the Sanity connector.
  2. Pick the Link Media Library Asset action (under Assets).
  3. Fill in the fields below, then reference the result from later steps as {{linkMediaLibraryAsset.response.data}}.

Request

Path parameters

datasetstringrequired

Query parameters

metaarray<string>

Image metadata to copy from the Media Library asset to the linked asset document. Applies to image assets only. `dimensions`, `hasAlpha`, and `isOpaque` are always included. Repeat the parameter for multiple values, such as meta=palette&meta=lqip.

Default ["palette","lqip","blurhash","thumbhash"]

Request body

Enter the body as JSON in the step's Body field.

assetIdstringrequired

The asset ID of the Media Library asset. This comes from the `asset._id` field returned as part of the response when uploading an asset to the library.

mediaLibraryIdstringrequired

The ID of the Media Library.

assetInstanceIdstringrequired

The asset instance ID of the Media Library asset. This comes from the `assetInstance._id` field returned as part of the response when uploading an asset to the library.

json
{
  "assetId": "string",
  "mediaLibraryId": "string",
  "assetInstanceId": "string"
}

Response

Returns 200 with an object. Read it in later steps with {{linkMediaLibraryAsset.response.data.<field>}}.

documentoneOf

The linked asset document in your dataset. Its `_type` is `sanity.imageAsset`, `sanity.fileAsset`, or `sanity.videoAsset`.

json
{
  "document": null
}

Need more? See the Sanity guide for connection setup and behaviour shared by every action.

Link Media Library Asset — Sanity — Documentation