Notification topics
Notifications to phones and desktops through the notifications app the receiver already has. Topics in a project; publish from the API, the CLI or MCP; devices subscribe with a short-lived token signed with the project's key; a preview and development each get their own topics.
/v1/notifications/configWhether notifications are served, and for which app#
available: whether topics can be published to here; phone_channel: whether each person can get the notification centre's events on their phone; server and app (the notifications app a receiver installs, and its stores); the plan's limits; key_secret, the secret in every project's secrets that signs its devices' tokens.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Response
200object
availablebooleanphone_channelbooleanserverstringappobjectnamestringstoresobject[]storestringurlstring
limitsNotificationLimitstopicsintegermessage_bytesintegertitle_charsintegertagsintegertag_charsintegeractionsintegerlabel_charsintegerurl_charsintegermin_delay_sintegermax_delay_sintegerkeep_hoursintegertoken_default_sintegertoken_max_sintegerrecentintegertopics_usedinteger
key_secretstring
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 500 | internal: an unexpected failure |
Example
curl "https://api.ibel.ai/v1/notifications/config" \
-H "Authorization: Bearer $KEY"/v1/notifications/topicsThe team's topics#
Every project's topics by name, or one project's with project, each with its numbers; the plan's limits with topics_used.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyanyany
Response
200object
topicsNotificationTopic[]idstringrequirednt_and 16 hexnamestringrequireddescriptionstringprojectobjectrequiredidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)requiredsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
next_cursorstringlimitsNotificationLimitstopicsintegermessage_bytesintegertitle_charsintegertagsintegertag_charsintegeractionsintegerlabel_charsintegerurl_charsintegermin_delay_sintegermax_delay_sintegerkeep_hoursintegertoken_default_sintegertoken_max_sintegerrecentintegertopics_usedinteger
availableboolean
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/notifications/topics" \
-H "Authorization: Bearer $KEY"/v1/notifications/usageThe team's notifications usage#
Messages published and deliveries to devices per day (Tehran's), every project's or one project's with project, and their cost at list price once the meters have a price (priced).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anydaysintegerqueryhow many days back: 1 to 90 (default 30)
Response
200NotificationUsage
daysintegerfromstring (date-time)tostring (date-time)publishedintegerdeliveredintegerper_dayobject[]daystringpublishedintegerdeliveredinteger
metersobject[]list_rialsintegerpricedbooleanfalse until the owner sets the meters' prices
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/notifications/usage" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topicsA project's topics#
The project's topics by name, each with its numbers in production.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anyanyany
Response
200object
topicsNotificationTopic[]idstringrequirednt_and 16 hexnamestringrequireddescriptionstringprojectobjectrequiredidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)requiredsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
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/notifications/topics" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topicsCreate a topic#
A topic: a name in the project; a message published to it reaches every device subscribed to it. A preview and development get their own when they first use it.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
any
Request bodyapplication/json
namestringrequiredletters, digits, - and _, 1 to 64 characters; unique in the project whatever its case
descriptionstringat most 300 characters
Response
201NotificationTopic
idstringrequirednt_and 16 hexnamestringrequireddescriptionstringprojectobjectrequiredidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)requiredsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_name, bad_setting, bad_json |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, limit |
| 404 | Not found: not_found |
| 409 | Conflict: name_taken |
| 500 | internal: an unexpected failure |
Example
curl -X POST "https://api.ibel.ai/v1/projects/my-api/notifications/topics" \
-H "Authorization: Bearer $KEY" \
-d '{"name":"my-api"}'/v1/projects/{project}/notifications/topics/{topic}A topic#
The topic with its numbers in the environment asked for: subscribers (devices subscribed, the edges' last count; null before the first), messages published and delivered in the last 24 hours.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)anyrequired
Response
200NotificationTopic
idstringrequirednt_and 16 hexnamestringrequireddescriptionstringprojectobjectrequiredidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)requiredsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
Errors
| Status | Description |
|---|---|
| 400 | Bad request: 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/notifications/topics/topic" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}Delete a topic#
Deletes the topic with its environments' own: nothing more is published to it; devices keep what they received. A session needs a step-up.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
- Step-up
- With a dashboard session, a second factor confirmed in the last 10 minutes; API keys pass.
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)
Response
200object
idstringnamestringdeletedboolean
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, step_up_required |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
-H "Authorization: Bearer $KEY"- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)
Request bodyapplication/json
descriptionstringat most 300 characters
Response
200NotificationTopic
idstringrequirednt_and 16 hexnamestringrequireddescriptionstringprojectobjectrequiredidstringnamestring
environmentstringthe environment the numbers are for (one topic's answer)
created_atstring (date-time)requiredsubscribersintegerdevices subscribed, the edges' last count (null before the first)
published_24hintegerdelivered_24hinteger
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_setting, nothing, bad_json |
| 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 PATCH "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
-H "Authorization: Bearer $KEY" \
-d '{"description":"…"}'/v1/projects/{project}/notifications/topics/{topic}/messagesThe kept messages#
What the topic keeps now for devices that were offline, newest first (50 a page, at most the plan's recent).
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)anyrequiredanyany
Response
200object
topicstringenvironmentstringmessagesNotificationMessage[]idstringrequiredtimestring (date-time)requiredexpires_atstring (date-time)titlestringtextstringrequiredpriorityintegerrequiredtagsstring[]clickstringactionsNotificationAction[]typestringrequiredone of
open,calllabelstringrequiredurlstringrequiredmethodstringone of
POST,PUT,GETbodystring
next_cursorstringkeep_hoursinteger
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 |
| 503 | Unavailable: notifications_unavailable |
Example
curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/messages" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/messagesPublish a message#
Sends a message to every device subscribed to the topic in the environment asked for, now or at at. A device that is offline gets it when it reconnects, within the plan's keep_hours.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)anyrequired
Request bodyapplication/json
textstringrequiredthe message, at most the plan's
message_bytes(4096 at the start)titlestringone line, at most
title_charspriorityinteger1 (lowest) to 5 (urgent); 3 is the default
1–5
tagsstring[]at most
tagswords of letters, digits, _, + and -clickstringan https address the notification opens when tapped
actionsNotificationAction[]0–3 items
typestringrequiredone of
open,calllabelstringrequiredurlstringrequiredmethodstringone of
POST,PUT,GETbodystring
atstring (date-time)deliver at this time instead of now (10 seconds to 72 hours ahead)
delay_sintegeror deliver this many seconds from now
Response
202object
idstringtopicstringenvironmentstringatstring (date-time)scheduledbooleanacceptedbooleanthe edge that holds the topic took it; not a promise that a device received it
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_message, bad_delay, 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 |
| 429 | Too many: rate_limited |
| 500 | internal: an unexpected failure |
| 503 | Unavailable: notifications_unavailable |
Example
curl -X POST "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/messages" \
-H "Authorization: Bearer $KEY" \
-d '{"text":"…"}'/v1/projects/{project}/notifications/topics/{topic}/tokensThe topic's subscribe tokens#
The tokens made for the topic (by this API, the dashboard, the CLI or the tools) and not expired, newest first, revoked ones marked. Tokens a function signs itself with NOTIFICATIONS_KEY are not here; rotating that secret ends them.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)environmentstringqueryone environment's tokens only: production, development or
preview-<branch>; left out, every environment'sanyany
Response
200object
topicstringtokensNotificationToken[]jtistringrequiredthe token's id, 16 hex digits
environmentstringrequiredexpires_atstring (date-time)requiredcreated_atstring (date-time)requiredcreated_bystringrevokedbooleanrequiredrevoked_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/notifications/topics/topic/tokens" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/tokensA subscribe token#
A device's right to subscribe to the topic in the environment asked for, until expires_at: the token, the server and the device's topic to enter in the notifications app, and link, which a QR code carries. Signed with the project's NOTIFICATIONS_KEY (in its secrets, one value per environment), so a function can make the same tokens itself; rotating that secret ends every token signed before. jti names this token to revoke it (DELETE …/tokens/{jti}).
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)anyrequired
Request bodyapplication/json
ttl_sintegerhow long the token works, 60 seconds to the plan's
token_max_s(defaulttoken_default_s, an hour)
Response
201NotificationSubscribe
serverstringrequireddevice_topicstringrequiredthe topic's name for devices (never its name in the project)
tokenstringrequired<payload>.<signature>, base64url: the payload is the JSON{topics, exp, kid, jti}(the device topics, when it ends in Unix seconds, the key it is signed with, its own id); the signature is HMAC-SHA256 with the key over the payload's bytesexpires_atstring (date-time)requiredlinkstringrequiredwhat the QR code carries; the app adds the topic from it
jtistringthe token's id, to revoke it
topicstringenvironmentstringkey_secretstring
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_ttl, bad_environment, 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: unavailable |
Example
curl -X POST "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens" \
-H "Authorization: Bearer $KEY" \
-d '{"ttl_s":1}'/v1/projects/{project}/notifications/topics/{topic}/tokensRevoke every token of the topic#
Revokes every token of the topic that is not expired (every environment's, or one environment's with environment): devices on them are refused from the next minute and their open connections end; a device subscribes again with a new token. A session needs a step-up.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
- Step-up
- With a dashboard session, a second factor confirmed in the last 10 minutes; API keys pass.
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)environmentstringqueryone environment's tokens only: production, development or
preview-<branch>; left out, every environment's
Response
200object
topicstringenvironmentstringthe environment asked for; null for every environment
revokedintegerhow many tokens were revoked now
Errors
| Status | Description |
|---|---|
| 400 | Bad request: bad_environment |
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, step_up_required |
| 404 | Not found: not_found |
| 500 | internal: an unexpected failure |
Example
curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/tokens/{jti}Revoke a subscribe token#
Revokes one token of the topic, by its jti: devices on it are refused from the next minute, until it would have expired, and their open connections end. Revoking it again gives the same answer. A session needs a step-up.
- Credential
- An API key or a dashboard session
- Roles
- owner, admin, developer
- Step-up
- With a dashboard session, a second factor confirmed in the last 10 minutes; API keys pass.
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)jtistringpathrequiredthe token's id (16 hex digits), as
jtiin its payload and in the answer that made it
Response
200object
topicstringjtistringrevokedboolean
Errors
| Status | Description |
|---|---|
| 401 | unauthorized: missing, invalid, expired or revoked credential |
| 403 | Not allowed: forbidden, step_up_required |
| 404 | Not found: not_found (no such token, or it has expired) |
| 500 | internal: an unexpected failure |
Example
curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens/jti" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/topics/{topic}/usageA topic's usage#
Messages published and deliveries per day, the topic's and its environments' own.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anytopicstringpathrequiredthe topic's name (any case) or id (
nt_…)daysintegerqueryhow many days back: 1 to 90 (default 30)
Response
200NotificationUsage
daysintegerfromstring (date-time)tostring (date-time)publishedintegerdeliveredintegerper_dayobject[]daystringpublishedintegerdeliveredinteger
metersobject[]list_rialsintegerpricedbooleanfalse until the owner sets the meters' prices
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/notifications/topics/topic/usage" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/usageA project's notifications usage#
Messages published and deliveries per day, every topic of the project.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
anydaysintegerqueryhow many days back: 1 to 90 (default 30)
Response
200NotificationUsage
daysintegerfromstring (date-time)tostring (date-time)publishedintegerdeliveredintegerper_dayobject[]daystringpublishedintegerdeliveredinteger
metersobject[]list_rialsintegerpricedbooleanfalse until the owner sets the meters' prices
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/notifications/usage" \
-H "Authorization: Bearer $KEY"/v1/projects/{project}/notifications/settingsA project's notifications settings#
The secret that signs its devices' tokens (key.secret, in each environment of the project's secrets), how many topics it has, the server and the plan's limits.
- Credential
- An API key or a dashboard session
- Roles
- Any role
Parameters
any
Response
200object
projectobjectidstringnamestring
availablebooleanserverstringtopicsintegerkeyobjectsecretstringenvironmentsstring[]token_formatstring
limitsNotificationLimitstopicsintegermessage_bytesintegertitle_charsintegertagsintegertag_charsintegeractionsintegerlabel_charsintegerurl_charsintegermin_delay_sintegermax_delay_sintegerkeep_hoursintegertoken_default_sintegertoken_max_sintegerrecentintegertopics_usedinteger
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/notifications/settings" \
-H "Authorization: Bearer $KEY"