Media Library

Configure your library

Set up and configure your media library

Media Library is preconfigured for your organization, but to create and deploy aspects, you need to configure your CLI to connect to the library.

Prerequisites:

  • npm, pnpm, or a similar package manager capable of installing and running the sanity CLI.
  • Read/write access to your organization's Media Library.

Obtain your mediaLibraryId

When you interact with the sanity media commands, you're prompted to select your library. If you only have a single organization, you should see a single library. If you're a member of multiple organizations, you can parse your organization and library ID using the URL.

Navigate to sanity.io/welcome, select your organization, then select the Media Library app. The URL for your library includes the mediaLibraryId.

https://www.sanity.io/@<organizationId>/media/<mediaLibraryId>/assets

Configure the CLI

Tell sanity CLI where to define your aspects by updating sanity.cli.ts.

With the aspects path defined, you can now use the media commands to create and deploy aspects.

Was this page helpful?