{"title":"Computer Control API","slug":"computers","category":"api","summary":"Remote control of registered computers — queue commands, take screenshots, run scripts on remote machines.","audience":["human","llm"],"tags":["api","computers","remote-control","automation"],"difficulty":"advanced","updated":"2026-06-27","word_count":346,"read_minutes":2,"llm_context":"Two sides: user-facing (Mind Key/JWT) and agent-facing (Computer Token)\nRegister agent: POST /computers/register { install_code } → returns computer_token\nList: GET /computers/list (Mind Key or JWT)\nQueue command: POST /computers/:id/commands { type, payload }\nCommand types: screenshot, click, move, type, key, scroll, drag\nAgent poll: GET /computers/me/poll?wait=5 (Computer Token)\nAgent result: POST /computers/me/commands/:cid/result (Computer Token)\nOne-shot screenshot: GET /computers/:id/screenshot (waits 30s for result)\nPattern: register agent on remote machine → user queues commands → agent polls and executes\n","lang":"en","translated":true,"requested_lang":"en","content_markdown":"\n# Computer Control API\n\nThe Computer Control API lets you remote-control registered computers. A small\nagent (`screen-remote-agent`) runs on the target machine, polls for commands,\nexecutes them, and posts results back. This enables LLM-driven GUI automation.\n\n## Architecture\n\n```\n┌─────────────┐  queue cmd   ┌──────────┐  poll   ┌─────────────────┐\n│ LLM Agent   │ ───────────▶ │ Synapse  │ ◀───── │ screen-remote   │\n│ (user-side) │              │  Server  │ ──────▶│ (on target PC)  │\n└─────────────┘              └──────────┘ result  └─────────────────┘\n                                     ▲\n                                     │\n                              ┌─────────────┐\n                              │  Human UI   │\n                              │ (browser)   │\n                              └─────────────┘\n```\n\n## User-Facing Endpoints (Mind Key or JWT)\n\n### GET /computers/list\n\nList all registered computers.\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/list\n```\n\n### GET /computers/:id\n\nGet details of a single computer.\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/comp_001\n```\n\n### POST /computers/install-code\n\nGenerate an install code for registering a new computer.\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/computers/install-code \\\n  -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"computer_name\": \"office-mac\"}'\n```\n\nResponse: `{ \"install_code\": \"ic_xyz789\", \"expires_at\": \"...\" }`\n\n### POST /computers/:id/commands\n\nQueue a command for the remote agent to execute.\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/computers/comp_001/commands \\\n  -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"type\": \"screenshot\",\n    \"payload\": {}\n  }'\n```\n\nResponse: `{ \"command_id\": \"cmd_001\", \"status\": \"queued\" }`\n\n### GET /computers/:id/command (via query)\n\nQueue a command via GET (for simple cases).\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     \"https://synapse.schaefer.zone/computers/comp_001/command?type=screenshot\"\n```\n\n### GET /computers/:id/commands\n\nList recent commands for a computer.\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     \"https://synapse.schaefer.zone/computers/comp_001/commands?limit=50\"\n```\n\n### GET /computers/:id/commands/:cid\n\nGet status + result of a specific command.\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/comp_001/commands/cmd_001\n```\n\n### GET /computers/:id/screenshot\n\nOne-shot: queue a screenshot command and wait up to 30s for the result.\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/comp_001/screenshot > screenshot.png\n```\n\n### POST /computers/:id/disable\n\nDisable a computer (revokes its token, keeps the record for audit).\n\n```bash\ncurl -X POST -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/comp_001/disable\n```\n\n### DELETE /computers/:id\n\nDelete a computer permanently.\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/comp_001\n```\n\n## Agent-Facing Endpoints (Computer Token)\n\nThese endpoints are used by the `screen-remote-agent` running on the target\nmachine. They use a Computer Token (returned by `/computers/register`), not a\nMind Key.\n\n### POST /computers/register\n\nRedeem an install code and get a Computer Token.\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/computers/register \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"code\": \"ic_xyz789\",\n    \"computer_name\": \"office-mac\",\n    \"platform\": \"darwin\",\n    \"platform_release\": \"14.5.0\",\n    \"python\": \"3.12.4\"\n  }'\n```\n\nResponse: `{ \"computer_id\": \"comp_001\", \"computer_token\": \"ct_...\" }`\n\n> [!CRITICAL]\n> Save the `computer_token` — it's shown only once and is required for all\n> agent-side endpoints.\n\n### GET /computers/me/poll\n\nLong-poll for new commands. The agent calls this in a loop.\n\n```bash\ncurl -H \"Authorization: Bearer ct_YOUR_COMPUTER_TOKEN\" \\\n     \"https://synapse.schaefer.zone/computers/me/poll?wait=30\"\n```\n\nReturns immediately if commands are pending, or after `wait` seconds if not.\n\n### POST /computers/me/commands/:cid/result\n\nPost the result of executing a command.\n\n```bash\ncurl -X POST https://synapse.schaefer.zone/computers/me/commands/cmd_001/result \\\n  -H \"Authorization: Bearer ct_YOUR_COMPUTER_TOKEN\" \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"status\": \"done\",\n    \"result\": { \"screenshot_b64\": \"iVBORw0KG...\" }\n  }'\n```\n\n## Command Types\n\n| Type | Payload | Description |\n|------|---------|-------------|\n| `screenshot` | `{}` | Capture screen as PNG (base64) |\n| `click` | `{x, y}` | Click at coordinates |\n| `move` | `{x, y}` | Move mouse to coordinates |\n| `type` | `{text}` | Type text at cursor |\n| `key` | `{keys: [\"Ctrl\",\"c\"]}` | Press key combo |\n| `scroll` | `{deltaX, deltaY}` | Scroll wheel |\n| `drag` | `{fromX, fromY, toX, toY}` | Drag and drop |\n\n## Common Pattern: LLM-Driven GUI Automation\n\n```python\n# LLM agent workflow\n1. List computers: GET /computers/list\n2. Take screenshot: GET /computers/:id/screenshot\n3. Analyze screenshot (vision model)\n4. Queue click: POST /computers/:id/commands {type:\"click\", payload:{x,y}}\n5. Wait for result: GET /computers/:id/commands/:cid\n6. Take new screenshot to verify\n7. Repeat until task done\n```\n\n## Next Steps\n\n- [Browser Proxy](/docs/api/browser) — separate service for browser automation\n- [Self-Hosted Agents Guide](/docs/guides/self-hosted-agents)\n","content_html":"<h1>Computer Control API</h1>\n<p>The Computer Control API lets you remote-control registered computers. A small\nagent (<code>screen-remote-agent</code>) runs on the target machine, polls for commands,\nexecutes them, and posts results back. This enables LLM-driven GUI automation.</p>\n<h2>Architecture</h2>\n<pre><code class=\"hljs language-plaintext\">┌─────────────┐  queue cmd   ┌──────────┐  poll   ┌─────────────────┐\n│ LLM Agent   │ ───────────▶ │ Synapse  │ ◀───── │ screen-remote   │\n│ (user-side) │              │  Server  │ ──────▶│ (on target PC)  │\n└─────────────┘              └──────────┘ result  └─────────────────┘\n                                     ▲\n                                     │\n                              ┌─────────────┐\n                              │  Human UI   │\n                              │ (browser)   │\n                              └─────────────┘</code></pre><h2>User-Facing Endpoints (Mind Key or JWT)</h2>\n<h3>GET /computers/list</h3>\n<p>List all registered computers.</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/computers/list</code></pre><h3>GET /computers/:id</h3>\n<p>Get details of a single computer.</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/computers/comp_001</code></pre><h3>POST /computers/install-code</h3>\n<p>Generate an install code for registering a new computer.</p>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/computers/install-code \\\n  -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{&quot;computer_name&quot;: &quot;office-mac&quot;}&#x27;</span></code></pre><p>Response: <code>{ &quot;install_code&quot;: &quot;ic_xyz789&quot;, &quot;expires_at&quot;: &quot;...&quot; }</code></p>\n<h3>POST /computers/:id/commands</h3>\n<p>Queue a command for the remote agent to execute.</p>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/computers/comp_001/commands \\\n  -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{\n    &quot;type&quot;: &quot;screenshot&quot;,\n    &quot;payload&quot;: {}\n  }&#x27;</span></code></pre><p>Response: <code>{ &quot;command_id&quot;: &quot;cmd_001&quot;, &quot;status&quot;: &quot;queued&quot; }</code></p>\n<h3>GET /computers/:id/command (via query)</h3>\n<p>Queue a command via GET (for simple cases).</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone/computers/comp_001/command?type=screenshot&quot;</span></code></pre><h3>GET /computers/:id/commands</h3>\n<p>List recent commands for a computer.</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone/computers/comp_001/commands?limit=50&quot;</span></code></pre><h3>GET /computers/:id/commands/:cid</h3>\n<p>Get status + result of a specific command.</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/computers/comp_001/commands/cmd_001</code></pre><h3>GET /computers/:id/screenshot</h3>\n<p>One-shot: queue a screenshot command and wait up to 30s for the result.</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/computers/comp_001/screenshot &gt; screenshot.png</code></pre><h3>POST /computers/:id/disable</h3>\n<p>Disable a computer (revokes its token, keeps the record for audit).</p>\n<pre><code class=\"hljs language-bash\">curl -X POST -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/computers/comp_001/disable</code></pre><h3>DELETE /computers/:id</h3>\n<p>Delete a computer permanently.</p>\n<pre><code class=\"hljs language-bash\">curl -X DELETE -H <span class=\"hljs-string\">&quot;Authorization: Bearer YOUR_MIND_KEY&quot;</span> \\\n     https://synapse.schaefer.zone/computers/comp_001</code></pre><h2>Agent-Facing Endpoints (Computer Token)</h2>\n<p>These endpoints are used by the <code>screen-remote-agent</code> running on the target\nmachine. They use a Computer Token (returned by <code>/computers/register</code>), not a\nMind Key.</p>\n<h3>POST /computers/register</h3>\n<p>Redeem an install code and get a Computer Token.</p>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/computers/register \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{\n    &quot;code&quot;: &quot;ic_xyz789&quot;,\n    &quot;computer_name&quot;: &quot;office-mac&quot;,\n    &quot;platform&quot;: &quot;darwin&quot;,\n    &quot;platform_release&quot;: &quot;14.5.0&quot;,\n    &quot;python&quot;: &quot;3.12.4&quot;\n  }&#x27;</span></code></pre><p>Response: <code>{ &quot;computer_id&quot;: &quot;comp_001&quot;, &quot;computer_token&quot;: &quot;ct_...&quot; }</code></p>\n<div class=\"callout callout-critical\">Save the `computer_token` — it's shown only once and is required for all\nagent-side endpoints.</div><h3>GET /computers/me/poll</h3>\n<p>Long-poll for new commands. The agent calls this in a loop.</p>\n<pre><code class=\"hljs language-bash\">curl -H <span class=\"hljs-string\">&quot;Authorization: Bearer ct_YOUR_COMPUTER_TOKEN&quot;</span> \\\n     <span class=\"hljs-string\">&quot;https://synapse.schaefer.zone/computers/me/poll?wait=30&quot;</span></code></pre><p>Returns immediately if commands are pending, or after <code>wait</code> seconds if not.</p>\n<h3>POST /computers/me/commands/:cid/result</h3>\n<p>Post the result of executing a command.</p>\n<pre><code class=\"hljs language-bash\">curl -X POST https://synapse.schaefer.zone/computers/me/commands/cmd_001/result \\\n  -H <span class=\"hljs-string\">&quot;Authorization: Bearer ct_YOUR_COMPUTER_TOKEN&quot;</span> \\\n  -H <span class=\"hljs-string\">&quot;Content-Type: application/json&quot;</span> \\\n  -d <span class=\"hljs-string\">&#x27;{\n    &quot;status&quot;: &quot;done&quot;,\n    &quot;result&quot;: { &quot;screenshot_b64&quot;: &quot;iVBORw0KG...&quot; }\n  }&#x27;</span></code></pre><h2>Command Types</h2>\n<table>\n<thead>\n<tr>\n<th>Type</th>\n<th>Payload</th>\n<th>Description</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>screenshot</code></td>\n<td><code>{}</code></td>\n<td>Capture screen as PNG (base64)</td>\n</tr>\n<tr>\n<td><code>click</code></td>\n<td><code>{x, y}</code></td>\n<td>Click at coordinates</td>\n</tr>\n<tr>\n<td><code>move</code></td>\n<td><code>{x, y}</code></td>\n<td>Move mouse to coordinates</td>\n</tr>\n<tr>\n<td><code>type</code></td>\n<td><code>{text}</code></td>\n<td>Type text at cursor</td>\n</tr>\n<tr>\n<td><code>key</code></td>\n<td><code>{keys: [&quot;Ctrl&quot;,&quot;c&quot;]}</code></td>\n<td>Press key combo</td>\n</tr>\n<tr>\n<td><code>scroll</code></td>\n<td><code>{deltaX, deltaY}</code></td>\n<td>Scroll wheel</td>\n</tr>\n<tr>\n<td><code>drag</code></td>\n<td><code>{fromX, fromY, toX, toY}</code></td>\n<td>Drag and drop</td>\n</tr>\n</tbody></table>\n<h2>Common Pattern: LLM-Driven GUI Automation</h2>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-comment\"># LLM agent workflow</span>\n<span class=\"hljs-number\">1.</span> <span class=\"hljs-type\">List</span> computers: GET /computers/<span class=\"hljs-built_in\">list</span>\n<span class=\"hljs-number\">2.</span> Take screenshot: GET /computers/:<span class=\"hljs-built_in\">id</span>/screenshot\n<span class=\"hljs-number\">3.</span> Analyze screenshot (vision model)\n<span class=\"hljs-number\">4.</span> Queue click: POST /computers/:<span class=\"hljs-built_in\">id</span>/commands {<span class=\"hljs-built_in\">type</span>:<span class=\"hljs-string\">&quot;click&quot;</span>, payload:{x,y}}\n<span class=\"hljs-number\">5.</span> Wait <span class=\"hljs-keyword\">for</span> result: GET /computers/:<span class=\"hljs-built_in\">id</span>/commands/:cid\n<span class=\"hljs-number\">6.</span> Take new screenshot to verify\n<span class=\"hljs-number\">7.</span> Repeat until task done</code></pre><h2>Next Steps</h2>\n<ul>\n<li><a href=\"/docs/api/browser\">Browser Proxy</a> — separate service for browser automation</li>\n<li><a href=\"/docs/guides/self-hosted-agents\">Self-Hosted Agents Guide</a></li>\n</ul>\n","urls":{"html":"/docs/api/computers","text":"/docs/api/computers?format=text","json":"/docs/api/computers?format=json","llm":"/docs/api/computers?format=llm"},"translations_available":["en","zh","hi","es","fr","ar","pt","ru","ja","de","it","ko","nl","pl","tr","sv","vi","th","id","uk"]}