Skip to content

Realtime API

REST endpoints for the Realtime area of Lepsto.

The Realtime area publishes 28 REST endpoints. Paths are relative to https://api.lepsto.com; see Authentication for the required header.

GET/realtime/archive

Read a channel's durably archived history from Postgres (survives the Redis hot window). Offset-paginated: pass the returned next_offset as after_offset for the next page.

MCP tool: realtime_archive_get

Parameters

NameInTypeRequiredDescription
channelquery
string
•
Channel whose archived history to read
after_offsetquery
string
—
Return entries strictly after this offset (from a previous page)
limitquery
integer
—
—

Response

Returns object.

FieldTypeAlwaysDescription
channel
string
•
—
entries
object[]
•
—
next_offset
string | null
•
Pass as after_offset to fetch the next page; null = no more entries
POST/realtime/archive/exports

Start an async NDJSON export of a channel's archived history to the product bucket. Returns an export id; poll realtime_archive_export_status until done.

MCP tool: realtime_archive_export

Parameters

NameInTypeRequiredDescription
channelbody
string
•
Channel whose archive to export
from_tsbody
integer
—
Only entries with ts >= from_ts (epoch ms)
to_tsbody
integer
—
Only entries with ts <= to_ts (epoch ms)

Response

Returns object.

FieldTypeAlwaysDescription
status
stringone of: pending, done, failed
•
—
export_id
string (uuid)
•
—
GET/realtime/archive/exports/:export_id

Check an archive export: status, and the NDJSON blob reference once done

MCP tool: realtime_archive_export_status

Parameters

NameInTypeRequiredDescription
export_idpath
string (uuid)
•
Export id returned by realtime_archive_export

Response

Returns object.

FieldTypeAlwaysDescription
ref
object | null
•
Blob reference of the NDJSON export once status is "done"
error
string | null
•
—
status
stringone of: pending, done, failed
•
—
export_id
string (uuid)
•
—
entry_count
integer | null
•
—
GET/realtime/grants

List realtime channel grants for this product. A non-empty subject restricts results to that subject; omit it to list all subjects.

MCP tool: realtime_grant_list

Parameters

NameInTypeRequiredDescription
subjectquery
string
—
Filter grants by subject

Response

Returns object.

FieldTypeAlwaysDescription
grants
object[]
•
—
POST/realtime/grants

Grant a subject (identity id or "*" for all identities) operations on channels matching a pattern; "*" in a pattern matches exactly one segment

MCP tool: realtime_grant_create

Parameters

NameInTypeRequiredDescription
subjectbody
string
•
Identity id the grant applies to, or "*" for every identity in the product
patternbody
string
•
Channel pattern, e.g. "chat:*" ("*" matches exactly one segment)
opsbody
string[]one of: subscribe, publish, presence, history
•
Operations granted on matching channels

Response

Returns object.

FieldTypeAlwaysDescription
id
string (uuid)
•
—
ops
string[]one of: subscribe, publish, presence, history
•
—
pattern
string
•
—
subject
string
•
—
createdAt
string
•
—
DELETE/realtime/grants/:id

Revoke a realtime channel grant by id

MCP tool: realtime_grant_revoke

Parameters

NameInTypeRequiredDescription
idpath
string (uuid)
•
Grant id to revoke

Response

Returns object.

FieldTypeAlwaysDescription
revoked
booleanone of: true
•
—
POST/realtime/messages

Publish a JSON message to a realtime channel of the current product

MCP tool: realtime_messages_publish

Parameters

NameInTypeRequiredDescription
channelbody
string
•
Channel to publish the message to
databody
string
•
JSON payload delivered to channel subscribers

Response

Returns object.

FieldTypeAlwaysDescription
epoch
string
—
Stream epoch of the stored message (present when history is on)
offset
string
—
Stream offset of the stored message (present when history is on)
channel
string
•
Channel the message was published to
replayed
boolean
•
true only when the answer was replayed from a previous Idempotency-Key publish
messageId
string
•
Envelope id of the message — history exposes the same value as entries[].id
published
booleanone of: true
•
Publish acknowledged by the fan-out backend
GET/realtime/messages/history

Read message history of a realtime channel: either a cursor (offset + epoch, replays strictly after the offset; recovered:false on epoch mismatch or aged-out entries) or a window (last_n / last_ms). Conceptually requires the `history` capability; in Phase 1 this surface is Identity-authenticated management access.

MCP tool: realtime_history_get

Parameters

