Realtime
Live messages to browsers on channels, with presence. Publish from a function binding, the API, the CLI or MCP; a browser connects with a short-lived token signed with the project's key. Nothing is created first and no history is kept; every preview of a project shares one set of channels.
/v1/liveA sign-in for the live connection that pushes changes#
The dashboard keeps one live connection per browser tab and is told when something it shows changes (a build, a deployment, a run, a notification, a new minute of numbers), instead of asking again on a timer. This answers where it connects and a short-lived sign-in for it, sent as the connection's first message, never in its address: {"type": "auth", "token"}. A session's sign-in works only from the dashboard; a key's only outside a browser. It reaches the topics of the caller's team, or, for a member limited to some projects (or a project's Agent key), those projects' only; available: false when live connections are not served here.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Response
200LiveConnection
availablebooleanrequiredwhether live connections are served here; when false nothing else is set
urlstringwhere the connection goes
tokenstringthe sign-in, sent as the first message
{"type":"auth","token":"<token>"}; renewed on the same connection before it ends ({"type":"token","token"})expiresstring (date-time)when the sign-in ends
userstringwho the connection is for (
p:<person id>ork:<key id>); a person's own topics startme/<user>/teamstringthe team whose topics it reaches (
t/<team>/...)max_topicsintegertopics one connection may follow at once
max_connsintegerlive connections one person (or key) may keep open at once
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden (a build's key) |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/live" \
-H "Authorization: Bearer $KEY"/v1/realtime/configWhether realtime is served, and where browsers connect#
available: whether channels are served here; socket_url, where a browser connects with ?token=; the limits; key_secret, the secret in every project's secrets that signs its browsers' tokens; token_format.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Response
200RealtimeConfig
availablebooleanwhether channels are served here
socket_urlstringwhere a browser connects, with
?token=<token>limitsRealtimeLimitsmessage_bytesintegera message's size as JSON (65,536)
name_charsintegera channel's name or a user id, in bytes of UTF-8 (128)
batchintegermessages in one publish (100)
token_default_sintegera token's life when no ttl is given (600 seconds)
token_max_sintegerthe longest a token is good for (3,600 seconds)
browser_publish_per_sintegermessages a browser may send on one connection each second, with a token that allows publishing (10)
key_secretstringthe secret in each environment of a project's secrets that signs its browsers' tokens
token_formatstring<payload>.<signature>, both base64url without padding; the payload is the JSON{"channel", "user", "exp", "kid": "<project id>:<production|preview|development>", "jti"?}, the signature HMAC-SHA256 with the key over the payload's bytes
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/realtime/config" \
-H "Authorization: Bearer $KEY"/v1/realtime/usageThe team's realtime usage#
Messages written to browsers, connected minutes and the peak of connections per day (Tehran's), every project's or one project's with project, and this month so far.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anydaysintegerqueryhow many days back: 1 to 90 (default 30)
1–90 · default
30
Response
200RealtimeUsage
daysobject[]daystringYYYY-MM-DD, Tehran's
messagesintegermessages written to browsers (presence events and pongs are not counted)
connected_minutesintegereach socket counts once in every minute it was open in, part of one too
peak_connectionsintegerthe most sockets open in one minute of the day
monthRealtimeMonthmessagesintegerconnected_minutesintegertable_change_hoursnumberhours a database of the project (or team) sent its table changes and stayed awake, billed as an always-on database (meter
realtime_table_change_hours)
fromstring (date-time)tostring (date-time)
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_param |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/realtime/usage" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/realtimeA project's realtime settings#
Where its browsers connect, the secret that signs their tokens, the limits, this month's use and how many channels were used in the last hour (every environment).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
any
Response
200RealtimeSettings
projectobjectidstringnamestring
availablebooleansocket_urlstringlimitsRealtimeLimitsmessage_bytesintegera message's size as JSON (65,536)
name_charsintegera channel's name or a user id, in bytes of UTF-8 (128)
batchintegermessages in one publish (100)
token_default_sintegera token's life when no ttl is given (600 seconds)
token_max_sintegerthe longest a token is good for (3,600 seconds)
browser_publish_per_sintegermessages a browser may send on one connection each second, with a token that allows publishing (10)
key_secretstringtoken_formatstringusageobjectmonthRealtimeMonthmessagesintegerconnected_minutesintegertable_change_hoursnumberhours a database of the project (or team) sent its table changes and stayed awake, billed as an always-on database (meter
realtime_table_change_hours)
channels_activeintegerchannels with a connection or a message in the last hour, every environment
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/projects/my-api/realtime" \
-H "Authorization: Bearer $KEY"/v1/realtime/channelsThe team's channels of the last hour#
Every project's channels with a connection or a message in the last hour (the team view), each with its project, by project name then channel; one project's with project. environment: with project, one of its environments; without, production, development or preview (every preview shares one set of channels).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyenvironmentstringqueryonly this environment's:
production,development,previewor a preview'spreview-<label>(every environment's without it)prefixstringqueryonly channels whose name starts with this
anyany
Response
200object
channelsRealtimeChannel[]namestringenvironmentstringthe environment's kind; every preview of the project shares one set of channels
one of
production,preview,developmentconnectionsintegersockets open in the last minute counted
messages_1hintegermessages written to browsers in the last hour
last_message_atstring (date-time)last_seen_atstring (date-time)projectProjectRefidstringrequiredprj_and 16 hex charactersnamestringrequired
next_cursorstring
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_param, bad_cursor, bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found (no such project) |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/realtime/channels" \
-H "Authorization: Bearer $KEY"/v1/realtime/table-changesThe team's table changes#
Every project's databases with table changes set (the team view), each with its project, by project name then database; one project's with project.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyanyany
Response
200object
readersRealtimeTableChangeReader[]databasestringthe database's name
enabledbooleantablesobject[]namestringschema.tableeventsstring[]channelstring
statestringrunning: sending changes;stopped: off, or not started yet;failed: seeerrorone of
running,stopped,failederrorstringpositionstringopaque, grows with every change sent; null before the first
created_atstring (date-time)updated_atstring (date-time)projectProjectRefidstringrequiredprj_and 16 hex charactersnamestringrequired
next_cursorstring
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_param, bad_cursor |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found (no such project) |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/realtime/table-changes" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/realtime/channelsA project's channels of the last hour#
Channels with a connection or a message in the last hour, by name; every environment's, or one environment's with environment (every preview shares one set of channels).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyenvironmentstringqueryonly this environment's:
production,development, or a preview'spreview-<label>(every environment's without it)prefixstringqueryonly channels whose name starts with this
anyany
Response
200object
channelsRealtimeChannel[]namestringenvironmentstringthe environment's kind; every preview of the project shares one set of channels
one of
production,preview,developmentconnectionsintegersockets open in the last minute counted
messages_1hintegermessages written to browsers in the last hour
last_message_atstring (date-time)last_seen_atstring (date-time)
next_cursorstring
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_param, bad_cursor, bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/projects/my-api/realtime/channels" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/realtime/channels/{channel}One channel#
A channel of the environment asked for, with its numbers of the last hour.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyanyanyrequired
Response
200RealtimeChannel
namestringenvironmentstringthe environment's kind; every preview of the project shares one set of channels
one of
production,preview,developmentconnectionsintegersockets open in the last minute counted
messages_1hintegermessages written to browsers in the last hour
last_message_atstring (date-time)last_seen_atstring (date-time)
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_channel, bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found (no such project, or nothing on the channel in the last hour) |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/projects/my-api/realtime/channels/channel" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/realtime/channels/{channel}/messagesPublish to a channel#
Sends one message, or up to batch in order, to every browser connected to the channel in the environment asked for. Nothing is kept: a browser that is not connected does not get it.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
anyanyanyrequired
Request bodyapplication/json
message or messages, not both
messageanyany JSON value, at most
message_bytes(65,536) as JSONmessagesany[]1 to
batchmessages, each any JSON value, published one after another1–100 items
Response
202object
publishedintegerhow many messages were published
deliveredintegerthe browser connections the messages were written to
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_channel, bad_message, bad_environment, bad_json |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden |
| 404 | Not found: not_found |
| 413 | Too large: message_too_large, too_large |
| 500 | internal: an unexpected failure |
| 503 | Unavailable: realtime_unavailable (try again shortly) |
Example
curl -X POST "https://api.ibel.ai/v1/projects/my-api/realtime/channels/channel/messages" \
-H "Authorization: Bearer $KEY" \
-d '{"message":null,"messages":[null]}'/v1/projects/{project}/realtime/channels/{channel}/presenceWho is on a channel#
The user ids connected to the channel now, and the number of connections.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyanyanyrequired
Response
200RealtimePresence
channelstringenvironmentstringone of
production,preview,developmentusersstring[]the user ids connected now, from their tokens
connectionsintegerthe sockets open on the channel now
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_channel, bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
| 503 | Unavailable: realtime_unavailable (try again shortly) |
Example
curl "https://api.ibel.ai/v1/projects/my-api/realtime/channels/channel/presence" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/realtime/table-changesThe databases' table changes#
The project's databases with table changes set: which tables go to which channels, and whether they are being sent.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyanyany
Response
200object
readersRealtimeTableChangeReader[]databasestringthe database's name
enabledbooleantablesobject[]namestringschema.tableeventsstring[]channelstring
statestringrunning: sending changes;stopped: off, or not started yet;failed: seeerrorone of
running,stopped,failederrorstringpositionstringopaque, grows with every change sent; null before the first
created_atstring (date-time)updated_atstring (date-time)
next_cursorstring
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_param, bad_cursor |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/projects/my-api/realtime/table-changes" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/realtime/table-changes/{database}Switch table changes on for a database#
Sends every committed insert, update and delete of the chosen tables to their channels (the project's production channels; the database's main branch), each change once, in commit order. Off by default. While it is on, the database stays awake (it no longer sleeps when unused) and is billed per hour as an always-on database (meter realtime_table_change_hours), so the body must say acknowledge_always_on: true. Switching it on restarts the database once; open connections reconnect. Called again, it changes the tables.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
anydatabasestringpathrequiredthe database's name in the project (any case) or its id
Request bodyapplication/json
tablesobject[]required1–… items
namestringrequiredschema.table, or a table ofpublic; checked against the databaseeventsstring[]which changes to send (default all three); updates and deletes need the table to have a primary key
channelstringthe channel they go to (default the table's name;
schema.tableoutsidepublic)
acknowledge_always_onbooleanrequiredmust be true: the database stays awake and is billed per hour as an always-on database
Response
200RealtimeTableChangeReader
databasestringthe database's name
enabledbooleantablesobject[]namestringschema.tableeventsstring[]channelstring
statestringrunning: sending changes;stopped: off, or not started yet;failed: seeerrorone of
running,stopped,failederrorstringpositionstringopaque, grows with every change sent; null before the first
created_atstring (date-time)updated_atstring (date-time)
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_table (no such table, or no primary key for updates and deletes), acknowledge_required, bad_channel, bad_json |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
| 503 | Unavailable: realtime_unavailable (try again shortly) |
Example
curl -X PUT "https://api.ibel.ai/v1/projects/my-api/realtime/table-changes/shop" \
-H "Authorization: Bearer $KEY" \
-d '{"tables":[{"name":"my-api","events":["insert"],"channel":"…"}],"acknowledge_always_on":true}'/v1/projects/{project}/realtime/table-changes/{database}Switch table changes off for a database#
Browsers get no more of its changes, and the database sleeps again when unused.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
anydatabasestringpathrequiredthe database's name in the project (any case) or its id
Response
200object
databasestringenabledbooleanone of
false
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/realtime/table-changes/shop" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/realtime/usageA project's realtime usage#
Messages written to browsers, connected minutes and the peak of connections per day (Tehran's), and this month so far with the hours its databases sent table changes.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anydaysintegerqueryhow many days back: 1 to 90 (default 30)
1–90 · default
30
Response
200RealtimeUsage
daysobject[]daystringYYYY-MM-DD, Tehran's
messagesintegermessages written to browsers (presence events and pongs are not counted)
connected_minutesintegereach socket counts once in every minute it was open in, part of one too
peak_connectionsintegerthe most sockets open in one minute of the day
monthRealtimeMonthmessagesintegerconnected_minutesintegertable_change_hoursnumberhours a database of the project (or team) sent its table changes and stayed awake, billed as an always-on database (meter
realtime_table_change_hours)
fromstring (date-time)tostring (date-time)
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_param |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/projects/my-api/realtime/usage" \
-H "Authorization: Bearer $KEY"