# Your computers

14 endpoints at `https://api.kosa8.com`, sent with `Authorization: Bearer $KOSA8_API_KEY`. Generated from the API's own [OpenAPI description](https://api.kosa8.com/openapi.json), which a test holds to the router.

## Register this computer (the desktop app or CLI, with its own key)[#]

POST`/v1/devices`scope sandboxes:read

A device is the kosa8 desktop app or CLI on one person's computer; it belongs to the member whose key registered it. Only that member queues actions to it or reads them (an admin sees a count per member, never the actions), and only the key it registered with polls, claims and reports for it. Actions are a typed allowlist, never a shell string: an unknown type or field is 400. Idempotent per member, machine_id and app: 201 the first time, then 200 with the same device_id (key, name, version and capabilities refreshed). Only an API key may register (a web session gets 403 device_key_required). Capabilities this API does not know are left out and listed in ignored_capabilities. At most 20 computers per member (409 too_many_devices).

JSON body

`name`requiredstring

The computer's name, 1-64 characters

`os`required"darwin" | "windows" | "linux"

—

`arch`requiredstring

arm64, amd64, …

`app`required"desktop" | "cli"

—

`version`requiredstring

kosa8 version

`capabilities`requiredarray of string

Action types this computer can run

`machine_id`string

A stable id of this computer, 8-200 characters; only a hash is kept. Without it, name and os stand in

Responses

201400401403409

```
curl -s -X POST https://api.kosa8.com/v1/devices \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## My computers[#]

GET`/v1/devices`scope sandboxes:read

An admin also gets team: [{member, total, online}], how many computers each member has (never their actions).

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/devices \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## One of my computers[#]

GET`/v1/devices/{id}`scope sandboxes:read

Parameters

`id`requiredpath · string

Device id (dvc_…)

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/devices/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Unlink one of my computers[#]

DELETE`/v1/devices/{id}`scope sandboxes:read

Its waiting and running actions are cancelled. The key it used stays until revoked under API keys.

Parameters

`id`requiredpath · string

Device id (dvc_…)

Responses

200401403404

```
curl -s -X DELETE https://api.kosa8.com/v1/devices/$SBX \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Long-poll for this computer's next action (the device's own key)[#]

GET`/v1/devices/{id}/actions/next`scope sandboxes:read

Marks the computer online (seen < 60 s). Returns the oldest action queued to it, or pending for any of the member's computers of a type it can run, and marks it picked up; an action picked up and still queued after 30 s is sent again, so set status waiting_for_approval as soon as the approval sheet shows. approval_remembered says the person chose Always allow for this type here.

Parameters

`id`requiredpath · string

Device id (dvc_…)

`wait`query · integer

Seconds to wait for one (default 0, at most 20)

Responses

200204401403404

```
curl -s -X GET https://api.kosa8.com/v1/devices/$SBX/actions/next \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Take one action by its short code (kosa8 do) or id (kosa8://action/<id>)[#]

POST`/v1/devices/{id}/actions/claim`scope sandboxes:read

Once: a second claim by any computer is 409 already_claimed; an expired code is 410. Another member's action is 404. A code is itself the approval (approval: cli); a deep link is not.

Parameters

`id`requiredpath · string

Device id (dvc_…)

JSON body

`code`string

K7QX-3P, any case, dash optional

`action_id`string

act_…

Responses

200400401403404409410

```
curl -s -X POST https://api.kosa8.com/v1/devices/$SBX/actions/claim \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Queue an action to one of my computers[#]

POST`/v1/devices/{id}/actions`scope sandboxes:write