NameInTypeRequiredDescription
channelquery
string
•
Channel to read history from
offsetquery
string
—
Cursor: resume strictly after this offset (requires epoch)
epochquery
string
—
Cursor: stream epoch the offset belongs to
last_nquery
integer
—
Window: return the last N entries
last_msquery
integer
—
Window: return entries newer than now minus this many milliseconds

Response

Returns object.

FieldTypeAlwaysDescription
epoch
string | null
•
Current stream epoch, or null when the channel has no history yet
channel
string
•
Channel the history was read from
entries
object[]
•
Entries in stream order
recovered
boolean
•
false when the cursor epoch mismatches or entries aged out — client must resync
GET/realtime/namespaces

List all realtime namespaces registered for this product

MCP tool: realtime_namespace_list

Parameters

No parameters.

Response

Returns object.

FieldTypeAlwaysDescription
namespaces
object[]
•
—
POST/realtime/namespaces

Register a realtime namespace (the part of a channel name before the first colon) with its policy: visibility, presence, client events, history, encryption, identified-only

MCP tool: realtime_namespace_create

Parameters

NameInTypeRequiredDescription
namebody
string
•
Namespace name (the part of a channel name before the first colon)
visibilitybody
stringone of: public, authorized
—
public: any authenticated identity may subscribe without a grant
presencebody
boolean
—
Whether presence is enabled on channels in this namespace
clientEventsbody
boolean
—
Whether clients may publish events directly
historybody
stringone of: none, last-message, window
—
History retention policy for channels in this namespace
historyWindowSecondsbody
integer
—
Retention window in seconds; required when history is "window"
encryptionRequiredbody
boolean
—
Whether payloads must be end-to-end encrypted
identifiedOnlybody
boolean
—
Whether only identified (non-anonymous) identities get capabilities
subscribeProxyUrlbody
string (uri) | null
—
If set, token mint consults this URL per requested channel (fail-closed); null disables
archivebody
string | objectone of: off
—
History archive policy: off, or durably retain archived entries for N days (requires history != "none")

Response

Returns object.

FieldTypeAlwaysDescription
id
string (uuid)
•
—
name
string
•
—
archive
string | objectone of: off
•
History archive policy
history
stringone of: none, last-message, window
•
—
presence
boolean
•
—
createdAt
string
•
—
updatedAt
string
•
—
visibility
stringone of: public, authorized
•
—
clientEvents
boolean
•
—
identifiedOnly
boolean
•
—
subscribeProxyUrl
string | null
•
—
encryptionRequired
boolean
•
—
historyWindowSeconds
integer | null
•
—
subscribeProxySecret
string
—
Full proxy signing secret — returned ONLY when subscribeProxyUrl is set/changed
subscribeProxySecretPrefix
string | null
•
Visible prefix of the proxy signing secret; null when no proxy url is set
DELETE/realtime/namespaces/:name

Delete a realtime namespace by name (grants on it stop resolving)

MCP tool: realtime_namespace_delete

Parameters

NameInTypeRequiredDescription
namepath
string
•
Namespace name

Response

Returns object.

FieldTypeAlwaysDescription
deleted
booleanone of: true
•
—
GET/realtime/namespaces/:name

Get a realtime namespace and its policy by name

MCP tool: realtime_namespace_get

Parameters

NameInTypeRequiredDescription
namepath
string
•
Namespace name

Response

Returns object.

FieldTypeAlwaysDescription
id
string (uuid)
•
—
name
string
•
—
archive
string | objectone of: off
•
History archive policy
history
stringone of: none, last-message, window
•
—
presence
boolean
•
—
createdAt
string
•
—
updatedAt
string
•
—
visibility
stringone of: public, authorized
•
—
clientEvents
boolean
•
—
identifiedOnly
boolean
•
—
subscribeProxyUrl
string | null
•
—
encryptionRequired
boolean
•
—
historyWindowSeconds
integer | null
•
—
subscribeProxySecret
string
—
Full proxy signing secret — returned ONLY when subscribeProxyUrl is set/changed
subscribeProxySecretPrefix
string | null
•
Visible prefix of the proxy signing secret; null when no proxy url is set
PATCH/realtime/namespaces/:name

Update the policy of a realtime namespace

MCP tool: realtime_namespace_update

Parameters

NameInTypeRequiredDescription
namepath
string
•
Namespace name to update
visibilitybody
stringone of: public, authorized
—
public: any authenticated identity may subscribe without a grant
presencebody
boolean
—
Whether presence is enabled on channels in this namespace
clientEventsbody
boolean
—
Whether clients may publish events directly
historybody
stringone of: none, last-message, window
—
History retention policy for channels in this namespace
historyWindowSecondsbody
integer
—
Retention window in seconds; required when history is "window"
encryptionRequiredbody
boolean
—
Whether payloads must be end-to-end encrypted
identifiedOnlybody
boolean
—
Whether only identified (non-anonymous) identities get capabilities
subscribeProxyUrlbody
string (uri) | null
—
If set, token mint consults this URL per requested channel (fail-closed); null disables
archivebody
string | objectone of: off
—
History archive policy: off, or durably retain archived entries for N days (requires history != "none")

