Social platforms

Browse YouTube's trending videos · YouTube API

GET/youtube/trending
$min $0.001

Return YouTube's country-aware trending videos, optionally scoped to a section (now, music, gaming, or movies). Useful for tracking what is gaining traction in a given market and timing content to live interest.

Try it without an API key: YouTube trending videos — what's trending today.

Using ChatGPT, Claude Code or another client? See the setup steps

Request
curl https://api.unifapi.com/youtube/trending \
  -H "Authorization: Bearer $UNIFAPI_KEY"

Parameters

countryquery
Optional ISO 3166 country code, e.g. `US` (default), `GB`.
typequery
Optional trending section (default `now`).
language_codequery
Optional language code, e.g. `en`.
Overview

This operation is part of the YouTube API in the social platforms category. It uses the same Bearer token, request tracing, error model, and billing envelope as every UnifAPI endpoint, so agents can switch between platforms without custom per-vendor glue code.

Use it when a workflow needs YouTube public data alongside other social networks, but should still keep one API key, one account balance, and one predictable JSON contract.

Common agent workflows

  • Track what is moving on YouTube for trend-discovery and content-planning agents.
  • Compare live YouTube signals with other public social data sources available through the same MCP and HTTP surface.
  • Give an AI agent a stable YouTube data source without building a per-platform integration.
  • Normalize YouTube responses into the same UnifAPI envelope used across the catalog.
Response shape

Unified envelope, platform-native fields

  • List-style responses return `data` as an array of top-level records plus optional `pagination` for continuation tokens or cursors.
  • The `billing.records_charged` field reports the charged billable-record quantity for the successful response.
  • If the workspace balance cannot cover every result, the response can be truncated and `billing.truncated_due_to_balance` tells the caller why.

Response status codes

200400401402404429500502503

Billing

This operation charges 1 credit per billable record, with a 1 credit ($0.001) operation minimum. Public responses include billing metadata with credits charged, records charged, and remaining workspace balance. Incorrect Credit deductions caused by platform failures can be restored as billing corrections.

Errors and retries

Authentication, validation, rate-limit, not-found, and provider errors use the unified UnifAPI error format. Agents should log `request_id`, retry only retryable failures, and treat invalid API keys, disabled keys, and expired keys as the same public `unauthorized` error type.

Response fields

Fields in the data object

A successful Browse YouTube's trending videos call returns one data object with these fields.

itemsobject[]
items[].idstring
YouTube video id (e.g. `oaSNBz4qMQY`).
items[].titlestring
items[].authorstring
items[].channel_idstring
items[].descriptionstring
items[].duration_secondsnumber
items[].view_countnumber
items[].published_timestring
Relative time string from source (e.g. `3 weeks ago`).
items[].is_liveboolean
items[].categorystring
Related endpoints

More YouTube operations

Combine endpoints from the same platform, then join the results with other UnifAPI categories without changing authentication or response parsing.

GET/youtube/search/playlists

Search YouTube playlists by keyword

Search YouTube playlists by keyword, returning matching playlists with owner channel and video count. Useful for finding curated collections and series on a topic.

GET/youtube/videos/{video_id}

Get a YouTube video by id

Return a single YouTube video's details by its video ID — title, description, channel, duration, category, publish time, and view and like counts. Useful for hydrating a known video or checking its current engagement.

GET/youtube/channels/{channel_id}

Get a YouTube channel by id

Return a YouTube channel's profile by its `UC…` channel ID, including title, handle, description, subscriber count, banner art, topic keywords, and external links. Useful as the entry point for any channel-level research or competitive analysis.

GET/youtube/channels/{channel_id}/community

List a YouTube channel's community posts

Return a YouTube channel's community-tab posts, by its `UC…` channel ID, as a cursor-paginated list — text, like and reply counts, and attachment kind. Useful for tracking creator announcements and audience engagement outside of videos.

GET/youtube/channels/{channel_id}/playlists

List playlists created by a YouTube channel

Return the playlists a YouTube channel has published, by its `UC…` channel ID, as a cursor-paginated list. Useful for mapping how a creator organizes their catalog into series and collections.

GET/youtube/channels/{channel_id}/search

Search within a YouTube channel

Search a single YouTube channel's videos by keyword, by its `UC…` channel ID, as a cursor-paginated list. Useful for finding a creator's coverage of a specific topic without scanning their whole catalog.