Guides
Webhooks
Get a signed request to your server the moment a transcript is ready, instead of polling.
Code examples use API and HEADERS (headers in JavaScript), set up as in the Quickstart.
How webhooks work
Add a webhook_url when you create a transcript. When the transcript finishes, ScribeFiles sends a POST with a JSON body to that address. It must be a public https:// URL.
curl https://scribefiles.com/v1/transcripts \
-H "Authorization: Bearer $SCRIBEFILES_API_KEY" \
-F file=@meeting.mp3 \
-F webhook_url=https://example.com/hooks/scribefiles
with open("meeting.mp3", "rb") as f:
requests.post(f"{API}/transcripts", headers=HEADERS, files={"file": f},
data={"webhook_url": "https://example.com/hooks/scribefiles"})
form.append("webhook_url", "https://example.com/hooks/scribefiles");
await fetch(`${API}/transcripts`, { method: "POST", headers, body: form });
Events
| Type | Sent when |
|---|---|
transcript.completed | The transcript is ready. Retrieve it or export it. |
transcript.failed | Transcription failed. data.error says why. |
Payload
data is the transcript object, without the text, to keep the request small. Fetch the full transcript with its id.
{
"type": "transcript.completed",
"created_at": "2026-11-07T10:42:13Z",
"data": {
"id": "9f2c6d0e4b5a4e1f8a7b3c2d1e0f9a8b",
"object": "transcript",
"title": "Weekly sync",
"status": "completed",
"duration_seconds": 2538.4,
"detected_language": "en",
"url": "https://scribefiles.com/t/9f2c6d0e4b5a4e1f8a7b3c2d1e0f9a8b",
"...": "other transcript fields"
}
}
Responding
- Reply with any
2xxstatus within 15 seconds. Do slow work (like downloading the transcript) after you've replied. - If your server doesn't reply with a
2xx, we try again after 30 seconds and again after 5 minutes: 3 attempts in all. - Each attempt for the same event has the same
webhook-id, so you can ignore one you've already handled.
Verifying the signature
Anyone can send a request to your URL, so check that each one really came from ScribeFiles. Every webhook carries three headers:
| Header | Contents |
|---|---|
webhook-id | A unique ID for this event. |
webhook-timestamp | When it was sent, in seconds since 1970 (UTC). |
webhook-signature | v1, followed by the signature. |
The signature is an HMAC-SHA256 of {webhook-id}.{webhook-timestamp}.{raw body}, keyed with your webhook signing secret (find it in Settings › API; it starts with whsec_, and the key is the base64 part after that prefix), then base64-encoded. Use the raw request body exactly as received, before any JSON parsing.
# Webhooks are sent by ScribeFiles to your server.
# Verify them in your server code: see the Python and JavaScript tabs.
import base64
import hashlib
import hmac
import os
import time
def verify(secret: str, headers: dict, body: bytes) -> bool:
msg_id = headers["webhook-id"]
timestamp = headers["webhook-timestamp"]
if abs(time.time() - int(timestamp)) > 300:
return False # more than 5 minutes old: could be a replay
key = base64.b64decode(secret.removeprefix("whsec_"))
signed = f"{msg_id}.{timestamp}.".encode() + body
expected = base64.b64encode(hmac.new(key, signed, hashlib.sha256).digest()).decode()
return any(hmac.compare_digest(sig.removeprefix("v1,"), expected)
for sig in headers["webhook-signature"].split())
# Flask example
from flask import Flask, request, abort
app = Flask(__name__)
@app.post("/hooks/scribefiles")
def scribefiles_hook():
if not verify(os.environ["SCRIBEFILES_WEBHOOK_SECRET"], request.headers, request.get_data()):
abort(400)
event = request.get_json()
if event["type"] == "transcript.completed":
handle_transcript(event["data"]["id"]) # fetch it with GET /v1/transcripts/{id}
return "", 204
import crypto from "node:crypto";
import express from "express";
function verify(secret, headers, rawBody) {
const id = headers["webhook-id"];
const timestamp = headers["webhook-timestamp"];
if (Math.abs(Date.now() / 1000 - Number(timestamp)) > 300) return false;
const key = Buffer.from(secret.replace(/^whsec_/, ""), "base64");
const expected = crypto.createHmac("sha256", key)
.update(`${id}.${timestamp}.${rawBody}`).digest("base64");
return headers["webhook-signature"].split(" ").some((s) => {
const sig = Buffer.from(s.replace(/^v1,/, ""));
return sig.length === expected.length && crypto.timingSafeEqual(sig, Buffer.from(expected));
});
}
const app = express();
app.post("/hooks/scribefiles", express.raw({ type: "application/json" }), (req, res) => {
if (!verify(process.env.SCRIBEFILES_WEBHOOK_SECRET, req.headers, req.body.toString())) {
return res.sendStatus(400);
}
const event = JSON.parse(req.body);
if (event.type === "transcript.completed") handleTranscript(event.data.id);
res.sendStatus(204);
});
Rotating the secret
If your secret leaks, click Rotate in Settings › API. Webhooks are signed with the new secret from then on, so update your server at the same time.
Questions about the API? Contact us.