Response

Returns object.

FieldTypeAlwaysDescription
id
string (uuid)
•
—
name
string
•
—
archive
string | objectone of: off
•
History archive policy
history
stringone of: none, last-message, window
•
—
presence
boolean
•
—
createdAt
string
•
—
updatedAt
string
•
—
visibility
stringone of: public, authorized
•
—
clientEvents
boolean
•
—
identifiedOnly
boolean
•
—
subscribeProxyUrl
string | null
•
—
encryptionRequired
boolean
•
—
historyWindowSeconds
integer | null
•
—
subscribeProxySecret
string
—
Full proxy signing secret — returned ONLY when subscribeProxyUrl is set/changed
subscribeProxySecretPrefix
string | null
•
Visible prefix of the proxy signing secret; null when no proxy url is set
GET/realtime/presence

Get the current presence roster for a channel. Roster is deduplicated by identity (connections counts live sockets); a per-connection view is deferred — the store is identity-keyed.

MCP tool: realtime_presence_get

Parameters

NameInTypeRequiredDescription
channelquery
string
•
Channel name, "namespace:rest"

Response

Returns object.

FieldTypeAlwaysDescription
channel
string
•
Channel name
members
object[]
•
Current roster, deduplicated by identity
POST/realtime/presence/enter

Enter presence on a realtime channel; upserts the caller (or member_id) into the roster

MCP tool: realtime_presence_enter

Parameters

NameInTypeRequiredDescription
channelbody
string
•
Channel name, "namespace:rest"
infobody
string
—
Arbitrary JSON metadata for the member (<=10KB serialized)
ttl_secondsbody
integer
—
Presence entry TTL in seconds (1-3600)
member_idbody
string
—
Act for a synthetic member id instead of the caller identity (backend integrations)

Response

Returns object.

FieldTypeAlwaysDescription
member
object
•
The entered/updated member
channel
string
•
Channel name
POST/realtime/presence/leave

Leave presence on a realtime channel, removing the caller (or member_id) from the roster

MCP tool: realtime_presence_leave

Parameters

NameInTypeRequiredDescription
channelbody
string
•
Channel name, "namespace:rest"
member_idbody
string
—
Act for a synthetic member id instead of the caller identity (backend integrations)

Response

Returns object.

FieldTypeAlwaysDescription
channel
string
•
Channel name
removed
boolean
•
Whether the member was removed
GET/realtime/presence/stats

Get the presence member count for a channel

MCP tool: realtime_presence_stats

Parameters

NameInTypeRequiredDescription
channelquery
string
•
Channel name, "namespace:rest"

Response

Returns object.

FieldTypeAlwaysDescription
channel
string
•
Channel name
members
integer
•
Number of distinct identities present
POST/realtime/presence/update

Update a presence member's info and/or refresh its TTL

MCP tool: realtime_presence_update

Parameters

NameInTypeRequiredDescription
channelbody
string
•
Channel name, "namespace:rest"
infobody
string
—
Arbitrary JSON metadata for the member (<=10KB serialized)
ttl_secondsbody
integer
—
Presence entry TTL in seconds (1-3600)
member_idbody
string
—
Act for a synthetic member id instead of the caller identity (backend integrations)

Response

Returns object.

FieldTypeAlwaysDescription
member
object
•
The entered/updated member
channel
string
•
Channel name
GET/realtime/public-access/status

Check whether this product has a public key configured — an onboarding hint for the portal, never an authorization decision

MCP tool: realtime_public_access_status

Parameters

No parameters.

Response

Returns object.

FieldTypeAlwaysDescription
exists
boolean
•
Whether this product has created a public key yet (an onboarding hint, not a gate)
GET/realtime/status

Get realtime service status: Redis fan-out connectivity, token signing key presence, gateway URL

MCP tool: realtime_status_get

Parameters

No parameters.

Response

Returns object.

FieldTypeAlwaysDescription
redis
stringone of: connected, disconnected, unconfigured
•
Redis fan-out connectivity
service
stringone of: ok
•
API liveness marker
gatewayUrl
string
•
WebSocket URL of the realtime gateway
signingKeyConfigured
boolean
•
Whether the token signing key is present
POST/realtime/tokens

