Saltar para o conteúdo

API reference

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
StatusCodeReasonMeaning
401UNAUTHORIZEDapi_key_missingNo Authorization header.
401UNAUTHORIZEDapi_key_invalidA malformed or unknown key.
401UNAUTHORIZEDapi_key_revokedThe key was revoked.
401UNAUTHORIZEDapi_key_expiredThe key is past its expiry.
401UNAUTHORIZEDaccount_unavailableThe account is blocked, closed or not verified.
429TOO_MANY_REQUESTSA rate limit is spent; retry after Retry-After seconds.
402PAYMENT_REQUIREDapi_access_requiredThe plan does not include API access; the body names it.
403FORBIDDENapi_key_read_onlyA read key on a file sent, a change or a deletion.
403FORBIDDENA change to a transcription the account does not own.
404NOT_FOUNDA transcription that does not exist, is deleted or is not the account’s.
400BAD_REQUESTA parameter or a body the operation refuses.
404NOT_FOUNDThe audio of a transcription that is unknown, deleted, not the account’s, or not yet processing.
400BAD_REQUESTA 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.
413CONTENT_TOO_LARGEfile_too_largeA 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.
429TOO_MANY_REQUESTSconcurrency_capThe 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.
413CONTENT_TOO_LARGEduration_too_longAn audio longer than the plan allows; maxDurationSec is the limit.
402PAYMENT_REQUIREDquota_exceededThe 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 later
import { openAsBlob } from 'node:fs'
import { basename } from 'node:path'

const API = 'https://scrivio.ch/v1'
const auth = { Authorization: `Bearer ${process.env.SCRIVIO_API_KEY}` }

async function call(path, init, expected) {
  const answer = await fetch(API + path, { ...init, headers: { ...auth, ...init.headers } })
  if (answer.status !== expected) throw new Error(`${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 = await call('/transcriptions?language=fr', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/octet-stream',
    'X-Filename': encodeURIComponent(basename(file)),
  },
  body: await openAsBlob(file),
}, 201)

// 2. Read it until the transcript is ready.
while (transcription.status === 'waiting' || transcription.status === 'processing') {
  await new Promise((resolve) => setTimeout(resolve, 10_000))
  transcription = await call(`/transcriptions/${transcription.id}`, {}, 200)
}
if (transcription.status === 'error') throw new Error('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(' ')}`)
}

Operations

GET/v1/accountaccount.get

The account behind the key: its plan and limits, this month's usage and the key itself.

Answer

200 The plan, the usage and the key — Account

Refusals

Refusals: account.get
StatusCodeDescription
401UNAUTHORIZED`api_key_missing`, `api_key_invalid`, `api_key_revoked`, `api_key_expired` or `account_unavailable`
429TOO_MANY_REQUESTSThe account's read bucket, 120 a minute

Example

curl -H "Authorization: Bearer $SCRIVIO_API_KEY" \
  "https://scrivio.ch/v1/account"

GET/v1/transcriptionstranscriptions.list

The account's transcriptions, newest first, deleted ones never; follow `nextCursor` for the next page.

Parameters

Parameters: transcriptions.list
NameInTypeDescription
limitqueryintegerRows a page holds, 1 to 100.minimum 1 · maximum 100 · default 50
cursorquerystringThe `nextCursor` of the previous page.
statusquerystringOnly the transcriptions of this status.one of waiting, processing, error, done
tagquerystringOnly 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

Answer

200 A page of the account's transcriptions — TranscriptionPage

Refusals

Refusals: transcriptions.list
StatusCodeDescription
400BAD_REQUESTA `limit` outside 1 to 100, a cursor that is not an id of the account's transcriptions, an unknown status, or an empty or long tag
401UNAUTHORIZEDNo valid key
402PAYMENT_REQUIRED`api_access_required`: the plan does not include the API
429TOO_MANY_REQUESTSThe account's read bucket, 120 a minute

Example

curl -H "Authorization: Bearer $SCRIVIO_API_KEY" \
  "https://scrivio.ch/v1/transcriptions"