Only the computer's own member; the computer must list the type in capabilities (409 not_capable). Types and their params: mcp.add {server_id: an MCP catalog id (GET /app/mcp-catalog.json), options: only the keys that entry's options declare (dir, read_only, name, allow_tools); never a secret, which the computer asks for}; mcp.remove {server_id: its name on the computer}; mcp.sync {} (the device then reports PUT …/inventory); agent.connect {client: claude-code | codex | gemini | qwen | opencode | copilot | vscode | cursor | windsurf | cline | amp | goose | kilo | droid | continue | zed | claude-desktop | jetbrains}; terminal.open {mode: "sandbox", sandbox_id} (a sandbox of this organization; needs sandboxes:write) or {mode: "local", cwd?}; repo.clone {repo: owner/name, ref?, dir?} (the person's own git credentials); cli.upgrade {}; app.open {page}. Paths are absolute (/…, ~/…, C:\…) with no .. and no control characters. The answer is the action (201) with its planned steps.

Parameters

`id`requiredpath · string

Device id (dvc_…)

JSON body

`type`required"mcp.add" | "mcp.remove" | "mcp.sync" | "agent.connect" | "terminal.open" | "repo.clone" | "cli.upgrade" | "app.open"

—

`params`object

—

Responses

201400401403404409429

```
curl -s -X POST https://api.kosa8.com/v1/devices/$SBX/actions \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Report an action's progress (the device that claimed it, with its own key)[#]

PATCH`/v1/devices/{id}/actions/{aid}`scope sandboxes:read

steps update by key (a new key needs a label and is added at the end); started_at and ended_at are stamped here. status moves queued → waiting_for_approval → running → done | failed | cancelled (409 invalid_transition otherwise); failed needs error. approval: once | always (remembered for this type on this computer) | denied (cancels it). On a cancelled or finished action the answer is 409 action_cancelled or action_finished: stop. Audited as device.action.run, done, fail or cancel when the status changes.

Parameters

`id`requiredpath · string

Device id (dvc_…)

`aid`requiredpath · string

Action id (act_…)

JSON body

`status`"waiting_for_approval" | "running" | "done" | "failed" | "cancelled"

—

`steps`array of object

—

`result`object

—

`error`object

—

`error.code`requiredstring

Short code

`error.message`requiredstring

One sentence

`error.fix`string

What to do, one sentence

`approval`"once" | "always" | "denied"

—

Responses

200400401403404409

```
curl -s -X PATCH https://api.kosa8.com/v1/devices/$SBX/actions/$AID \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Report what is installed on this computer (the device's own key)[#]

PUT`/v1/devices/{id}/inventory`scope sandboxes:read

Parameters

`id`requiredpath · string

Device id (dvc_…)

JSON body

`mcp`array of object

—

`agents`array of object

—

Responses

200400401403404

```
curl -s -X PUT https://api.kosa8.com/v1/devices/$SBX/inventory \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## Forget an Always allow on one of my computers[#]

DELETE`/v1/devices/{id}/approvals/{type}`scope sandboxes:read

The computer asks again the next time an action of that type arrives.

Parameters

`id`requiredpath · string

Device id (dvc_…)

`type`requiredpath · string

Action type, like mcp.add

Responses

200400401403404

```
curl -s -X DELETE https://api.kosa8.com/v1/devices/$SBX/approvals/$TYPE \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Queue an action for any of my computers[#]

POST`/v1/actions`scope sandboxes:write

Pending until the first of my computers that can run it picks it up, or until `kosa8 do <short_code>` claims it; expired after 10 minutes. At most 50 waiting (429). Types and their params: mcp.add {server_id: an MCP catalog id (GET /app/mcp-catalog.json), options: only the keys that entry's options declare (dir, read_only, name, allow_tools); never a secret, which the computer asks for}; mcp.remove {server_id: its name on the computer}; mcp.sync {} (the device then reports PUT …/inventory); agent.connect {client: claude-code | codex | gemini | qwen | opencode | copilot | vscode | cursor | windsurf | cline | amp | goose | kilo | droid | continue | zed | claude-desktop | jetbrains}; terminal.open {mode: "sandbox", sandbox_id} (a sandbox of this organization; needs sandboxes:write) or {mode: "local", cwd?}; repo.clone {repo: owner/name, ref?, dir?} (the person's own git credentials); cli.upgrade {}; app.open {page}. Paths are absolute (/…, ~/…, C:\…) with no .. and no control characters. The answer is the action (201) with its planned steps.

JSON body

`type`required"mcp.add" | "mcp.remove" | "mcp.sync" | "agent.connect" | "terminal.open" | "repo.clone" | "cli.upgrade" | "app.open"

—

`params`object

—

Responses

201400401403404429

```
curl -s -X POST https://api.kosa8.com/v1/actions \
  -H "Authorization: Bearer $KOSA8_API_KEY" \
  -H 'Content-Type: application/json' -d @body.json
```

## My actions, newest first[#]

GET`/v1/actions`scope sandboxes:read

Parameters

`limit`query · integer

Default 20

`device_id`query · string

Only this computer's

Responses

200401403

```
curl -s -X GET https://api.kosa8.com/v1/actions \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## One of my actions (poll about every second while it runs)[#]

GET`/v1/actions/{aid}`scope sandboxes:read

Parameters

`aid`requiredpath · string

Action id (act_…)

Responses

200401403404

```
curl -s -X GET https://api.kosa8.com/v1/actions/$AID \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

## Cancel one of my actions[#]

POST`/v1/actions/{aid}/cancel`scope sandboxes:read

A running action's computer learns on its next report (409 action_cancelled).

Parameters

`aid`requiredpath · string

Action id (act_…)

Responses

200401403404409

```
curl -s -X POST https://api.kosa8.com/v1/actions/$AID/cancel \
  -H "Authorization: Bearer $KOSA8_API_KEY"
```

---
Source: https://docs.kosa8.com/api/your-computers/
