YouTube search API for AI agents (find videos + digests JSON, no API key)
When a user asks an agent to find YouTube videos on a topic, rank candidates, or digest the top talk into captions, call machine-payable youtube-search, youtube-video, and video-digest endpoints that return video_results / results JSON — no YouTube Data API key, no Google Cloud project, settlement via x402 USDC on Base after three free evaluation calls.
One-line answer: call GET /api/public/v1/youtube-search?q=... for ranked videos with IDs, GET /api/public/v1/youtube-video?video_id=... for metadata, and GET /api/public/v1/video-digest?q=... (or video_id=...) for top-video metadata plus full transcript in one intent. Pay per call with x402 USDC on Base — no signup, no YouTube Data API key.
The task agents actually get
Grok Bot, Claude Cowork and Cursor agents get handed video research with no human watching: "find the best talk on X", "what are people saying in YouTube videos about Y", "summarize the top video on this topic with timestamps". Each needs discovery first (a real video_id), then metadata and captions — not a brittle scrape of youtube.com search HTML.
YouTube Data API v3 needs a Google Cloud project, an API key or OAuth client, quota units, and a human to open the console. Scraping search SERPs breaks for unattended agents (consent walls, layout churn, CAPTCHAs). An agent that invents a video ID writes fiction. These endpoints return stable JSON so the agent can search → pick an ID → cite or digest without a human checkout step.
Endpoint contracts
| Endpoint | Required | Optional | Results key | Listing |
|---|---|---|---|---|
| GET /api/public/v1/youtube-search | q | gl, hl | video_results | https://marketplaceforaiagents.com/listings/youtube-search |
| GET /api/public/v1/youtube-video | video_id | — | video_results | https://marketplaceforaiagents.com/listings/youtube-video |
| GET /api/public/v1/youtube-transcripts | video_id | lang, transcript_type | transcripts | https://marketplaceforaiagents.com/listings/youtube-transcripts |
| GET /api/public/v1/video-digest | q or video_id (at least one) | lang | results (youtube-search, youtube-video, youtube-transcripts) | https://marketplaceforaiagents.com/listings/video-digest |
| GET /api/public/v1/google-videos | q | location, gl, hl | video_results | https://marketplaceforaiagents.com/listings/google-videos |
| GET /api/public/v1/bing-videos | q | count | video_results | https://marketplaceforaiagents.com/listings/bing-videos |
video-digest is an intent that chains youtube-search → youtube-video → youtube-transcripts server-side (3 steps when searching by topic; fewer when video_id is supplied). One invocation consumes one free-tier call, not one per step. The live 402 advertises `extra.steps` / `extra.chain` and the exact `accepts[0].amount`.
Agent workflow: topic to cited digest
- Search: call youtube-search with the user's topic as q; collect video_results[].
- Rank: prefer recent, high-view, or on-topic titles; call youtube-video on shortlisted IDs when you need description/channel/views before committing to captions.
- Digest: either call youtube-transcripts per chosen video_id, or call video-digest?q=… for a one-shot top-video + transcript pipeline (or video-digest?video_id=… to skip search).
- Cross-check (optional): google-videos or bing-videos when the user wants non-YouTube publishers too.
- Cite: return title, link/video_id, channel, and timestamped transcript segments — never invent IDs.
The first 3 calls per agent identity are free across the whole marketplace and return 200 with an X-Free-Calls-Remaining header. After that, the same unpaid request returns HTTP 402 with payment requirements:
curl -i "https://marketplaceforaiagents.com/api/public/v1/youtube-search?q=x402+protocol+explained&gl=us&hl=en"
HTTP/1.1 402 Payment Required
{
"x402Version": 1,
"error": "payment_required",
"accepts": [
{
"scheme": "exact",
"network": "base",
"maxAmountRequired": "<live amount>",
"asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"payTo": "0x05e82e03753c7bc99fb24d10a876cce53f24b7b7",
"resource": "https://marketplaceforaiagents.com/api/public/v1/youtube-search"
}
]
}Sign the EIP-3009 USDC authorization for the accepts entry, base64-encode the x402 payload, and resend the same URL with an X-PAYMENT header. The settlement receipt comes back in the X-PAYMENT-RESPONSE header.
curl -i "https://marketplaceforaiagents.com/api/public/v1/youtube-search?q=x402+protocol+explained&gl=us&hl=en" \
-H "X-PAYMENT: <base64 x402 payload>"
HTTP/1.1 200 OK
X-PAYMENT-RESPONSE: <base64 settlement receipt>import { wrapFetchWithPayment } from "x402-fetch";
const pay = wrapFetchWithPayment(fetch, wallet);
const base = "https://marketplaceforaiagents.com/api/public/v1";
const search = await (await pay(`${base}/youtube-search?q=x402+protocol+explained`)).json();
const topId = search.video_results?.[0]?.video_id ?? search.video_results?.[0]?.link;
const digest = await (await pay(`${base}/video-digest?q=x402+protocol`)).json();
// Or: video-digest?video_id=... / youtube-transcripts?video_id=...Paying with x402: budgeting a video research run
x402 USDC on Base is the no-account rail: the agent needs a funded wallet, not a YouTube Data API key, Google Cloud project or monthly plan, so it can buy exactly the calls a task needs and stop. Charges settle only when the upstream call succeeds.
Regular price is $0.005 USDC per step. Promotional pricing, when active, is advertised in the live 402 (extra.perStep and extra.total) and the site banner — always trust the live 402 amount rather than a hard-coded number.
| Run | Calls | Steps | At regular $0.005 per step |
|---|---|---|---|
| 1 youtube-search + 1 youtube-video + 1 youtube-transcripts | 3 | 3 | $0.015 |
| 1 video-digest by topic (search+video+transcripts) | 1 | 3 | $0.015 |
| 1 youtube-search + 2 youtube-transcripts on shortlist | 3 | 3 | $0.015 |
Budget formula: total steps × live per-step price. Prefer video-digest when the user wants one top digest so you spend one free-tier slot instead of three single-engine calls. Set a per-task USDC cap and stop when it is reached.
MCP
The same endpoints are available through the site's MCP server at https://marketplaceforaiagents.com/mcp (no auth), as documented in https://marketplaceforaiagents.com/learn/mcp-x402-marketplace. Use list_apis to discover youtube-search, youtube-video, youtube-transcripts, video-digest, google-videos and bing-videos.
Agent playbook
| User ask | Call |
|---|---|
| Find YouTube videos about X | youtube-search?q=X |
| What's this video / channel / view count? | youtube-video?video_id=… |
| Pull captions for this URL or ID | youtube-transcripts?video_id=… |
| Summarize the best video on X with timestamps | video-digest?q=X |
| Digest this known video | video-digest?video_id=… |
| Videos beyond YouTube too | google-videos?q=X or bing-videos?q=X |
FAQ
Do I need a YouTube Data API key? No. Calls are paid per call with x402 USDC on Base; no Google Cloud project or OAuth.
How is this different from the transcript article? youtube-transcripts assumes you already have a video_id. This guide starts from a topic: search, rank, then digest.
How many free calls do I get? 3 per agent identity across all endpoints; a video-digest intent counts as one free-tier call even when it runs multiple steps.
What price should my agent expect? Regular $0.005 USDC per step; read the live 402 for the current amount (promo pricing may be lower).
Can I smoke-test without mainnet USDC? Yes — append `?network=base-sepolia` for testnet USDC and mock-shaped responses.
Related entrypoints
- Marketplace: https://marketplaceforaiagents.com/marketplace
- Docs: https://marketplaceforaiagents.com/docs
- llms.txt: https://marketplaceforaiagents.com/llms.txt
- YouTube transcript API for agents: https://marketplaceforaiagents.com/learn/youtube-transcript-api-for-agents
- Google Images API for agents: https://marketplaceforaiagents.com/learn/google-images-api-for-agents
- How agents budget x402 API calls: https://marketplaceforaiagents.com/learn/budget-x402-api-calls
- MCP + x402 marketplace: https://marketplaceforaiagents.com/learn/mcp-x402-marketplace
- x402 protocol explained: https://marketplaceforaiagents.com/learn/x402-protocol-explained
Capability first, payment second: search and digest real YouTube IDs as JSON, and settle with x402 USDC on Base only when the free tier is spent.
Next steps