Back to Blog
YouTube

YouTube Video Details API: Get Complete Video Metadata

February 12, 2026
5 min read
S
By SociaVault Team
youtubevideo detailsapivideo metadata

YouTube Video Details API: Get Complete Video Metadata

Sometimes you don't need a whole channel — you need everything about one specific video. View count, likes, comments, the full description, the keywords, the channel behind it, how long it is. The Video Details endpoint returns all of that as clean JSON from a single URL, which makes it the building block for video tracking, engagement analysis, and competitor comparison.

This is a quick, practical reference: the request, the real response shape, and a few patterns worth copying.

The request

One required parameter — the video url (a full watch URL or a Short URL both work).

const res = await fetch(
  "https://api.sociavault.com/v1/scrape/youtube/video?url=" +
    encodeURIComponent("https://www.youtube.com/watch?v=dQw4w9WgXcQ"),
  { headers: { "x-api-key": "YOUR_API_KEY" } },
);
const { data } = await res.json();
ParameterTypeRequiredDescription
urlstringYesYouTube video or Short URL
languagestringNoPreferred language for transcript/captions

The response

The useful thing here is that counts come as integers (viewCountInt, likeCountInt, commentCountInt) alongside their display strings — so you can do math without parsing "1.5B" text.

{
  "success": true,
  "data": {
    "id": "dQw4w9WgXcQ",
    "url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "title": "Rick Astley - Never Gonna Give You Up",
    "description": "The official video for \"Never Gonna Give You Up\"...",
    "publishDate": "2009-10-25T06:57:33Z",
    "type": "video",
    "viewCountInt": 1500000000,
    "likeCountInt": 15000000,
    "commentCountInt": 2800000,
    "durationFormatted": "00:03:33",
    "durationMs": 213000,
    "genre": "Music",
    "keywords": ["rick astley", "never gonna give you up", "rickroll"],
    "channel": {
      "id": "UCuAXFkgsw1L7xaCfnd5JJOw",
      "handle": "RickAstley",
      "title": "Rick Astley",
      "url": "https://www.youtube.com/@RickAstley"
    },
    "thumbnail": "https://img.youtube.com/vi/dQw4w9WgXcQ/maxresdefault.jpg"
  },
  "credits_used": 1,
  "endpoint": "youtube/video"
}

A couple of field notes that save debugging time: the video's tags are in the keywords field (not tags), and the content type is in type (e.g. "video") rather than separate boolean flags. Always log a real response once to confirm shapes for the videos you care about.

Pattern 1: Track a video over time

Snapshot the integer counts on a schedule and diff them to see daily momentum.

async function trackVideo(videoUrl) {
  const res = await fetch(
    `https://api.sociavault.com/v1/scrape/youtube/video?url=${encodeURIComponent(videoUrl)}`,
    { headers: { "x-api-key": "YOUR_API_KEY" } },
  );
  const { data } = await res.json();

  await saveMetrics({
    videoId: data.id,
    views: data.viewCountInt,
    likes: data.likeCountInt,
    comments: data.commentCountInt,
    at: new Date(),
  });

  const prev = await getYesterdayMetrics(data.id);
  if (prev)
    console.log(
      `Views +${(data.viewCountInt - prev.views).toLocaleString()} since yesterday`,
    );
}

Pattern 2: Engagement rate

const { data } = await (
  await fetch(
    `https://api.sociavault.com/v1/scrape/youtube/video?url=${encodeURIComponent(url)}`,
    { headers: { "x-api-key": "YOUR_API_KEY" } },
  )
).json();

const engagementRate =
  ((data.likeCountInt + data.commentCountInt) / data.viewCountInt) * 100;
console.log(`Engagement: ${engagementRate.toFixed(3)}%`);

Pattern 3: Compare several videos at once

const urls = ["https://youtu.be/A", "https://youtu.be/B", "https://youtu.be/C"];

const videos = await Promise.all(
  urls.map(async (u) => {
    const r = await fetch(
      `https://api.sociavault.com/v1/scrape/youtube/video?url=${encodeURIComponent(u)}`,
      { headers: { "x-api-key": "YOUR_API_KEY" } },
    );
    return (await r.json()).data;
  }),
);

console.table(
  videos.map((v) => ({
    title: v.title,
    views: v.viewCountInt,
    engagement:
      (((v.likeCountInt + v.commentCountInt) / v.viewCountInt) * 100).toFixed(
        3,
      ) + "%",
    genre: v.genre,
  })),
);

Pattern 4: Compare keywords with a competitor

The keywords field is great for SEO research — see which terms you share with a competing video and which you're missing.

const mine = (await getVideo(myUrl)).keywords || [];
const theirs = (await getVideo(competitorUrl)).keywords || [];

const shared = mine.filter((k) => theirs.includes(k));
const theyHaveIDont = theirs.filter((k) => !mine.includes(k));

console.log("Shared keywords:", shared);
console.log("Keywords they target that I don't:", theyHaveIDont);

That last list — keywords a higher-ranking competitor targets that you don't — is often the quickest SEO win available.

Frequently Asked Questions

Can I use a video ID instead of a full URL?

Yes — both a full watch URL and a Short URL work. If you only have an ID, wrap it in a standard watch URL (https://www.youtube.com/watch?v=ID) before passing it.

Where are the video's tags in the response?

In the keywords field, not a tags field. YouTube hides these from the public UI, but they're returned in the video metadata, which makes them useful for SEO and competitor keyword analysis.

Are Shorts supported?

Yes. Pass a Short's URL the same way. The type field in the response tells you what kind of content it is, so you can branch on it if you handle Shorts and long-form differently.

How current are the view counts?

They're fetched live, so they reflect the video's current numbers at request time (within minutes). That's why snapshotting on a schedule lets you compute daily deltas accurately.

What happens with private, deleted, or age-restricted videos?

Private and deleted videos return an error since there's no public data to read. Age-restricted videos may return limited metadata. Only public videos return the full response.

How many credits does it cost?

One credit per video lookup. Comparing several videos costs one credit each, so a five-video comparison is five credits.

Get Started

Pull full metadata for any public video with one call. Start free with SociaVault — 50 credits, no card — or read the endpoint docs.

Found this helpful?

Share it with others who might benefit

Ready to Try SociaVault?

Start extracting social media data with our powerful API. No credit card required.