Skip to main content
Key type: browsing your files requires a private key (see Create an API Key) — but Sanity Studio is a client-side app, so that key ships inside the Studio’s JavaScript bundle. Anyone with access to your Studio, including via browser devtools, can read it. Restrict who has access to your Studio deployment accordingly, and treat the key as you would any other client-exposed credential.
The @autorender/sanity plugin lets content editors browse, upload, and pick Autorender assets (images, video, and other files) directly from Sanity Studio, without leaving the editor.

How does it work?

The package ships two plugins you can use independently or together:
  1. autorenderAssetSourcePlugin — adds an “Autorender” entry to the asset picker on standard image and file fields, alongside Sanity’s own “Upload” and “Browse”. Picking an asset hands Sanity a plain CDN URL, which Sanity downloads into its own asset pipeline like any other third-party source.
  2. autorenderSchemaPlugin — adds an autorender.asset object schema type you attach to your own document schemas. Unlike the asset source above, this keeps serving the file from the Autorender CDN instead of copying it into Sanity, and keeps the asset’s Autorender metadata (folder, tags, dimensions, custom metadata) attached to the document for use in GROQ queries.
Both plugins only call your own Autorender workspace’s endpoints (list files, list folders, upload) — neither renames nor deletes anything in your workspace.

Prerequisites

  • A Sanity Studio project (v3 or later) running locally
  • Node.js and npm, yarn, or pnpm
  • An Autorender workspace and a private API key — see Create an API Key

1. Install the plugin


2. Add it to your Studio config

sanity.config.ts
Sanity Studio only exposes environment variables prefixed with SANITY_STUDIO_ to client code, so set your key as SANITY_STUDIO_AUTORENDER_API_KEY (or similar) in your Studio’s .env file. That’s enough to browse, upload, and pick Autorender assets from any image/file field. The rest of this guide covers the autorender.asset schema type and the remaining configuration options.

3. Use Autorender as an asset source

With autorenderAssetSourcePlugin installed, open any image or file field in the Studio and click Select. An “Autorender” entry appears alongside “Upload” and “Browse”.
Autorender entry in Sanity's asset source picker

The Autorender entry in a standard image field's asset source menu.

Clicking it opens the Autorender browser: search or navigate folders, select a file, and Sanity downloads it into its own asset pipeline.
Autorender file browser dialog inside Sanity Studio

Browsing and searching Autorender folders and files from inside Sanity Studio.


4. Use the autorender.asset schema type (optional)

Use this when you want documents to keep serving assets from the Autorender CDN — instead of Sanity’s own asset pipeline — with the asset’s Autorender metadata available in GROQ queries.
sanity.config.ts
Then reference autorender.asset from your own document schemas:
schemas/post.ts
A single autorender.asset field renders a preview with Select… / Remove buttons. An array of autorender.asset gets an extra Add multiple button, so editors can pick several assets from one browsing session.
autorender.asset field showing a selected asset preview

An autorender.asset field with a selected video, shown by its thumbnail and the Autorender badge.

Query the asset’s fields directly in GROQ — no joins or dereferencing needed, since the data lives on the document itself:

5. Upload new files

Both the asset-source dialog and the autorender.asset field’s browser include an Upload new button, so editors can add a file straight to Autorender without leaving Sanity. Uploads go to whichever Autorender folder is currently open in the dialog, and the newly uploaded file is selected immediately.

6. Render the images on your frontend

Rendering differs by field type, since a standard image field only stores a reference to a Sanity-hosted asset, while an autorender.asset field stores the Autorender CDN URL directly on the document.

The standard image field

Resolve the reference into a URL with @sanity/image-url — the same package you’d use for any Sanity image, since by this point it’s a normal Sanity asset:
lib/sanity.ts
app/page.tsx
If you’re using next/image, add Sanity’s CDN to your allowed remote patterns:
next.config.js

The autorender.asset field

No image-builder needed — url/thumbnail are already plain, permanent CDN links, so query and render them directly:
app/page.tsx
Add Autorender’s CDN to next.config.js too, alongside Sanity’s:
next.config.js

Advanced: custom base URL

If your Autorender workspace is served from a different API host, pass baseUrl alongside apiKey:

Next steps

Automatic format

Serve AVIF or WebP per browser with f_auto on the CDN URLs these plugins insert.

Resize and aspect ratio

Control width, height, and fit on every delivery URL.