Scority

YouTube Transcript API for Python

Use Python requests to call the Scority Transcript API. The HTTP API and OpenAPI spec are the stable path today.

Direct answer

Use HTTP requests from server-side Python

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

  • Do not ship API keys in client-side apps, notebooks shared with outputs, or public repositories.
  • Send exactly one of video_id or video_url.
  • Use language for a preferred caption language.
  • Handle normalized Scority error codes instead of raw upstream details.
Example

Fetch a transcript by video ID

This example uses requests. Load SCORITY_API_KEY from your environment and keep the value out of logs.

import os
import requests

api_key = os.environ["SCORITY_API_KEY"]

response = requests.get(
    "https://api.scority.ai/v1/youtube/transcript",
    headers={
        "x-api-key": api_key,
        "accept": "application/json",
    },
    params={
        "video_id": "dQw4w9WgXcQ",
        "language": "en",
    },
    timeout=30,
)

body = response.json()

if not response.ok:
    raise RuntimeError(body.get("error", {}).get("code", "transcript_request_failed"))

print(body["text"])
print(body["segments"][0])
Video URL

Request by YouTube URL

Use video_url when your app receives full YouTube URLs from users. The response shape is the same as a video_id request.

response = requests.get(
    "https://api.scority.ai/v1/youtube/transcript",
    headers={"x-api-key": os.environ["SCORITY_API_KEY"]},
    params={
        "video_url": "https://www.youtube.com/watch?v=dQw4w9WgXcQ",
    },
    timeout=30,
)
Errors

Map error codes to user-facing behavior

Scority returns a normalized error object. Your Python service should handle authentication, validation, rate limits, quota, missing transcripts, and upstream failures explicitly.

Authentication

401 unauthorized means the x-api-key header is missing, invalid, or inactive.

Open →

Rate limits

429 rate_limited includes Retry-After and X-RateLimit headers when short-window protection applies.

Open →

Transcript errors

transcript_not_available and upstream_transcript_failed are expected cases for some public videos.

Open →
SDK status

Python client preview status

The repository contains a Python client preview for future package work. For production integrations today, use the HTTP 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 pip install command in these docs.
  • Do not invent channel, playlist, upload, billing, dashboard, or search SDK methods.

Python guide

Read the broader Python guide for transcript request patterns.

Open →

OpenAPI

Use the machine-readable API contract for generated clients or manual validation.

Open →

Migration guide

Move from local transcript libraries to Scority's HTTP API carefully.

Open →