Skip to content

Protocol Overview

The Unbroken Protocol is an HTTP-based protocol for creating, reading, and writing to durable, append-only byte streams. This page provides a complete reference of all protocol operations.

Communication Model

The protocol uses standard HTTP methods applied to stream URLs:

┌────────┐ ┌────────┐
│ Client │ │ Server │
└───┬────┘ └───┬────┘
│ │
│ PUT /stream (create) │
│───────────────────────────────────▶│
│ │
│ 201 Created │
│◀───────────────────────────────────│
│ │
│ POST /stream (append) │
│───────────────────────────────────▶│
│ │
│ 204 No Content │
│◀───────────────────────────────────│
│ │
│ GET /stream?offset=x (read) │
│───────────────────────────────────▶│
│ │
│ 200 OK + data │
│◀───────────────────────────────────│

URL Structure

The protocol does not mandate a specific URL structure. Servers may organize streams using any scheme:

/v1/streams/{id}
/api/conversations/{user}/{conversation}
/sync/{database}/changes
/{tenant}/events/{stream}

The protocol is defined by HTTP methods, query parameters, and headers applied to any stream URL.

Operations Summary

Write Operations

MethodPathDescriptionRequired
PUT{stream}Create a new streamBaseline
POST{stream}Append data to streamOptional
DELETE{stream}Delete streamOptional

Read Operations

MethodPathDescriptionRequired
GET{stream}?offset=xCatch-up readBaseline
GET{stream}?offset=x&live=long-pollLong-poll readOptional
GET{stream}?offset=x&live=sseSSE streamingOptional
HEAD{stream}Get stream metadataBaseline

Implementation Notes

Servers MAY implement read and write paths independently:

  • A database sync server might only implement reads, using internal mechanisms for writes
  • A log aggregation service might only implement writes, with reads handled by a separate system
  • A full-featured server implements both paths

Request Format

Common Headers

All requests may include:

HeaderDescription
AuthorizationAuthentication credentials
Content-TypeMedia type of request body

Query Parameters

ParameterOperationsDescription
offsetGETStarting position for read
liveGETLive mode: long-poll or sse
cursorGET (long-poll)CDN collapsing cursor

Response Format

Success Responses

CodeMeaningUsed By
200 OKSuccess with bodyGET, PUT (idempotent)
201 CreatedStream createdPUT
204 No ContentSuccess, no bodyPOST, DELETE, GET (timeout)

Error Responses

CodeMeaning
400 Bad RequestInvalid parameters or body
404 Not FoundStream does not exist
405 Method Not AllowedOperation not supported
409 ConflictSequence regression or config mismatch
410 GoneOffset before retention window
413 Payload Too LargeRequest body exceeds limit
429 Too Many RequestsRate limit exceeded

Response Headers

HeaderDescriptionOperations
Stream-Next-OffsetNext offset for readsAll successful reads/writes
Stream-Up-To-DateAt end of streamGET (when caught up)
Stream-CursorCDN collapsing keyGET
Content-TypeStream content typeGET, HEAD, PUT
LocationStream URLPUT (201)

Default Port

The default port for standalone Unbroken Protocol servers is 9999/tcp.

When integrated into an existing application server, use the host server’s port.

Versioning

The protocol uses a single-integer major version. Non-breaking changes are added through:

  • New optional headers
  • New optional query parameters
  • Additional response headers

Breaking changes require a new major version.

Detailed Documentation

For complete details on each operation: