API Reference

Complete reference for the Tannur REST API and SDK methods.

Authentication

All API requests require authentication using your API key in the Authorization header.

Authorization: Bearer YOUR_API_KEY

Endpoints

POST/events

Append a new event to a stream

{
  "stream": "orders",
  "type": "ORDER_CREATED",
  "data": {
    "id": "ord_123",
    "total": 99.99
  }
}
GET/events/:stream

Read events from a stream

Query Parameters: limit, offset, after, before

GET/state/:stream

Get the current state of a stream

POST/deploy

Deploy a projection or reducer function

SDK Methods

tannur.append()

await tannur.append(stream: string, event: Event)

Append an event to a stream. Returns the event ID.

tannur.read()

await tannur.read(stream: string, options?: ReadOptions)

Read events from a stream. Returns an array of events.

tannur.subscribe()

tannur.subscribe(stream: string, callback: (event) => void)

Subscribe to real-time updates on a stream.

tannur.project()

await tannur.project(stream: string, reducer: Reducer)

Create a projection by reducing events to state.

Rate Limits

  • Free: 1,000 requests/hour
  • Sprout: 10,000 requests/hour
  • Growth: Unlimited