# Caching & Headers

How transcripts are stored and what every header means.

Source: https://youtubetranscriptapi.com/docs/caching

## Transcript storage

The first time any customer requests a video's transcript in a given language, we fetch it and keep it. Every later request for that video and language, in any format, with or without timestamps or metadata, is served from storage. Request and response shapes are identical either way. Stored responses still cost 1 credit.

Search results, channel listings, playlists, and latest uploads are always fetched fresh, because rankings and uploads change. Only the first page of a channel or playlist listing is served for now: a `continuation` request is refused with `422 continuation_unavailable` before the credit check, so it needs no balance and is never charged.

## X-Cache-Status

The `X-Cache-Status` header tells you where the response came from:

- `HIT` — Served from storage, in about a second.
- `MISS` — Fetched live, usually 10–30 seconds.

## Latency and timeouts

A video not fetched before usually takes 10–30 seconds; videos already fetched return in about a second. Set your HTTP client timeout to at least 60 seconds. Examples for Python and JavaScript are in the [Get Transcript reference](https://youtubetranscriptapi.com/docs/api/transcript#latency).

```http
HTTP/1.1 200 OK
X-Cache-Status: HIT
X-Credits-Charged: 1
X-Credits-Remaining: 99
X-RateLimit-Limit: 300
X-RateLimit-Remaining: 287
X-RateLimit-Reset: 1735689600
Content-Type: application/json
```

`X-Credits-Charged` and `X-Credits-Remaining` show what the call cost and the balance left. They are on successful responses only. See [Rate Limits](https://youtubetranscriptapi.com/docs/rate-limits#credit-headers) for how to alert on a low balance.

## Freshness

Captions on published videos rarely change, so stored transcripts do not expire. If a creator edits captions after we first fetched them, the stored version is returned.
