API v3 controls a room from our servers. Hiding captions, changing languages and stopping a broadcast work whether or not a dashboard is open, and a start tells you whether the broadcast came up.
It uses the API keys you already have. Every address on this page starts with:
https://api.getcaptionkit.com/v3
Authentication
Send your API key with every request, in one of three ways:
Authorization: Bearer {API_KEY}header. We suggest this one.X-API-Key: {API_KEY}header.?key={API_KEY}in the URL, for tools that can only build a URL.
The key identifies your account, so requests never name one. A deleted key can keep working for up to a minute.
Rooms
Every request names a room. For your main room, use default. For any other room, use its handle from the Rooms page, or its room ID.
Endpoints
GET /rooms: every room on your account.GET /rooms/{ROOM}: one room.GET /rooms/{ROOM}/status: whether the room is live. Also opens as a WebSocket.PATCH /rooms/{ROOM}/settings: show or hide captions, the "Starting soon" message, and languages.PUT /rooms/{ROOM}/translations/{LANGUAGE}: add a translation, or turn its audio on or off.DELETE /rooms/{ROOM}/translations/{LANGUAGE}: remove a translation.POST /rooms/{ROOM}/clear: clear the caption text.POST /rooms/{ROOM}/start: start a broadcast.POST /rooms/{ROOM}/stop: stop a broadcast.
Every response is JSON.
The room
Most endpoints answer with the room as it is after your request:
{
"id": "5b1f0d3e-7c2a-4e8b-9f61-2d4a8c0e7b13",
"slug": "default",
"name": "Main room",
"settings": {
"visible": true,
"pending": false,
"language": "en-US",
"translations": ["es-419", "ko"],
"audioTranslations": ["es-419"]
},
"live": false,
"status": null
}id,slugandname: the room's ID, handle and name.settings: the room's settings. The ones you can change are described under Change settings below. The room's other dashboard settings are listed here too.live: whether a broadcast is running right now.status: the running broadcast, ornullwhen nothing is live. Its fields are listed in Stream status.
Get your rooms
GET /rooms
Every room on your account, main room first.
curl https://api.getcaptionkit.com/v3/rooms -H "Authorization: Bearer {API_KEY}"Response
{ "rooms": [ { ... }, { ... } ] }GET /rooms/{ROOM}
One room.
curl https://api.getcaptionkit.com/v3/rooms/default -H "Authorization: Bearer {API_KEY}"
Room status
GET /rooms/{ROOM}/status
Whether the room is live, and the broadcast if it is.
curl https://api.getcaptionkit.com/v3/rooms/default/status -H "Authorization: Bearer {API_KEY}"Response
{ "live": false, "status": null }Live updates over WebSocket
Open the same address as a WebSocket to be told the moment the room goes live or offline:
wss://api.getcaptionkit.com/v3/rooms/default/status?key={API_KEY}A browser can't put a header on a WebSocket, so there the key goes in the URL.
The first message is the room's current status.
After that, a message arrives whenever a broadcast starts, stops or changes, and every 30 seconds while the room is live.
Send the text
pingat least once a minute to keep the connection open. The server repliespong.If the room is live and no message arrives for 60 seconds, treat it as offline. The broadcast may have ended without saying so.
Reconnect if the connection closes. Connections can drop when we release updates.
A wrong key or a room that doesn't exist is refused, and no connection opens.
Each message
{
"v": 1,
"type": "status",
"live": true,
"status": { ... }
}This is the same feed as the one in Stream status, which uses your CaptionKit ID in place of a key.
Change settings
PATCH /rooms/{ROOM}/settings
Send only the settings you want to change. The response is the room.
visible(true or false): show or hide captions.pending(true or false): turn the "Starting soon" message on or off.language(language code): the spoken language.translations(list of language codes): the translations. This replaces the whole list.audioTranslations(list of language codes): the translations that are also spoken. Each must be intranslations.
Hide captions
curl -X PATCH https://api.getcaptionkit.com/v3/rooms/default/settings -H "Authorization: Bearer {API_KEY}" -H "Content-Type: application/json" -d '{"visible": false}'Set the spoken language, using fetch in JS or Node
await fetch("https://api.getcaptionkit.com/v3/rooms/default/settings", {
method: "PATCH",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ language: "es" }),
});Language codes are listed in Supported languages.
A broadcast that is already running keeps the languages it started with. Language changes apply from the next broadcast.
Two requests that change different settings at the same moment both take effect.
A setting we don't recognise is refused, so a typo doesn't look like it worked.
Adding more languages than your plan allows is refused with
plan_limit.
Translations
To add or remove one translation without sending the whole list, use these.
PUT /rooms/{ROOM}/translations/{LANGUAGE}
Adds a translation. Sending it again changes nothing, so it is safe to repeat.
curl -X PUT https://api.getcaptionkit.com/v3/rooms/default/translations/ko -H "Authorization: Bearer {API_KEY}"To turn the translation's audio on or off as well, send audio:
curl -X PUT https://api.getcaptionkit.com/v3/rooms/default/translations/ko -H "Authorization: Bearer {API_KEY}" -H "Content-Type: application/json" -d '{"audio": true}'DELETE /rooms/{ROOM}/translations/{LANGUAGE}
Removes a translation, and its audio.
curl -X DELETE https://api.getcaptionkit.com/v3/rooms/default/translations/ko -H "Authorization: Bearer {API_KEY}"Both answer with the room.
Clear captions
POST /rooms/{ROOM}/clear
Clears the caption text everywhere it is showing. The response is the room.
curl -X POST https://api.getcaptionkit.com/v3/rooms/default/clear -H "Authorization: Bearer {API_KEY}"
Start a broadcast
POST /rooms/{ROOM}/start
A broadcast needs a dashboard, because that is where the audio comes from. A start goes to the one computer that has 📡 Signals turned on for the room, so turn Signals on at the computer with the microphone.
curl -X POST https://api.getcaptionkit.com/v3/rooms/default/start -H "Authorization: Bearer {API_KEY}"The answer comes once that dashboard is recording, which can take up to about 25 seconds.
Response
{
"started": true,
"desk": "Sound desk",
"sessionId": "2355239b-578f-4bca-bfa5-8cd544633967"
}desk is the name of the computer that started the broadcast.
When a start fails, the error's code says why:
already_live(409): a broadcast is already running in the room.no_dashboard(409): no dashboard has Signals turned on for the room.dashboard_refused(409): the dashboard couldn't start. Themessagesays why, for example no microphone.limit_reached(409): your plan's hours for this billing period are used up.cancelled(409): a stop arrived before the broadcast began.dashboard_timeout(504): the dashboard didn't answer, or didn't confirm it was recording in time. It is told to drop the start, so it won't begin later.
Stop a broadcast
POST /rooms/{ROOM}/stop
Ends the broadcast on our servers, so it works even when the broadcasting computer has frozen or gone offline.
curl -X POST https://api.getcaptionkit.com/v3/rooms/default/stop -H "Authorization: Bearer {API_KEY}"Response
{ "stopped": true }If nothing is live, the answer is
not_live(409).To tell your dashboards who stopped the broadcast, send a name as
by, for example{"by": "ProPresenter"}.A stop sent while a start is still on its way calls that start off. The stop answers
{ "stopped": true }and the start answerscancelled.If the dashboard was asked to call a start off and never answered, the stop answers
dashboard_timeout(504). The broadcast may not have been stopped, so send the stop again.
Errors
An error answers with a status of 400 or above and a body like this:
{
"error": {
"code": "room_not_found",
"message": "No room \"sanctuary\" on this account. Your main room is \"default\"."
}
}Some errors add details. As well as the start and stop codes above:
missing_api_key,invalid_api_key(401): no key was sent, or the key isn't one of yours.room_not_found,not_found(404): no such room, or no such address.method_not_allowed(405): the address exists, but not with that method.invalid_json(400),invalid_request(422): the body isn't JSON, or has a setting or value we don't accept.unknown_language(422): not a language code we support.audio_not_translated(422): audio was asked for in a language that isn't in the room's translations.audio_unavailable(422): audio isn't available in that language yet.plan_limit(422): more languages than your plan allows.detailsgives the limits.conflict(409): the room's settings kept changing while yours were being saved. Send the request again.internal_error(500): something went wrong on our side.
Signals
Signals are the older way to do the same things, and everything built on them keeps working. A signal never reports whether anything acted on it, so use this API when you need to know whether a start worked.