Blog/Developer Tools/

YouTube Public Data API: Search & Channels | SandBase

Search YouTube and read public videos, channels, comments, and captions with one REST API — one SandBase key, built for agents.

Dark cinematic render of YouTube video, channel, and search data flowing through one API conduit into an agent core

YouTube is the largest public video corpus on the internet, and its search, channel, and caption data feeds everything from media monitoring to content research to transcript pipelines for LLMs. The official YouTube Data API can do a lot, but it means a Google Cloud project with credentials and a daily quota you budget against; public list reads work with an API key, while private and account-authorized operations require OAuth, and caption download follows its own flow.

The SandBase YouTube public data API gives you a simpler read path. It searches YouTube and reads public videos, channels, comments, and captions through plain REST endpoints — one SandBase API key and no Google Cloud project on your side. The field names and JSON shapes below are illustrative examples to show the general structure; confirm the exact parameters and response fields against each endpoint’s live API reference and a real response.

This is not Google’s official YouTube Data API. Use the official YouTube Data API when you need authenticated actions on your own account, uploads, or Google-governed quota. Use SandBase when your workflow needs public, read-only search and content data for research, monitoring, or enrichment. Ready to try it? Get a SandBase API key and browse the YouTube endpoints.

Key takeaway

  • One API searches YouTube and reads public videos, channels, comments, captions, and suggestions.
  • The Model API endpoints in this guide are called with POST /v1/api/youtube/<path> — pass only that endpoint’s params, no Google Cloud project, one SANDBASE_API_KEY.
  • Endpoints key off natural identifiers: search_query, video_id, channel_id, channel_name, or a keyword.
  • It returns public, read-only data only. There is no uploading, no account actions, and no Google OAuth on your side; authenticate with a SandBase API key.

Which YouTube API do you need?

Your needChooseWhy
Upload, manage your own channel, or act on an authenticated accountOfficial YouTube Data APIOAuth-protected account actions (public list reads there use an API key); Google-governed quota.
Search and read public videos, channels, comments, or captionsSandBase YouTube public-data APIPlain REST, one SandBase key, structured JSON for read-only workflows.
Private or account-only data and analyticsNeither public workflowOwner analytics and private data are out of scope for this public-data guide.

What you can get from the YouTube API

The catalog spans a web surface and a newer web-v2 surface. Grouped by job:

  • Search — general search, video search, shorts search, and search suggestions.
  • Videos — video info, related videos, streams, and comments with replies.
  • Channels — resolve a channel id from a name or URL, then read channel info, videos, shorts, and community posts.
  • Captions & transcripts — video captions and subtitles per video.

Not every listed capability is enabled for direct calls yet — a couple of endpoints returned an upstream error while I was testing — so treat each endpoint’s live API reference as the source of truth before you build.

SandBase YouTube API page: description, capability tags, and the YouTube Endpoints list The YouTube API page on SandBase — a tagged overview and the endpoint list, each with its path.

What YouTube provides vs. what SandBase adds

Public data comes from YouTube. SandBase does not own or operate YouTube; it provides a uniform API layer for eligible public-data workflows. Each capability becomes one stable endpoint, auth collapses to a single key, and responses come back as predictable JSON — so an agent can chain “resolve a channel → list its videos → pull a video’s comments” along one convention instead of managing OAuth scopes and daily quota.

Quick start: your first call

SandBase exposes more than one API surface. The catalog may show GET paths under /apis/v1/...; this guide uses the vendor-qualified Model API path on each endpoint’s API reference. Do not swap the HTTP method or URL — follow the reference for the endpoint you choose.

Resolve a channel id from a channel name:

import os
import requests

resp = requests.post(
    "https://api.sandbase.ai/v1/api/youtube/web/channel-id",
    headers={
        "Authorization": f"Bearer {os.environ['SANDBASE_API_KEY']}",
        "Content-Type": "application/json",
    },
    json={"channel_name": "NASA"},
)
resp.raise_for_status()
body = resp.json()
if body.get("status") != "completed":
    error = body.get("error", {})
    raise RuntimeError(error.get("message", "YouTube request did not complete"))

data = body["outputs"][0]["data"]
# Field names are illustrative — confirm the exact keys against a live response.
print(data.get("channel_name"), data.get("channel_id"))
curl -X POST https://api.sandbase.ai/v1/api/youtube/web/channel-id \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"channel_name": "NASA"}'

Every response uses the same SandBase envelope: an id, a status, the model name, and an outputs array whose single item carries the payload under data. Only this envelope is guaranteed; the business fields nested inside data are set by the upstream surface, so the endpoint reference and a real response are the source of truth. Status can be pending, running, completed, failed, or timeout — check each endpoint’s reference for its run mode and branch on status rather than assuming a request always returns a completed payload. The block below is an illustrative response shape only — the nested field names and values are examples, not a guaranteed schema, so confirm the exact fields against a live response:

