API ReferenceYouTube Stats API

YouTube Stats API

The YouTube Stats API retrieves engagement metrics and metadata for YouTube videos, including view counts, likes, comments, and channel information.

Endpoint

https://api.socialkit.dev/youtube/stats

Example Request

GET https://api.socialkit.dev/youtube/stats?access_key=<your-access-key>&url=https://youtube.com/watch?v=dQw4w9WgXcQ

Response

{
	"success": true,
	"data": {
		"url": "https://youtube.com/watch?v=dQw4w9WgXcQ",
		"videoId": "dQw4w9WgXcQ",
		"title": "Rick Astley - Never Gonna Give You Up (Official Video)",
		"description": "...",
		"channelName": "Rick Astley",
		"channelLink": "https://youtube.com/channel/UCuAXFkgsw1L7xaCfnd5JJOw",
		"channelHandle": "@RickAstleyYT",
		"views": 1428567890,
		"likes": 16234567,
		"comments": 4567890,
		"duration": "3:33",
		"publishedAt": "2009-10-25T07:57:33.000Z",
		"thumbnailUrl": "https://i.ytimg.com/vi/dQw4w9WgXcQ/maxresdefault.jpg",
		"contentType": "video",
		"isShortForm": false
	}
}

Parameters

url string Required
The YouTube URL of the video to get statistics for. Supports various YouTube URL formats.


access_key string Required
Your API access key. Can be provided via the access_key query parameter, x-access-key header, or request body.


cache boolean Optional Defaults to false
Cache the response for faster subsequent requests.


cache_ttl number Optional Defaults to 2592000
Cache the response for a custom TTL (in seconds). Maximum 2592000 seconds (1 month), minimum 3600 seconds (1 hour).

Response Fields

The API returns the following data fields:

  • url: The original YouTube URL provided
  • videoId: The 11-character YouTube video ID (e.g. dQw4w9WgXcQ)
  • title: The video title
  • description: The video description
  • channelName: The display name of the YouTube channel
  • channelLink: Direct link to the YouTube channel (channel ID URL)
  • channelHandle: The channel’s @handle (e.g. @RickAstleyYT). Empty for older channels that never set a handle.
  • views: Total view count (number)
  • likes: Total like count (number)
  • comments: Total comment count (number)
  • duration: Video duration in M:SS or H:MM:SS format
  • publishedAt: ISO 8601 timestamp of when the video was published (e.g. 2009-10-25T07:57:33.000Z). Falls back to the raw upstream string if it can’t be parsed.
  • thumbnailUrl: URL to the video thumbnail
  • contentType: "video" for regular YouTube videos, "short" for YouTube Shorts
  • isShortForm: true for Shorts and any video ≤ 60s, false otherwise. Useful for filtering long-form vs short-form content programmatically.

Use Cases

  • Social Media Analytics: Track video performance across different platforms
  • Content Research: Analyze engagement metrics for popular videos
  • Competitor Analysis: Monitor competitor video performance
  • Trend Analysis: Identify viral content and engagement patterns
  • Marketing Insights: Understand what content resonates with audiences
  • Reporting: Generate reports on video performance metrics
  • Content Strategy: Make data-driven decisions about video content

Notes

  • View counts, likes, and comments are retrieved in real-time
  • All numeric fields are returned as integers
  • Channel links use the standard YouTube channel URL format
  • Statistics may vary slightly due to YouTube’s real-time updates