Skip to main content
POST
/
extract
/
youtube
Extract YouTube videos
curl --request POST \
  --url https://api.horizon.new/v1/extract/youtube \
  --header 'Content-Type: application/json' \
  --data '{
  "sourceUrl": "<string>",
  "sourceName": "<string>",
  "options": {},
  "webhookUrl": "<string>"
}'
{
  "jobId": "job_01hx9q9",
  "status": "queued",
  "statusUrl": "<string>",
  "result": {},
  "etaSeconds": 123,
  "jobType": "extract/pdf"
}
Pull public YouTube videos into Horizon, producing transcripts, captions, and structural context without downloading the file yourself. Perfect for analyzing talks, tutorials, or marketing content published on YouTube.

Request body

  • sourceUrl — Canonical YouTube video URL or share link. Required if file is not provided.
  • file — Optional uploaded video file corresponding to the YouTube content (multipart/form-data).
  • sourceName — Optional label stored with the transcript.
  • options — Optional object. Supported keys:
    • transcriptionModel — Preferred transcription backend (whisper-large-v3, etc.).
    • includeCaptions — Boolean; merge official closed captions when available (default true).
    • captureChapters — Boolean; capture YouTube chapter markers in the output (default true).
    • segmentLength — Target characters per chunk (default 800).
  • webhookUrl — Optional HTTPS URL Horizon should call when the extraction finishes.

Sample request

curl https://api.horizon.new/v1/extract/youtube \
  -H "Content-Type: application/json" \
  -d '{
    "sourceUrl": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    "sourceName": "Horizon Launch Keynote",
    "options": {
      "transcriptionModel": "whisper-large-v3",
      "includeCaptions": true,
      "captureChapters": true,
      "segmentLength": 750
    }
  }'

# or upload the video manually

curl https://api.horizon.new/v1/extract/youtube \
  -H "Content-Type: application/json" \
  -d '{
    "file": "data:video/mp4;base64,AAAAIGZ0eX...",
    "sourceName": "Horizon Launch Keynote",
    "options": {
      "transcriptionModel": "whisper-large-v3",
      "includeCaptions": true,
      "captureChapters": true,
      "segmentLength": 750
    }
  }'

Response

Returns 202 Accepted with jobId, status, statusUrl, and optional etaSeconds. When complete, result includes transcript chunks, YouTube details (title, channel, publish date), and chapter markers when enabled.

Notes

  • Only public or unlisted videos are supported; private videos require exporting and using the /extract/video endpoint instead.
  • Horizon downloads the video in the background; no additional hosting required.
  • Captions are merged with the transcription by default; disable via includeCaptions: false if you want raw ASR output.
  • Poll GET /jobs/{jobId} (same as the statusUrl) to monitor progress or fetch transcripts and accompanying details later.
  • To upload a video file manually, send multipart/form-data with a file field instead of sourceUrl.

x402 flow

YouTube extraction is billed through Coinbase’s x402 protocol. When payment is required, expect:
HTTP/1.1 402 Payment Required
Content-Type: application/json

{
  "x402Version": 1,
  "accepts": [
    {
      "scheme": "exact",
      "network": "base-sepolia",
      "maxAmountRequired": "240000",
      "resource": "POST /extract/youtube",
      "description": "Horizon YouTube extraction",
      "mimeType": "application/json",
      "payTo": "0xYourReceivingWallet",
      "maxTimeoutSeconds": 900,
      "asset": "0xYourUSDCContract",
      "extra": {
        "name": "USDC",
        "version": "1"
      }
    }
  ],
  "error": null
}
Forward the challenge to your facilitator, complete /verify and /settle, then replay the request with the facilitator-issued Base64 token inside X-PAYMENT. Horizon resumes processing and returns settlement details in X-PAYMENT-RESPONSE.

Body

application/json

Provide either sourceUrl or file.

sourceUrl
string<uri>
sourceName
string
options
object

Extraction hints such as language, segmentLength, transcriptionModel, or sheet preferences depending on the endpoint.

webhookUrl
string<uri>

Webhook to call when the extraction completes.

file
file

Upload the raw file instead of providing sourceUrl.

Response

Extraction job accepted

jobId
string
required
Example:

"job_01hx9q9"

status
enum<string>
required
Available options:
queued,
processing,
completed,
failed
statusUrl
string<uri>
required

Canonical link to GET /jobs/{jobId} for this job.

jobType
string
required
Example:

"extract/pdf"

result
object | null

Present when the job completes synchronously.

etaSeconds
integer | null

Estimated seconds until completion.