Sand AISand AI MAGI-2MAGI-2 kini tersedia di SandBase: video 1080p dengan audio nativeCoba sekarang

YouTube Video Captions

Dokumentasi API
https://api.sandbase.ai/v1/api/youtube/video-captions

Get available caption tracks for a YouTube video or request captions in SRT, XML, JSON3, or plain-text format. Use it to support transcription, accessibility, localization, or text analysis.

Harga
$0.014286USD / panggilan
Metode
POST
Respons
JSON
Parameter
1 wajib · 2 opsional

Playground

Input
The unique identifier for a YouTube video.
Caption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks.
Caption output format.
OutputSiap

Output Anda akan muncul di sini

Lengkapi input, lalu klik Run.

README API

YouTube Video Captions API

This API returns the caption tracks available for a YouTube video. It needs a videoId. If you also pass languageCode, it returns the captions for that language in the format you set with format.

Use cases

  • List which caption languages a video offers before you decide what to download.
  • Check whether a video has English captions before you queue it for transcription.
  • Build a language picker for a video player or localization tool from the track list.
  • Collect caption text in srt, xml, json3, or txt format for text analysis.

Request

curl -X POST "https://api.sandbase.ai/v1/api/youtube/video-captions" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"videoId": "dQw4w9WgXcQ"}'

The result is returned in outputs[0].data.

Parameters

NameTypeRequiredDescription
videoIdstringYesThe unique identifier for a YouTube video.
formatstringNoCaption output format.
languageCodestringNoCaption language code, such as en, zh-Hans, or a.en. Leave it empty to retrieve available caption tracks.

Example response

Real response for the request above, trimmed: lists keep their first item and long strings are cut.

{
  "captions": [
    {
      "language_code": "en",
      "language_name": "English"
    }
  ],
  "video_id": "dQw4w9WgXcQ"
}

Response fields

FieldMeaning
video_idThe ID of the video the caption tracks belong to. It matches the videoId you sent.
captions[]One entry for each caption track available for the video.
captions[].language_codeThe code for the track language, such as en, de, or ja. Pass this value as languageCode to request the captions for that track.
captions[].language_nameThe language name for the track in English, such as English or German.

Notes

Pricing

$0.014286 per successful call. Failed calls are not charged. It is included in the daily free quota of each organization.

Jelajahi lebih lanjut

API Terkait

Semua APIs
APIHargaRespons
YouTube$0.014286 per panggilanJSON
YouTubeDari $0.00045 per panggilanJSON
YouTubeDari $0.0012 per panggilanJSON
YouTubeDari $0.0012 per panggilanJSON
YouTubeDari $0.0012 per panggilanJSON
YouTube$0.014286 per panggilanJSON

Panduan:Best YouTube API in 2026: Pricing Compared

Pertanyaan

FAQ

Bagaimana cara menggunakan API YouTube Video Captions?

Kirim permintaan POST ke https://api.sandbase.ai/v1/api/youtube/video-captions dengan kunci API SandBase Anda di header Authorization (Bearer) dan parameter sebagai body JSON. Anda juga dapat mencobanya di Playground di halaman ini tanpa menulis kode.

Berapa biaya API YouTube Video Captions?

$0.014286 per panggilan, ditagihkan dari saldo SandBase Anda. Anda hanya dikenai biaya untuk panggilan yang Anda lakukan; tidak ada langganan.

Parameter apa yang diterima API YouTube Video Captions?

Wajib: videoId (string). Opsional: languageCode (string) dan format (salah satu dari srt, xml, json3, txt). Tabel Parameters dan Playground di halaman ini mencantumkan setiap field.

Apa yang dikembalikan API YouTube Video Captions?

Respons JSON yang dikembalikan dalam permintaan HTTP yang sama (sinkron). README di halaman ini menyertakan contoh respons.

Apakah saya memerlukan akun developer atau kunci API YouTube?

Tidak. YouTube Video Captions berjalan melalui SandBase, jadi satu kunci API SandBase mencakup endpoint ini dan setiap API serta model lain di katalog. Anda tidak perlu mendaftar akses API YouTube secara terpisah.