The Scrivio API lets your own programs send audio and video files to transcribe, read your transcriptions with their transcripts, rename, tag, highlight and delete them, and download their audio. It is a REST API under /v1, authenticated by an API key you create on your account.
Base URL
Every operation is under https://scrivio.ch/v1, the host you use Scrivio on. The prefix is the version: a change that breaks a client will come under a new prefix.
Authentication
Create a key on « My account › API ». Send it on every call as Authorization: Bearer <key>.
A key lives 30, 90 or 365 days and is never extended. You receive a mail when a key is created and one reminder a week before it expires. Revoke a key at once from the same page if it leaks.
Plans and rights
API access is included in the paying plans. Keys created on free plan work as soon as the account moves to a paying plan.
The API and the interface share one monthly budget and one set of plan limits.
Rate limits
Calls are rate limited per account, all its keys together, with separate limits for reads, for writes and for files sent.
Pagination
GET /v1/transcriptions answers newest first, 50 rows per page by default and 100 at most (limit). Pass the nextCursor of a page as cursor to read the next one; it is null on the last page.
Refusals
Refusals
Status
Code
Reason
Meaning
401
UNAUTHORIZED
api_key_missing
No Authorization header.
401
UNAUTHORIZED
api_key_invalid
A malformed or unknown key.
401
UNAUTHORIZED
api_key_revoked
The key was revoked.
401
UNAUTHORIZED
api_key_expired
The key is past its expiry.
401
UNAUTHORIZED
account_unavailable
The account is blocked, closed or not verified.
429
TOO_MANY_REQUESTS
A rate limit is spent; retry after Retry-After seconds.
402
PAYMENT_REQUIRED
api_access_required
The plan does not include API access; the body names it.
403
FORBIDDEN
api_key_read_only
A read key on a file sent, a change or a deletion.
403
FORBIDDEN
A change to a transcription the account does not own.
404
NOT_FOUND
A transcription that does not exist, is deleted or is not the account’s.
400
BAD_REQUEST
A parameter or a body the operation refuses.
404
NOT_FOUND
The audio of a transcription that is unknown, deleted, not the account’s, or not yet processing.
400
BAD_REQUEST
A file sent without a known language or its X-Filename, with a blank name, an unknown format or an empty body; or a file that is neither audio nor video, has no audio track or cannot be converted.
413
CONTENT_TOO_LARGE
file_too_large
A file larger than the plan allows, declared or measured while it is sent; maxBytes is the limit. Over 4 GiB the proxy refuses it with its own page.
429
TOO_MANY_REQUESTS
concurrency_cap
The account is already sending as many files at once as it may, those of the interface included; max is that number. Retry after Retry-After seconds.
413
CONTENT_TOO_LARGE
duration_too_long
An audio longer than the plan allows; maxDurationSec is the limit.
402
PAYMENT_REQUIRED
quota_exceeded
The minutes left this month do not cover the file; minutesRemaining and resetsAt say what is left and when the count starts again.
Examples
Each program sends a file, waits for its transcript and prints it, with the key in SCRIVIO_API_KEY and the file as its argument. Each uses its language’s standard library alone, but for Rust, which needs two crates.
// node transcribe.mjs interview.mp3 — Node.js 20 or laterimport { openAsBlob } from'node:fs'import { basename } from'node:path'constAPI = 'https://scrivio.ch/v1'const auth = { Authorization: `Bearer ${process.env.SCRIVIO_API_KEY}` }
asyncfunctioncall(path, init, expected) {
const answer = awaitfetch(API + path, { ...init, headers: { ...auth, ...init.headers } })
if (answer.status !== expected) thrownewError(`${answer.status} ${await answer.text()}`)
return answer.json()
}
// 1. Send the file: its bytes as the body, streamed from the disk, its name in X-Filename.const file = process.argv[2]
let transcription = awaitcall('/transcriptions?language=fr', {
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
'X-Filename': encodeURIComponent(basename(file)),
},
body: awaitopenAsBlob(file),
}, 201)
// 2. Read it until the transcript is ready.while (transcription.status === 'waiting' || transcription.status === 'processing') {
awaitnewPromise((resolve) => setTimeout(resolve, 10_000))
transcription = awaitcall(`/transcriptions/${transcription.id}`, {}, 200)
}
if (transcription.status === 'error') thrownewError('The transcription failed; its minutes were refunded.')
// 3. Print it, one turn of speech per line.for (const segment of transcription.transcript) {
console.log(`${segment.speaker}: ${segment.words.map((w) => w.word).join(' ')}`)
}
// node transcribe.ts interview.mp3 — Node.js 22.18 or laterimport { openAsBlob } from'node:fs'import { basename } from'node:path'interfaceSegment {
speaker: string
start: number
end: number
words: { word: string; start: number; end: number }[]
}
interfaceTranscription {
id: string
name: string
status: 'waiting' | 'processing' | 'error' | 'done'/** On the detail alone: null until the transcription is done. */
transcript?: Segment[] | null
}
interfaceInitextendsRequestInit {
headers?: Record<string, string>
}
constAPI = 'https://scrivio.ch/v1'const auth = { Authorization: `Bearer ${process.env.SCRIVIO_API_KEY}` }
asyncfunctioncall(path: string, init: Init, expected: number): Promise<Transcription> {
const answer = awaitfetch(API + path, { ...init, headers: { ...auth, ...init.headers } })
if (answer.status !== expected) thrownewError(`${answer.status} ${await answer.text()}`)
return (await answer.json()) asTranscription
}
// 1. Send the file: its bytes as the body, streamed from the disk, its name in X-Filename.const file = process.argv[2]
let transcription = awaitcall('/transcriptions?language=fr', {
method: 'POST',
headers: {
'Content-Type': 'application/octet-stream',
'X-Filename': encodeURIComponent(basename(file)),
},
body: awaitopenAsBlob(file),
}, 201)
// 2. Read it until the transcript is ready.while (transcription.status === 'waiting' || transcription.status === 'processing') {
awaitnewPromise((resolve) => setTimeout(resolve, 10_000))
transcription = awaitcall(`/transcriptions/${transcription.id}`, {}, 200)
}
if (transcription.status === 'error') thrownewError('The transcription failed; its minutes were refunded.')
// 3. Print it, one turn of speech per line.for (const segment of transcription.transcript ?? []) {
console.log(`${segment.speaker}: ${segment.words.map((w) => w.word).join(' ')}`)
}
# python3 transcribe.py interview.mp3 — Python 3.8 or laterimport json
import os
import sys
import time
import urllib.error
import urllib.parse
import urllib.request
API = "https://scrivio.ch/v1"defcall(method, path, expected, body=None, headers=None):
request = urllib.request.Request(API + path, data=body, method=method, headers=headers or {})
request.add_header("Authorization", "Bearer " + os.environ["SCRIVIO_API_KEY"])
try:
with urllib.request.urlopen(request) as answer:
status, text = answer.status, answer.read()
except urllib.error.HTTPErroras refusal:
status, text = refusal.code, refusal.read()
if status != expected:
sys.exit(str(status) + " " + text.decode())
return json.loads(text)
# 1. Send the file: its bytes as the body, its name in X-Filename.
path = sys.argv[1]
withopen(path, "rb") as file:
transcription = call("POST", "/transcriptions?language=fr", 201, file.read(), {
"Content-Type": "application/octet-stream",
"X-Filename": urllib.parse.quote(os.path.basename(path), safe=""),
})
# 2. Read it until the transcript is ready.while transcription["status"] in ("waiting", "processing"):
time.sleep(10)
transcription = call("GET", "/transcriptions/" + transcription["id"], 200)
if transcription["status"] == "error":
sys.exit("The transcription failed; its minutes were refunded.")
# 3. Print it, one turn of speech per line.for segment in transcription["transcript"]:
print(segment["speaker"] + ": " + " ".join(word["word"] for word in segment["words"]))
// java Transcribe.java interview.mp3 — Java 11 or laterimport java.net.URI;
import java.net.URLEncoder;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
publicclassTranscribe {
staticfinalStringAPI = "https://scrivio.ch/v1";
staticfinalHttpClientHTTP = HttpClient.newHttpClient();
publicstaticvoidmain(String[] args) throwsException {
// 1. Send the file: its bytes as the body, its name in X-Filename.Path file = Path.of(args[0]);
String name = URLEncoder.encode(file.getFileName().toString(), StandardCharsets.UTF_8)
.replace("+", "%20");
String transcription = call(HttpRequest.newBuilder(URI.create(API + "/transcriptions?language=fr"))
.header("Content-Type", "application/octet-stream")
.header("X-Filename", name)
.POST(HttpRequest.BodyPublishers.ofFile(file)), 201);
String id = field(transcription, "id");
// 2. Read it until the transcript is ready.URI detail = URI.create(API + "/transcriptions/" + id);
String status = field(transcription, "status");
while (status.equals("waiting") || status.equals("processing")) {
Thread.sleep(10_000);
transcription = call(HttpRequest.newBuilder(detail).GET(), 200);
status = field(transcription, "status");
}
if (status.equals("error")) {
thrownewIllegalStateException("The transcription failed; its minutes were refunded.");
}
// 3. Print it, one turn of speech per line: each speaker, then the words that follow.StringBuilder line = newStringBuilder();
Matcher m = Pattern.compile("\"(speaker|word)\":\"([^\"]*)\"").matcher(transcription);
while (m.find()) {
if (m.group(1).equals("speaker")) {
if (line.length() > 0) System.out.println(line);
line = newStringBuilder(m.group(2) + ":");
} else {
line.append(' ').append(m.group(2));
}
}
System.out.println(line);
}
staticStringcall(HttpRequest.Builder request, int expected) throwsException {
HttpResponse<String> answer = HTTP.send(
request.header("Authorization", "Bearer " + System.getenv("SCRIVIO_API_KEY")).build(),
HttpResponse.BodyHandlers.ofString());
if (answer.statusCode() != expected) {
thrownewIllegalStateException(answer.statusCode() + " " + answer.body());
}
return answer.body();
}
// The standard library has no JSON parser: this reads the first string field of a name.// A real program would use the JSON library it already has.staticStringfield(String json, String name) {
Matcher m = Pattern.compile("\"" + name + "\":\"([^\"]*)\"").matcher(json);
if (!m.find()) thrownewIllegalStateException("No " + name + " in " + json);
return m.group(1);
}
}
// dotnet run -- interview.mp3 — .NET 6 or later, in a console project (dotnet new console)usingSystem.Net;
usingSystem.Net.Http.Headers;
usingSystem.Text.Json;
conststringApi = "https://scrivio.ch/v1";
// No timeout: the answer to a file sent comes once it is uploaded and converted.usingvar http = newHttpClient { Timeout = Timeout.InfiniteTimeSpan };
http.DefaultRequestHeaders.Authorization =
newAuthenticationHeaderValue("Bearer", Environment.GetEnvironmentVariable("SCRIVIO_API_KEY"));
// 1. Send the file: its bytes as the body, streamed from the disk, its name in X-Filename.var path = args[0];
usingvar file = File.OpenRead(path);
var content = newStreamContent(file);
content.Headers.ContentType = newMediaTypeHeaderValue("application/octet-stream");
var upload = newHttpRequestMessage(HttpMethod.Post, Api + "/transcriptions?language=fr");
upload.Content = content;
upload.Headers.Add("X-Filename", Uri.EscapeDataString(Path.GetFileName(path)));
var transcription = awaitRead(await http.SendAsync(upload), HttpStatusCode.Created);
// 2. Read it until the transcript is ready.var id = transcription.GetProperty("id").GetString();
var status = transcription.GetProperty("status").GetString();
while (status is"waiting"or"processing")
{
awaitTask.Delay(TimeSpan.FromSeconds(10));
transcription = awaitRead(await http.GetAsync(Api + "/transcriptions/" + id), HttpStatusCode.OK);
status = transcription.GetProperty("status").GetString();
}
if (status == "error") thrownewException("The transcription failed; its minutes were refunded.");
// 3. Print it, one turn of speech per line.foreach (var segment in transcription.GetProperty("transcript").EnumerateArray())
{
var speaker = segment.GetProperty("speaker").GetString();
var words = segment.GetProperty("words").EnumerateArray().Select(w => w.GetProperty("word").GetString());
Console.WriteLine(speaker + ": " + string.Join(" ", words));
}
staticasyncTask<JsonElement> Read(HttpResponseMessage answer, HttpStatusCode expected)
{
var text = await answer.Content.ReadAsStringAsync();
if (answer.StatusCode != expected) thrownewException((int)answer.StatusCode + " " + text);
returnJsonDocument.Parse(text).RootElement;
}
// cargo run -- interview.mp3 — the standard library has no HTTP client, so two crates// in Cargo.toml: ureq = "3" and serde_json = "1"use serde_json::Value;
use std::{env, fs, path::Path, thread, time::Duration};
constAPI: &str = "https://scrivio.ch/v1";
typeError = Box<dyn std::error::Error>;
fnmain() -> Result<(), Error> {
let auth = format!("Bearer {}", env::var("SCRIVIO_API_KEY")?);
let path = env::args().nth(1).ok_or("usage: transcribe <file>")?;
let name = Path::new(&path).file_name().ok_or("not a file")?.to_string_lossy();
// Every answer is read, a refusal included, to show its body.let agent: ureq::Agent = ureq::Agent::config_builder().http_status_as_error(false).build().into();
// 1. Send the file: its bytes as the body, its name in X-Filename.let answer = agent
.post(&format!("{API}/transcriptions?language=fr"))
.header("Authorization", &auth)
.header("Content-Type", "application/octet-stream")
.header("X-Filename", &encode(&name))
.send(&fs::read(&path)?)?;
letmut transcription = read(answer, 201)?;
// 2. Read it until the transcript is ready.whilematches!(transcription["status"].as_str(), Some("waiting" | "processing")) {
thread::sleep(Duration::from_secs(10));
let id = transcription["id"].as_str().unwrap_or_default();
let answer = agent.get(&format!("{API}/transcriptions/{id}")).header("Authorization", &auth).call()?;
transcription = read(answer, 200)?;
}
if transcription["status"] == "error" {
returnErr("The transcription failed; its minutes were refunded.".into());
}
// 3. Print it, one turn of speech per line.for segment in transcription["transcript"].as_array().into_iter().flatten() {
let words: Vec<&str> = segment["words"].as_array().into_iter().flatten()
.filter_map(|word| word["word"].as_str())
.collect();
println!("{}: {}", segment["speaker"].as_str().unwrap_or_default(), words.join(" "));
}
Ok(())
}
fnread(mut answer: ureq::http::Response<ureq::Body>, expected: u16) -> Result<Value, Error> {
let text = answer.body_mut().read_to_string()?;
if answer.status() != expected {
returnErr(format!("{} {text}", answer.status()).into());
}
Ok(serde_json::from_str(&text)?)
}
/// The file's name for X-Filename, percent-encoded as encodeURIComponent does.fnencode(name: &str) -> String {
name.bytes()
.map(|b| match b {
b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'_' | b'.' | b'~' => (b as char).to_string(),
_ => format!("%{b:02X}"),
})
.collect()
}
// go run transcribe.go interview.mp3 — Go 1.16 or laterpackage main
import (
"bytes""encoding/json""fmt""io""net/http""net/url""os""path/filepath""strings""time"
)
const api = "https://scrivio.ch/v1"// The fields this program reads: encoding/json matches their names without regard to case.typeTranscriptionstruct {
ID string
Status string
Transcript []struct {
Speaker string
Words []struct{ Word string }
}
}
funccall(method, path string, body []byte, headers map[string]string, expected int) Transcription {
request, err := http.NewRequest(method, api+path, bytes.NewReader(body))
check(err)
request.Header.Set("Authorization", "Bearer "+os.Getenv("SCRIVIO_API_KEY"))
for name, value := range headers {
request.Header.Set(name, value)
}
answer, err := http.DefaultClient.Do(request)
check(err)
defer answer.Body.Close()
text, err := io.ReadAll(answer.Body)
check(err)
if answer.StatusCode != expected {
check(fmt.Errorf("%d %s", answer.StatusCode, text))
}
var transcription Transcriptioncheck(json.Unmarshal(text, &transcription))
return transcription
}
funccheck(err error) {
if err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
funcmain() {
// 1. Send the file: its bytes as the body, its name in X-Filename.
file, err := os.ReadFile(os.Args[1])
check(err)
transcription := call("POST", "/transcriptions?language=fr", file, map[string]string{
"Content-Type": "application/octet-stream",
"X-Filename": url.PathEscape(filepath.Base(os.Args[1])),
}, http.StatusCreated)
// 2. Read it until the transcript is ready.for transcription.Status == "waiting" || transcription.Status == "processing" {
time.Sleep(10 * time.Second)
transcription = call("GET", "/transcriptions/"+transcription.ID, nil, nil, http.StatusOK)
}
if transcription.Status == "error" {
check(fmt.Errorf("the transcription failed; its minutes were refunded"))
}
// 3. Print it, one turn of speech per line.for _, segment := range transcription.Transcript {
words := make([]string, len(segment.Words))
for i, word := range segment.Words {
words[i] = word.Word
}
fmt.Println(segment.Speaker+":", strings.Join(words, " "))
}
}
<?php// php transcribe.php interview.mp3 — PHP 8.4 or laterconstAPI = 'https://scrivio.ch/v1';
// The file is sent from memory, whatever its size.ini_set('memory_limit', '-1');
functioncall(string $method, string $path, int $expected, string $body = '', array $headers = []): array
{
$headers[] = 'Authorization: Bearer ' . getenv('SCRIVIO_API_KEY');
$context = stream_context_create(['http' => [
'method' => $method,
'header' => $headers,
'content' => $body,
// An hour to answer: a file sent is converted before the answer comes.'timeout' => 3600,
'ignore_errors' => true,
]]);
$text = file_get_contents(API . $path, false, $context);
$status = (int) explode(' ', http_get_last_response_headers()[0])[1];
if ($status !== $expected) {
fwrite(STDERR, $status . ' ' . $text . PHP_EOL);
exit(1);
}
returnjson_decode($text, true);
}
// 1. Send the file: its bytes as the body, its name in X-Filename.
$path = $argv[1];
$transcription = call('POST', '/transcriptions?language=fr', 201, file_get_contents($path), [
'Content-Type: application/octet-stream',
'X-Filename: ' . rawurlencode(basename($path)),
]);
// 2. Read it until the transcript is ready.while (in_array($transcription['status'], ['waiting', 'processing'], true)) {
sleep(10);
$transcription = call('GET', '/transcriptions/' . $transcription['id'], 200);
}
if ($transcription['status'] === 'error') {
fwrite(STDERR, 'The transcription failed; its minutes were refunded.' . PHP_EOL);
exit(1);
}
// 3. Print it, one turn of speech per line.foreach ($transcription['transcript'] as $segment) {
echo $segment['speaker'], ': ', implode(' ', array_column($segment['words'], 'word')), PHP_EOL;
}
# ruby transcribe.rb interview.mp3require"json"require"net/http"require"uri"API = "https://scrivio.ch/v1"defcall(request, expected)
request["Authorization"] = "Bearer " + ENV.fetch("SCRIVIO_API_KEY")
uri = request.uri
# An hour to answer: a file sent is converted before the answer comes.
answer = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https", read_timeout: 3600) do |http|
http.request(request)
end
abort "#{answer.code} #{answer.body}"unless answer.code.to_i == expected
JSON.parse(answer.body)
end# 1. Send the file: its bytes as the body, streamed from the disk, its name in X-Filename.
path = ARGV.fetch(0)
upload = Net::HTTP::Post.new(URI(API + "/transcriptions?language=fr"))
upload["Content-Type"] = "application/octet-stream"
upload["Content-Length"] = File.size(path).to_s
upload["X-Filename"] = URI.encode_www_form_component(File.basename(path)).gsub("+", "%20")
transcription = File.open(path, "rb") do |file|
upload.body_stream = file
call(upload, 201)
end# 2. Read it until the transcript is ready.while %w[waiting processing].include?(transcription["status"])
sleep 10
transcription = call(Net::HTTP::Get.new(URI(API + "/transcriptions/" + transcription["id"])), 200)
end
abort "The transcription failed; its minutes were refunded."if transcription["status"] == "error"# 3. Print it, one turn of speech per line.
transcription["transcript"].each do |segment|
puts segment["speaker"] + ": " + segment["words"].map { |word| word["word"] }.join(" ")
end
Operations
GET/v1/accountaccount.get
The account behind the key: its plan and limits, this month's usage and the key itself.
The account's transcriptions, newest first, deleted ones never; follow `nextCursor` for the next page.
Parameters
Parameters: transcriptions.list
Name
In
Type
Description
limit
query
integer
Rows a page holds, 1 to 100.minimum 1 · maximum 100 · default 50
cursor
query
string
The `nextCursor` of the previous page.
status
query
string
Only the transcriptions of this status.one of waiting, processing, error, done
tag
query
string
Only the transcriptions carrying this tag, compared as the interface stores tags (trimmed, lower-cased), at most 32 characters as a stored tag.1 to 32 characters
Send a file: it is converted, measured, charged to the month's minutes and queued, as « Importer » does in the interface, under the plan's limits. The file is the raw body, audio or video, and its name goes in `X-Filename`; read `GET /v1/transcriptions/{id}` until its `status` is `done`. A file sent twice is two transcriptions, each charged. A refusal may be answered while the file is still being sent.
Parameters
Parameters: transcriptions.create
Name
In
Type
Description
languagerequired
query
string
The language spoken in the audio, ISO 639-1: one the upload dialog of the interface offers.one of ar, ca, cs, da, de, el, en, es, eu, fa, fi, fr, gl, he, hi, hr, hu, it, ja, ka, ko, lv, ml, nl, nn, no, pl, pt, ro, ru, sk, sl, sv, te, tl, tr, uk, ur, vi, zh
format
query
string
How the transcript is cut: `text` in turns of speech, `srt` in subtitle cues; `text` when absent.one of text, srt
X-Filenamerequired
header
string
The file's name, percent-encoded as `encodeURIComponent` does: the transcription is named after it
Request body
application/octet-stream The file, audio or video, as the raw body
Answer
201 The transcription, `waiting`, its duration measured on the converted audio — Transcription
Refusals
Refusals: transcriptions.create
Status
Code
Description
400
BAD_REQUEST
A missing or unknown `language`, an unknown `format`, no `X-Filename` or one that decodes blank or with a NUL, an empty body, or a file that is neither audio nor video, has no audio track or cannot be converted
401
UNAUTHORIZED
No valid key
402
PAYMENT_REQUIRED
`api_access_required`: the plan does not include the API. `quota_exceeded`: the month's minutes do not cover the file, with `minutesRemaining` and `resetsAt`
403
FORBIDDEN
`api_key_read_only`
413
CONTENT_TOO_LARGE
`file_too_large` with `maxBytes`, whether the size is declared or measured while the file is sent, or `duration_too_long` with `maxDurationSec`: the plan's limits. A body over 4 GiB is refused by the proxy with its own page, not this body
429
TOO_MANY_REQUESTS
The account's write bucket (30 a minute) or its bucket `api.upload` (120 files an hour); `concurrency_cap` with `Retry-After: 120` and `max`, the files an account may send at once, those of the interface included
Delete the transcription for every owner: its audio, its text and its annotations are erased and the row leaves every owner's list at once. There is no restore.
The audio Scrivio keeps of a transcription: the MP3 converted when the file was sent, not the file itself. Available once the transcription is `processing` or `done`; `Range` requests are served. Downloading it is not an opening.
Parameters
Parameters: transcriptions.audio
Name
In
Type
Description
idrequired
path
string
A UUID v7.
Answer
200 The audio, `Content-Disposition` carrying its stored name; 206 for a `Range` request — audio/mpeg
Refusals
Refusals: transcriptions.audio
Status
Code
Description
400
BAD_REQUEST
Not a UUID v7
401
UNAUTHORIZED
No valid key
402
PAYMENT_REQUIRED
`api_access_required`
404
NOT_FOUND
Unknown, deleted, not the account's, or not yet `processing`