crawlfetch

Bulk video download API

Downloading one video is easy; downloading 50,000 reliably is a queueing problem. This guide covers the patterns that keep bulk jobs fast and within your CrawlFetch rate limit.

The pattern

  1. Put URLs in a queue (SQS, Redis, a database table) — one job per URL.
  2. Run workers with a fixed concurrency below your plan's limit.
  3. Each worker resolves, downloads downloadUrl immediately, and stores the file.
  4. On 429, pause that worker for Retry-After seconds; on 500, retry with backoff; on 404, mark the job failed permanently.
  5. Key jobs by the platform video ID so re-runs skip finished work.

Example worker with bounded concurrency

import asyncio, os, httpx
LIMIT = asyncio.Semaphore(8) # stay under your plan's rate limit
cf = httpx.AsyncClient(base_url="https://api.crawlfetch.com", headers={"Authorization": f"Bearer {os.environ['CRAWLFETCH_KEY']}"}, timeout=20)
async def fetch_one(url: str) -> str:
async with LIMIT:
for attempt in range(5):
r = await cf.get("/v1/resolve", params={"url": url})
if r.status_code == 429:
await asyncio.sleep(int(r.headers.get("retry-after", "5")))
continue
if r.status_code >= 500:
await asyncio.sleep(2 ** attempt)
continue
r.raise_for_status()
v = r.json()
async with cf.stream("GET", v["downloadUrl"]) as dl:
with open(f"{v['id']}.mp4", "wb") as f:
async for chunk in dl.aiter_bytes():
f.write(chunk)
return v["id"]
raise RuntimeError(f"gave up on {url}")
async def main(urls):
print(await asyncio.gather(*(fetch_one(u) for u in urls), return_exceptions=True))

Plan sizing

Every plan comes with monthly credits (Free 500, Starter 19,000, Pro 49,000, Scale 200,000), and each successful download costs a few credits by platform and file size. Every response includes x-credits-remaining, so workers can top up or slow down before they hit 402. See pricing.

FAQ

Can I mix platforms in one batch?

Yes. YouTube, TikTok, Instagram Reels and the other supported platforms all go through the same endpoint.

Should I resolve everything first and download later?

No — download links expire after a few hours. Resolve and download in the same job.

Related

Last updated 2026-10-25

Add video downloads to your product today.

1,000 credits on signup plus 500 every month. That is roughly 180 YouTube clips to start, with no card.

Create free account