> ## 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.

# LiveObjects REST API

The LiveObjects REST API provides HTTP access to LiveObjects state management functionality for server-side operations. Use this API to query object state, perform administrative tasks, and integrate LiveObjects with server-side workflows.

## Overview

The LiveObjects REST API enables you to:

* Query current state of LiveObjects
* Retrieve object history
* List objects in a namespace
* Perform administrative operations

## Base URL

All LiveObjects REST API requests use:

<Code>
  ```text theme={null}
  https://rest.ably.io
  ```
</Code>

## Authentication

The LiveObjects REST API uses the same authentication as the standard [REST API](/docs/api/rest-api):

### Basic Authentication

<Code>
  ```shell theme={null}
  curl https://rest.ably.io/liveobjects/my-namespace/objects/object-id \
    -u "{{API_KEY}}"
  ```
</Code>

### Token Authentication

<Code>
  ```shell theme={null}
  curl https://rest.ably.io/liveobjects/my-namespace/objects/object-id \
    -H "Authorization: Bearer {{TOKEN}}"
  ```
</Code>

## Objects

Query and manage LiveObject instances.

### Get Object

Retrieve the current state of a LiveObject:

<Code>
  ```shell theme={null}
  curl https://rest.ably.io/liveobjects/my-namespace/objects/object-id \
    -u "{{API_KEY}}"
  ```
</Code>

<ResponseField name="objectId" type="string">
  Unique identifier for the object.
</ResponseField>

<ResponseField name="data" type="object">
  Current state data of the object.
</ResponseField>

<ResponseField name="version" type="string">
  Version identifier for the current state.
</ResponseField>

<ResponseField name="timestamp" type="integer">
  Timestamp when the object was last modified.
</ResponseField>

### List Objects

List all objects in a namespace:

<Code>
  ```shell theme={null}
  curl https://rest.ably.io/liveobjects/my-namespace/objects \
    -u "{{API_KEY}}"
  ```
</Code>

<ParamField query="limit" type="integer" default="100">
  Maximum number of objects to return.
</ParamField>

<ParamField query="prefix" type="string">
  Filter objects by ID prefix.
</ParamField>

### Get Object History

Retrieve the history of state changes for an object:

<Code>
  ```shell theme={null}
  curl "https://rest.ably.io/liveobjects/my-namespace/objects/object-id/history?limit=50" \
    -u "{{API_KEY}}"
  ```
</Code>

<ParamField query="start" type="integer">
  Start time in milliseconds since epoch.
</ParamField>

<ParamField query="end" type="integer">
  End time in milliseconds since epoch.
</ParamField>

<ParamField query="limit" type="integer" default="100">
  Maximum number of history entries to return.
</ParamField>

<ParamField query="direction" type="string" default="backwards">
  Query direction: `forwards` or `backwards`.
</ParamField>

## State Operations

Query and modify object state.

### Update Object State

Update the state of a LiveObject:

<Code>
  ```shell theme={null}
  curl -X PATCH https://rest.ably.io/liveobjects/my-namespace/objects/object-id \
    -u "{{API_KEY}}" \
    -H "Content-Type: application/json" \
    -d '{
      "data": {
        "status": "active",
        "count": 42
      }
    }'
  ```
</Code>

<ParamField body="data" type="object" required>
  New state data to merge with existing state.
</ParamField>

<ParamField body="version" type="string">
  Optional version for optimistic concurrency control.
</ParamField>

### Delete Object

Delete a LiveObject:

<Code>
  ```shell theme={null}
  curl -X DELETE https://rest.ably.io/liveobjects/my-namespace/objects/object-id \
    -u "{{API_KEY}}"
  ```
</Code>

## Namespaces

Manage LiveObjects namespaces.

### Get Namespace Info

Retrieve information about a namespace:

<Code>
  ```shell theme={null}
  curl https://rest.ably.io/liveobjects/my-namespace \
    -u "{{API_KEY}}"
  ```
</Code>

<ResponseField name="namespaceId" type="string">
  Namespace identifier.
</ResponseField>

<ResponseField name="objectCount" type="integer">
  Number of objects in the namespace.
</ResponseField>

<ResponseField name="lastActivity" type="integer">
  Timestamp of last activity in milliseconds.
</ResponseField>

### List Namespaces

List all LiveObjects namespaces:

<Code>
  ```shell theme={null}
  curl https://rest.ably.io/liveobjects \
    -u "{{API_KEY}}"
  ```
</Code>

## Subscriptions

Manage subscriptions to LiveObjects state changes.

### Get Active Subscriptions

Retrieve active subscriptions for an object:

<Code>
  ```shell theme={null}
  curl https://rest.ably.io/liveobjects/my-namespace/objects/object-id/subscriptions \
    -u "{{API_KEY}}"
  ```
</Code>

<ResponseField name="subscriptions" type="array">
  List of active subscriptions.
</ResponseField>

<ResponseField name="subscriptions[].connectionId" type="string">
  Connection ID of the subscriber.
</ResponseField>

<ResponseField name="subscriptions[].clientId" type="string">
  Client ID of the subscriber.
</ResponseField>

## Error Handling

The LiveObjects REST API uses standard HTTP status codes:

<Code>
  ```json theme={null}
  {
    "error": {
      "code": 40160,
      "message": "Object not found",
      "statusCode": 404
    }
  }
  ```
</Code>

Common errors:

* `400` - Invalid request parameters
* `401` - Authentication failed
* `403` - Insufficient permissions
* `404` - Object or namespace not found
* `409` - Version conflict (optimistic concurrency)
* `429` - Rate limit exceeded

## Rate Limits

The LiveObjects REST API shares rate limits with the standard REST API:

* State queries: Up to 50 requests per second
* State updates: Up to 2,000 updates per second

See [rate limits](/docs/platform/pricing/limits) for details.

## Examples

### Query Object State

<Code>
  ```javascript theme={null}
  async function getObjectState(namespace, objectId) {
    const response = await fetch(
      `https://rest.ably.io/liveobjects/${namespace}/objects/${objectId}`,
      {
        headers: {
          'Authorization': `Basic ${btoa(API_KEY)}`
        }
      }
    );
    
    return await response.json();
  }
  ```
</Code>

### Update Object State

<Code>
  ```javascript theme={null}
  async function updateObjectState(namespace, objectId, newData) {
    const response = await fetch(
      `https://rest.ably.io/liveobjects/${namespace}/objects/${objectId}`,
      {
        method: 'PATCH',
        headers: {
          'Authorization': `Basic ${btoa(API_KEY)}`,
          'Content-Type': 'application/json'
        },
        body: JSON.stringify({
          data: newData
        })
      }
    );
    
    return await response.json();
  }
  ```
</Code>

### List Objects in Namespace

<Code>
  ```javascript theme={null}
  async function listObjects(namespace, prefix = '') {
    const url = new URL(
      `https://rest.ably.io/liveobjects/${namespace}/objects`
    );
    
    if (prefix) {
      url.searchParams.set('prefix', prefix);
    }
    
    const response = await fetch(url, {
      headers: {
        'Authorization': `Basic ${btoa(API_KEY)}`
      }
    });
    
    return await response.json();
  }
  ```
</Code>

## Related Resources

* [LiveObjects Documentation](/docs/liveobjects)
* [REST API Reference](/docs/api/rest-api)
* [LiveObjects SDK](/docs/api/realtime-sdk)
* [State Synchronization Guide](/docs/liveobjects/state)
