Guides
Upload a file
Send an audio or video file from disk and wait for the transcript.
Code examples use API and HEADERS (headers in JavaScript), set up as in the Quickstart.
Send the file
Upload the file as multipart/form-data, with the file in a field called file. Any other options go in the same form. This example asks for speaker labels, sets the language and gives the transcript a title:
curl https://scribefiles.com/v1/transcripts \
-H "Authorization: Bearer $SCRIBEFILES_API_KEY" \
-F file=@interview.m4a \
-F language=en \
-F speaker_labels=true \
-F speakers_expected=2 \
-F title="Interview with Dr. Lee"
import os
import requests
API = "https://scribefiles.com/v1"
HEADERS = {"Authorization": f"Bearer {os.environ['SCRIBEFILES_API_KEY']}"}
with open("interview.m4a", "rb") as f:
res = requests.post(f"{API}/transcripts", headers=HEADERS, files={"file": f}, data={
"language": "en",
"speaker_labels": "true",
"speakers_expected": "2",
"title": "Interview with Dr. Lee",
})
res.raise_for_status()
transcript = res.json()
import { readFile } from "node:fs/promises";
const API = "https://scribefiles.com/v1";
const headers = { Authorization: `Bearer ${process.env.SCRIBEFILES_API_KEY}` };
const form = new FormData();
form.append("file", new Blob([await readFile("interview.m4a")]), "interview.m4a");
form.append("language", "en");
form.append("speaker_labels", "true");
form.append("speakers_expected", "2");
form.append("title", "Interview with Dr. Lee");
const res = await fetch(`${API}/transcripts`, { method: "POST", headers, body: form });
if (!res.ok) throw new Error((await res.json()).error.message);
const transcript = await res.json();
The request returns once the file has arrived and passed its checks, with a 201 and the new transcript (status queued). All the options are in the API reference.
Choosing options
language: leave it out (or sendauto) to detect the language, or send a language code when you know it. That's slightly faster and more reliable for short clips.mode:express(the default) is fast and great for meetings and notes.studiois our most accurate mode, for interviews, podcasts and tricky audio.speaker_labels: labels each segmentSpeaker 1,Speaker 2… Addspeakers_expectedif you know how many people talk.restore_audio: cleans up noise and levels the volume before transcribing. Useful for phone calls and noisy rooms.translate_to_english: transcribes speech in any language straight into English.
Waiting for the result
Transcription runs in the background. Either:
- Poll: retrieve the transcript every 5–10 seconds until
statusiscompletedorfailed.progress(0 to 1) andstagetell you how far along it is. - Use a webhook: add
webhook_urlto the request and we'll call your server when it's done. See Webhooks.
# Repeat until "status" is "completed" or "failed"
curl https://scribefiles.com/v1/transcripts/TRANSCRIPT_ID \
-H "Authorization: Bearer $SCRIBEFILES_API_KEY"
import time
def wait_for(transcript_id: str) -> dict:
while True:
t = requests.get(f"{API}/transcripts/{transcript_id}", headers=HEADERS).json()
if t["status"] == "completed":
return t
if t["status"] == "failed":
raise RuntimeError(t["error"])
time.sleep(5)
async function waitFor(id) {
for (;;) {
const t = await (await fetch(`${API}/transcripts/${id}`, { headers })).json();
if (t.status === "completed") return t;
if (t.status === "failed") throw new Error(t.error);
await new Promise((r) => setTimeout(r, 5000));
}
}
Large files
Files can be up to 10 hours and 5 GB. For big files, give your HTTP client a long timeout (or none) for the upload itself. If the file already sits in cloud storage, send a link instead and skip the upload.
Questions about the API? Contact us.