Skip to main content
The Ably REST SDK provides a simple, stateless interface for publishing messages, querying history, and managing authentication. This SDK is ideal for server-side applications and scenarios where a persistent connection is not required.

Overview

The REST SDK enables you to:
  • Publish messages to channels
  • Retrieve message and presence history
  • Generate authentication tokens
  • Query channel metadata
  • Retrieve application statistics

Getting Started

To use the REST SDK, first instantiate a client:

Core Concepts

Constructor

The REST SDK constructor creates a new client instance for making HTTP requests to Ably. You can instantiate the client using an API key string or a ClientOptions object for more advanced configuration. See the full constructor documentation for detailed information.

Authentication

The REST SDK supports both Basic and Token authentication:
  • Basic Authentication: Use your API key directly with each request
  • Token Authentication: Generate and use temporary tokens for enhanced security
Learn more about authentication.

Channels

Channels in the REST SDK provide:
  • Message publishing
  • History retrieval
  • Presence querying
Explore the Channels API.

Messages

Publish messages and retrieve message history:
  • Single or batch message publishing
  • Paginated history queries
  • Message filtering options
Read about Messages.

Key Features

Stateless Operations

The REST SDK is stateless, making it ideal for:
  • Server-side integrations
  • Serverless functions
  • Batch operations
  • Administrative tasks

HTTP API Access

All operations use Ably’s REST API:
  • Standard HTTP methods (GET, POST)
  • JSON or MessagePack encoding
  • Automatic fallback host support
  • Rate limiting and retry logic

Token Generation

Generate authentication tokens for client applications:
  • Ably Tokens for temporary access
  • Ably JWTs for custom authentication
  • TokenRequests for delegated authentication

Comparison with Realtime SDK

Choose the REST SDK when:
  • You don’t need real-time updates
  • You’re building server-side services
  • You need simple publish operations
  • You want to minimize resource usage
Choose the Realtime SDK when:
  • You need to receive messages in real-time
  • You require presence functionality
  • You want automatic reconnection
  • Your app needs bidirectional communication

API Reference Sections

Build docs developers (and LLMs) love