Skip to main content

Stream status

Get live caption stream status over the API

Written by James

Check whether your church is live from your own automation software. There are three ways to do it:

  • A live WebSocket feed that tells you the moment a broadcast starts or stops.

  • A status URL you can poll for tools that check on a schedule.

  • The CaptionKit API with your API key.

The WebSocket feed and status URL don't need an API key.

Find your CaptionKit ID and room

Your CaptionKit ID is on your Account page in the dashboard.

For your main room, use default. For any other room, use its handle from the Rooms page.

Live updates over WebSocket

Open a WebSocket connection to:

wss://connect.getcaptionkit.com/status/{CAPTIONKIT_ID}/{ROOM}
  • 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 you're live.

  • Send the text ping at least once a minute to keep the connection open. We suggest every 30 seconds. The server replies pong.

  • If you're live and no message arrives for 60 seconds, treat the room as offline. The broadcast may have ended without saying so.

  • Reconnect if the connection closes. Connections can drop when we release updates.

  • A room that doesn't exist is refused with a 404.

Example in JavaScript

const url = `wss://connect.getcaptionkit.com/status/${CAPTIONKIT_ID}/default`;

function connect() {
const ws = new WebSocket(url);
const ping = setInterval(() => ws.send("ping"), 30000);

ws.onmessage = (event) => {
if (event.data === "pong") return;
const { live, status } = JSON.parse(event.data);
console.log(live ? `Live since ${new Date(status.startedAt)}` : "Offline");
};

ws.onclose = () => {
clearInterval(ping);
setTimeout(connect, 5000);
};
}

connect();

Each message

{
"v": 1,
"type": "status",
"live": true,
"status": { ... }
}

status has the same fields as the example below, and is null when the room is offline.

Polling

For tools that check on a schedule, request the same address over HTTPS. You get the room's current status as JSON.

Using curl

curl https://connect.getcaptionkit.com/status/{CAPTIONKIT_ID}/default

Using fetch in JS or Node

const res = await fetch(`https://connect.getcaptionkit.com/status/${CAPTIONKIT_ID}/default`);
const { live, status } = await res.json();

Response

{
"live": true,
"status": {
"live": true,
"sessionId": "2355239b-578f-4bca-bfa5-8cd544633967",
"accountId": "9c9a80c2-ee91-4590-a83a-cf2a454893c3",
"profileId": "5b1f0d3e-7c2a-4e8b-9f61-2d4a8c0e7b13",
"startedAt": 1783005063199,
"lastSeen": 1783005093607,
"audio": true,
"options": {
"language": "en-US",
"translations": ["es-419", "ko"],
"interimResults": true,
"profanityFilter": true,
"tts": true,
"audioTranslations": ["es-419"]
}
}
}

When the room is offline, the response is {"live": false, "status": null}.

  • Responses are cached for 5 seconds, so polling more often than that won't get fresher data.

  • Any website can call it straight from the browser.

  • A room that doesn't exist returns a 404.

Status fields

  • live: whether the room is broadcasting right now.

  • sessionId: the current broadcast.

  • accountId: your CaptionKit ID.

  • profileId: the room's ID.

  • startedAt and lastSeen: when the broadcast started and when it last checked in, in milliseconds since 1 January 1970 (Unix time).

  • audio: whether audio translations are playing for this broadcast.

  • options.language: the spoken language.

  • options.translations: the translations running.

  • options.audioTranslations: the translations with audio.

  • options.interimResults and options.profanityFilter: the broadcast's caption settings.

With your API key

The API reports status for the account a key belongs to, so you don't need your CaptionKit ID. Create an API key in your dashboard first.

GET /v2/me/status

Your main room.

curl "https://api.captionkit.com/v2/me/status?key={API_KEY}"

GET /v2/me/profiles/{ROOM}/status

Any room, by its handle or room ID.

curl "https://api.captionkit.com/v2/me/profiles/{ROOM}/status?key={API_KEY}"

Using fetch in JS or Node

fetch(`https://api.captionkit.com/v2/me/status?key=${API_KEY}`)

Both return the same response as polling. You can also send the key as Authorization: Bearer {API_KEY} instead of in the URL.

Did this answer your question?