You have a YouTube URL and you need the JSON for its title, duration, channel, views, thumbnail, and video ID—without downloading the video or wiring up a full YouTube SDK. By the end of this guide, you’ll call the YouTube Video Info endpoint on Zyla API Hub to turn a watch or Shorts URL into structured metadata you can persist in your app today.
What this API does (and why you’d use it)
The YouTube Premium Download API on Zyla API Hub exposes an Info endpoint that accepts an official YouTube watch URL (and also works with /shorts/ URLs). It returns:
- title
- duration
- channel
- views
- thumbnail image URL
- video ID
No video transfer is involved; you just get the metadata you need. Typical use cases:
- Save canonical titles, durations, and thumbnails when a user pastes a YouTube link into your product.
- Pre-fill video details in a CMS or content pipeline.
- Enrich database records during ingestion jobs without a heavyweight integration.
Live streams may return limited metadata, which is expected behavior for in-progress streams. If you also need binary media or progressive download, the product provides a separate download job path, but this post focuses on Info only.
Where to find it on Zyla API Hub
The Info endpoint is part of the YouTube Premium Download API on Zyla API Hub. Browse or subscribe here:
YouTube Premium Download API on Zyla API Hub
You can also explore thousands of other production-ready APIs on zylalabs.com with one account and one API key. Subscribe per listing. There’s no Free Plan; however, your first Hub API includes a 7-day free trial (up to 50 requests). Check the API page for current access options and pricing.
Getting started on Zyla API Hub
- Register for a Zyla account. Your first Hub API includes a 7-day free trial (up to 50 requests).
- Open the API listing, click Subscribe, and copy your Bearer API key from your dashboard.
- Call the Info endpoint with either a watch URL (for example, https://www.youtube.com/watch?v=jNQXAC9IVRw) or a /shorts/ URL.
- Persist the returned title, duration, channel, views, thumbnail, and video ID in your database.
If you prefer to orchestrate from an AI coding agent or an MCP-compatible client, the same APIs are available through the MCP endpoint described later in this guide.
Info endpoint: what it returns and how to call it
The Info endpoint reads a YouTube URL and returns structured JSON with the fields listed above. You provide an official YouTube watch URL (or a Shorts URL). If you’re handling user input, validate that the link includes either watch?v= or /shorts/ before calling the API.
Reference documentation for Info is available here:
Info endpoint documentation on Zyla
cURL example and official sample response
The following block contains a complete, copy-pasteable cURL call and its official JSON response. Replace YOUR_API_KEY with your key and use the sample URL https://www.youtube.com/watch?v=jNQXAC9IVRw (YouTube’s first video) or another watch/shorts URL you need to inspect.
curl -H "Authorization: Bearer YOUR_API_KEY" \
"https://zylalabs.com/api/13563/youtube-premium-download-api/30268/info?url=https://www.youtube.com/watch?v=jNQXAC9IVRw"
Field-by-field: what to store and how to use it
- title: The human-readable title for display and search.
- duration: Persist exactly as returned; if you need a uniform format for UX (for example, mm:ss), convert after storing the raw value. Treat unknown or missing duration for live streams accordingly.
- channel: The channel name for attribution and filtering.
- views: An integer count for analytics or popularity sorting. Use as-is and be ready for large numbers.
- thumbnail image URL: Store the URL, not the image. Fetch on demand or cache with a short TTL to keep bandwidth down.
- video ID: The canonical ID (e.g., jNQXAC9IVRw). Use it to de-duplicate records or to re-derive a watch URL.
Live streams: Fields may be missing or partial. Code defensively by testing for the presence of each key; don’t assume every response includes all fields for every video state.
Robust error handling and retries
Build around three realities:
- Input validation: Only pass official watch URLs or /shorts/ URLs. Reject malformed input early.
- Response checks: Handle HTTP errors from the request. If the API indicates an error or missing fields, surface a clear message to users and allow retry.
- Live or recently published videos: Metadata may be limited or temporarily unavailable; implement a short, capped retry with exponential backoff.
If your code expects a title or video ID and they are absent, skip downstream steps and log the event. For consistent user experience, render a placeholder label in UI while you retry in the background.
JavaScript/Python example to parse the response
The snippet below sends the same request shown in the cURL example and extracts the fields you’re likely to persist. Replace YOUR_API_KEY with your token. Use the same request URL as in the cURL above.
// Node.js (native fetch or node-fetch). Requires Node 18+ for global fetch.
const API_URL = "USE_THE_SAME_URL_AS_IN_THE_CURL_EXAMPLE_ABOVE";
const API_KEY = "YOUR_API_KEY";
async function fetchVideoInfo() {
const res = await fetch(API_URL, {
method: "GET",
headers: {
"Authorization": `Bearer ${API_KEY}`
}
});
if (!res.ok) {
const text = await res.text();
throw new Error(`Request failed: ${res.status} - ${text}`);
}
const data = await res.json();
// Defensive parsing: check each field before using
const title = data.title ?? null;
const duration = data.duration ?? null;
const channel = data.channel ?? null;
const views = data.views ?? null;
const thumbnail = data["thumbnail image URL"] || data.thumbnail || null; // support potential key naming variants
const videoId = data["video ID"] || data.videoId || null;
// Persist or use as needed
return { title, duration, channel, views, thumbnail, videoId };
}
fetchVideoInfo()
.then(info => {
console.log("Parsed video info:", info);
// TODO: upsert into your DB
})
.catch(err => {
console.error("Error calling Info endpoint:", err);
});
Production pointers that save time
- Input normalization: Accept both watch and /shorts/ URLs. Strip tracking parameters (like
&t=) before calling the Info endpoint if your app collects them, but always keep the canonical watch or shorts URL intact. - Deduplication: Index on
video ID, not the full URL. Users often paste variations of the same video link. - Caching: Since titles and thumbnails rarely change, cache responses by
video ID. A 24-hour TTL covers most use cases; adjust based on how fresh you need the view count. - Thumbnails: Store the thumbnail URL and let your CDN or frontend fetch it lazily. If you cache the image, set a reasonable revalidation window; creators sometimes update thumbnails.
- Views: Treat this as a snapshot at the time of your call. Don’t assume it’s real-time.
- Durations: For live streams or scheduled premieres, duration can be missing or non-final. In your UI, fall back to “Live” or “—” until a concrete value appears.
Using the Info endpoint for Shorts
Shorts work with the same path as regular videos; simply provide a /shorts/ URL. Ensure your URL detection handles both forms in copy/paste flows:
- watch: https://www.youtube.com/watch?v=VIDEO_ID
- shorts: https://www.youtube.com/shorts/VIDEO_ID
Store the results exactly the same way. If you display durations in your UI, some Shorts may present very small durations—keep your formatting resilient across a range from seconds to hours.
Call this API from an AI agent (MCP)
Every API on Zyla API Hub is reachable from MCP-compatible clients (Claude Code, Cursor, Windsurf, and more) using the MCP endpoint. This is useful if your developer workflow or internal tools are agent-driven and need to fetch video metadata on the fly.
Use this MCP endpoint with your API key to enable your agent to call subscribed APIs:
Once your key is configured, instruct the agent to call the YouTube Premium Download API’s Info capability with the watch or /shorts/ URL you want to resolve. The agent will return the same JSON fields described above. Keep your key scoped to a secure workspace and avoid logging secrets.
Operational checklist before you ship
- Subscribe to the API on the listing page and confirm your key works via the cURL sample.
- Accept both watch and /shorts/ URLs in your UI.
- Parse and store: title, duration, channel, views, thumbnail image URL, video ID.
- Handle missing values and HTTP errors with a user-friendly fallback flow.
- Cache by video ID with a TTL appropriate for your freshness needs.
- Re-run the call for live or recently published videos after a short delay if you need updated details.
API docs and helpful links
- API listing: YouTube Premium Download API
- Info endpoint docs: Info endpoint
- Zyla home: zylalabs.com
- Create an account: Register
FAQ
Which YouTube URLs does the Info endpoint accept?
Official watch URLs (containing watch?v=) and /shorts/ URLs.
Do I need to download the video to get metadata?
No. The Info endpoint returns title, duration, channel, views, thumbnail image URL, and video ID without transferring the media file.
How do I handle live streams?
Live streams may return limited metadata. Code defensively for missing fields and retry later if you need updated values.
Is there a free plan?
There’s no Free Plan. Your first Hub API includes a 7-day free trial (up to 50 requests). Check the API page for current access options and pricing.
Can I call this from an AI coding agent?
Yes. Use the MCP endpoint and your API key to invoke the Info capability from MCP-compatible clients.
Ready to turn YouTube links into structured JSON your app can use? Create your account on Zyla, subscribe to the API, and ship your integration this week. Start here: Register. Explore more production-ready APIs at zylalabs.com.