Skip to main content

Computer Control API

Remote control of registered computers — queue commands, take screenshots, run scripts on remote machines.


Computer Control API

The Computer Control API lets you remote-control registered computers. A small agent (screen-remote-agent) runs on the target machine, polls for commands, executes them, and posts results back. This enables LLM-driven GUI automation.

Architecture

┌─────────────┐  queue cmd   ┌──────────┐  poll   ┌─────────────────┐
│ LLM Agent   │ ───────────▶ │ Synapse  │ ◀───── │ screen-remote   │
│ (user-side) │              │  Server  │ ──────▶│ (on target PC)  │
└─────────────┘              └──────────┘ result  └─────────────────┘
                                     ▲
                                     │
                              ┌─────────────┐
                              │  Human UI   │
                              │ (browser)   │
                              └─────────────┘

User-Facing Endpoints (Mind Key or JWT)

GET /computers/list

List all registered computers.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/list

GET /computers/:id

Get details of a single computer.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001

POST /computers/install-code

Generate an install code for registering a new computer.

curl -X POST https://synapse.schaefer.zone/computers/install-code \
  -H "Authorization: Bearer YOUR_MIND_KEY" \
  -H "Content-Type: application/json" \
  -d '{"computer_name": "office-mac"}'

Response: { "install_code": "ic_xyz789", "expires_at": "..." }

POST /computers/:id/commands

Queue a command for the remote agent to execute.

curl -X POST https://synapse.schaefer.zone/computers/comp_001/commands \
  -H "Authorization: Bearer YOUR_MIND_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "screenshot",
    "payload": {}
  }'

Response: { "command_id": "cmd_001", "status": "queued" }

GET /computers/:id/command (via query)

Queue a command via GET (for simple cases).

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     "https://synapse.schaefer.zone/computers/comp_001/command?type=screenshot"

GET /computers/:id/commands

List recent commands for a computer.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     "https://synapse.schaefer.zone/computers/comp_001/commands?limit=50"

GET /computers/:id/commands/:cid

Get status + result of a specific command.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001/commands/cmd_001

GET /computers/:id/screenshot

One-shot: queue a screenshot command and wait up to 30s for the result.

curl -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001/screenshot > screenshot.png

POST /computers/:id/disable

Disable a computer (revokes its token, keeps the record for audit).

curl -X POST -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001/disable

DELETE /computers/:id

Delete a computer permanently.

curl -X DELETE -H "Authorization: Bearer YOUR_MIND_KEY" \
     https://synapse.schaefer.zone/computers/comp_001

Agent-Facing Endpoints (Computer Token)

These endpoints are used by the screen-remote-agent running on the target machine. They use a Computer Token (returned by /computers/register), not a Mind Key.

POST /computers/register

Redeem an install code and get a Computer Token.

curl -X POST https://synapse.schaefer.zone/computers/register \
  -H "Content-Type: application/json" \
  -d '{
    "code": "ic_xyz789",
    "computer_name": "office-mac",
    "platform": "darwin",
    "platform_release": "14.5.0",
    "python": "3.12.4"
  }'

Response: { "computer_id": "comp_001", "computer_token": "ct_..." }

Save the `computer_token` — it's shown only once and is required for all agent-side endpoints.

GET /computers/me/poll

Long-poll for new commands. The agent calls this in a loop.

curl -H "Authorization: Bearer ct_YOUR_COMPUTER_TOKEN" \
     "https://synapse.schaefer.zone/computers/me/poll?wait=30"

Returns immediately if commands are pending, or after wait seconds if not.

POST /computers/me/commands/:cid/result

Post the result of executing a command.

curl -X POST https://synapse.schaefer.zone/computers/me/commands/cmd_001/result \
  -H "Authorization: Bearer ct_YOUR_COMPUTER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "status": "done",
    "result": { "screenshot_b64": "iVBORw0KG..." }
  }'

Command Types

Type Payload Description
screenshot {} Capture screen as PNG (base64)
click {x, y} Click at coordinates
move {x, y} Move mouse to coordinates
type {text} Type text at cursor
key {keys: ["Ctrl","c"]} Press key combo
scroll {deltaX, deltaY} Scroll wheel
drag {fromX, fromY, toX, toY} Drag and drop

Common Pattern: LLM-Driven GUI Automation

# LLM agent workflow
1. List computers: GET /computers/list
2. Take screenshot: GET /computers/:id/screenshot
3. Analyze screenshot (vision model)
4. Queue click: POST /computers/:id/commands {type:"click", payload:{x,y}}
5. Wait for result: GET /computers/:id/commands/:cid
6. Take new screenshot to verify
7. Repeat until task done

Next Steps