Query structured spec data via REST or MCP. Get exactly what your agent needs.
https://rest.ably.io
/keys/{keyName}/requestToken
This is the means by which clients obtain access tokens to use the service. You can see how to construct an Ably TokenRequest in the [Ably TokenRequest spec](https://www.ably.io/documentation/rest-api/token-request-spec) documentation, although we recommend you use an Ably SDK rather to create a TokenRequest, as the construction of a TokenRequest is complex. The resulting token response object contains the token properties as defined in Ably TokenRequest spec. Authentication is not required if using a Signed TokenRequest.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
{
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"$ref": "#/components/schemas/TokenRequest"
},
{
"$ref": "#/components/schemas/SignedTokenRequest"
}
]
},
"example": {
"keyName": "YourKey.Name",
"timestamp": "1559124196551",
"capability": {
"channel1": [
"publish",
"subscribe"
],
"wildcard:channels:*": [
"publish"
]
}
}
}
}
}
POST /keys/{keyName}/requestToken
/channels/{channel_id}/messages
Get message history for a channel
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional | ||||
| optional | ||||
| optional | ||||
| optional | ||||
| optional |
GET /channels/{channel_id}/messages
/channels/{channel_id}/presence/history
Get presence on a channel
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional | ||||
| optional | ||||
| optional | ||||
| optional | ||||
| optional |
GET /channels/{channel_id}/presence/history
/channels/{channel_id}/messages
Publish a message to the specified channel
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Message"
}
},
"application/x-msgpack": {
"schema": {
"$ref": "#/components/schemas/Message"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/Message"
}
}
}
}
POST /channels/{channel_id}/messages
/push/channelSubscriptions
Delete a device details object.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| channel | query | optional | string | Filter to restrict to subscriptions associated with that channel. |
| deviceId | query | optional | string | Must be set when clientId is empty, cannot be used with clientId. |
| clientId | query | optional | string | Must be set when deviceId is empty, cannot be used with deviceId. |
DELETE /push/channelSubscriptions
/push/channelSubscriptions
Get a list of push notification subscriptions to channels.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| channel | query | optional | string | Filter to restrict to subscriptions associated with that channel. |
| deviceId | query | optional | string | Optional filter to restrict to devices associated with that deviceId. Cannot be used with clientId. |
| clientId | query | optional | string | Optional filter to restrict to devices associated with that clientId. Cannot be used with deviceId. |
| limit | query | optional | integer | The maximum number of records to return. |
GET /push/channelSubscriptions
/push/channelSubscriptions
Subscribe either a single device or all devices associated with a client ID to receive push notifications from messages sent to a channel.
{
"content": {
"application/json": {
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"channel": {
"type": "string",
"description": "Channel name."
},
"deviceId": {
"type": "string",
"description": "Must be set when clientId is empty, cannot be used with clientId."
}
}
},
{
"type": "object",
"properties": {
"channel": {
"type": "string",
"description": "Channel name."
},
"clientId": {
"type": "string",
"description": "Must be set when deviceId is empty, cannot be used with deviceId."
}
}
}
]
},
"example": {
"channel": "my:channel",
"clientId": "myClientId"
}
},
"application/x-msgpack": {
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"channel": {
"type": "string",
"description": "Channel name."
},
"deviceId": {
"type": "string",
"description": "Must be set when clientId is empty, cannot be used with clientId."
}
}
},
{
"type": "object",
"properties": {
"channel": {
"type": "string",
"description": "Channel name."
},
"clientId": {
"type": "string",
"description": "Must be set when deviceId is empty, cannot be used with deviceId."
}
}
}
]
},
"example": {
"channel": "my:channel",
"clientId": "myClientId"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"oneOf": [
{
"type": "object",
"properties": {
"channel": {
"type": "string",
"description": "Channel name."
},
"deviceId": {
"type": "string",
"description": "Must be set when clientId is empty, cannot be used with clientId."
}
}
},
{
"type": "object",
"properties": {
"channel": {
"type": "string",
"description": "Channel name."
},
"clientId": {
"type": "string",
"description": "Must be set when deviceId is empty, cannot be used with deviceId."
}
}
}
]
},
"example": {
"channel": "my:channel",
"clientId": "myClientId"
}
}
}
}
POST /push/channelSubscriptions
/push/channels
Returns a paginated response of channel names.
GET /push/channels
/push/deviceRegistrations
Unregisters devices. All their subscriptions for receiving push notifications through channels will also be deleted.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| deviceId | query | optional | string | Optional filter to restrict to devices associated with that deviceId. Cannot be used with clientId. |
| clientId | query | optional | string | Optional filter to restrict to devices associated with that clientId. Cannot be used with deviceId. |
DELETE /push/deviceRegistrations
/push/deviceRegistrations
List of device details of devices registed for push notifications.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| deviceId | query | optional | string | Optional filter to restrict to devices associated with that deviceId. |
| clientId | query | optional | string | Optional filter to restrict to devices associated with that clientId. |
| limit | query | optional | integer | The maximum number of records to return. |
GET /push/deviceRegistrations
/push/deviceRegistrations
Register a device’s details, including the information necessary to deliver push notifications to it. Requires "push-admin" capability.
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
},
"application/x-msgpack": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
}
}
}
POST /push/deviceRegistrations
/push/deviceRegistrations/{device_id}
Unregisters a single device by its device ID. All its subscriptions for receiving push notifications through channels will also be deleted.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
DELETE /push/deviceRegistrations/{device_id}
/push/deviceRegistrations/{device_id}
Get the full details of a device.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
GET /push/deviceRegistrations/{device_id}
/push/deviceRegistrations/{device_id}
Specific attributes of an existing registration can be updated. Only clientId, metadata and push.recipient are mutable.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
},
"application/x-msgpack": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
}
}
}
PATCH /push/deviceRegistrations/{device_id}
/push/deviceRegistrations/{device_id}
Device registrations can be upserted (the existing registration is replaced entirely) with a PUT operation. Only clientId, metadata and push.recipient are mutable.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
{
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
},
"application/x-msgpack": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
},
"application/x-www-form-urlencoded": {
"schema": {
"$ref": "#/components/schemas/DeviceDetails"
}
}
}
}
PUT /push/deviceRegistrations/{device_id}
/push/deviceRegistrations/{device_id}/resetUpdateToken
Gets an updated device details object.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
GET /push/deviceRegistrations/{device_id}/resetUpdateToken
/push/publish
A convenience endpoint to deliver a push notification payload to a single device or set of devices identified by their client identifier.
{
"content": {
"application/json": {
"schema": {
"type": "object",
"required": [
"recipient"
],
"properties": {
"push": {
"$ref": "#/components/schemas/Push"
},
"recipient": {
"$ref": "#/components/schemas/Recipient"
}
}
}
},
"application/x-msgpack": {
"schema": {
"type": "object",
"required": [
"recipient"
],
"properties": {
"push": {
"$ref": "#/components/schemas/Push"
},
"recipient": {
"$ref": "#/components/schemas/Recipient"
}
}
}
},
"application/x-www-form-urlencoded": {
"schema": {
"type": "object",
"required": [
"recipient"
],
"properties": {
"push": {
"$ref": "#/components/schemas/Push"
},
"recipient": {
"$ref": "#/components/schemas/Recipient"
}
}
}
}
}
}
POST /push/publish
/stats
The Ably system can be queried to obtain usage statistics for a given application, and results are provided aggregated across all channels in use in the application in the specified period. Stats may be used to track usage against account quotas.
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional | ||||
| optional | ||||
| optional | ||||
| optional | ||||
| unit | query | optional | string | Specifies the unit of aggregation in the returned results. |
GET /stats
/time
This returns the service time in milliseconds since the epoch.
GET /time
/channels
Enumerate all active channels of the application
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| limit | query | optional | integer | |
| prefix | query | optional | string | Optionally limits the query to only those channels whose name starts with the given prefix |
| by | query | optional | string | optionally specifies whether to return just channel names (by=id) or ChannelDetails (by=value) |
GET /channels
/channels/{channel_id}
Get metadata of a channel
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional |
GET /channels/{channel_id}
/channels/{channel_id}/presence
Get presence on a channel
| Name | In | Required | Type | Description |
|---|---|---|---|---|
| optional | ||||
| clientId | query | optional | string | |
| connectionId | query | optional | string | |
| limit | query | optional | integer |
GET /channels/{channel_id}/presence
ChannelDetails
{
"type": "object",
"required": [
"channelId"
],
"properties": {
"region": {
"type": "string",
"description": "In events relating to the activity of a channel in a specific region, this optionally identifies the region."
},
"status": {
"$ref": "#/components/schemas/ChannelStatus"
},
"channelId": {
"type": "string",
"description": "The required name of the channel including any qualifier, if any."
},
"isGlobalMaster": {
"type": "boolean",
"description": "In events relating to the activity of a channel in a specific region, this optionally identifies whether or not that region is responsible for global coordination of the channel."
}
}
}
ChannelStatus
{
"type": "object",
"required": [
"isActive"
],
"properties": {
"isActive": {
"type": "boolean",
"description": "A required boolean value indicating whether the channel that is the subject of the event is active. For events indicating regional activity of a channel this indicates activity in that region, not global activity."
},
"occupancy": {
"$ref": "#/components/schemas/Occupancy"
}
},
"description": "A ChannelStatus instance."
}
DeviceDetails
{
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the device generated by the device itself."
},
"clientId": {
"type": "string",
"description": "Optional trusted client identifier for the device."
},
"metadata": {
"type": "object",
"description": "Optional metadata object for this device. The metadata for a device may only be set by clients with push-admin privileges and will be used more extensively in the future with smart notifications."
},
"platform": {
"enum": [
"ios",
"android"
],
"type": "string",
"description": "Platform of the push device."
},
"formFactor": {
"enum": [
"phone",
"tablet",
"desktop",
"tv",
"watch",
"car",
"embedded"
],
"type": "string",
"description": "Form factor of the push device."
},
"push.state": {
"enum": [
"Active",
"Failing",
"Failed"
],
"type": "string",
"readOnly": true,
"description": "the current state of the push device."
},
"deviceSecret": {
"type": "string",
"description": "Secret value for the device."
},
"push.recipient": {
"$ref": "#/components/schemas/Recipient"
}
}
}
Error
{
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "Error code."
},
"href": {
"type": "string",
"description": "Link to help with error."
},
"message": {
"type": "string",
"description": "Message explaining the error's cause."
},
"serverId": {
"type": "string",
"description": "Server ID with which error was encountered."
},
"statusCode": {
"type": "integer",
"description": "Status error code."
}
},
"description": "Returned error from failed REST."
}
Extras
{
"type": "object",
"properties": {
"push": {
"$ref": "#/components/schemas/Push"
}
},
"description": "Extras object. Currently only allows for [push](https://www.ably.io/documentation/general/push/publish#channel-broadcast-example) extra."
}
Message
{
"type": "object",
"properties": {
"id": {
"type": "string",
"readOnly": true,
"description": "A Unique ID that can be specified by the publisher for [idempotent publishing](https://www.ably.io/documentation/rest/messages#idempotent)."
},
"data": {
"type": "string",
"description": "The string encoded payload, with the encoding specified below."
},
"name": {
"type": "string",
"description": "The event name, if provided."
},
"extras": {
"$ref": "#/components/schemas/Extras"
},
"clientId": {
"type": "string",
"description": "The [client ID](https://www.ably.io/documentation/core-features/authentication#identified-clients) of the publisher of this message."
},
"encoding": {
"type": "string",
"description": "This will typically be empty as all messages received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute will contain the remaining transformations not applied to the data payload."
},
"timestamp": {
"type": "integer",
"format": "int64",
"readOnly": true,
"description": "Timestamp when the message was received by the Ably, as milliseconds since the epoch."
},
"connectionId": {
"type": "string",
"description": "The connection ID of the publisher of this message."
}
},
"description": "Message object."
}
Notification
{
"type": "object",
"properties": {
"body": {
"type": "string",
"description": "Text below title on the expanded notification."
},
"icon": {
"type": "string",
"description": "Platform-specific icon for the notification."
},
"sound": {
"type": "string",
"description": "Platform-specific sound for the notification."
},
"title": {
"type": "string",
"description": "Title to display at the notification."
},
"collapseKey": {
"type": "string",
"description": "Platform-specific, used to group notifications together."
}
}
}
Occupancy
{
"type": "object",
"properties": {
"publishers": {
"type": "integer",
"description": "The number of connections attached to the channel that are authorised to publish."
},
"subscribers": {
"type": "integer",
"description": "The number of connections attached that are authorised to subscribe to messages."
},
"presenceMembers": {
"type": "integer",
"description": "The number of members currently entered into the presence channel."
},
"presenceConnections": {
"type": "integer",
"description": "The number of connections that are authorised to enter members into the presence channel."
},
"presenceSubscribers": {
"type": "integer",
"description": "The number of connections that are authorised to subscribe to presence messages."
}
},
"description": "An Occupancy instance indicating the occupancy of a channel. For events indicating regional activity of a channel this indicates activity in that region, not global activity."
}
PresenceMessage
{
"type": "object",
"properties": {
"id": {
"type": "string",
"readOnly": true,
"description": "Unique ID assigned by Ably to this presence update."
},
"data": {
"type": "string",
"description": "The presence update payload, if provided."
},
"action": {
"enum": [
"ABSENT",
"PRESENT",
"ENTER",
"LEAVE",
"UPDATE"
],
"type": "string",
"readOnly": true,
"description": "The event signified by a PresenceMessage."
},
"extras": {
"$ref": "#/components/schemas/Extras"
},
"clientId": {
"type": "string",
"description": "The client ID of the publisher of this presence update."
},
"encoding": {
"type": "string",
"description": "This will typically be empty as all presence updates received from Ably are automatically decoded client-side using this value. However, if the message encoding cannot be processed, this attribute will contain the remaining transformations not applied to the data payload."
},
"timestamp": {
"type": "integer",
"format": "int64",
"readOnly": true,
"description": "Timestamp when the presence update was received by Ably, as milliseconds since the epoch."
},
"connectionId": {
"type": "string",
"description": "The connection ID of the publisher of this presence update."
}
}
}
Push
{
"type": "object",
"properties": {
"fcm": {
"type": "object",
"properties": {
"notification": {
"$ref": "#/components/schemas/Notification"
}
},
"description": "Extends and overrides generic values when delivering via GCM/FCM. [See examples](https://www.ably.io/documentation/general/push/publish#payload-structure)"
},
"web": {
"type": "object",
"properties": {
"notification": {
"$ref": "#/components/schemas/Notification"
}
},
"description": "Extends and overrides generic values when delivering via web. [See examples](https://www.ably.io/documentation/general/push/publish#payload-structure)"
},
"apns": {
"type": "object",
"properties": {
"notification": {
"$ref": "#/components/schemas/Notification"
}
},
"description": "Extends and overrides generic values when delivering via APNs. [See examples](https://www.ably.io/documentation/general/push/publish#payload-structure)"
},
"data": {
"type": "string",
"description": "Arbitrary [key-value string-to-string payload](https://www.ably.io/documentation/general/push/publish#channel-broadcast-example)."
},
"notification": {
"$ref": "#/components/schemas/Notification"
}
}
}
Recipient
{
"type": "object",
"properties": {
"clientId": {
"type": "string",
"writeOnly": true,
"description": "Client ID of recipient"
},
"deviceId": {
"type": "string",
"writeOnly": true,
"description": "Client ID of recipient"
},
"deviceToken": {
"type": "string",
"description": "when using APNs, specifies the required device token."
},
"transportType": {
"enum": [
"apns",
"fcm",
"gcm"
],
"type": "string",
"description": "Defines which push platform is being used."
},
"registrationToken": {
"type": "string",
"description": "when using GCM or FCM, specifies the required registration token."
}
},
"description": "Push recipient details for a device."
}
SignedTokenRequest
{
"allOf": [
{
"$ref": "#/components/schemas/TokenRequest"
},
{
"type": "object",
"required": [
"mac"
],
"properties": {
"mac": {
"type": "string",
"description": "A signature, generated as an HMAC of each of the above components, using the key secret value."
}
}
}
]
}
TokenDetails
{
"type": "object",
"properties": {
"token": {
"type": "string",
"description": "The Ably Token."
},
"issued": {
"type": "integer",
"description": "Timestamp of token creation."
},
"expires": {
"type": "integer",
"description": "Timestamp of token expiration."
},
"keyName": {
"type": "string",
"description": "Name of the key used to create the token"
},
"capability": {
"type": "string",
"description": "Regular expression representation of the capabilities of the token."
}
}
}
TokenRequest
{
"type": "object",
"required": [
"keyName",
"capability",
"timestamp",
"nonce"
],
"properties": {
"nonce": {
"type": "string",
"description": "An unquoted, un-escaped random string of at least 16 characters. Used to ensure the Ably TokenRequest cannot be reused."
},
"keyName": {
"type": "string",
"example": "xVLyHw.LMJZxw",
"description": "Name of the key used for the TokenRequest. The keyName comprises of the app ID and key ID on an API Key."
},
"clientId": {
"type": "string",
"description": "The [client ID](https://www.ably.io/documentation/core-features/authentication#identified-clients) to be assosciated with the token. Can be set to * to allow for any client ID to be used."
},
"timestamp": {
"type": "integer",
"description": "Time of creation of the Ably TokenRequest."
},
"capability": {
"type": "object",
"example": {
"channel1": [
"publish",
"subscribe"
]
},
"description": "The [capabilities](https://www.ably.io/documentation/core-features/authentication#capabilities-explained) (i.e. a set of channel names/namespaces and, for each, a set of operations) which should be a subset of the set of capabilities associated with the key specified in keyName."
}
}
}