Skip to content

HTTP API on the machine port

These routes are on the machine port. A machine sends Authorization: Bearer <instance token>. The routes under /v1/record and /v1/team-agents are for an agent inside a session. They take ?session=<session id>, and that session must be running on the calling machine. The attempt routes, /v1/budgets, /v1/record/pulls/replies, every /v1/team-agents route and GET /v1/usage also need the id of the tool call they serve in x-agents-tool-use, which the machine reported as a call of that route’s tool with no result yet and, for a write, the same arguments, /report its text alone, and answer 403 without it.

Method Path What it does
POST /v1/instance/heartbeat Reports the machine’s status as online or offline, its screen size when it has a desktop, and the Claude account a session started now would run on, as login:<sign-in id> or team:<version>, or null.
POST /v1/instance/recover Reports a daemon that started. What it held goes back in the queue, but a summary pass it held fails, and its unfinished messages come back as sessions to resume.
POST /v1/instance/commands/<id>/claim Claims a queued command. Answers 409 when it is already claimed or not queued.
POST /v1/instance/commands/<id> Reports a claimed command done or failed, with an optional error and result. A message command takes only failed, and answers 400 to done, since a message is done when the turn that answers it ends, which the session’s event batch reports with ended. A summarize command’s done carries Claude’s JSON result, and answers 400 when it does not parse.
GET /v1/instance/commands/<id>/summary The prompt of a summary pass the machine holds, with the session’s steps it covers. Answers 404 for another machine’s pass. Answers 409, which the daemon then fails, for steps another pass already summarized, after another pass over the session failed in the last 30 minutes, while a spent budget holds the session, or when none of its steps shows anything.
GET /v1/instance/workspaces/<id>/setup Says whether one of the machine’s workspaces is still being set up.
POST /v1/workspaces/<id>/changes Reports what differs from the base branch in a workspace’s repos.
GET /v1/health Says whether the API serves and the commit it runs. Holds nothing secret.
GET /v1/instance/team-claude-token Asks for the team’s Claude token, naming the one the box holds in have. Only a box is told.
Method Path What it does
POST /v1/sessions/<id>/events Appends a batch of events to a session’s record, with the session’s status and raw lines.
POST /v1/sessions/<id>/documents Saves files an agent wrote in its task’s folder as document versions.
POST /v1/instance/sessions/<id>/seat Asks which seat a session runs on.
POST /v1/instance/seats/<number>/up Reports a seat up for the agent it was started for.
Method Path What it does
GET /v1/instance/folders Lists the folders connected on the Mac and how many sessions each holds.
POST /v1/instance/folders Connects a folder.
POST /v1/instance/folders/disconnect Disconnects a folder.
POST /v1/instance/terminal-sessions Names the record’s session for a Claude Code session found in a connected folder.
Method Path What it does
POST /v1/instance/claude-logins/<id>/link Gives the sign-in link the box made.
POST /v1/instance/claude-logins/<id>/code Asks for the code the person sent. Answers code.
POST /v1/instance/claude-logins/<id>/done Reports the sign-in done, with validDays.
POST /v1/instance/claude-logins/<id>/failed Reports the sign-in failed, with a reason.
Method Path What it does
GET /v1/record/search Searches the team record for q. limit is 1 to 50, 10 by default.
GET /v1/record/sessions/<id> Reads a session. from is the first step, 1 by default, and limit is 1 to 200, 60 by default.
GET /v1/record/pipelines/<name>/history Lists a pipeline’s recent runs. limit is 1 to 30, 10 by default.
GET /v1/record/agents/<name> Reads an agent’s profile.
GET /v1/record/ready Lists what is ready to start and what is held, among the team’s shared tasks.
GET /v1/record/repos Lists the team’s repos, each with its forge, default branch and open pull requests, as finished text in answer, with what a forge wrote fenced. A pipeline stage’s session gets 403.
GET /v1/record/playbooks Reads the team’s playbooks in use, or its rules with kind=rules, as read_playbooks does: the version, its playbooks and skills, or one file’s text with file.
GET /v1/instance/playbooks/<tree> The files of the team’s published playbooks with that tree hash, which the machine checks before it loads them.
GET /v1/record/pulls Lists the open pull requests of every repo, or of the one repo names as owner/name or a bare name, as finished text in answer. A name two repos share answers 409, another team’s repo 404, and a pipeline stage’s session 403.
GET /v1/record/pulls/<n> Reads one pull request of the repo repo names, as finished text in answer. file reads one file’s patch, and from is where its page starts, which the last page names. A pull request the forge lacks answers 404 with the forge’s words fenced, from without file 400, a file the pull request lacks 404, and a pipeline stage’s session 403.
GET /v1/record/recent Lists recent activity. hours is 1 to 336, 24 by default.
POST /v1/record/memory Saves the agent’s memory of a person or the team. kind is profile or log, about is a login or team, and content is the text.
GET /v1/record/attachments/<id> Serves an attachment to the agent, to save in its working folder.
POST /v1/record/share Posts a file or a screenshot into the agent’s chat or onto its task’s page. caption is at most 2,000 characters. Answers 201.
POST /v1/record/react Reacts to a post in the agent’s chat or task.
Method Path What it does
GET /v1/team-agents Lists the agents the calling agent may work with.
POST /v1/team-agents/ask Puts a question in front of the people the agent works for. It returns at once, and the answer comes back as the agent’s next message.
POST /v1/team-agents/messages Sends a message to another agent.
POST /v1/team-agents/tasks Hands a task to another agent.
POST /v1/team-agents/report Reports a task’s result back.
POST /v1/team-agents/stuck notify_people. Sends the agent’s owner’s phone “ is stuck”, and no words of the agent’s, at most once in ten minutes, and answers in words whether it went.
POST /v1/team-agents/agents Makes a new agent.
POST /v1/team-agents/chats Starts a chat with people and agents for the person the turn is for, and posts text there as the agent. Answers conversationId, with (the agent of a DM, or the room’s name) and for. It answers 403 when no person is behind the turn, and 409 from a room, a private conversation or a turn that started 3 already.
POST /v1/team-agents/room-members Adds the agent named in agent to a room, with the rights of the person the running turn is for. Without roomId it is the room the turn is in. A turn no person asked answers 403.

