DEVELOPER · API · INTEGRATION
API ACCESS.
Automatisiere Transkriptionen via REST API. Abrechnung läuft per Minute — identisch zum Web-Interface.
Guthaben
Preis: wird geladen…
API Keys
Wird geladen…
Quickstart
Endpoints
Webhook
Minimales Beispiel (Python)
import httpx API_KEY = "sk_live_..." BASE = "https://subli.ch" # 1. Job starten resp = httpx.post(f"{BASE}/api/v1/transcribe", headers={"Authorization": f"Bearer {API_KEY}"}, json={"url": "https://example.com/podcast.mp3"}) job_id = resp.json()["job_id"] # 2. Auf Fertigstellung warten import time while True: status = httpx.get(f"{BASE}/api/v1/job/{job_id}", headers={"Authorization": f"Bearer {API_KEY}"}).json() if status["status"] == "done": break time.sleep(5) # 3. SRT herunterladen srt = httpx.get(f"{BASE}/api/v1/result/{job_id}", headers={"Authorization": f"Bearer {API_KEY}"}).text print(srt)
Mit Webhook (empfohlen)
resp = httpx.post(f"{BASE}/api/v1/transcribe", headers={"Authorization": f"Bearer {API_KEY}"}, json={ "url": "https://example.com/podcast.mp3", "webhook_url": "https://dein-server.com/callback" }) # SUBLI ruft dich auf, sobald der Job fertig ist.
POST /api/v1/transcribe
Startet einen Transkriptions-Job.
{ "url": "https://…/podcast.mp3", // HTTPS, max 4 GB "webhook_url": "https://…/callback" // optional } // Response 200 { "job_id": "…", "status": "queued", "duration_seconds": 1823.0 } // Response 402 — zu wenig Guthaben { "error": "insufficient_funds", "missing_rappen": 450 }
GET /api/v1/job/{job_id}
// status: "queued" | "loading" | "transcribing" | "processing" | "done" | "error" { "job_id": "…", "status": "transcribing", "progress": 30 }
GET /api/v1/result/{job_id}?format=srt
format: srt (default) oder json
// SRT (text/plain) 1 00:00:00,000 --> 00:00:03,420 Willkommen zum Podcast. // JSON — jedes Wort/Segment trägt automatisch ein "speaker"-Feld (z.B. "SPEAKER_00") { "words": […], "segments": […] }
Auth-Header für alle Requests:
Authorization: Bearer sk_live_…
Wenn du webhook_url mitgibst, sendet SUBLI bei Job-Abschluss einen POST mit diesem Payload:
{ "event": "transcription.done", "job_id": "…", "status": "done", "result_url": "https://subli.ch/api/v1/result/{job_id}", "srt_url": "https://subli.ch/api/v1/result/{job_id}?format=srt", "json_url": "https://subli.ch/api/v1/result/{job_id}?format=json" }
Signatur verifizieren
Jeder Webhook-Request enthält den Header X-Subli-Signature — ein HMAC-SHA256 des JSON-Body, signiert mit deinem Webhook Secret (sichtbar in der Key-Liste oben).
import hmac, hashlib, json def verify(body_bytes, signature, secret): expected = hmac.new( secret.encode(), body_bytes, hashlib.sha256 ).hexdigest() return hmac.compare_digest(expected, signature)