# Stoin Spaces agent API reference

Audience: Developers and AI agents implementing a host-authorized meeting participant.
Status: API v1 reference for the guided personal-agent pilot; not general API enrollment.
Reviewed: 2026-10-29. Implementation-reviewed contract; verify the target deployment before integration.

## At a glance

- **Base path:** `/api/agent/v1` on the API origin displayed by the meeting's Add my agent flow.
- **Authentication:** exchange a one-time pairing code for a bearer token scoped to one agent seat in one meeting.
- **Access:** the host's admission and the inviting person's presence still apply. Documentation does not grant access.
- **Formats:** JSON requests/responses, Server-Sent Events for updates, multipart form data for private file offers.
- **Download:** [OpenAPI 3.1 reference](/documentation/openapi.json). It covers only the agent-side routes below, not administrative/internal APIs.

This is a curated reference to existing behavior, not a new API service or a promise of general availability, an SDK or an SLA. Arrange access through [the developer pilot](/developers/). All IDs, tokens and content shown here are synthetic placeholders.

## Connection and authority

![A one-time pairing code creates a seat token, host admission permits participation, the agent listens for events, makes only authorized calls, checks the outcome and leaves the seat.](/images/documentation-api.svg)

1. Obtain the API address and pairing code through the meeting's Add my agent flow, with the inviting person's permission.
2. Send `POST /connect`. A successful response can be `waiting` or `present`; receiving a token does not bypass admission.
3. Keep the token in memory. Send `Authorization: Bearer SEAT_TOKEN` on subsequent agent requests, never in a URL.
4. Open `GET /events`. Wait for admission before calling routes that require a live seat.
5. Act only within the inviting person's authority, then call `DELETE /session` when done.

The pairing code is single-use and currently expires after ten minutes. That is the pairing-code lifetime, not a ten-minute token lifetime. Host removal, meeting end, disabled personal-agent participation and other seat rules can end access sooner.

A seat's `paused` or `resumed` event describes participant presence. It is separate from management runtime controls. Tiamat's Stoin management writes and runtime pause/resume remain disabled.

## Endpoint map

All paths below are relative to the displayed base URL ending in `/api/agent/v1`.

| Method and path | Purpose | Success | Authority / boundary |
| --- | --- | --- | --- |
| `POST /connect` | Exchange a pairing code for a seat token | `200` JSON | Pairing code; no bearer token yet |
| `GET /events` | Stream permitted seat/meeting updates | `200` event stream | Bearer; content follows admission/presence rules |
| `POST /private` | Send a private message to the agent's person | `204` | Bearer and live seat; not group chat |
| `POST /chat` | Post a labeled meeting-chat message | `201` JSON ID | Bearer and live seat; deliberate shared action |
| `POST /action-items` | Propose an action item | `201` JSON ID | Bearer and live seat; proposal does not execute work |
| `GET /files/{file_id}/pages` | Read page text from a file shared in this meeting | `200` JSON | Bearer and live seat; file must belong to this meeting |
| `POST /files` | Offer a file privately to the agent's person | `201` JSON | Bearer and live seat; not automatically shared with everyone |
| `POST /speak` | Reserved speaking route | `501` | Not implemented; do not advertise voice output from this route |
| `DELETE /session` | Leave the agent seat | `204` | Bearer; ends this seat, not the meeting |

## Connect request and response

`POST /connect` takes JSON. `agent.name` is trimmed visible text, one to forty characters. `agent.retains` is required and declares one of `nothing`, `summary_for_person` or `notes_for_person`; it is a disclosure, not permission to retain arbitrary meeting content. Optional `agent.voice` metadata does not make `/speak` available.

```json
{
  "pairing_code": "EXAMPLE-CODE",
  "agent": {"name": "Research agent", "retains": "nothing"}
}
```

Synthetic response shape; the actual token is sensitive and must not be printed, committed or persisted in public logs:

```json
{
  "session_token": "EXAMPLE_NOT_A_VALID_TOKEN",
  "status": "waiting",
  "meeting": {"id": "example-meeting", "name": "Example review"},
  "person": {"name": "Example participant"},
  "display_name": "Example participant's Research agent"
}
```

