> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/ably/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# REST SDK

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:

<Code>
  ```javascript theme={null}
  const rest = new Ably.Rest('your-api-key');
  ```

  ```python theme={null}
  rest = AblyRest('your-api-key')
  ```

  ```java theme={null}
  AblyRest rest = new AblyRest("your-api-key");
  ```
</Code>

## 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](/docs/api/rest-sdk) 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](/docs/api/rest-sdk/authentication).

### Channels

Channels in the REST SDK provide:

* Message publishing
* History retrieval
* Presence querying

Explore the [Channels API](/docs/api/rest-sdk/channels).

### Messages

Publish messages and retrieve message history:

* Single or batch message publishing
* Paginated history queries
* Message filtering options

Read about [Messages](/docs/api/rest-sdk/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

<Tiles>
  {[
    {
      title: 'Authentication',
      description: 'Manage authentication and generate tokens',
      link: '/docs/api/rest-sdk/authentication',
    },
    {
      title: 'Channels',
      description: 'Publish messages and query channels',
      link: '/docs/api/rest-sdk/channels',
    },
    {
      title: 'Messages',
      description: 'Publish messages and retrieve history',
      link: '/docs/api/rest-sdk/messages',
    },
    {
      title: 'Presence',
      description: 'Query presence state and history',
      link: '/docs/api/rest-sdk/presence',
    },
    ]}
</Tiles>

## Related Resources

* [Realtime SDK Overview](/docs/api/realtime-sdk)
* [REST API Reference](/docs/api/rest-api)
* [Authentication Guide](/docs/auth)
* [Publishing Messages](/docs/messages)
