Install Jentic One Beta
Jentic One is a self-hosted execution layer for AI agents. It lets your agent call the Media Library, or any other public or private API you need. You set the rules, the agent never sees your credentials, and every call is logged.
Two steps, two machines. Install the instance in a safe environment, then register your agent from wherever it runs.
Step 1: Jentic One Host machine
# On the machine that will host your Jentic One instance:
curl -fsSL "https://jentic.com/install.sh?src=apis&api=%2Fapis%2Fsanity.io%2Fsanity-media-library" | shStep 2: Agent machine
# On the machine where your agent runs (keep this separate from the instance):
curl -fsSL "https://jentic.com/install.sh?src=apis&api=%2Fapis%2Fsanity.io%2Fsanity-media-library" | sh
jentic register # connects your agent to your Jentic One instanceJentic One is in public beta. The setup above keeps your agent separate from the instance, which is what you want before using real credentials: an agent running as the same OS user as Jentic One can read its stored keys directly. Just evaluating? A single local install is fine to start. See the secure deployment guide for the tiers.
What an agent can do with Media Library API.
Upload an image, video, or file to a Media Library as multipart form-data or raw bytes, with a title, filename, sha1, and cdnAccessPolicy of public, authenticated, or private
Import an asset from a public HTTPS URL through Sanity's egress proxy, up to 50 MiB, with a filename in the JSON body
Query asset documents in a library with a GROQ query by GET or POST, and create, patch, or delete them through mutate with an optional dryRun
Search assets and references with a term, filter, and projection, and list the documents that reference a given assetId
GET STARTED
Get video playback info with thumbnail, animated preview, storyboard, and subtitle options, or redirect to a stream or named rendition
Generate AI subtitles for a video in a given languageCode, or upload a VTT or SRT subtitle file, and delete subtitles by subtitleId
Create, list, read, and delete ed25519 signing keys for a library
Patterns agents use Media Library API for, with concrete tasks.
★ AI agent curating a shared media library
An agent asked to bring a batch of campaign images into Sanity searches Jentic for 'upload an image to the Sanity Media Library', loads the uploadAssetFromUrl operation, and imports each one from its HTTPS URL with a filename, a title, and the cdnAccessPolicy the team wants. It then uses searchAssets to confirm the uploads are findable, without the Sanity token entering its context.
POST /media-libraries/{libraryId}/from-url with type image, title Summer hero, cdnAccessPolicy public, and body {url: 'https://cdn.example.com/summer-hero.jpg', filename: 'summer-hero.jpg'}, then GET /media-libraries/{libraryId}/refsearch with term summer
Safe asset cleanup
Deleting an image that a published page still uses breaks the page. Before removing anything, getReferencesToAsset lists the documents that reference an assetId, paged with a cursor and narrowed with excludePaths and perspective. Only unreferenced assets are then deleted through mutateMedia, and dryRun lets the deletion be checked first.
GET /media-libraries/{libraryId}/references/documents/{assetId}/to for an asset, and if no references are returned POST /media-libraries/{libraryId}/mutate with dryRun true and a delete mutation for that asset id
Video subtitles and playback
Video in the Media Library needs captions and preview images. The generateSubtitle operation starts AI subtitle generation for a languageCode and returns a processing status right away, which requires AI features enabled for the organization. Teams with existing captions upload a VTT or SRT file with uploadSubtitle instead, and getPlaybackInfo returns thumbnail, animated preview, storyboard, and subtitle details for the player.
POST /media-libraries/{libraryId}/video/{videoId}/subtitles with languageCode en, then GET /media-libraries/{libraryId}/video/{videoId}/playback-info with subtitlesFormat vtt
Querying assets with GROQ
Asset documents in a Media Library are queryable with GROQ, the same language used across Sanity. The query operation takes a GROQ query string by GET, and queryPost accepts it in a request body for longer queries, so an agent can list assets by type, find ones missing a title, or project only the fields a report needs.
POST /media-libraries/{libraryId}/query with a GROQ query selecting image assets that have no title, and return their ids and filenames
20 endpoints — the sanity media library api stores and organizes images, videos, and files in a sanity media library, a store of assets kept apart from any one project dataset.
METHOD
PATH
DESCRIPTION
/media-libraries/{libraryId}/upload
Upload an asset
/media-libraries/{libraryId}/from-url
Upload an asset from a URL
/media-libraries/{libraryId}/query
Query media with GROQ
/media-libraries/{libraryId}/mutate
Create, patch, or delete media documents
/media-libraries/{libraryId}/refsearch
Search assets and references
/media-libraries/{libraryId}/references/documents/{assetId}/to
List references to an asset
/media-libraries/{libraryId}/video/{videoId}/subtitles
Generate subtitles with AI
/media-libraries/{libraryId}/video/{videoId}/playback-info
Get video playback information
/media-libraries/{libraryId}/upload
Upload an asset
/media-libraries/{libraryId}/from-url
Upload an asset from a URL
/media-libraries/{libraryId}/query
Query media with GROQ
/media-libraries/{libraryId}/mutate
Create, patch, or delete media documents
/media-libraries/{libraryId}/refsearch
Search assets and references
/media-libraries/{libraryId}/references/documents/{assetId}/to
List references to an asset
/media-libraries/{libraryId}/video/{videoId}/subtitles
Generate subtitles with AI
What agents get from Jentic-routed access to this vendor.
Setup
Wiring the Sanity Media Library by hand means choosing between multipart and raw-byte uploads, passing type, title, and cdnAccessPolicy as query parameters, and knowing which operations need a token and which video routes are open. Through Jentic you install once, import it from the API Directory, store the token once, and your agent calls it.
Permission scoping
Sanity puts the library id, and for video the video id, in the URL path (/media-libraries/{libraryId}/...), so a rule can pin your agent to one library and the operations you pick. You choose the operations it may call, so destructive ones like mutate deletions, deleteSubtitle, or deleteSigningKey are not included unless you add them.
Credential isolation
Your Sanity token is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
Intent-based discovery
Agents search Jentic by intent such as 'upload an image to the Sanity Media Library' or 'generate subtitles for a video', and Jentic returns the matching operation, such as uploadAssetFromUrl or generateSubtitle, with its input schema.
Alternatives and complements available in the Jentic catalogue.
Specific to using Media Library API through Jentic.
What authentication does the Sanity Media Library API use?
Per its OpenAPI spec, the Media Library API uses a bearer token (BearerAuth, a JWT) in the Authorization header for uploads, mutations, searches, references, subtitles, and signing keys. The two query operations accept a bearer token optionally. The six video playback, playback redirect, and rendition operations, GET and HEAD, are public operations that declare no security at all. Through Jentic the token is stored by your own instance and attached at call time where it is needed.
Can I upload an asset from a URL?
Yes. POST to /media-libraries/{libraryId}/from-url with a JSON body holding the url and a filename. Sanity fetches a public or preauthorized HTTPS URL through its egress proxy, limited to 50 MiB, and does not forward your credentials or headers to the source. The type, title, and cdnAccessPolicy go in query parameters.
How do I add subtitles to a Sanity video?
Call generateSubtitle with a languageCode to have AI produce them; it returns a processing status immediately and needs AI features enabled for the organization, otherwise it returns 400. To use your own captions, call uploadSubtitle with the VTT or SRT file as the raw body and languageCode, format, and closedCaptions as query parameters.
What are the rate limits for the Sanity Media Library API?
The OpenAPI spec does not specify rate limits. Check the Sanity documentation at https://www.sanity.io/docs for current API limits for your plan.
Is there a Sanity Media Library MCP server?
You don't need an MCP server to give your agent the Sanity Media Library API. Jentic connects it directly from the API Directory: import it, store your Sanity token once, and your agent calls the upload, query, and subtitle operations it needs without loading a separate server's tool definitions.
How do I find where an asset is used through Jentic?
Search Jentic for 'find documents that reference a Sanity asset', load the getReferencesToAsset operation, and execute GET /media-libraries/{libraryId}/references/documents/{assetId}/to with the asset id, following the cursor for more results. To run it on your own infrastructure, install Jentic One from its GitHub repo.
Can I limit what my agent is allowed to do with the Sanity Media Library API?
Yes. A rule that allows only the upload, from-url, and refsearch operations under one libraryId lets the agent add and find assets in that library, while mutate, subtitle deletion, and signing key changes stay off its list. Every call it makes is logged.
For Agents
Upload images, videos, and files to a Sanity Media Library, query and edit asset documents with GROQ, find where an asset is used, and add subtitles to videos.
Use for: Upload this product photo to our Sanity Media Library, Import an image from this URL into the media library as a private asset, Find every document that uses this asset before I delete it, Search the media library for assets matching the term summer
Not supported: Does not transform or resize images on the fly, manage project datasets, or edit page content. Use for storing, querying, and serving assets in a Sanity Media Library only.
The Sanity Media Library API stores and organizes images, videos, and files in a Sanity Media Library, a store of assets kept apart from any one project dataset. It uploads assets directly or fetches them from a public HTTPS URL, with a type of image, video, or file and a cdnAccessPolicy of public, authenticated, or private, then queries and mutates asset documents with GROQ and the Content Lake mutation syntax. It also searches assets and the documents that reference them, delivers video through playback info, thumbnails, storyboards, streams, and renditions, generates subtitles with AI or accepts uploaded VTT and SRT files, and manages the signing keys used for protected media.
This API is usable in Jentic One now. Its AI-readiness score against Jentic's framework shows where it stands today and where improvements would make it even easier for agents to use.
/media-libraries/{libraryId}/video/{videoId}/playback-info
Get video playback information
Base layer of spec validity and structural soundness.
Aggregated quality score from linter diagnostics, weighted by severity.
Percentage of `$ref` references that resolve successfully.
Checks whether the API description parses successfully and conforms to its declared specification (e.g., OpenAPI).
Structural correctness score based on schema issues using logarithmic dampening.
Clarity, completeness, and ingestion readiness for developers and tooling.
How richly the API is illustrated with examples.
Percentage of examples that conform to their schemas.
Percentage of operations with complete response definitions (success, client error, server error).
Health of API ingestion, bundling, and resolution within Jentic pipelines.
Semantic breadth, depth, and agent comprehension for AI systems.
Coverage of descriptions across API elements.
Coverage of RFC 9457 Problem Details for error responses.
Coverage, uniqueness, and casing consistency of operationIds for AI inference.
Coverage of summaries across operations/tags/info.
Functional utility, complexity comfort, and AI orchestration readiness.
Agent comfort level based on API operational and structural complexity.
Trust, risk posture, and security compliance.
Average quality of security schemes based on authentication method strength (weakest link for OAuth2).
Findability, semantic richness, and reasoning readiness.
Clarity and depth of descriptions across API elements.
Score it yourself
Every API in the directory is allowlisted, so you can re-score it with no key required.
npx @jentic/api-scorecard-cli score <openapi-url>