POST/v1/transcriptionstranscriptions.create

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
NameInTypeDescription
languagerequiredquerystringThe 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
formatquerystringHow the transcript is cut: `text` in turns of speech, `srt` in subtitle cues; `text` when absent.one of text, srt
X-FilenamerequiredheaderstringThe 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
StatusCodeDescription
400BAD_REQUESTA 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
401UNAUTHORIZEDNo valid key
402PAYMENT_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`
403FORBIDDEN`api_key_read_only`
413CONTENT_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
429TOO_MANY_REQUESTSThe 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

Example

curl -X POST -H "Authorization: Bearer $SCRIVIO_API_KEY" -H "Content-Type: application/octet-stream" -H "X-Filename: interview.mp3" --data-binary @interview.mp3 \
  "https://scrivio.ch/v1/transcriptions?language=fr"

GET/v1/transcriptions/{id}transcriptions.get

One transcription and its transcript.

Parameters

Parameters: transcriptions.get
NameInTypeDescription
idrequiredpathstringA UUID v7.

Answer

200 The transcription and its transcript — TranscriptionWithTranscript

Refusals

Refusals: transcriptions.get
StatusCodeDescription
400BAD_REQUESTNot a UUID v7
401UNAUTHORIZEDNo valid key
402PAYMENT_REQUIRED`api_access_required`
404NOT_FOUNDUnknown, deleted, or not the account's
429TOO_MANY_REQUESTSThe account's read bucket

Example

curl -H "Authorization: Bearer $SCRIVIO_API_KEY" \
  "https://scrivio.ch/v1/transcriptions/$TRANSCRIPTION_ID"

PATCH/v1/transcriptions/{id}transcriptions.update

Change the name, the tags or highlight; only the fields sent change, all of them or none.

Parameters

Parameters: transcriptions.update
NameInTypeDescription
idrequiredpathstringA UUID v7.

Request body

Request body: transcriptions.update
NameTypeDescription
highlightedboolean« Mise en évidence ».
namestringTrimmed, never blank, at most 255 characters.1 to 255 characters
tagsRawTag[]The whole list, replacing the current one; stored trimmed and lower-cased, duplicates dropped.at most 30 items

Answer

200 The transcription as stored — Transcription

Refusals

Refusals: transcriptions.update
StatusCodeDescription
400BAD_REQUESTAn empty body, a blank or long name, too many or too long tags, an unknown field, or not a UUID v7
401UNAUTHORIZEDNo valid key
402PAYMENT_REQUIRED`api_access_required`
403FORBIDDEN`api_key_read_only`, or not the account's
404NOT_FOUNDUnknown or deleted
413CONTENT_TOO_LARGEA body larger than 64 KiB
429TOO_MANY_REQUESTSThe account's write bucket, 30 a minute

Example

curl -X PATCH -H "Authorization: Bearer $SCRIVIO_API_KEY" -H "Content-Type: application/json" -d '{"highlighted":true,"name":"Interview","tags":["interview"]}' \
  "https://scrivio.ch/v1/transcriptions/$TRANSCRIPTION_ID"

DELETE/v1/transcriptions/{id}transcriptions.delete

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.

Parameters

Parameters: transcriptions.delete
NameInTypeDescription
idrequiredpathstringA UUID v7.

Answer

200 Deleted — Deleted

Refusals

Refusals: transcriptions.delete
StatusCodeDescription
400BAD_REQUESTNot a UUID v7
401UNAUTHORIZEDNo valid key
402PAYMENT_REQUIRED`api_access_required`
403FORBIDDEN`api_key_read_only`, or not the account's
404NOT_FOUNDUnknown
429TOO_MANY_REQUESTSThe account's write bucket

Example

curl -X DELETE -H "Authorization: Bearer $SCRIVIO_API_KEY" \
  "https://scrivio.ch/v1/transcriptions/$TRANSCRIPTION_ID"

GET/v1/transcriptions/{id}/audiotranscriptions.audio

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
NameInTypeDescription
idrequiredpathstringA UUID v7.

Answer

200 The audio, `Content-Disposition` carrying its stored name; 206 for a `Range` request — audio/mpeg

Refusals

Refusals: transcriptions.audio
StatusCodeDescription
400BAD_REQUESTNot a UUID v7
401UNAUTHORIZEDNo valid key
402PAYMENT_REQUIRED`api_access_required`
404NOT_FOUNDUnknown, deleted, not the account's, or not yet `processing`
429TOO_MANY_REQUESTSThe account's read bucket

Example

curl -H "Authorization: Bearer $SCRIVIO_API_KEY" -o audio.mp3 \
  "https://scrivio.ch/v1/transcriptions/$TRANSCRIPTION_ID/audio"

Schemas

Account

Account
NameTypeDescription
keyrequiredKeyInfoThe key that made this call.
planrequiredPlanInfo
usagerequiredUsageInfo

ApiKeyRights

What a key may do: `write` includes reading and deleting.

Values: "read", "write"

Deleted

Deleted
NameTypeDescription
alreadyDeletedrequiredbooleanThe transcription was deleted before this call.
idrequiredstring

ErrorCode

The `code` of a refusal, with the status it names.

Values: "BAD_REQUEST", "UNAUTHORIZED", "PAYMENT_REQUIRED", "FORBIDDEN", "NOT_FOUND", "CONFLICT", "EMAIL_NOT_VERIFIED", "CONTENT_TOO_LARGE", "TOO_MANY_REQUESTS", "INTERNAL"

KeyInfo

KeyInfo
NameTypeDescription
expiresAtrequiredstring
idrequiredstring
namerequiredstring
prefixrequiredstringThe key's first twelve characters.
rightsrequiredApiKeyRights

PlanInfo

PlanInfo
NameTypeDescription
apiAccessrequiredbooleanWhether the plan includes the API: without it every operation but this one answers 402.
maxConcurrentrequiredinteger
maxDurationSecrequiredintegerThe longest audio an upload may send, in seconds.
maxFileBytesrequiredintegerThe largest file an upload may send, in bytes.
monthlyMinutesrequiredintegerAudio minutes a month, before any override or credit.
namerequiredstring
slugrequiredstring

ProblemDetails

The body of every refusal, `application/problem+json`, with the extensions the codes of this API carry.

ProblemDetails
NameTypeDescription
bucketstringTOO_MANY_REQUESTS: the bucket that refused.
coderequiredErrorCode
detailrequiredstring
maxinteger`concurrency_cap`: the uploads a user may run at once.minimum 0
maxBytesinteger`file_too_large`: the plan's size cap in bytes.
maxDurationSecinteger`duration_too_long`: the plan's duration cap in seconds.
minutesLimitnumber`quota_exceeded`: the month's limit, credits included.
minutesRemainingnumber`quota_exceeded`: the minutes left this month.
minutesRequestednumber`quota_exceeded`: the minutes the file would have used.
planstringAn upload refusal of the plan or the budget: the plan's slug.
reasonstringAn upload refusal: `email_unverified`, `file_too_large`, `duration_too_long`, `quota_exceeded`, `concurrency_cap`.
resetsAtstring`quota_exceeded`: the first instant of next month.
retryAfterSecintegerTOO_MANY_REQUESTS: the seconds before a retry may succeed.minimum 0
statusrequiredintegerminimum 0
titlerequiredstring
typerequiredstringAlways `about:blank`.

RawTag

Segment

A turn of one speaker.

Segment
NameTypeDescription
endrequirednumber
speakerrequiredstring
startrequirednumber
wordsrequiredWord[]

Transcription

A transcription without its transcript.

Transcription
NameTypeDescription
createdAtrequiredstring
doneAtrequiredstring | nullWhen the transcript was ready; `null` until then.
durationSecrequirednumber | nullThe audio's length in seconds; `null` until it is measured.
highlightedrequiredboolean« Mise en évidence » in the interface.
idrequiredstring
languagerequiredstringThe language the audio was transcribed in, ISO 639-1.
lastAccessAtrequiredstring | nullThe last opening by an owner, in the interface or through the API.
namerequiredstring
statusrequiredTranscriptionStatus
tagsrequiredstring[]
unreadrequiredbooleanFinished and not opened since: « Non lue » in the interface.

TranscriptionPage

A page of the list.

TranscriptionPage
NameTypeDescription
datarequiredTranscription[]
nextCursorrequiredstring | nullThe `cursor` of the next page; `null` on the last one.

TranscriptionPatch

The facts to change: at least one; a field left out is left as it is.

TranscriptionPatch
NameTypeDescription
highlightedboolean« Mise en évidence ».
namestringTrimmed, never blank, at most 255 characters.1 to 255 characters
tagsRawTag[]The whole list, replacing the current one; stored trimmed and lower-cased, duplicates dropped.at most 30 items

TranscriptionStatus

`transcriptions.status`.

Values: "waiting", "processing", "error", "done"

TranscriptionWithTranscript

A transcription and its transcript.

TranscriptionWithTranscript
NameTypeDescription
createdAtrequiredstring
doneAtrequiredstring | nullWhen the transcript was ready; `null` until then.
durationSecrequirednumber | nullThe audio's length in seconds; `null` until it is measured.
highlightedrequiredboolean« Mise en évidence » in the interface.
idrequiredstring
languagerequiredstringThe language the audio was transcribed in, ISO 639-1.
lastAccessAtrequiredstring | nullThe last opening by an owner, in the interface or through the API.
namerequiredstring
statusrequiredTranscriptionStatus
tagsrequiredstring[]
unreadrequiredbooleanFinished and not opened since: « Non lue » in the interface.
transcriptrequiredSegment[] | nullThe segments as stored, corrections included; `null` until the transcription is done.

UsageInfo

UsageInfo
NameTypeDescription
creditedMinutesrequirednumber
filesCountrequiredinteger
minutesLimitrequirednumberThe month's limit: the plan's or the account's override, credits included.
minutesRemainingrequirednumber
minutesUsedrequirednumber
periodrequiredstring`YYYY-MM`, the month counted.
resetsAtrequiredstringThe first instant of next month, when the count starts again.

Word

One word of a segment, its bounds in seconds from the start of the audio.

Word
NameTypeDescription
endrequirednumber
startrequirednumber
wordrequiredstring