# Build YouTube datasets with an API.

> Build YouTube datasets as JSON: channels, uploads, comments and transcripts in bulk, at a cost you can plan. One key, pay per answer, errors never charged.

Channels, uploads, comments and transcripts as JSON, in bulk. A fixed price per call or per page of results, so you know the cost before you run it.

[Get started](https://wagamiai.com/signup)

Sign up is open, no card needed. Got an invite code? [Set up your account](https://wagamiai.com/setup)

### Every piece as JSON

Channels, uploads, comments, transcripts and video details, each pulled on its own.

### One JSON line per video

List a channel, add its transcripts, write a line per video. Up to 1,000 uploads in a call.

### A cost you can plan

Lists **$0.03** per 1,000 items, transcripts **$1.50** per 1,000. Count the calls: that is the bill.

A few lines

## A dataset, start to finish.

List a channel, add its transcripts, write one JSON line per video.

- Predictable credits per call and per page
- Failed calls are never charged
- Limits you can read, so a job can pace itself

python

```
import json, os, requests
API = "https://wagamiai.com"
S = requests.Session()
S.headers["Authorization"] = f"Bearer {os.environ['WAGAMI_KEY']}"

rows = S.post(f"{API}/v1/channel/videos",
              json={"ref": "@veritasium", "limit": 200}).json()["items"]
with open("dataset.jsonl", "w", encoding="utf-8") as out:
    for v in rows:
        t = S.post(f"{API}/v1/transcript", json={"ref": v["id"]}).json()
        v["transcript"] = t.get("transcript")
        out.write(json.dumps(v) + "\n")
```

dataset.jsonl, one line, shortened

```
{"id": "Fg2mPn7wKx0", "title": "…", "views": …,
 "published_ts": …, "transcript": "…"}
{"id": "Hb2kQ7rVn3e", "title": "…", "views": …,
 "published_ts": …, "transcript": "…"}
```

Questions

## Good to know

### How do I plan the cost?

Every call or page of results has a fixed price in credits. Lists and comments are 3 credits per 50 items, transcripts and video details 3 per call. 10,000 transcripts is 30,000 credits, about $15 at the base rate.

### Can I fetch many videos at once?

Up to 25 videos in one bulk call, as many such calls as your balance covers. A failed item in a bulk call carries its own error and the rest still return.

### What happens when a call fails?

It is never charged. `GET /v1/limits` shows what is left this minute, today and this week, and every answer carries the same headers.

### Can I use the data however I like?

This is public YouTube data. Check YouTube's terms and creators' rights before you publish, share or train on what you collect.

## Start with one key.

Give each job, or each AI agent, its own key with a credit cap. 2,000 credits = $1, from $25, and credits never expire.

[Get started](https://wagamiai.com/signup) [See pricing](https://wagamiai.com/pricing)

---
This is the Markdown copy of https://wagamiai.com/youtube-dataset-api (WagamiAI). Every page has one: add `.md` to its address. All pages: https://wagamiai.com/llms.txt