Mint a short-lived capability token (JWT) from namespace policy and grants, and return the gateway WebSocket URL. A non-empty channels list filters capabilities to matching channels; omit it to skip that filter. Namespaces with a subscription proxy still require concrete requested channels approved by the proxy.

MCP tool: realtime_tokens_create

Parameters

NameInTypeRequiredDescription
channelsbody
string[]
—
Concrete channels to filter the resolved capabilities to; omit to receive all capabilities the identity has

Response

Returns object.

FieldTypeAlwaysDescription
token
string
•
Signed EdDSA capability JWT (60s TTL)
gatewayUrl
string
•
WebSocket URL of the realtime gateway to connect to
GET/realtime/webhooks

List all client webhooks registered for this product (secret metadata only)

MCP tool: realtime_webhook_list

Parameters

No parameters.

Response

Returns object.

FieldTypeAlwaysDescription
webhooks
object[]
•
—
POST/realtime/webhooks

Register a client webhook: lifecycle notifications (channel occupied/vacated, presence member added/removed) are POSTed to the URL signed with HMAC-SHA256. Returns the full signing secret ONCE.

MCP tool: realtime_webhook_create

Parameters

NameInTypeRequiredDescription
urlbody
string (uri)
•
Endpoint that receives signed lifecycle POSTs (https in production)
eventsbody
string[]one of: channel.occupied, channel.vacated, presence.member-added, presence.member-removed
•
Lifecycle event types this webhook receives
descriptionbody
string
—
Free-form note

Response

Returns object.

FieldTypeAlwaysDescription
secret
string
•
Full signing secret — returned only once, at creation. Store it now.
webhook
object
•
—
DELETE/realtime/webhooks/:webhookId

Delete a client webhook (its secrets and delivery log go with it)

MCP tool: realtime_webhook_delete

Parameters

NameInTypeRequiredDescription
webhookIdpath
string (uuid)
•
Webhook id

Response

Returns object.

FieldTypeAlwaysDescription
deleted
booleanone of: true
•
—
GET/realtime/webhooks/:webhookId

Get a client webhook by id (secret metadata only, never the secret)

MCP tool: realtime_webhook_get

Parameters

NameInTypeRequiredDescription
webhookIdpath
string (uuid)
•
Webhook id

Response

Returns object.

FieldTypeAlwaysDescription
id
string (uuid)
•
—
url
string
•
—
active
boolean
•
—
events
string[]
•
—
secrets
object[]
•
Secret metadata only — never the secret itself
createdAt
string
•
—
updatedAt
string
•
—
description
string | null
•
—
PATCH/realtime/webhooks/:webhookId

Update a client webhook: url, event filter, description, active flag

MCP tool: realtime_webhook_update

Parameters

NameInTypeRequiredDescription
urlbody
string (uri)
—
Endpoint that receives signed lifecycle POSTs (https in production)
eventsbody
string[]one of: channel.occupied, channel.vacated, presence.member-added, presence.member-removed
—
Lifecycle event types this webhook receives
descriptionbody
string | null
—
Free-form note
activebody
boolean
—
Inactive webhooks receive no deliveries
webhookIdpath
string (uuid)
•
Webhook id to update

Response

Returns object.

FieldTypeAlwaysDescription
id
string (uuid)
•
—
url
string
•
—
active
boolean
•
—
events
string[]
•
—
secrets
object[]
•
Secret metadata only — never the secret itself
createdAt
string
•
—
updatedAt
string
•
—
description
string | null
•
—
GET/realtime/webhooks/:webhookId/deliveries

List recent delivery attempts of a webhook (status, attempts, response code)

MCP tool: realtime_webhook_deliveries_list

Parameters

NameInTypeRequiredDescription
webhookIdpath
string (uuid)
•
Webhook id
limitquery
integer
—
Max deliveries to return (newest first)

Response

Returns object.

FieldTypeAlwaysDescription
deliveries
object[]
•
—
POST/realtime/webhooks/:webhookId/secret/rotate

Rotate the webhook signing secret with an overlap window: the new secret signs immediately (returned ONCE), the previous one keeps verifying until its grace expiry

MCP tool: realtime_webhook_secret_rotate

Parameters

NameInTypeRequiredDescription
webhookIdpath
string (uuid)
•
Webhook id

Response

Returns object.

FieldTypeAlwaysDescription
prefix
string
•
Visible prefix of the new secret (X-Realtime-Key)
secret
string
•
New full signing secret — returned only once. Store it now.
previousExpiresAt
string | null
•
When the rotated-out secret stops verifying (grace window)
Was this page helpful?
Esc

Start typing to search the docs.

↑↓navigate↵select