{"title":"Computer Control API","slug":"computers","category":"api","summary":"Zdalne sterowanie zarejestrowanymi komputerami — kolejkowanie poleceń, zrzuty ekranu, uruchamianie skryptów na maszynach zdalnych.","audience":["human","llm"],"tags":["api","computers","remote-control","automation"],"difficulty":"advanced","updated":"2026-06-27","word_count":327,"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":"pl","translated":true,"requested_lang":"pl","content_markdown":"\n# Computer Control API\n\nComputer Control API umożliwia zdalne sterowanie zarejestrowanymi komputerami.\nNa maszynie docelowej działa niewielki agent (`screen-remote-agent`), który\nodpytuje o polecenia, wykonuje je i odsyła wyniki. Umożliwia to automatyzację\nGUI sterowaną przez LLM.\n\n## Architektura\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## Endpointy użytkownika (Mind Key lub JWT)\n\n### GET /computers/list\n\nLista wszystkich zarejestrowanych komputerów.\n\n```bash\ncurl -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/list\n```\n\n### GET /computers/:id\n\nSzczegóły pojedynczego komputera.\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\nGeneruje kod instalacyjny do rejestracji nowego komputera.\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\nOdpowiedź: `{ \"install_code\": \"ic_xyz789\", \"expires_at\": \"...\" }`\n\n### POST /computers/:id/commands\n\nKolejkuje polecenie do wykonania przez agenta zdalnego.\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\nOdpowiedź: `{ \"command_id\": \"cmd_001\", \"status\": \"queued\" }`\n\n### GET /computers/:id/command (przez zapytanie)\n\nKolejkuje polecenie przez GET (dla prostych przypadków).\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\nLista ostatnich poleceń dla komputera.\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\nZwraca status i wynik konkretnego polecenia.\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\nPojedyncze działanie: kolejkuje polecenie zrzutu ekranu i czeka do 30 s na wynik.\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\nWyłącza komputer (cofa jego token, zachowuje rekord w celach audytowych).\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\nTrwale usuwa komputer.\n\n```bash\ncurl -X DELETE -H \"Authorization: Bearer YOUR_MIND_KEY\" \\\n     https://synapse.schaefer.zone/computers/comp_001\n```\n\n## Endpointy agenta (Computer Token)\n\nZ tych endpointów korzysta `screen-remote-agent` uruchomiony na maszynie\ndocelowej. Używają Computer Token (zwracanego przez `/computers/register`), a nie\nMind Key.\n\n### POST /computers/register\n\nRealizuje kod instalacyjny i zwraca 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\nOdpowiedź: `{ \"computer_id\": \"comp_001\", \"computer_token\": \"ct_...\" }`\n\n> [!CRITICAL]\n> Należy zapisać `computer_token` — jest wyświetlany tylko raz i wymagany przez\n> wszystkie endpointy po stronie agenta.\n\n### GET /computers/me/poll\n\nLong-poll dla nowych poleceń. Agent wywołuje to w pętli.\n\n```bash\ncurl -H \"Authorization: Bearer ct_YOUR_COMPUTER_TOKEN\" \\\n     \"https://synapse.schaefer.zone/computers/me/poll?wait=30\"\n```\n\nPowraca natychmiast, gdy są oczekujące polecenia, lub po `wait` sekundach, jeśli\nich nie ma.\n\n### POST /computers/me/commands/:cid/result\n\nPublikuje wynik wykonania polecenia.\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## Typy poleceń\n\n| Typ | Payload | Opis |\n|------|---------|------|\n| `screenshot` | `{}` | Przechwyć ekran jako PNG (base64) |\n| `click` | `{x, y}` | Kliknięcie we współrzędnych |\n| `move` | `{x, y}` | Przesunięcie myszy we współrzędne |\n| `type` | `{text}` | Wpisanie tekstu w pozycji kursora |\n| `key` | `{keys: [\"Ctrl\",\"c\"]}` | Wciśnięcie kombinacji klawiszy |\n| `scroll` | `{deltaX, deltaY}` | Przewinięcie kółkiem |\n| `drag` | `{fromX, fromY, toX, toY}` | Przeciągnięcie i upuszczenie |\n\n## Typowy wzorzec: automatyzacja GUI sterowana przez LLM\n\n```python\n# Przepływ agenta LLM\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## Następne kroki\n\n- [Proxy przeglądarki](/docs/api/browser) — osobna usługa do automatyzacji przeglądarki\n- [Przewodnik po agentach self-hosted](/docs/guides/self-hosted-agents)\n","content_html":"<h1>Computer Control API</h1>\n<p>Computer Control API umożliwia zdalne sterowanie zarejestrowanymi komputerami.\nNa maszynie docelowej działa niewielki agent (<code>screen-remote-agent</code>), który\nodpytuje o polecenia, wykonuje je i odsyła wyniki. Umożliwia to automatyzację\nGUI sterowaną przez LLM.</p>\n<h2>Architektura</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>Endpointy użytkownika (Mind Key lub JWT)</h2>\n<h3>GET /computers/list</h3>\n<p>Lista wszystkich zarejestrowanych komputerów.</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>Szczegóły pojedynczego komputera.</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>Generuje kod instalacyjny do rejestracji nowego komputera.</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>Odpowiedź: <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>Kolejkuje polecenie do wykonania przez agenta zdalnego.</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>Odpowiedź: <code>{ &quot;command_id&quot;: &quot;cmd_001&quot;, &quot;status&quot;: &quot;queued&quot; }</code></p>\n<h3>GET /computers/:id/command (przez zapytanie)</h3>\n<p>Kolejkuje polecenie przez GET (dla prostych przypadków).</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>Lista ostatnich poleceń dla komputera.</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>Zwraca status i wynik konkretnego polecenia.</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>Pojedyncze działanie: kolejkuje polecenie zrzutu ekranu i czeka do 30 s na wynik.</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>Wyłącza komputer (cofa jego token, zachowuje rekord w celach audytowych).</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>Trwale usuwa komputer.</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>Endpointy agenta (Computer Token)</h2>\n<p>Z tych endpointów korzysta <code>screen-remote-agent</code> uruchomiony na maszynie\ndocelowej. Używają Computer Token (zwracanego przez <code>/computers/register</code>), a nie\nMind Key.</p>\n<h3>POST /computers/register</h3>\n<p>Realizuje kod instalacyjny i zwraca 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>Odpowiedź: <code>{ &quot;computer_id&quot;: &quot;comp_001&quot;, &quot;computer_token&quot;: &quot;ct_...&quot; }</code></p>\n<div class=\"callout callout-critical\">Należy zapisać `computer_token` — jest wyświetlany tylko raz i wymagany przez\nwszystkie endpointy po stronie agenta.</div><h3>GET /computers/me/poll</h3>\n<p>Long-poll dla nowych poleceń. Agent wywołuje to w pętli.</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>Powraca natychmiast, gdy są oczekujące polecenia, lub po <code>wait</code> sekundach, jeśli\nich nie ma.</p>\n<h3>POST /computers/me/commands/:cid/result</h3>\n<p>Publikuje wynik wykonania polecenia.</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>Typy poleceń</h2>\n<table>\n<thead>\n<tr>\n<th>Typ</th>\n<th>Payload</th>\n<th>Opis</th>\n</tr>\n</thead>\n<tbody><tr>\n<td><code>screenshot</code></td>\n<td><code>{}</code></td>\n<td>Przechwyć ekran jako PNG (base64)</td>\n</tr>\n<tr>\n<td><code>click</code></td>\n<td><code>{x, y}</code></td>\n<td>Kliknięcie we współrzędnych</td>\n</tr>\n<tr>\n<td><code>move</code></td>\n<td><code>{x, y}</code></td>\n<td>Przesunięcie myszy we współrzędne</td>\n</tr>\n<tr>\n<td><code>type</code></td>\n<td><code>{text}</code></td>\n<td>Wpisanie tekstu w pozycji kursora</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>Wciśnięcie kombinacji klawiszy</td>\n</tr>\n<tr>\n<td><code>scroll</code></td>\n<td><code>{deltaX, deltaY}</code></td>\n<td>Przewinięcie kółkiem</td>\n</tr>\n<tr>\n<td><code>drag</code></td>\n<td><code>{fromX, fromY, toX, toY}</code></td>\n<td>Przeciągnięcie i upuszczenie</td>\n</tr>\n</tbody></table>\n<h2>Typowy wzorzec: automatyzacja GUI sterowana przez LLM</h2>\n<pre><code class=\"hljs language-python\"><span class=\"hljs-comment\"># Przepływ agenta LLM</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>Następne kroki</h2>\n<ul>\n<li><a href=\"/docs/api/browser\">Proxy przeglądarki</a> — osobna usługa do automatyzacji przeglądarki</li>\n<li><a href=\"/docs/guides/self-hosted-agents\">Przewodnik po agentach self-hosted</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"]}