401 unauthorized
The x-api-key header is missing, invalid, or not active.
Open →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.
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.
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])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",
},
})Scority returns a normalized error object with error.code and error.message. Do not parse raw upstream text or assume every failure is retryable.
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.