Skip to content
cloudhostDocs
API reference

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.

GET/v1/notifications/config

Whether 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

  • availableboolean
  • phone_channelboolean
  • serverstring
  • appobject
  • limitsNotificationLimits
  • key_secretstring

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/notifications/config" \
  -H "Authorization: Bearer $KEY"
GET/v1/notifications/topics

The 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

  • any
  • any
  • any

Response

200object

  • topicsNotificationTopic[]
  • next_cursorstring
  • limitsNotificationLimits
  • availableboolean

Errors

StatusDescription
400Bad request: bad_param, bad_cursor
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/notifications/topics" \
  -H "Authorization: Bearer $KEY"
GET/v1/notifications/usage

The 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

  • any
  • daysintegerquery

    how many days back: 1 to 90 (default 30)

Response

200NotificationUsage

  • daysinteger
  • fromstring (date-time)
  • tostring (date-time)
  • publishedinteger
  • deliveredinteger
  • per_dayobject[]
  • metersobject[]
  • list_rialsinteger
  • pricedboolean

    false until the owner sets the meters' prices

Errors

StatusDescription
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/notifications/usage" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/notifications/topics

A 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

  • any
  • any
  • any

Response

200object

  • topicsNotificationTopic[]
    • idstringrequired

      nt_ and 16 hex

    • namestringrequired
    • descriptionstring
    • projectobjectrequired
    • environmentstring

      the environment the numbers are for (one topic's answer)

    • created_atstring (date-time)required
    • subscribersinteger

      devices subscribed, the edges' last count (null before the first)

    • published_24hinteger
    • delivered_24hinteger
  • next_cursorstring

Errors

StatusDescription
400Bad request: bad_param, bad_cursor
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/notifications/topics

Create 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

  • namestringrequired

    letters, digits, - and _, 1 to 64 characters; unique in the project whatever its case

  • descriptionstring

    at most 300 characters

Response

201NotificationTopic

  • idstringrequired

    nt_ and 16 hex

  • namestringrequired
  • descriptionstring
  • projectobjectrequired
  • environmentstring

    the environment the numbers are for (one topic's answer)

  • created_atstring (date-time)required
  • subscribersinteger

    devices subscribed, the edges' last count (null before the first)

  • published_24hinteger
  • delivered_24hinteger

Errors

StatusDescription
400Bad request: bad_name, bad_setting, bad_json
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, limit
404Not found: not_found
409Conflict: name_taken
500internal: 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"}'
GET/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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • anyrequired

Response

200NotificationTopic

  • idstringrequired

    nt_ and 16 hex

  • namestringrequired
  • descriptionstring
  • projectobjectrequired
  • environmentstring

    the environment the numbers are for (one topic's answer)

  • created_atstring (date-time)required
  • subscribersinteger

    devices subscribed, the edges' last count (null before the first)

  • published_24hinteger
  • delivered_24hinteger

Errors

StatusDescription
400Bad request: bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
  -H "Authorization: Bearer $KEY"
DELETE/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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

Response

200object

  • idstring
  • namestring
  • deletedboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, step_up_required
404Not found: not_found
500internal: an unexpected failure

Example

curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
  -H "Authorization: Bearer $KEY"
PATCH/v1/projects/{project}/notifications/topics/{topic}

Change a topic#

Its description.

Credential
An API key or a dashboard session
Roles
owner, admin, developer

Parameters

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

Request bodyapplication/json

  • descriptionstring

    at most 300 characters

Response

200NotificationTopic

  • idstringrequired

    nt_ and 16 hex

  • namestringrequired
  • descriptionstring
  • projectobjectrequired
  • environmentstring

    the environment the numbers are for (one topic's answer)

  • created_atstring (date-time)required
  • subscribersinteger

    devices subscribed, the edges' last count (null before the first)

  • published_24hinteger
  • delivered_24hinteger

Errors

StatusDescription
400Bad request: bad_setting, nothing, bad_json
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404Not found: not_found
500internal: an unexpected failure

Example

curl -X PATCH "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic" \
  -H "Authorization: Bearer $KEY" \
  -d '{"description":"…"}'
GET/v1/projects/{project}/notifications/topics/{topic}/messages

The 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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • anyrequired
  • any
  • any

Response

200object

  • topicstring
  • environmentstring
  • messagesNotificationMessage[]
  • next_cursorstring
  • keep_hoursinteger

Errors

StatusDescription
400Bad request: bad_param, bad_cursor, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure
503Unavailable: notifications_unavailable

Example

curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/messages" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/notifications/topics/{topic}/messages

Publish 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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • anyrequired

Request bodyapplication/json

  • textstringrequired

    the message, at most the plan's message_bytes (4096 at the start)

  • titlestring

    one line, at most title_chars

  • priorityinteger

    1 (lowest) to 5 (urgent); 3 is the default

    1–5

  • tagsstring[]

    at most tags words of letters, digits, _, + and -

  • clickstring

    an https address the notification opens when tapped

  • actionsNotificationAction[]

    0–3 items

  • atstring (date-time)

    deliver at this time instead of now (10 seconds to 72 hours ahead)

  • delay_sinteger

    or deliver this many seconds from now

Response

202object

  • idstring
  • topicstring
  • environmentstring
  • atstring (date-time)
  • scheduledboolean
  • acceptedboolean

    the edge that holds the topic took it; not a promise that a device received it

Errors

StatusDescription
400Bad request: bad_message, bad_delay, bad_environment, bad_json
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404Not found: not_found
413Too large: message_too_large, too_large
429Too many: rate_limited
500internal: an unexpected failure
503Unavailable: notifications_unavailable

Example

curl -X POST "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/messages" \
  -H "Authorization: Bearer $KEY" \
  -d '{"text":"…"}'
GET/v1/projects/{project}/notifications/topics/{topic}/tokens

The 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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • environmentstringquery

    one environment's tokens only: production, development or preview-<branch>; left out, every environment's

  • any
  • any

Response

200object

  • topicstring
  • tokensNotificationToken[]
  • next_cursorstring

Errors

StatusDescription
400Bad request: bad_param, bad_cursor, bad_environment
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens" \
  -H "Authorization: Bearer $KEY"
POST/v1/projects/{project}/notifications/topics/{topic}/tokens

A 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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • anyrequired

Request bodyapplication/json

  • ttl_sinteger

    how long the token works, 60 seconds to the plan's token_max_s (default token_default_s, an hour)

Response

201NotificationSubscribe

  • serverstringrequired
  • device_topicstringrequired

    the 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 bytes

  • expires_atstring (date-time)required
  • linkstringrequired

    what the QR code carries; the app adds the topic from it

  • jtistring

    the token's id, to revoke it

  • topicstring
  • environmentstring
  • key_secretstring

Errors

StatusDescription
400Bad request: bad_ttl, bad_environment, bad_json
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden
404Not found: not_found
500internal: an unexpected failure
503Unavailable: 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}'
DELETE/v1/projects/{project}/notifications/topics/{topic}/tokens

Revoke 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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • environmentstringquery

    one environment's tokens only: production, development or preview-<branch>; left out, every environment's

Response

200object

  • topicstring
  • environmentstring

    the environment asked for; null for every environment

  • revokedinteger

    how many tokens were revoked now

Errors

StatusDescription
400Bad request: bad_environment
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, step_up_required
404Not found: not_found
500internal: an unexpected failure

Example

curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens" \
  -H "Authorization: Bearer $KEY"
DELETE/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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • jtistringpathrequired

    the token's id (16 hex digits), as jti in its payload and in the answer that made it

Response

200object

  • topicstring
  • jtistring
  • revokedboolean

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
403Not allowed: forbidden, step_up_required
404Not found: not_found (no such token, or it has expired)
500internal: an unexpected failure

Example

curl -X DELETE "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/tokens/jti" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/notifications/topics/{topic}/usage

A 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

  • any
  • topicstringpathrequired

    the topic's name (any case) or id (nt_…)

  • daysintegerquery

    how many days back: 1 to 90 (default 30)

Response

200NotificationUsage

  • daysinteger
  • fromstring (date-time)
  • tostring (date-time)
  • publishedinteger
  • deliveredinteger
  • per_dayobject[]
  • metersobject[]
  • list_rialsinteger
  • pricedboolean

    false until the owner sets the meters' prices

Errors

StatusDescription
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/projects/my-api/notifications/topics/topic/usage" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/notifications/usage

A 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

  • any
  • daysintegerquery

    how many days back: 1 to 90 (default 30)

Response

200NotificationUsage

  • daysinteger
  • fromstring (date-time)
  • tostring (date-time)
  • publishedinteger
  • deliveredinteger
  • per_dayobject[]
  • metersobject[]
  • list_rialsinteger
  • pricedboolean

    false until the owner sets the meters' prices

Errors

StatusDescription
400Bad request: bad_param
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/projects/my-api/notifications/usage" \
  -H "Authorization: Bearer $KEY"
GET/v1/projects/{project}/notifications/settings

A 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

  • projectobject
  • availableboolean
  • serverstring
  • topicsinteger
  • keyobject
  • limitsNotificationLimits

Errors

StatusDescription
401unauthorized: missing, invalid, expired or revoked credential
404Not found: not_found
500internal: an unexpected failure

Example

curl "https://api.ibel.ai/v1/projects/my-api/notifications/settings" \
  -H "Authorization: Bearer $KEY"