# Huddle for developers

Huddle is a shared document workspace for people and AI agents: drafts that save as you type, numbered revisions, and publishing that never overwrites an edit you have not seen.

Call the same operations over plain HTTP, as MCP tools, or from a page through WebMCP. The base URL is `https://huddle.ferrite.run`.

## Quickstart

Read something first. This request needs no setup:

```sh
curl -s 'https://huddle.ferrite.run/api/docs'
```

List every document that is not archived, most recently changed first. Use it to find a document id or to see what is being worked on. Returns each document's title, revision number, whether it has an open draft and how many minutes ago it changed, plus the total.

Then change something. Send an `idempotency-key` so a retry cannot run twice:

```sh
curl -s -X POST 'https://huddle.ferrite.run/api/docs' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: create_doc-1' \
  -d '{"title":"Meeting notes"}'
```

To use Huddle from an AI assistant, add its MCP server:

```sh
claude mcp add --transport http huddle https://huddle.ferrite.run/mcp
```

## Authentication and API keys

No API key, account or sign-up is needed: the API is keyless, so the first request you send can be a real one.

## Sandbox

The public address is the sandbox. Everybody shares one demonstration workspace and calls act as an anonymous visitor, so reads and writes are both safe to try. Create a document of your own with `create_doc` and work on that one, because a draft you save in somebody else's document replaces theirs. Archive your document when you have finished.

The [sandbox page](/sandbox) is the place to start.

## Endpoints

| Operation | Request | What it does |
| --- | --- | --- |
| `list_docs` | `GET /api/docs` | List every document that is not archived, most recently changed first. Use it to find a document id or to see what is being worked on. Returns each document's title, revision number, whether it has an open draft and how many minutes ago it changed, plus the total. |
| `get_doc` | `GET /api/docs/{id}` | Read one document with its draft and its history. Use it before you save or publish, because both need the draft_version and the revision number it gives. Returns the published text, the open draft when there is one, and the revisions newest first. |
| `search_docs` | `GET /api/search` | Search document titles, and revisions by author or number, ignoring case. Use it when you know part of a title, or want every revision one author published. Returns matching documents and then matching revisions, up to 20 of each per page, plus next_cursor. |
| `list_activity` | `GET /api/activity` | List the newest published revisions across the whole workspace, at most 50. Use it to see what changed recently without opening each document. Returns the document, revision number, author, time and length of each, newest first. |
| `create_doc` | `POST /api/docs` | Create an empty document. Use it to start something new, then write into it with save_draft and publish_draft. Returns the new document's id, its title and its revision number, which is 0 until something is published. |
| `save_draft` | `POST /api/docs/{id}/draft` | Save the document's shared draft without publishing it. Use it to keep work in progress; it replaces the draft everyone sees. Returns the new draft_version to send with the next save, or a conflict when the draft has changed since the version you name. |
| `publish_draft` | `POST /api/docs/{id}/publish` | Publish the open draft as the document's next revision. Use it after save_draft, when the text is ready for everyone. Returns the document's id, title and new revision number, or a refusal with the reason when somebody else published first, the draft differs from the body you send, or there is nothing new to publish. |
| `archive_doc` | `POST /api/docs/{id}/archive` | Archive a document, or restore an archived one. Use it to take a finished document out of the list, search and activity: its text, draft and revisions stay readable at the same address, and archived set to false brings it back. Returns the document's id, title and revision number. |
| `discard_draft` | `POST /api/docs/{id}/draft/discard` | Throw away the document's open draft. Use it to drop unpublished changes; the published text and every revision stay as they are. Returns the new draft_version, or a conflict when the draft has changed since the version you name. |

The [OpenAPI 3.1 document](/openapi.json) describes every parameter and response. The MCP server at `https://huddle.ferrite.run/mcp` exposes the same operations as tools with the same names.

## Example requests

### `list_docs`

```sh
curl -s 'https://huddle.ferrite.run/api/docs'
```

### `get_doc`

```sh
curl -s 'https://huddle.ferrite.run/api/docs/d-1'
```

### `search_docs`

```sh
curl -s 'https://huddle.ferrite.run/api/search?q=release'
```

### `list_activity`

```sh
curl -s 'https://huddle.ferrite.run/api/activity'
```

### `create_doc`

```sh
curl -s -X POST 'https://huddle.ferrite.run/api/docs' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: create_doc-1' \
  -d '{"title":"Meeting notes"}'
```

### `save_draft`

```sh
curl -s -X POST 'https://huddle.ferrite.run/api/docs/d-1/draft' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: save_draft-1' \
  -d '{"body":"Version 2 adds search and an activity page.","expect_draft_version":0}'
```

### `publish_draft`

```sh
curl -s -X POST 'https://huddle.ferrite.run/api/docs/d-1/publish' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: publish_draft-1' \
  -d '{"body":"Version 2 adds search and an activity page.","expect_draft_version":1,"expect_revision":1}'
```

### `archive_doc`

```sh
curl -s -X POST 'https://huddle.ferrite.run/api/docs/d-1/archive' \
  -H 'content-type: application/json' \
  -H 'idempotency-key: archive_doc-1' \
  -d '{"archived":true}'
```

## Conventions

- Rate limits: every response carries `RateLimit-Limit`, `RateLimit-Remaining` and `RateLimit-Reset`. A `429` also carries `Retry-After`, in seconds.
- Errors: refusals are RFC 9457 `application/problem+json` with a stable `type`, a `detail` written to be read, and a `hint` when there is a next step.
- Retries: repeat the same `idempotency-key` on a write and you receive the first result again.
- Versioning: this is version 0.2.0. A change that would break a caller is announced with `Deprecation` and `Sunset` headers at least 90 days ahead.
- Markdown: add `.md` to a page path, or send `Accept: text/markdown`.

## Machine-readable descriptions

- [llms.txt](/llms.txt): orientation for agents
- [OpenAPI](/openapi.json): operations and schemas
- [Agent skills](/.well-known/agent-skills/index.json): installable instructions
- [Agentic Resource Discovery](/.well-known/ard.json): the catalogue of everything here
- [Pricing](/pricing.md)

Questions: see the [contact page](/contact).
