Scority

YouTube Transcript API for Node.js

Use server-side Node.js fetch calls to request YouTube transcripts from the Scority API. The HTTP API and OpenAPI spec are the stable path today.

Direct answer

Use the HTTP API from server-side Node.js

The stable integration path today is the HTTPS API at https://api.scority.ai. Keep x-api-key on the server and call GET /v1/youtube/transcript with either video_id or video_url.

  • Do not expose x-api-key in browser JavaScript.
  • Use video_id or video_url, not both in the same request.
  • Use language when you need a specific caption language.
  • Handle 401, 429, 404, and 502 responses as normal API outcomes.
Example

Fetch a transcript by video ID

This example uses the built-in fetch available in modern Node.js runtimes. Replace YOUR_API_KEY through an environment variable, not an inline literal.

const apiKey = process.env.SCORITY_API_KEY

if (!apiKey) {
  throw new Error("SCORITY_API_KEY is required")
}

const url = new URL("https://api.scority.ai/v1/youtube/transcript")
url.searchParams.set("video_id", "dQw4w9WgXcQ")
url.searchParams.set("language", "en")

const response = await fetch(url, {
  headers: {
    "x-api-key": apiKey,
    accept: "application/json",
  },
})

const body = await response.json()

if (!response.ok) {
  throw new Error(body.error?.code ?? "transcript_request_failed")
}

console.log(body.text)
console.log(body.segments[0])
Video URL

Request by YouTube URL

Use video_url when your app stores full YouTube URLs instead of IDs. The API still resolves the request to a video ID before fetching or reading from cache.

const url = new URL("https://api.scority.ai/v1/youtube/transcript")
url.searchParams.set(
  "video_url",
  "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
)

const response = await fetch(url, {
  headers: {
    "x-api-key": process.env.SCORITY_API_KEY ?? "",
    accept: "application/json",
  },
})
Errors

Handle API errors explicitly

Scority returns a normalized error object with error.code and error.message. Do not parse raw upstream text or assume every failure is retryable.

401 unauthorized

The x-api-key header is missing, invalid, or not active.

Open →

429 rate_limited

Respect Retry-After and X-RateLimit headers before retrying.

Open →

502 upstream_transcript_failed

The upstream caption request failed. Retry carefully and show a useful application-level message.

Open →
SDK status

Node client preview status

The repository contains a private @scority/sdk preview for future package work. For production integrations today, use the HTTP API examples on this page or generate against the OpenAPI spec.

  • Use the HTTP API and OpenAPI specification for production integrations today.
  • The client preview models the transcript endpoint only.
  • There is no public npm install command in these docs.
  • Do not invent channel, playlist, upload, billing, dashboard, or search SDK methods.

Node guide

Read the broader Node.js guide for transcript request patterns.

Open →

JavaScript guide

Use fetch from trusted server-side JavaScript and backend routes.

Open →

OpenAPI

Inspect the machine-readable API contract.

Open →

Error codes

Map API error codes to application behavior.

Open →