# FetchBrief API Turn YouTube videos into FetchBrief summaries from a script or an AI agent: positions, levels, bias, and quotes with timestamps, as Markdown. Everything you make lands in the same library you see on the website. > **Early access.** This API is new and may change. Changes are listed under [Changelog](#changelog). > > This page as Markdown: On this page: [Start](#start) · [Stay up to date with your channels](#stay-up-to-date-with-your-channels) · [Endpoints](#endpoints) · [Check a channel](#check-a-channel) · [Your library](#your-library) · [The job](#the-job) · [Send a transcript](#send-a-transcript) · [Credits](#credits) · [Limits and retries](#limits-and-retries) · [Errors](#errors) · [Terms](#terms) · [Changelog](#changelog) ## Start 1. Get Pro: 2. Create a key on your account page: . It is shown once. 3. Send it on every request as `Authorization: Bearer `. Summarize one video: ```bash curl https://www.fetchbrief.com/v1/jobs \ -H "Authorization: Bearer $FETCHBRIEF_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://www.youtube.com/watch?v=VIDEO_ID_01"}' ``` Then poll the job until `status` is `done`, and read `summary.markdown`: ```bash curl https://www.fetchbrief.com/v1/jobs/job_8kQ2 \ -H "Authorization: Bearer $FETCHBRIEF_KEY" ``` ## Stay up to date with your channels The script below follows three channels. Each run it summarizes anything new and saves every summary in your library as a Markdown file. Run it twice a day. ```python """Keep summaries from three YouTube channels in a local folder.""" import os, pathlib, time from datetime import datetime, timedelta, timezone import requests API = "https://www.fetchbrief.com/v1" KEY = os.environ["FETCHBRIEF_KEY"] CHANNELS = ["@ExampleAnalyst", "@SecondAnalyst", "@ThirdAnalyst"] FOLDER = pathlib.Path("summaries") def call(method, path, headers=None, **kw): """One request. On 429 or a server error, wait and try again.""" wait = 2 for _ in range(6): r = requests.request(method, API + path, timeout=30, **kw, headers={"Authorization": f"Bearer {KEY}", **(headers or {})}) if r.status_code not in (429, 500, 502, 503): r.raise_for_status() return r.json() time.sleep(int(r.headers.get("Retry-After", wait))) wait = min(wait * 2, 60) r.raise_for_status() def days_ago(n): return (datetime.now(timezone.utc) - timedelta(days=n)).strftime("%Y-%m-%d") # 1. Start a job for every new video. Videos already in your library are skipped. jobs = [] for channel in CHANNELS: videos = call("GET", f"/channels/{channel}/videos", params={"since": days_ago(2)}) for v in videos["data"]: if not v["in_library"] and v["live"] == "none": jobs.append(call("POST", "/jobs", json={"url": v["url"]}, headers={"Idempotency-Key": f'{v["id"]}-{days_ago(0)}'})) # 2. A summary takes about a minute: wait 30 seconds, then check every 15, for up # to 10 minutes. Videos still waiting for captions finish on a later run. deadline = time.time() + 600 time.sleep(30) while time.time() < deadline and any(j["status"] in ("queued", "processing") for j in jobs): jobs = [call("GET", f"/jobs/{j['id']}") for j in jobs] time.sleep(15) # 3. Save every summary from the last week that isn't on disk yet. FOLDER.mkdir(exist_ok=True) params = {"since": days_ago(7)} while True: page = call("GET", "/summaries", params=params) for s in page["data"]: path = FOLDER / f"{s['created_at'][:10]}_{s['id']}.md" if not path.exists(): path.write_text(call("GET", f"/summaries/{s['id']}")["markdown"], encoding="utf-8") if not page["next_cursor"]: break params["cursor"] = page["next_cursor"] ``` Run it at 7:00 and 19:00 (cron; any scheduler works): ```bash 0 7,19 * * * cd ~/fetchbrief && FETCHBRIEF_KEY=fb_live_… python3 sync.py ``` Why it's shaped this way: - **A two-day window, not "since last run".** A run that stops halfway loses nothing: the next one sees the same videos, and anything already in your library is skipped. - **`Idempotency-Key` is the video id plus today's date (UTC).** A retried request within the same run never starts or charges twice; a job that failed outright is retried fresh on the next run instead of replaying the same failure for 24 hours, since the key changes with the day. - **Step 3 reads your library, not the jobs.** It also picks up summaries you made on the website, and ones that were waiting for captions on an earlier run. - **`call` waits when told to.** It honours `Retry-After`, and otherwise doubles its wait up to a minute. Your agent and the script can use the same key at the same time. ## Endpoints Base URL `https://www.fetchbrief.com/v1`. JSON in and out. Only summaries use credits; everything else is included with Pro. | Endpoint | What it does | |---|---| | `GET /channels/{channel}/videos` | What a YouTube channel has posted, and which of those you already have. | | `POST /jobs` | Summarize a video. Body `{"url": "…"}` or `{"transcript": "…"}`. Returns `202` and a job. | | `GET /jobs` | Your jobs from the last 30 days. `status=active` shows what's still running. | | `GET /jobs/{id}` | One job. | | `GET /summaries` | Your library, newest first, without the full text. | | `GET /summaries/{id}` | One summary, with the full text. | | `GET /account` | Credits left and jobs in progress. Use it to check a key. | `POST /jobs` takes an optional `Idempotency-Key` header. Retrying with the same key returns the same job and charges once. ## Check a channel ```bash curl "https://www.fetchbrief.com/v1/channels/@ExampleAnalyst/videos?since=2026-10-24" \ -H "Authorization: Bearer $FETCHBRIEF_KEY" ``` ```json { "object": "list", "channel": {"id": "UC…", "handle": "@ExampleAnalyst", "title": "Example Analyst"}, "data": [ {"object": "video", "id": "VIDEO_ID_01", "url": "https://www.youtube.com/watch?v=VIDEO_ID_01", "title": "…", "published_at": "2026-10-25T14:02:11Z", "duration_s": 2710, "kind": "video", "live": "none", "in_library": false, "summary_id": null} ], "checked_at": "2026-10-27T15:10:00Z", "last_checked_at": "2026-10-24T09:31:40Z", "has_more": false } ``` - `{channel}` is a handle (`@ExampleAnalyst`) or a channel id (`UC…`). - Pick videos with `last=N` (up to 50), or `since` and `until`. `since=last_check` means "since this key last checked this channel". - `kind` is `video` or `stream`. Shorts (under 2 minutes, or tagged `#shorts`) are left out unless `include_shorts=true`. - `live` is `none`, `upcoming` or `live`. Upcoming and live ones can't be summarized yet. - `in_library` says whether you already have it; if so, `summary_id` is its id. - At most 31 days and 50 videos per call; `has_more` says when there were more. ## Your library The same library as on the website. Summaries made here show up there, and the other way round. ```json { "object": "list", "data": [ {"object": "summary", "id": "sum_3Hx9", "video": {"id": "VIDEO_ID_01", "url": "https://www.youtube.com/watch?v=VIDEO_ID_01", "title": "…", "channel": "Example Analyst", "published_on": "2026-10-25"}, "created_at": "2026-10-27T15:11:02Z", "takeaway": "…", "tickers": [{"symbol": "BTC", "bias": "Bearish (ST) / Bullish (LT)"}], "share_url": "https://www.fetchbrief.com/s/…"} ], "next_cursor": null } ``` - `created_at` is when you made it. `published_on` is the video's date. - `takeaway` is the summary's one-line thesis. `tickers` lists the tickers it covers, with the bias as written in the summary. - Filter with `since=YYYY-MM-DD` and `channel=`. - Up to 100 per page (`limit` up to 500). If `next_cursor` isn't `null`, call again with `cursor=`. - `GET /summaries/{id}` adds `markdown`, the full summary. ## The job ```json { "object": "job", "id": "job_8kQ2", "status": "done", "video": {"id": "VIDEO_ID_01", "url": "https://www.youtube.com/watch?v=VIDEO_ID_01", "title": "…", "channel": "Example Analyst", "published_on": "2026-10-25"}, "created_at": "2026-10-27T15:10:08Z", "completed_at": "2026-10-27T15:10:59Z", "credits_used": 1.0, "credits_remaining": 182.5, "summary": {"object": "summary", "id": "sum_3Hx9", "format": "markdown", "markdown": "…", "share_url": "https://www.fetchbrief.com/s/…"}, "transcript_wait": null, "error": null } ``` | `status` | What to do | |---|---| | `queued`, `processing` | Working on it. A summary usually takes about a minute: check after 30 seconds, then every 15. | | `waiting_for_transcript` | YouTube hasn't published captions yet. We check again at `transcript_wait.next_check_at` and stop at `give_up_at`; this can take hours. Check back at `next_check_at`. | | `done` | Read `summary`. | | `failed` | `error` says why. See [Errors](#errors). | | Field | What it means | |---|---| | `video` | `title`, `channel` and `published_on` are `null` until known. `video` is `null` for a transcript job. | | `credits_used` | `null` until charged, then steps of 0.5. `0` after an automatic refund. | | `credits_remaining` | Your balance when the response was built. | | `summary` | `null` until done. `share_url` is a link anyone can read. | | `transcript_wait` | Only while waiting: `checked_at`, `next_check_at`, `give_up_at`. | | `error` | Only when failed: `code`, `message`, `docs`, and `required` for `insufficient_credits`. | Treat any other status as still in progress. Asking for a video that's already running for you returns that job; it isn't started or charged again. ## Send a transcript If the video has no captions, or you already have its transcript, send the text instead of the URL: ```bash jq -n --rawfile t transcript.txt '{transcript: $t}' | curl https://www.fetchbrief.com/v1/jobs \ -H "Authorization: Bearer $FETCHBRIEF_KEY" \ -H "Content-Type: application/json" \ -d @- ``` - Send `url` or `transcript`, not both. - Plain text, 200 to 200,000 characters. In the job, `video` is `null`. - Only send text you have the right to share. ## Credits - A typical video costs one credit. Longer ones use more, shorter ones use less. - The API uses the same credits as the website: monthly credits first, then top-up credits. - A video already in your library costs nothing, wherever you made it. - A failed job is refunded automatically. - Every job shows `credits_used` and `credits_remaining`. - Buy more on your account page: . Prices are on . ## Limits and retries | Limit | Value | Over it | |---|---|---| | Requests | 60 a minute per account | `429 rate_limited` | | Channel checks | 60 an hour per account | `429 rate_limited` | | Jobs in progress | 5 at once; jobs waiting for captions don't count | `429 too_many_in_progress` | On a `429`, wait the number of seconds in `Retry-After`, then try again. On a `5xx`, wait 2 seconds and double it each time, up to a minute. The `call` function in [the script above](#stay-up-to-date-with-your-channels) does both. ## Errors ```json {"error": {"code": "insufficient_credits", "message": "Not enough credits to start a job. Buy more on the account page: https://www.fetchbrief.com/account#topup", "docs": "https://www.fetchbrief.com/docs/api#credits", "required": 1.5}} ``` Check `error.code`, not `message`. | HTTP `code` | Meaning | |---|---| | 400 `invalid_request` | Bad JSON, missing `url`, or an unknown field | | 400 `invalid_url` | Not a YouTube video URL | | 400 `invalid_transcript` | Too short, too long, or not a transcript | | 401 `account_required` | No `Authorization` header | | 401 `invalid_key` | Key unknown or revoked | | 402 `pro_required` | The account isn't on Pro | | 402 `insufficient_credits` | Not enough credits; `required` says how many | | 404 `not_found` | No such id on your account | | 404 `channel_not_found` | No YouTube channel by that handle or id | | 409 `idempotency_conflict` | Same `Idempotency-Key`, different body | | 429 `rate_limited` | Too many requests or channel checks; see `Retry-After` | | 429 `too_many_in_progress` | 5 jobs already in progress; see `Retry-After` | | 503 `paused` | The API is paused; try again later | | 500 `internal_error` | Something broke on our side | When a job fails, its `error.code` is one of: | `code` | Meaning | |---|---| | `no_transcript` | The video has no captions, or the wait for them ran out | | `transcript_unavailable` | We couldn't get the captions this time | | `video_unavailable` | Private, removed or members-only | | `insufficient_credits` | Not enough credits once the video's length was known | | `pro_required` | Pro ended while the job was waiting | | `internal_error` | Something broke on our side | On `no_transcript` or `transcript_unavailable`, you can [send the transcript](#send-a-transcript) yourself. Every response has a `Request-Id` header. Include it if you contact us through . ## Terms The API is covered by our [terms](https://www.fetchbrief.com/terms). Keep your key private: anything done with it is charged to your account. You can revoke it on your account page. ## Changelog - 2026-10-28: First version.