The /v1/team-agents routes work only in a session with a turn running on the calling machine, or with a helper’s pass open from a turn that ran there, and answer 403 otherwise. A refusal the server records answers 409.

Method Path What it does
POST /v1/tasks/attempts Starts a task with attempts. Takes title, instructions, repos by name, an optional agent by name and attempts.
GET /v1/tasks/<id>/attempts Lists a task’s attempts and the team’s coding computers.
POST /v1/tasks/<id>/attempts/<n>/pick Picks an attempt, with the pull request’s title and body.
POST /v1/tasks/<id>/attempts/<n>/discard Discards an attempt.

These take ?session=<session id> too. Each runs as the person the session’s running turn is for, under the rules of the people route at the same path, and answers {"answer": "<words>"}. With no turn running on the calling machine, or a turn no person asked for, each answers 403. A start, a pick and a discard also answer 403 unless that person answered yes to an ask of the session for the same tool and arguments. Each yes runs one call, and no Always stands for these three. A session that is itself an attempt’s answers 409 to a start.

Method Path What it does
GET /v1/usage Says what agents cost, with the query the team route takes, read with the sight of the person the session’s running turn is for, as finished text in answer. It takes ?session=<session id>. With no turn running on the calling machine, or a turn no person asked for, it answers 403.
GET /v1/team-agents/summary A plain summary, with the query the team route takes, read with the sight of the person the session’s running turn is for, as finished text in answer. A session with no running turn answers 403.