Pay 0.015 USDC, send a YouTube URL (youtube.com or youtu.be), get the full transcript as an array of {start, dur, text} segments in seconds plus total duration and detected language. Optional `lang` (ISO-639-1, e.g. "en", "pt-BR") selects a non-default caption track. InnerTube Android-client path first, classic HTML scrape fallback. No LLM, no headless browser. Errors surface as 502 with reason (captions_disabled, no_captions, language_not_available, video_unavailable, rate_limited). Built for agents that summarise, classify, or search video content before paying for the heavier LLM token cost.
curl -X POST https://app.heinrichstech.com/v1/cdp/youtube \
-H 'content-type: application/json' \
-d '{"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","lang":"en"}'
# 1. Server returns 402 with a PAYMENT-REQUIRED header containing the x402 challenge.
# 2. Pick a compatible accepts[] option and pay its exact advertised amount.
# Listed primary: 0.015 USDC to 0xDa2F35d283c42dd60B965322394bc658a5c1769F on Base mainnet (eip155:8453).
# 3. Retry the same request with PAYMENT-SIGNATURE. The selected facilitator
# verifies and settles, then the response unlocks.
This call does not sign or spend. It lets your agent inspect the exact live price, recipient, asset, and network choices before choosing a compatible x402 buyer.
const res = await fetch('https://app.heinrichstech.com/v1/cdp/youtube', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({"url":"https://www.youtube.com/watch?v=dQw4w9WgXcQ","lang":"en"}),
});
if (res.status !== 402) throw new Error(`Expected 402, received ${res.status}`);
const challenge = await res.json();
console.table(challenge.accepts.map(({ network, asset, amount, payTo }) => ({
network, asset, amount, payTo,
})));
Agents and ecosystem indexers can discover this endpoint without scraping. Hit the JSON feeds below or read the OpenAPI spec directly; the fresh 402 challenge remains canonical for price, asset, recipient, and network availability.