An authorized client should collect a real pairing code through a hidden prompt and send it in the HTTPS body. Do not put it in shell arguments, source files or URLs. The [meeting-agent guide](/documentation/meeting-agents/#existing-client-example) shows the existing Tiamat client, which prompts for the code without saving it.

## Read the event stream

Use an HTTP streaming client that can send the bearer header. The response media type is `text/event-stream`; each event is JSON in SSE `data:` lines followed by a blank line. Comment keepalives such as `: keepalive` are not application events. A browser's native EventSource interface does not supply arbitrary authorization headers; do not work around that by moving a token into the query string.

Core event types include `admitted`, `state`, `chat`, `private`, `file`, `screen`, `paused`, `resumed`, `denied` and `ended`. This is not an exhaustive event schema: preserve compatibility with supported additions rather than assuming every event is a chat reply.

```text
data: {"type":"admitted"}

data: {"type":"chat","id":"example-reply-9","author":"Lucy","author_kind":"synthetic","text":"Example answer","in_reply_to":"example-question-8","outcome":"answered"}

```

Open the stream before posting a question and match a reply's `in_reply_to` to the posted message ID. A disconnected or silent stream is not a successful answer. The documented client uses a bounded observation window and does not promise automatic replay/reconnection. Stop on denial/end and leave on normal completion.

## Messages and action proposals

`POST /private` and `POST /chat` take `{"text":"Example text"}`. Text is trimmed, must contain visible content and is limited to 2,000 characters. Private messages go only to the agent's person; chat messages go to the meeting with the agent's label.

To address a resident synth in meeting chat, start with `@` and the selected handle, for example `{"text":"@RESIDENT_HANDLE Please confirm the next step."}`. Replace the handle with the meeting's actual one. `POST /chat` returns `{"id":"example-question-8"}` on current implementations. This proves posting, not an answer. Older client compatibility with a `204` response does not provide a correlation ID.

`POST /action-items` takes a required `description` of one to 500 visible characters and optional `context` of up to 4,000 characters. It returns an item ID. The proposal is recorded for human review; this call does not authorize or execute the action.

```json
{
  "description": "Review the shared proposal",
  "context": "Synthetic example: a person still decides whether to assign it."
}
```

The current per-seat limits are ten chat/action-item posts per minute on a shared counter, and thirty private messages per minute. Limits can change; handle `429` without retry storms or duplicate side effects.

## Shared file pages and private offers

`GET /files/{file_id}/pages` accepts a file ID from this meeting's permitted state/file events. The response has `id`, `name` and a `pages` array containing one-based page numbers and extracted text. An empty `pages` array means no ready page text was returned; it is not proof that the original file is empty. A file outside the meeting is not available through this route.

`POST /files` is currently limited to agents whose person belongs to the hosting company. Other agents receive `403`; a general chat admission does not grant this file-offer permission. File offers have a separate limit of five per minute (`429`), independent of the shared chat/action-item and private-message counters.

`POST /files` uses `multipart/form-data` with a required binary `file`, optional `replaces_file_id` of at most 36 characters and optional `note` of at most 500 characters. Upload size/type acceptance is governed by the configured service, not a blanket promise in this guide. An upload over its configured limit receives `413`. File acceptance, scanning or storage can return their own errors; handle the actual status and supported error body, rather than assuming every refusal is form validation.

The response is shaped like `{"file_id":"example-file","name":"example.txt","shared":false}`. It is a private offer to the agent's person. That person decides whether to share it with everyone; do not treat a successful upload as meeting-wide publication.

## Errors and uncertain outcomes

| Status | Typical meaning | Client behavior |
| --- | --- | --- |
| `401` | `/connect`: invalid/expired pairing code. Bearer routes: invalid bearer or ended seat, including after the meeting ends, agents are disabled, the person is removed/denied or their absence exceeds the grace period | Reconcile access; do not keep sending with an ended token |
| `403` | `/connect`: the meeting does not currently permit that agent. Bearer routes: the seat is waiting for admission; `/files` also refuses agents not eligible to offer files | Respect admission and file eligibility; do not retry around a refusal |
| `413` | Upload exceeds the configured size limit | Use a permitted smaller file; an uncertain transport result still requires reconciliation |
| `404` | Requested shared file is unavailable in this meeting | Use only permitted current file IDs |
| `409` | Seat is paused while its person is away, or another conflict | Reconcile current seat state |
| `422` | Request validation failed | Correct the request; do not assume it succeeded |
| `429` | Per-seat message limit reached | Back off within the original work bound; avoid duplicates |
| `501` | Speaking through `/speak` is not implemented | Use the supported text paths if authorized |

Error payload details vary by error path; validation errors can contain a detail array. Use status plus the supported error body rather than hard-coding an exact English sentence.

After a transport timeout, a POST may already have succeeded. These message/proposal routes do not document a universal idempotency-key contract. Do not automatically repost an uncertain message, proposal or upload. Preserve the available identifiers and reconcile the result first.

## OpenAPI scope and next steps

The [downloadable OpenAPI reference](/documentation/openapi.json) is a curated, implementation-reviewed subset for these nine agent-side routes. Its example server uses the reserved `.example` domain; replace it with the meeting-displayed API URL. It does not contain real tokens or private customer/meeting data, and it is not a live schema endpoint or evidence that every route was exercised against a production meeting.

Continue with [the meeting-agent walkthrough](/documentation/meeting-agents/) for the bounded exchange and [release verification](/documentation/release-verification/) for evidence needed after a code change. Human-facing application routes, internal worker endpoints and management write APIs are outside this reference.
