# Computers


## List computers

`GET /v1/computers`

List your scoped computers

Permission: `sessions.control` (Every member).

### Responses

- `200` Current signed state. (application/json, ComputerList)
  - `computers` (array of ComputerPresence, required) [at most 32 items]
    - `version` (1, required)
    - `scope` (ComputerScope, required)
      - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
      - `tenantId` (string, required)
      - `personId` (string, required)
    - `computerId` (string (uuid), required)
    - `runnerDeviceId` (string, required)
    - `name` (string, required): At most 64 Unicode scalar values and 160 UTF-8 bytes; no control characters. [min length 1; max length 64]
    - `generation` (integer, required)
    - `issuedAt` (integer, required)
    - `expiresAt` (integer, required)
    - `enabled` (boolean, required)
    - `capabilities` (array of "changes" | "projects" | "settings" | "start", required) [at most 4 items]
    - `signature` (string, required)
  - `serverTime` (integer, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/computers" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fcomputers)

## Stream computer events

`GET /v1/computers/stream`

Your computer requests' and Code commands' new states, live, as server-sent events.

Permission: `sessions.control` (Every member).

### Responses

- `200` The event stream (text/event-stream, ComputerRequestChanged | CodeCommandChanged)
- `403` Not a person, not a current member, or without `sessions.control` (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `429` More than 8 live streams of yours on this Gateway copy (`control_events_per_person`), or the rate limit (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.
- `503` Too many live streams on this Gateway copy (`control_events_full`): read your receipts instead (application/json, Error)
  - `error` (object)
    - `message` (string, required)
    - `type` (string, required): The class of the error: invalid_request_error (400, 405, 408, 409, 413, 422, 426), authentication_error (401), billing_error (402), permission_error (403), not_found (404), rate_limit_error (429), or a 5xx type such as server_error.
    - `code` (string): Stable: branch on it, not on message. Every 4xx carries one: its site's own code, else the default for its status (400 invalid_request, 401 unauthenticated, 402 payment_required, 403 forbidden, 404 not_found, 405 method_not_allowed, 408 request_timeout, 409 conflict, 422 unprocessable, 429 rate_limited, any other 4xx invalid_request). A 502 carries its site's code, else upstream_error. Any other 5xx carries one only when its site sets it. The agent routes (/v1/anthropic/, /v1/openai/) answer in the provider's shape.
    - `param` (string): `model` when the error is a model refusal (a `code` starting with `model_`); absent otherwise.
    - `nexus` (object): Details of the error, when it has any: the policy rule of a model refusal, the seconds of a 408.
    - `minimum` (string): On a 426 `cli_too_old` only: the oldest `nexus` CLI version Gateway supports.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | More than 8 live streams of yours on this Gateway copy (`control_events_per_person`), or the rate limit |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | Too many live streams on this Gateway copy (`control_events_full`): read your receipts instead |

### Example

```sh
curl "$NEXUS_URL/v1/computers/stream" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fcomputers%2Fstream)

## Publish computer presence

`PUT /v1/computers/{computerId}/presence`

Publish signed computer presence without a session

Permission: `sessions.control` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `computerId` | path | string (uuid) | yes |  |

### Request body (application/json, required)

- `version` (1, required)
- `scope` (ComputerScope, required)
  - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
  - `tenantId` (string, required)
  - `personId` (string, required)
- `computerId` (string (uuid), required)
- `runnerDeviceId` (string, required)
- `name` (string, required): At most 64 Unicode scalar values and 160 UTF-8 bytes; no control characters. [min length 1; max length 64]
- `generation` (integer, required)
- `issuedAt` (integer, required)
- `expiresAt` (integer, required)
- `enabled` (boolean, required)
- `capabilities` (array of "changes" | "projects" | "settings" | "start", required) [at most 4 items]
- `signature` (string, required)

### Responses

- `200` Current signed state. (application/json, ComputerPresence)
  - `version` (1, required)
  - `scope` (ComputerScope, required)
    - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
    - `tenantId` (string, required)
    - `personId` (string, required)
  - `computerId` (string (uuid), required)
  - `runnerDeviceId` (string, required)
  - `name` (string, required): At most 64 Unicode scalar values and 160 UTF-8 bytes; no control characters. [min length 1; max length 64]
  - `generation` (integer, required)
  - `issuedAt` (integer, required)
  - `expiresAt` (integer, required)
  - `enabled` (boolean, required)
  - `capabilities` (array of "changes" | "projects" | "settings" | "start", required) [at most 4 items]
  - `signature` (string, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X PUT "$NEXUS_URL/v1/computers/<computerId>/presence" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1,
    "scope": {
      "gateway": "<gateway>",
      "tenantId": "<tenantId>",
      "personId": "<personId>"
    },
    "computerId": "<computerId>",
    "runnerDeviceId": "<runnerDeviceId>",
    "name": "Platform",
    "generation": 1,
    "issuedAt": 1,
    "expiresAt": 1,
    "enabled": false,
    "capabilities": [
      "changes"
    ],
    "signature": "<signature>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#put%3A%2Fv1%2Fcomputers%2F%7BcomputerId%7D%2Fpresence)

## Submit computer request

`POST /v1/computers/{computerId}/requests`

Submit an encrypted request to your computer

Permission: `sessions.control` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `computerId` | path | string (uuid) | yes |  |

### Request body (application/json, required)

- `version` (1, required)
- `scope` (ComputerScope, required)
  - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
  - `tenantId` (string, required)
  - `personId` (string, required)
- `computerId` (string (uuid), required)
- `id` (string (uuid), required)
- `senderDeviceId` (string, required)
- `runnerDeviceId` (string, required)
- `generation` (integer, required)
- `issuedAt` (integer, required)
- `expiresAt` (integer, required)
- `lockedKey` (string, required): 80 decoded HPKE bytes; canonical unpadded base64url.
- `sealed` (string, required): 29 to 65565 decoded encrypted bytes; canonical unpadded base64url.
- `signature` (string, required)

### Responses

- `200` Current signed state. (application/json, ComputerRequest)
  - `envelope` (ComputerRequestEnvelope, required)
    - `version` (1, required)
    - `scope` (ComputerScope, required)
      - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
      - `tenantId` (string, required)
      - `personId` (string, required)
    - `computerId` (string (uuid), required)
    - `id` (string (uuid), required)
    - `senderDeviceId` (string, required)
    - `runnerDeviceId` (string, required)
    - `generation` (integer, required)
    - `issuedAt` (integer, required)
    - `expiresAt` (integer, required)
    - `lockedKey` (string, required): 80 decoded HPKE bytes; canonical unpadded base64url.
    - `sealed` (string, required): 29 to 65565 decoded encrypted bytes; canonical unpadded base64url.
    - `signature` (string, required)
  - `requestHash` (string, required)
  - `state` ("queued" | "claimed" | "replied" | "expired", required)
  - `reply` (ComputerReplyEnvelope | null, required)
  - `serverTime` (integer, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/computers/<computerId>/requests" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1,
    "scope": {
      "gateway": "<gateway>",
      "tenantId": "<tenantId>",
      "personId": "<personId>"
    },
    "computerId": "<computerId>",
    "id": "<id>",
    "senderDeviceId": "<senderDeviceId>",
    "runnerDeviceId": "<runnerDeviceId>",
    "generation": 1,
    "issuedAt": 1,
    "expiresAt": 1,
    "lockedKey": "<lockedKey>",
    "sealed": "<sealed>",
    "signature": "<signature>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fcomputers%2F%7BcomputerId%7D%2Frequests)

## List computer requests

`GET /v1/computers/{computerId}/requests/inbox`

Read at most 20 queued encrypted computer requests

Permission: `sessions.control` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `computerId` | path | string (uuid) | yes |  |

### Responses

- `200` Current signed state. (application/json, ComputerInbox)
  - `requests` (array of ComputerRequest, required) [at most 20 items]
    - `envelope` (ComputerRequestEnvelope, required)
      - `version` (1, required)
      - `scope` (ComputerScope, required)
        - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
        - `tenantId` (string, required)
        - `personId` (string, required)
      - `computerId` (string (uuid), required)
      - `id` (string (uuid), required)
      - `senderDeviceId` (string, required)
      - `runnerDeviceId` (string, required)
      - `generation` (integer, required)
      - `issuedAt` (integer, required)
      - `expiresAt` (integer, required)
      - `lockedKey` (string, required): 80 decoded HPKE bytes; canonical unpadded base64url.
      - `sealed` (string, required): 29 to 65565 decoded encrypted bytes; canonical unpadded base64url.
      - `signature` (string, required)
    - `requestHash` (string, required)
    - `state` ("queued" | "claimed" | "replied" | "expired", required)
    - `reply` (ComputerReplyEnvelope | null, required)
    - `serverTime` (integer, required)
  - `serverTime` (integer, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/computers/<computerId>/requests/inbox" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fcomputers%2F%7BcomputerId%7D%2Frequests%2Finbox)

## Get computer request

`GET /v1/computers/{computerId}/requests/{id}`

Reconcile an encrypted computer request after expiry

Permission: `sessions.control` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `computerId` | path | string (uuid) | yes |  |
| `id` | path | string (uuid) | yes |  |

### Responses

- `200` Current signed state. (application/json, ComputerRequest)
  - `envelope` (ComputerRequestEnvelope, required)
    - `version` (1, required)
    - `scope` (ComputerScope, required)
      - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
      - `tenantId` (string, required)
      - `personId` (string, required)
    - `computerId` (string (uuid), required)
    - `id` (string (uuid), required)
    - `senderDeviceId` (string, required)
    - `runnerDeviceId` (string, required)
    - `generation` (integer, required)
    - `issuedAt` (integer, required)
    - `expiresAt` (integer, required)
    - `lockedKey` (string, required): 80 decoded HPKE bytes; canonical unpadded base64url.
    - `sealed` (string, required): 29 to 65565 decoded encrypted bytes; canonical unpadded base64url.
    - `signature` (string, required)
  - `requestHash` (string, required)
  - `state` ("queued" | "claimed" | "replied" | "expired", required)
  - `reply` (ComputerReplyEnvelope | null, required)
  - `serverTime` (integer, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/computers/<computerId>/requests/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fcomputers%2F%7BcomputerId%7D%2Frequests%2F%7Bid%7D)

## Claim computer request

`POST /v1/computers/{computerId}/requests/{id}/claim`

Claim a computer request once

Permission: `sessions.control` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `computerId` | path | string (uuid) | yes |  |
| `id` | path | string (uuid) | yes |  |

### Request body (application/json, required)

- `runnerDeviceId` (string, required)
- `signature` (string, required)

### Responses

- `200` Current signed state. (application/json, ComputerRequestClaimed)
  - `claimed` (boolean, required)
  - `request` (ComputerRequest, required)
    - `envelope` (ComputerRequestEnvelope, required)
      - `version` (1, required)
      - `scope` (ComputerScope, required)
        - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
        - `tenantId` (string, required)
        - `personId` (string, required)
      - `computerId` (string (uuid), required)
      - `id` (string (uuid), required)
      - `senderDeviceId` (string, required)
      - `runnerDeviceId` (string, required)
      - `generation` (integer, required)
      - `issuedAt` (integer, required)
      - `expiresAt` (integer, required)
      - `lockedKey` (string, required): 80 decoded HPKE bytes; canonical unpadded base64url.
      - `sealed` (string, required): 29 to 65565 decoded encrypted bytes; canonical unpadded base64url.
      - `signature` (string, required)
    - `requestHash` (string, required)
    - `state` ("queued" | "claimed" | "replied" | "expired", required)
    - `reply` (ComputerReplyEnvelope | null, required)
    - `serverTime` (integer, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/computers/<computerId>/requests/<id>/claim" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "runnerDeviceId": "<runnerDeviceId>",
    "signature": "<signature>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fcomputers%2F%7BcomputerId%7D%2Frequests%2F%7Bid%7D%2Fclaim)

## Reply computer request

`POST /v1/computers/{computerId}/requests/{id}/reply`

Store a signed encrypted reply for the exact sender

Permission: `sessions.control` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `computerId` | path | string (uuid) | yes |  |
| `id` | path | string (uuid) | yes |  |

### Request body (application/json, required)

- `version` (1, required)
- `scope` (ComputerScope, required)
  - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
  - `tenantId` (string, required)
  - `personId` (string, required)
- `computerId` (string (uuid), required)
- `requestId` (string (uuid), required)
- `requestHash` (string, required)
- `runnerDeviceId` (string, required)
- `recipientDeviceId` (string, required)
- `lockedKey` (string, required)
- `sealed` (string, required): 29 to 262173 decoded encrypted bytes; canonical unpadded base64url.
- `signature` (string, required)

### Responses

- `200` Current signed state. (application/json, ComputerRequest)
  - `envelope` (ComputerRequestEnvelope, required)
    - `version` (1, required)
    - `scope` (ComputerScope, required)
      - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
      - `tenantId` (string, required)
      - `personId` (string, required)
    - `computerId` (string (uuid), required)
    - `id` (string (uuid), required)
    - `senderDeviceId` (string, required)
    - `runnerDeviceId` (string, required)
    - `generation` (integer, required)
    - `issuedAt` (integer, required)
    - `expiresAt` (integer, required)
    - `lockedKey` (string, required): 80 decoded HPKE bytes; canonical unpadded base64url.
    - `sealed` (string, required): 29 to 65565 decoded encrypted bytes; canonical unpadded base64url.
    - `signature` (string, required)
  - `requestHash` (string, required)
  - `state` ("queued" | "claimed" | "replied" | "expired", required)
  - `reply` (ComputerReplyEnvelope | null, required)
  - `serverTime` (integer, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/computers/<computerId>/requests/<id>/reply" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1,
    "scope": {
      "gateway": "<gateway>",
      "tenantId": "<tenantId>",
      "personId": "<personId>"
    },
    "computerId": "<computerId>",
    "requestId": "<requestId>",
    "requestHash": "<requestHash>",
    "runnerDeviceId": "<runnerDeviceId>",
    "recipientDeviceId": "<recipientDeviceId>",
    "lockedKey": "<lockedKey>",
    "sealed": "<sealed>",
    "signature": "<signature>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fcomputers%2F%7BcomputerId%7D%2Frequests%2F%7Bid%7D%2Freply)

## List phone pairing requests

`GET /v1/devices/{inviterDeviceId}/pairing-requests`

Read your device pairing relay

Permission: `keys.manage_own` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inviterDeviceId` | path | string | yes |  |

### Responses

- `200` Current signed state. (application/json, PhonePairingRequests)
  - `requests` (array of PhonePairingRequest, required) [at most 20 items]
    - `envelope` (PhonePairingEnvelope, required)
      - `version` (1, required)
      - `scope` (ComputerScope, required)
        - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
        - `tenantId` (string, required)
        - `personId` (string, required)
      - `id` (string (uuid), required)
      - `inviteId` (string (uuid), required)
      - `inviterDeviceId` (string, required)
      - `senderDeviceId` (string, required)
      - `expiresAt` (integer, required)
      - `lockedKey` (string, required)
      - `sealed` (string, required): 29 to 8221 decoded encrypted bytes. Raw invitation secret occurs only inside this ciphertext.
      - `signature` (string, required)
    - `state` ("pending" | "finished", required)
    - `decision` (PhonePairingDecision): Desktop-signed outcome for an invitation. Approval binds the winning request and sender. Cancellation applies to the entire invitation. The relay receipt can be retried for five minutes after expiry.
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/devices/<inviterDeviceId>/pairing-requests" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fdevices%2F%7BinviterDeviceId%7D%2Fpairing-requests)

## Submit phone pairing request

`POST /v1/devices/{inviterDeviceId}/pairing-requests`

Relay an encrypted phone scan proof

Permission: `keys.manage_own` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inviterDeviceId` | path | string | yes |  |

### Request body (application/json, required)

- `version` (1, required)
- `scope` (ComputerScope, required)
  - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
  - `tenantId` (string, required)
  - `personId` (string, required)
- `id` (string (uuid), required)
- `inviteId` (string (uuid), required)
- `inviterDeviceId` (string, required)
- `senderDeviceId` (string, required)
- `expiresAt` (integer, required)
- `lockedKey` (string, required)
- `sealed` (string, required): 29 to 8221 decoded encrypted bytes. Raw invitation secret occurs only inside this ciphertext.
- `signature` (string, required)

### Responses

- `200` The relay request and its signed decision, when available. (application/json, PhonePairingRequest)
  - `envelope` (PhonePairingEnvelope, required)
    - `version` (1, required)
    - `scope` (ComputerScope, required)
      - `gateway` (string, required): Normalized Gateway HTTP(S) URL, without trailing slash.
      - `tenantId` (string, required)
      - `personId` (string, required)
    - `id` (string (uuid), required)
    - `inviteId` (string (uuid), required)
    - `inviterDeviceId` (string, required)
    - `senderDeviceId` (string, required)
    - `expiresAt` (integer, required)
    - `lockedKey` (string, required)
    - `sealed` (string, required): 29 to 8221 decoded encrypted bytes. Raw invitation secret occurs only inside this ciphertext.
    - `signature` (string, required)
  - `state` ("pending" | "finished", required)
  - `decision` (PhonePairingDecision): Desktop-signed outcome for an invitation. Approval binds the winning request and sender. Cancellation applies to the entire invitation. The relay receipt can be retried for five minutes after expiry.
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` The invitation expired or was already used. The request conflicts with an existing entry, or the relay is full.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | The invitation expired or was already used. The request conflicts with an existing entry, or the relay is full. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/devices/<inviterDeviceId>/pairing-requests" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1,
    "scope": {
      "gateway": "<gateway>",
      "tenantId": "<tenantId>",
      "personId": "<personId>"
    },
    "id": "<id>",
    "inviteId": "<inviteId>",
    "inviterDeviceId": "<inviterDeviceId>",
    "senderDeviceId": "<senderDeviceId>",
    "expiresAt": 1,
    "lockedKey": "<lockedKey>",
    "sealed": "<sealed>",
    "signature": "<signature>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fdevices%2F%7BinviterDeviceId%7D%2Fpairing-requests)

## Finish phone pairing request

`POST /v1/devices/{inviterDeviceId}/pairing-requests/{id}/finish`

Publish the inviting computer’s signed pairing decision

Permission: `keys.manage_own` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `inviterDeviceId` | path | string | yes |  |
| `id` | path | string (uuid) | yes |  |

### Request body (application/json)

- `decision` (PhonePairingDecision): Desktop-signed outcome for an invitation. Approval binds the winning request and sender. Cancellation applies to the entire invitation. The relay receipt can be retried for five minutes after expiry.

### Responses

- `200` The decision or legacy delivery marker is recorded. (application/json, PhonePairingFinished)
  - `finished` (boolean, required)
- `400` Malformed scope, identifier or ciphertext.
- `403` Not an owner, current member or valid signer.
- `404` No such owned computer, request or device.
- `409` Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox.

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | Malformed scope, identifier or ciphertext. |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such owned computer, request or device. |
| 409 |  | Stale generation, disabled/offline computer, expired admission, immutable body conflict, unavailable content policy or full bounded mailbox. |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/devices/<inviterDeviceId>/pairing-requests/<id>/finish" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "decision": {
      "state": "approved",
      "scope": {
        "gateway": "<gateway>",
        "tenantId": "<tenantId>",
        "personId": "<personId>"
      },
      "computerId": "<computerId>",
      "inviteId": "<inviteId>",
      "inviterDeviceId": "<inviterDeviceId>",
      "expiresAt": 1,
      "requestId": "<requestId>",
      "senderDeviceId": "<senderDeviceId>",
      "signature": "<signature>"
    }
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fdevices%2F%7BinviterDeviceId%7D%2Fpairing-requests%2F%7Bid%7D%2Ffinish)
