Skip to Content

Agent HTTP API

The agent's own API, the one the apps use: pair once for a device token, then JSON over HTTPS and one live event stream.

Everything the apps do goes through this API on your agent's public URL (https://rusuban-agent-….sprites.app). There is no Rusuban server in between.

Pairing and auth

POST /pair
Content-Type: application/json

{ "code": "123456", "name": "My laptop", "platform": "web" }

201 returns { token, device }. Send the token on every /api call:

Authorization: Bearer <token>
Rule
Codes6 digits, 10 minutes, once; 5 wrong tries end every live code
Pair limit5 per address and 30 in total per 10 minutes
Tokens32 random bytes, stored as a SHA-256 hash, revoked from Devices
Rolesowner uses everything; viewer only /api/whoami (its app shows /public/state)
Body limit1 MiB (413 too_large)
CORS/api and /pair only from the origins in WEB_ORIGINS
Busywhile a Rewind runs or the boot check is underway, writes answer 503 agent_busy

Public, no token

Method and path
GET /healthok, name, version, uptime, whether it's inside a Sprite
GET /public/statethe redacted live view; any origin, 60 a minute per address. Live view
POST /hooks/tickthe QStash tick; checks the signature against the public URL, each signature once
GET /s/<token>a shared mini-app, frozen and sandboxed

Live events

GET /api/stream?after=<seq> (or Last-Event-ID) is a Server-Sent Events stream: it replays everything after seq, then follows live, with a ping every 15 seconds and a ready event that says whether the client should reload. It closes when the device is removed. The app opens it while it's in front and closes it in the background.

Chat

POST /api/chatthe AI SDK UI-message body ({id, messages}) or {conversationId, text}; answers with the run's stream, replayed from its first chunk
GET /api/chat/:id/streamresume the active run (204 if none)
GET /api/conversations, GET /api/conversations/:id/messageshistory

Cards

GET /api/approvals (?status=recent)waiting cards, or the last 50 decided; each has allowable
POST /api/approvals/:id/decide{decision: "once" | "conversation" | "always" | "deny" | "handled"}; returns the card, when it sends, and any rule card
POST /api/approvals/:id/edit{args}: a new card that replaces this one
POST /api/approvals/:id/undocancels inside the window, or queues the compensating action

Everything else

AreaRoutes
Needs youGET /api/items, /items/:id, POST /items/:id/hide | move | snooze | done, GET /api/brief, /calendar/next, /inbox
MoneyGET /api/money, /cases, /cases/:id, POST /cases/:id/resolve | dismiss | reopen | draft | call, POST /money/scan
CallsGET /api/calls, /calls/:id
WatchersGET/POST /api/watchers, POST /watchers/:id/pause | resume | stop | check
ErrandsGET /api/errands, /errands/:id, /errands/:id/live (frames), POST /errands/:id/input | takeover | handback | paid | stop
CodeGET /api/code/setup, PUT /code/engine, the ChatGPT sign-in routes, GET /code/repos/available, PUT /code/repos, GET/POST /code/tasks, POST /code/tasks/:id/cancel
Mini-appsGET/POST /api/mini-apps, GET /mini-apps/:id, POST /mini-apps/:id/rebuild | publish | share | archive
You/api/you, /settings, /memory, /rules (+ /rules/what-if), /routines, /quiet, /activity (+ /facets, /heatmap, /export), /usage, /connections, /devices, /agent (+ /checkpoint, /rewind), /search
PushGET /api/push/vapid, POST /push/tokens, DELETE /push/mine, POST /push/test

Errands have no create route: they start from chat, as a plan card.

On this page