Skip to main content
The Ably REST API provides direct HTTP access to the Ably service for publishing messages, querying history, managing authentication, and more. While we recommend using the REST SDK for most applications, the REST API is available for scenarios where an SDK is not available or practical.

Overview

The REST API enables you to:
  • Publish messages to channels
  • Retrieve message and presence history
  • Request authentication tokens
  • Query channel metadata and statistics
  • Manage push notifications
  • Perform batch operations

Base URL

All REST API requests use the following base URL: For enterprise customers, custom endpoints may be available.

Authentication

The REST API supports two authentication methods:

Basic Authentication

Use your API key in the Authorization header:

Token Authentication

Use an Ably Token or JWT in the Authorization header: Learn more about authentication.

Core Endpoints

Publishing Messages

Publish messages to a channel:

Message History

Retrieve message history:

Presence

Query current presence:

Authentication Tokens

Request an Ably Token:

Request Format

Content Types

The API accepts the following content types:
  • application/json - JSON (default)
  • application/x-msgpack - MessagePack (binary)
  • application/x-www-form-urlencoded - Form-encoded

Response Format

Specify the response format using the Accept header or format parameter:
  • application/json - JSON (default)
  • application/x-msgpack - MessagePack (binary)
  • application/javascript - JSONP
  • text/html - HTML

Pagination

APIs with potentially large result sets return paginated responses: Pagination links are provided in the response headers.

Rate Limits

The REST API has rate limits to ensure fair usage:
  • Message publish: Up to 2,000 messages per second per account
  • History queries: Up to 50 requests per second per account
  • Token requests: Up to 50 requests per second per account
See rate limits for full details.

Error Handling

Errors return standard HTTP status codes with error details: Common status codes:
  • 400 - Bad Request (invalid parameters)
  • 401 - Unauthorized (invalid credentials)
  • 403 - Forbidden (insufficient permissions)
  • 404 - Not Found (resource not found)
  • 429 - Too Many Requests (rate limited)
  • 500 - Internal Server Error

API Reference Sections

Build docs developers (and LLMs) love