{
  "id": "3cdfb9e9-51d0-4129-82cf-055edbdc1199",
  "status": "completed",
  "model": "youtube/web/channel-id",
  "outputs": [
    {
      "data": {
        "…": "illustrative response shape — confirm the nested fields against a live response"
      }
    }
  ]
}

A channel-resolving endpoint is meant to give you a channel id you carry into the channel and video endpoints. A failed or timeout run carries error and never outputs, so branch on status before reading outputs[0].data. Response shapes differ by endpoint — inspect one real response and map the exact path per endpoint.

SandBase API reference for a YouTube endpoint, showing the vendor-qualified URL, the parameter, and the response schema The endpoint API reference is the source of truth for each parameter name and response path.

Capability map

Capability clusterRepresentative endpointTypical use
Searchyoutube/web-v2/general-searchBroad topic and keyword discovery
Search suggestionsyoutube/web-v2/search-suggestionsKeyword expansion and autocomplete research
Channel resolveyoutube/web/channel-idName/URL → channel id
Channel contentyoutube/web-v2/channel-videosList a channel’s videos
Video infoyoutube/web-v2/video-infoMetadata, author, category, captions availability
Commentsyoutube/web-v2/video-commentsEngagement and sentiment analysis
Captionsyoutube/web-v2/video-captionsTranscript pipelines

Paging differs by endpoint — several endpoints accept an optional continuation_token request parameter. Check each endpoint’s reference for whether and how it paginates.

SandBase YouTube Endpoints list showing search, video, channel, comment, and caption endpoints with their paths A slice of the YouTube endpoint list across the web and web-v2 surfaces.

Chaining calls in an agent workflow

Because every endpoint shares the same auth and the same response envelope, an agent can walk from a search term to a transcript without special-casing each surface. A common content-research pattern looks like this:

  1. Discover. Call youtube/web-v2/general-search with a search_query to find candidate videos and channels, then read the fields you need from a real response.
  2. Resolve the channel. Call youtube/web/channel-id with a channel_name to get a stable channel_id, then youtube/web-v2/channel-videos to list its uploads.
  3. Read the video. Call youtube/web-v2/video-info with a video_id for metadata, then youtube/web-v2/video-comments and youtube/web-v2/video-captions for engagement and caption tracks.

Each step returns the same { id, status, model, outputs } shape, so your agent branches on status once and reuses the same JSON-reading code across every step.

Common use cases

YouTube search API for topic discovery

Run youtube/web-v2/general-search with a query to survey the field, and use youtube/web-v2/search-suggestions to expand a seed keyword into related autocomplete queries. Input: a query or keyword. Output: results and suggestion lists. Endpoints: general-search, search-suggestions.

YouTube channel API for creator research

Resolve a channel with youtube/web/channel-id, then read its videos with youtube/web-v2/channel-videos. Input: a channel name. Output: a channel id and its video list. Endpoints: channel-id, channel-videos.

YouTube captions API for transcript pipelines

Use youtube/web-v2/video-captions to discover a video’s available caption tracks (calling without a language returns the track list), then request a specific language_code to fetch that track for a summarization or search pipeline. Input: a video id (plus an optional language_code). Output: available tracks, then the selected track. Endpoint: video-captions. For the full four-call walkthrough, see how to build a YouTube transcript pipeline.

Limitations and boundaries

  • Public, read-only data only. No uploading, account actions, or owner analytics.
  • Rate and volume. Treat responses as best-effort reads and handle HTTP 429 with backoff.
  • Parameters and shapes follow the upstream surface. Identifiers vary (search_query, video_id, channel_id, channel_name, keyword); some endpoints accept an optional continuation_token for paging. Inspect a real response and read the schema first.
  • Not every listed endpoint is callable yet. A couple of endpoints returned an upstream error during testing; verify against the live API reference before building on a specific endpoint.
  • This is not an official Google partnership. SandBase provides uniform access to public data; respect YouTube’s terms and applicable rules for your use case.

FAQ

Do I need a Google Cloud project or YouTube OAuth? No. You authenticate to SandBase with your SANDBASE_API_KEY. You do not create a Google Cloud project or manage OAuth quota for these read endpoints.

What identifies a video or channel? Natural identifiers: video_id, channel_id, and channel_name. Search takes a search_query; suggestions take a keyword. Use channel-id to turn a name into a stable id first.

How does pagination work? Several endpoints accept an optional continuation_token request parameter for the next page. Check each endpoint’s reference for whether and how it paginates.

Can I read private videos or channel analytics? No. The API returns public data only. Private videos, unlisted-only data, and owner analytics are out of scope.

Can I collect transcripts or comments at higher volume? Check the live YouTube API listing for the current set of endpoints and their supported parameters, and confirm availability against each endpoint’s reference before building on it.

Start with one search request

Create a SandBase API key, resolve a channel with channel-id or run a general-search, and inspect the returned schema before you expand to videos, comments, or captions. When you are ready: