Authentication
401 unauthorized means the x-api-key header is missing, invalid, or inactive.
Open →Use Python requests to call the Scority Transcript 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 in server-side configuration and call GET /v1/youtube/transcript with either video_id or video_url.
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])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,
)Scority returns a normalized error object. Your Python service should handle authentication, validation, rate limits, quota, missing transcripts, and upstream failures explicitly.
401 unauthorized means the x-api-key header is missing, invalid, or inactive.
Open →429 rate_limited includes Retry-After and X-RateLimit headers when short-window protection applies.
Open →transcript_not_available and upstream_transcript_failed are expected cases for some public videos.
Open →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.