Skip to main content
The Chat REST API provides HTTP access to Ably Chat functionality for server-side operations. Use this API to send messages, manage rooms, and perform administrative tasks without maintaining a persistent connection.

Overview

The Chat REST API enables you to:
  • Send messages to chat rooms
  • Query message history
  • Manage room metadata
  • Retrieve room occupancy
  • Perform moderation actions

Base URL

All Chat REST API requests use:

Authentication

The Chat REST API uses the same authentication as the standard REST API:

Basic Authentication

Token Authentication

Rooms

Rooms are the primary organizational unit in Chat.

Get Room

Retrieve room metadata:
roomId
string
Unique identifier for the room.
name
string
Room display name.
metadata
object
Custom room metadata.

List Rooms

List all active rooms:

Messages

Send and retrieve chat messages.

Send Message

Send a message to a room:
text
string
required
The message text content.
metadata
object
Custom message metadata.
headers
object
Message headers for filtering and routing.

Get Message History

Retrieve message history for a room:
start
integer
Start time in milliseconds since epoch.
end
integer
End time in milliseconds since epoch.
limit
integer
default:"100"
Maximum number of messages to return (max 1000).
direction
string
default:"backwards"
Query direction: forwards or backwards.

Occupancy

Query room occupancy information.

Get Occupancy

Retrieve current room occupancy:
connections
integer
Number of active connections to the room.
presenceMembers
integer
Number of members present in the room.

Typing Indicators

Manage typing indicators (typically used by server-side bots).

Send Typing Indicator

Reactions

Send reactions to messages.

Send Reaction

Add a reaction to a message:

Get Reactions

Retrieve reactions for a message:

Moderation

Perform moderation actions on messages.

Delete Message

Delete a message from a room:

Update Message

Update a message in a room:

Error Handling

The Chat REST API uses standard HTTP status codes: Common errors:
  • 400 - Invalid request parameters
  • 401 - Authentication failed
  • 403 - Insufficient permissions
  • 404 - Room or message not found
  • 429 - Rate limit exceeded

Rate Limits

The Chat REST API shares rate limits with the standard REST API:
  • Message sending: Up to 2,000 messages per second
  • History queries: Up to 50 requests per second
See rate limits for details.

Examples

Send Chat Message

Retrieve Recent Messages

Build docs developers (and LLMs) love