Rate-limit headers
Every authenticated response includes:| Header | Meaning |
|---|---|
X-RateLimit-Limit | Your ceiling for the current window. |
X-RateLimit-Remaining | Requests left in the current window. |
X-RateLimit-Reset | Unix timestamp (seconds) when the window resets. |
GET /health and GET /meta are not rate limited and omit
these headers.
The values above are illustrative. Read
X-RateLimit-Remaining and
X-RateLimit-Reset at runtime instead of assuming a fixed limit — limits can change
without a new API version.When you hit the limit
Exceeding the limit returns429 with code: RATE_LIMITED and a Retry-After
header giving the number of seconds to wait:
Retry-After when present, then fall back to exponential back-off. Slowing
down proactively as X-RateLimit-Remaining approaches zero avoids most 429s.
503
(SERVICE_UNAVAILABLE) responses. See Errors.
Be a good client
- Paginate efficiently. Use the largest sensible
limit(up to200) to fetch a page set in fewer calls. See Pagination. - Cache with ETags.
GETresponses carry a strongETagandCache-Control: private, no-cache. Send the value back asIf-None-Match; an unchanged representation returns304 Not Modifiedwith an empty body — a conditional request still counts, but you skip the re-download. - Skip
include_totalunless needed. It adds aCOUNTquery per request. - Batch with the metrics endpoints. Instead of polling many resources one at a
time, use the batch windowed metrics endpoints —
POST /v2/accounts/metrics,POST /v2/videos/metrics, andPOST /v2/account-videos/metrics— and the video deltas endpoint to retrieve many records in a single call. See the API reference for these endpoints. - Spread out background jobs. Add jitter and avoid bursts so you do not exhaust a window all at once.