# Transcribe a recording

> Turn an audio recording into text, with speaker labels and timings, and optionally translate the text into Persian or English. Download it as plain text, SRT subtitles, a PDF or a Word file. Sequence: `GET /api/v1/transcription/pricing` → `POST /api/v1/transcription/jobs` (multipart, holds Fara) → poll `GET /api/v1/transcription/jobs/{id}` → `GET /api/v1/transcription/jobs/{id}/download?file=source|translation&format=txt|srt|pdf|docx`.

## At a glance

- Base path: `/api/v1/transcription`
- Auth: `Authorization: Bearer fara_sk_...` ([Authentication](https://faraatarjomeh.com/api/v1/docs/authentication.md))
- Scope: `read` for GET, `write` for everything else
- Spends Fara: yes, `POST /api/v1/transcription/jobs` holds Fara. Everything else is free.
- Async: yes. Usually a few minutes.
- Review: none
- Terminal statuses: `completed`, `failed`, `cancelled`
- Webhook events: `transcription.completed`, `transcription.failed`, `transcription.cancelled`
- Output: TXT, SRT, PDF and Word, for the original text and (if asked) the translation
- Note: `GET /api/v1/transcription/jobs/{id}` returns the job object itself, not wrapped in `{ "job": ... }`
- Large files or unreliable connections: send the recording in chunks (up to 1 GB), then create the job with `{ "uploadId": "upl_..." }` — see [Upload large recordings in chunks](https://faraatarjomeh.com/api/v1/docs/guides/chunked-uploads.md)
- Upload by link: send `audioUrl` (an https link) in a JSON body instead of a file. Any account.
- Early access: `externalId`, `metadata`, `?externalId=` / `?idempotencyKey=` lookups — see [Meetings: early-access features](https://faraatarjomeh.com/api/v1/docs/guides/meeting-extras.md)

## Before you start

### Price and limits

```http
GET /api/v1/transcription/pricing HTTP/1.1
Authorization: Bearer fara_sk_...
```

Response `200 OK`:

```json
{
  "faraPerMin": 0.73,
  "faraPerMinWithTranslation": 0.85,
  "maxDurationSeconds": 14400,
  "audioMaxBytes": 209715200,
  "targetLanguages": ["none", "fa", "en"]
}
```

```bash
curl -sS "https://faraatarjomeh.com/api/v1/transcription/pricing" -H "Authorization: Bearer $FARA_API_KEY"
```

| Field | Meaning |
|---|---|
| `faraPerMin` | Typical Fara per minute, text only (`targetLanguage: "none"`). |
| `faraPerMinWithTranslation` | Typical Fara per minute with translation. |
| `maxDurationSeconds` | Longest recording (today 14,400 s = 4 hours). |
| `audioMaxBytes` | Largest file (today 200 MB). |
| `targetLanguages` | Allowed `targetLanguage` values. |

Estimate: `ceil(durationSeconds / 60) × rate`. The exact hold is computed from the real length after upload and returned in the create answer (`cost.faraCharged`). If it is above the user's budget, cancel at once: the hold is released and nothing is charged.

| Limit | Value |
|---|---|
| Upload field | multipart/form-data, file field `audio` (one file) |
| File types | The file part's `Content-Type` must be one of `audio/mpeg`, `audio/mp4`, `audio/x-m4a`, `audio/wav`, `audio/x-wav`, `audio/webm`, `audio/ogg`, `audio/flac`, and the content must really be MP3, WAV, M4A/MP4, OGG, FLAC or WebM. A part sent as `application/octet-stream` is dropped and you get `400`. |
| File size | `audioMaxBytes` |
| Duration | `maxDurationSeconds` |
| Billing unit | Whole minutes, rounded up, at least 1 |
| Rate limits | 120 requests per 60 s per API key; job creation 300 uploads per hour per account |

## Steps

### 1. Upload the recording

Send an `Idempotency-Key` (a new UUID per upload). A success (and a `500`/`502`/`504`) is stored for 24 hours: sending the same key again returns that first answer and never charges twice. A `4xx` or `503` answer is not stored, so after you fix the request (or the user tops up) you can send it again with the same key. The key does not cover the file content, so never reuse a key for a different file.

```http
POST /api/v1/transcription/jobs HTTP/1.1
Authorization: Bearer fara_sk_...
Idempotency-Key: 3c4d5e6f-7a8b-4c9d-8e0f-1a2b3c4d5e6f
Content-Type: multipart/form-data; boundary=----fara

------fara
Content-Disposition: form-data; name="sourceLanguage"

auto
------fara
Content-Disposition: form-data; name="targetLanguage"

fa
------fara
Content-Disposition: form-data; name="audio"; filename="interview.m4a"
Content-Type: audio/mp4

<binary audio>
------fara--
```

Response `201 Created`:

```json
{
  "jobId": "66f5e0c1d2e3f4a5b6c7d8e9",
  "cost": { "faraCharged": 19, "minutesBilled": 23 },
  "durationSeconds": 1325.2
}
```

```bash
curl -sS -X POST "https://faraatarjomeh.com/api/v1/transcription/jobs" \
  -H "Authorization: Bearer $FARA_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -F "sourceLanguage=auto" \
  -F "targetLanguage=fa" \
  -F "audio=@interview.m4a;type=audio/mp4"
```

#### Form fields

| Field | Type | Required | Default | Allowed values | Notes |
|---|---|---|---|---|---|
| `audio` | file | yes | — | see Limits | One audio file. |
| `sourceLanguage` | string | no | `auto` | `auto`, or a 2- or 3-letter lowercase language code (`en`, `fa`, `de`, `eng` …) | The spoken language. `auto` detects it. |
| `targetLanguage` | string | no | `none` | `none`, `fa`, `en` (see `targetLanguages`) | Translate the text into this language. `none` = text only. |

The text leaves out filler words (um, uh) and false starts, as meeting transcripts do.

If the recording is already in `targetLanguage`, nothing is translated: the job finishes with `translationSkipped: true` and has no translation file.

### 2. Wait for the job

```http
GET /api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9 HTTP/1.1
Authorization: Bearer fara_sk_...
```

Response `200 OK` (the job itself, no wrapper; trimmed):

```json
{
  "_id": "66f5e0c1d2e3f4a5b6c7d8e9",
  "status": "completed",
  "stage": "done",
  "progress": 100,
  "originalFilename": "interview.m4a",
  "audioMimeType": "audio/mp4",
  "audioSizeBytes": 21504311,
  "durationSeconds": 1325.2,
  "sourceLanguage": "auto",
  "targetLanguage": "fa",
  "detectedLanguage": "eng",
  "speakerCount": 2,
  "translationSkipped": false,
  "sourcePreview": "Thanks for joining us today. Happy to be here. Let's start with your first book...",
  "translationPreview": "گوینده 1: از اینکه امروز به ما پیوستید سپاسگزاریم...",
  "cost": { "faraCharged": 17, "minutesBilled": 23, "heldFara": 19, "refundedFara": 2 },
  "customerErrorCode": null,
  "createdAt": "2026-09-25T13:00:00.000Z",
  "updatedAt": "2026-09-25T13:04:12.000Z",
  "completedAt": "2026-09-25T13:04:12.000Z",
  "failedAt": null
}
```

```bash
curl -sS "https://faraatarjomeh.com/api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9" -H "Authorization: Bearer $FARA_API_KEY"
```

Poll every 15 seconds, or use webhooks. Stop on `completed`, `failed` or `cancelled`.

| Field | Type | Notes |
|---|---|---|
| `_id` | string | Job id (24 hex characters). |
| `status` | string | See [State machine](#state-machine). |
| `stage` | string | Display only: `queued`, `uploading_audio`, `transcribing`, `translating`, `finalizing`, `done`. More values can appear. |
| `progress` | number | 0–100. |
| `originalFilename`, `audioMimeType`, `audioSizeBytes`, `durationSeconds` | | From the upload. |
| `sourceLanguage`, `targetLanguage` | string | What you asked for. |
| `detectedLanguage` | string or null | Language found in the recording (a language code, often 3 letters, for example `eng`). |
| `speakerCount` | integer or null | Number of speakers found. |
| `translationSkipped` | boolean | `true` when the recording was already in `targetLanguage`. |
| `sourcePreview`, `translationPreview` | string | First 600 characters (`…` added when cut). `sourcePreview` is the plain text; `translationPreview` has speaker labels like the TXT file. `""` when there is none. Only on `GET /api/v1/transcription/jobs/{id}`. |
| `cost` | object | The hold while running; after `completed`, the real charge plus `heldFara` and `refundedFara`. |
| `customerErrorCode` | string or null | Why a `failed` job failed. |

List: `GET /api/v1/transcription/jobs?limit=20&offset=0` → `{ "jobs": [ ... ] }` (newest first, no previews, `limit` at most 50). Add `q` to search by name: the name you gave the job or its original file name, ignoring case, at most 100 characters.

### 3. Download

```http
GET /api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9/download?file=translation&format=srt HTTP/1.1
Authorization: Bearer fara_sk_...
```

Response `200 OK`, `Content-Type: application/x-subrip; charset=utf-8`, `Content-Disposition: attachment; filename="interview.fa.srt"`:

```text
1
00:00:00,000 --> 00:00:03,200
گوینده 1: از اینکه امروز به ما پیوستید سپاسگزاریم.

2
00:00:03,400 --> 00:00:05,100
گوینده 2: خوشحالم که اینجا هستم.
```

```bash
curl -sS -o interview.txt "https://faraatarjomeh.com/api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9/download?file=source&format=txt" \
  -H "Authorization: Bearer $FARA_API_KEY"
curl -sS -o interview.fa.srt "https://faraatarjomeh.com/api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9/download?file=translation&format=srt" \
  -H "Authorization: Bearer $FARA_API_KEY"
```

| Query | Default | Allowed values | Notes |
|---|---|---|---|
| `file` | `source` | `source`, `translation` | `translation` exists only if `targetLanguage` was not `none` and `translationSkipped` is `false`; else `404`. |
| `format` | `txt` | `txt`, `srt`, `pdf`, `docx` | `txt` (`text/plain; charset=utf-8`): paragraphs. `srt` (`application/x-subrip; charset=utf-8`): numbered timed cues. With more than one speaker, lines start with `Speaker N:` (`گوینده N:` for Persian text). `pdf` (`application/pdf`) and `docx` (`application/vnd.openxmlformats-officedocument.wordprocessingml.document`): an A4 document, one block per speaker turn with its start time, right-to-left for Persian and Arabic. The first request for a PDF or Word file can take a few seconds; later ones are immediate. |

Needs `status: "completed"`, else `409`. The file name is the upload's name plus the language code.

### Delete

```http
DELETE /api/v1/transcription/jobs/{id} HTTP/1.1
Authorization: Bearer fara_sk_...
```

Response `204 No Content`. Removes the audio, the transcript and the files from our servers. This cannot be undone. Ledger rows (billing history) stay. Only a finished job (`completed`, `failed` or `cancelled`) can be deleted. A job that is still running or queued, or waiting for review, answers `409` with `JOB_NOT_FINISHED`: cancel it first. After the delete the job answers `404`. Open to every account.

### Cancel

```http
POST /api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9/cancel HTTP/1.1
Authorization: Bearer fara_sk_...
```

Response `200 OK`: `{ "ok": true }`. The hold is released. Works in any status except `completed` and `cancelled`, and not once the last step has started (`stage` is `finalizing` or `done`) → `409`.

```bash
curl -sS -X POST "https://faraatarjomeh.com/api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9/cancel" -H "Authorization: Bearer $FARA_API_KEY"
```

There is no retry call. After `failed` (hold released), upload again as a new job.

## State machine

| `status` | Terminal? | Meaning | Next action for the client |
|---|---|---|---|
| `pending` | no | Queued. | Poll. |
| `active` | no | Transcribing, translating, or writing the files. | Poll. |
| `completed` | yes | Done and charged. | Download. |
| `failed` | yes | Stopped. Hold released. `customerErrorCode` says why. | `NO_SPEECH_FOUND`: no speech in the file; do not retry. `SERVICE_BUSY`, `TOOK_TOO_LONG`, `GENERIC`: upload again once. |
| `cancelled` | yes | Cancelled. Hold released. | Nothing. |

Transitions: create → `pending` → `active` → `completed`. Any error → `failed`. `cancel` → `cancelled`. Treat any other status as still running.

## Billing

1. `POST /api/v1/transcription/jobs` measures the recording and holds the price for its length, with or without translation (`cost.faraCharged`). `402` if the balance is too low; nothing is held on any `4xx`.
2. When the files are ready, the real cost is charged: the measured length plus the real translation work. If it is above the hold, the difference is charged as an extra ledger row when your balance covers it; if it does not, only the hold is charged. Anything held and not used is released (`cost.heldFara`, `cost.refundedFara`). A skipped translation is not charged.
3. On `failed` or `cancelled` the whole hold is released.

The same recording (the same file, byte for byte) sent again by the same account within 7 days, as a meeting job or an audio-to-text job, is transcribed once: later jobs reuse that text, so the words, timings and speakers are the same. Each job is still charged as above. The stored text is deleted after 7 days, or earlier when the job it came from is deleted. It is never used for another account.

See [Billing](https://faraatarjomeh.com/api/v1/docs/billing.md).

## Webhook events

| Event | When |
|---|---|
| `transcription.completed` | The files are ready. |
| `transcription.failed` | The job failed. GET the job for `customerErrorCode`. |
| `transcription.cancelled` | The job was cancelled. |

Payload: `{ "type": "transcription.completed", "timestamp": "...", "id": "evt_...", "data": { "object": "transcription", "id": "66f5e0c1d2e3f4a5b6c7d8e9", "status": "completed", "createdAt": "...", "updatedAt": "...", "links": { "self": "https://faraatarjomeh.com/api/v1/transcription/jobs/66f5e0c1d2e3f4a5b6c7d8e9" } } }`. See [Webhooks](https://faraatarjomeh.com/api/v1/docs/webhooks.md).

## Errors and recovery

All errors are `application/problem+json`. Branch on `code`. See [Errors](https://faraatarjomeh.com/api/v1/docs/errors.md).

| HTTP | `code` | When | Retry? | What the client should do |
|---|---|---|---|---|
| 400 | [`BAD_REQUEST`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-bad-request) | No `audio` part, part type not allowed, content is not audio, duration unreadable, file over `audioMaxBytes`, bad `sourceLanguage` or `targetLanguage`, bad `file` or `format` on download. | no | Fix the request or the file. |
| 400 | [`AUDIO_SOURCE_TOO_LONG`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-audio-source-too-long) | Longer than `maxDurationSeconds`. | no | Split the recording. |
| 402 | [`INSUFFICIENT_CREDITS`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-insufficient-credits) | Balance below the hold. Body has `cost` (`{ faraCharged, minutesBilled }`, the hold) and `balance`. | no | Tell the user; they top up at https://faraatarjomeh.com. After the top-up, send the same request again; the same `Idempotency-Key` is fine (4xx answers are not stored). |
| 402 | [`CHARGEBACK_LIABILITY_OUTSTANDING`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-chargeback-liability-outstanding) | A payment was reversed. | no | Tell the user to settle it on the website. |
| 404 | [`NOT_FOUND`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-not-found) | No such job, or the asked file does not exist (for example no translation). | no | Check the id and `file`. |
| 409 | [`CONFLICT`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-conflict) | Download before `completed`, or cancel after `finalizing`/terminal. | refresh | GET the job and decide from `status`. |
| 409 | [`IDEMPOTENCY_KEY_IN_USE`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-idempotency-key-in-use) | First request with this key still running. | yes | Wait `Retry-After`, resend with the same key. |
| 429 | [`RATE_LIMITED`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-rate-limited) | Too many requests. | yes | Wait `Retry-After` seconds. |
| 500, 502, 504 | [`INTERNAL_ERROR`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-internal-error), [`UPSTREAM_ERROR`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-upstream-error), [`UPSTREAM_TIMEOUT`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-upstream-timeout) | Unknown outcome: the job may or may not exist. This answer is stored, so the same `Idempotency-Key` only replays it. | check first | List jobs with `GET /api/v1/transcription/jobs` and look for one with the same `originalFilename` created in the last minutes. Only if there is none, send the request again with a NEW `Idempotency-Key`. |
| 503 | [`FEATURE_DISABLED`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-feature-disabled) | Transcription is off on this server. | later | Try again much later. |
| 503 | [`CREDIT_RESERVATION_UNAVAILABLE`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-credit-reservation-unavailable) | Could not hold Fara right now. | yes | Wait `Retry-After`, upload again with the same `Idempotency-Key`. |
| 503 | [`SERVICE_UNAVAILABLE`](https://faraatarjomeh.com/api/v1/docs/errors.md#error-service-unavailable) | Could not queue the job; hold released. | yes | Back off, upload again with the same `Idempotency-Key`. |

## Rules for agents

- Get the rate first. After upload, compare `cost.faraCharged` with the user's budget; if it is higher, cancel at once.
- Set the file part's `Content-Type` to the real audio type.
- Use a new `Idempotency-Key` for every file. Reuse it only to retry the same upload.
- Poll no faster than every 15 seconds. Prefer webhooks.
- Read `GET /api/v1/transcription/jobs/{id}` as the job itself (no `job` wrapper).
- Check `translationSkipped` before downloading `file=translation`.
- Branch on `code` and `customerErrorCode`, never on `detail`. Treat unknown statuses as still running.

## Complete script

Both scripts: upload with translation to Persian → poll → download the original TXT and the translated SRT. Set `FARA_API_KEY`, `FARA_BASE_URL` and `MAX_FARA`.

```python
# Python 3.9+, pip install requests
import os, sys, time, uuid
import requests

BASE = os.environ.get("FARA_BASE_URL", "https://faraatarjomeh.com").rstrip("/")
H = {"Authorization": f"Bearer {os.environ['FARA_API_KEY']}"}
FILE = "interview.m4a"
MAX_FARA = 50
TYPES = {".mp3": "audio/mpeg", ".m4a": "audio/mp4", ".mp4": "audio/mp4", ".wav": "audio/wav",
         ".webm": "audio/webm", ".ogg": "audio/ogg", ".flac": "audio/flac"}

def check(r):
    if r.status_code >= 400:
        p = r.json() if "json" in r.headers.get("Content-Type", "") else {}
        raise SystemExit(f"{r.status_code} {p.get('code')}: {p.get('detail')}")
    return r

pricing = check(requests.get(f"{BASE}/api/v1/transcription/pricing", headers=H, timeout=30)).json()
if os.path.getsize(FILE) > pricing["audioMaxBytes"]:
    sys.exit("file is too large")

mime = TYPES[os.path.splitext(FILE)[1].lower()]
idem = str(uuid.uuid4())  # one key per file; reuse only to retry this upload (on 500/502/504 check the job list first)
for attempt in range(5):
    with open(FILE, "rb") as f:
        r = requests.post(f"{BASE}/api/v1/transcription/jobs", headers={**H, "Idempotency-Key": idem},
                          data={"sourceLanguage": "auto", "targetLanguage": "fa"},
                          files={"audio": (os.path.basename(FILE), f, mime)}, timeout=600)
    if r.status_code in (409, 429, 503) and r.json().get("code") in ("IDEMPOTENCY_KEY_IN_USE", "RATE_LIMITED", "CREDIT_RESERVATION_UNAVAILABLE", "SERVICE_UNAVAILABLE"):
        time.sleep(int(r.headers.get("Retry-After", 2 ** attempt)))
        continue
    break
created = check(r).json()
job_id = created["jobId"]
print("job:", job_id, "held:", created["cost"]["faraCharged"], "Fara")
if created["cost"]["faraCharged"] > MAX_FARA:
    check(requests.post(f"{BASE}/api/v1/transcription/jobs/{job_id}/cancel", headers=H, timeout=30))
    sys.exit("over budget; cancelled, hold released")

while True:
    job = check(requests.get(f"{BASE}/api/v1/transcription/jobs/{job_id}", headers=H, timeout=60)).json()  # no wrapper
    print(job["status"], job.get("stage"), job.get("progress"))
    if job["status"] in ("completed", "failed", "cancelled"):
        break
    time.sleep(15)
if job["status"] != "completed":
    sys.exit(f"job ended as {job['status']} ({job.get('customerErrorCode')})")

wanted = [("source", "txt")]
if job["targetLanguage"] != "none" and not job["translationSkipped"]:
    wanted.append(("translation", "srt"))
for file, fmt in wanted:
    d = check(requests.get(f"{BASE}/api/v1/transcription/jobs/{job_id}/download",
                           params={"file": file, "format": fmt}, headers=H, timeout=120))
    with open(f"{file}.{fmt}", "wb") as out:
        out.write(d.content)
print("charged:", job["cost"]["faraCharged"], "Fara")
```

```js
// Node.js 20+ (ESM: save as transcribe.mjs)
import { openAsBlob, statSync } from "node:fs";
import { writeFile } from "node:fs/promises";
import { randomUUID } from "node:crypto";
import { basename, extname } from "node:path";

const BASE = (process.env.FARA_BASE_URL ?? "https://faraatarjomeh.com").replace(/\/+$/, "");
const H = { Authorization: `Bearer ${process.env.FARA_API_KEY}` };
const FILE = "interview.m4a";
const MAX_FARA = 50;
const TYPES = { ".mp3": "audio/mpeg", ".m4a": "audio/mp4", ".mp4": "audio/mp4", ".wav": "audio/wav", ".webm": "audio/webm", ".ogg": "audio/ogg", ".flac": "audio/flac" };
const sleep = (ms) => new Promise((r) => setTimeout(r, ms));

async function call(path, init = {}) {
  const res = await fetch(`${BASE}${path}`, { ...init, headers: { ...H, ...init.headers } });
  if (!res.ok) {
    const p = await res.json().catch(() => ({}));
    throw Object.assign(new Error(`${res.status} ${p.code}: ${p.detail}`), {
      code: p.code,
      retryAfter: Number(res.headers.get("retry-after")) || 0,
    });
  }
  return res;
}

const pricing = await (await call("/api/v1/transcription/pricing")).json();
if (statSync(FILE).size > pricing.audioMaxBytes) throw new Error("file is too large");

const idem = randomUUID(); // one key per file; reuse only to retry this upload (on 500/502/504 check the job list first)
const RETRY = new Set(["IDEMPOTENCY_KEY_IN_USE", "RATE_LIMITED", "CREDIT_RESERVATION_UNAVAILABLE", "SERVICE_UNAVAILABLE"]);
let created;
for (let attempt = 0; ; attempt++) {
  const form = new FormData();
  form.append("sourceLanguage", "auto");
  form.append("targetLanguage", "fa");
  form.append("audio", await openAsBlob(FILE, { type: TYPES[extname(FILE).toLowerCase()] }), basename(FILE));
  try {
    created = await (await call("/api/v1/transcription/jobs", { method: "POST", headers: { "Idempotency-Key": idem }, body: form })).json();
    break;
  } catch (e) {
    if (!RETRY.has(e.code) || attempt >= 4) throw e;
    await sleep((e.retryAfter || 2 ** attempt) * 1000);
  }
}
const jobId = created.jobId;
console.log("job:", jobId, "held:", created.cost.faraCharged, "Fara");
if (created.cost.faraCharged > MAX_FARA) {
  await call(`/api/v1/transcription/jobs/${jobId}/cancel`, { method: "POST" });
  throw new Error("over budget; cancelled, hold released");
}

let job;
for (;;) {
  job = await (await call(`/api/v1/transcription/jobs/${jobId}`)).json(); // no wrapper
  console.log(job.status, job.stage, job.progress);
  if (["completed", "failed", "cancelled"].includes(job.status)) break;
  await sleep(15_000);
}
if (job.status !== "completed") throw new Error(`job ended as ${job.status} (${job.customerErrorCode})`);

const wanted = [["source", "txt"]];
if (job.targetLanguage !== "none" && !job.translationSkipped) wanted.push(["translation", "srt"]);
for (const [file, format] of wanted) {
  const res = await call(`/api/v1/transcription/jobs/${jobId}/download?file=${file}&format=${format}`);
  await writeFile(`${file}.${format}`, Buffer.from(await res.arrayBuffer()));
}
console.log("charged:", job.cost.faraCharged, "Fara");
```
