# Pages

> Pages: standalone HTML, Markdown, React (`jsx`) or spreadsheet (`sheet`, JSON data) pages, and whiteboards (`board`, JSON data that every version must parse as, else 400 `page_board_invalid` with `nexus.problems`; a board may be written as a layout, a timeline, columns, a flow, a mind map or a grid, which Gateway lays out on top of the latest version, else 400 `page_board_layout_invalid`), in versions that never change. Every write makes the next version; a write built on an old version is refused (409 `page_version_conflict`), and a restore makes a new version from an old one. At most 16 MiB a version. Writes that contain what phishing needs (password fields, forms that submit somewhere, meta refresh, iframes, object and embed, obfuscated eval) are refused with the reason (400 `page_content_blocked`). Private to their owner for now: sharing and the sandboxed viewer come next.

## List pages

`GET /v1/pages`

Your pages in this organization, most recently written first.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | no | A case-insensitive match in the title. |
| `order` | query | "recent" \| "name" \| "kind" \| "created" | no | The order for this list. Keep the same filter and order when sending its cursor. |
| `limit` | query | integer | no | At most this many (default 30) |
| `docText` | query | boolean | no | Match saved Markdown in owned Docs as well as titles when q is set. |
| `cursor` | query | string | no | `nextCursor` from the previous page |

### Responses

- `200` OK (application/json, PageList)
  - `contentMatches` (object): Saved Doc excerpts keyed by page ID for matches in this list.
  - `pages` (array of PageSummary, required)
    - `id` (string, required): `pag_…`
    - `title` (string, required): The latest version's title
    - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written
  - `nextCursor` (string)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

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

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

## Create page

`POST /v1/pages`

Create a page from finished HTML, Markdown or a React component: version 1. Audited as page.created.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `routes` (array of SiteRouteWrite): Additional saved HTML or React Site routes. The content field holds the root. On a version write, omission carries the previous routes and an empty list removes them. [at most 31 items]
  - `path` (string, required) [max length 128]
  - `title` (string, required) [max length 120]
  - `content` (string, required): Document source in the Site’s format.
- `title` (string, required): 1 to 120 characters [min length 1; max length 120]
- `format` ("html" | "md" | "jsx" | "sheet" | "board") [default "html"]
- `content` (string, required): The page's source: HTML, or Markdown. At most 16 MiB of UTF-8.

### Responses

- `201` Created (application/json, PageWritten)
  - `page` (PageSummary, required)
    - `id` (string, required): `pag_…`
    - `title` (string, required): The latest version's title
    - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written
  - `version` (PageVersion, required)
    - `pageId` (string, required)
    - `version` (integer, required)
    - `title` (string, required)
    - `contentSha256` (string, required): The content's SHA-256, lowercase hex
    - `bytes` (integer, required): The content's size in bytes (UTF-8)
    - `createdVia` ("chat_tool" | "api" | "cli" | "restore" | "remix", required)
    - `restoredFrom` (integer): A restore's source version
    - `remixedFrom` (PageRemixedFrom): A remix's source: the share it was read through and the page version it copies.
      - `artifactId` (string, required)
      - `pageId` (string, required)
      - `version` (integer, required)
    - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "<title>",
    "content": "<content>"
  }'
```

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

## List page trash

`GET /v1/pages/trash`

The caller’s pages in Trash.

Permission: `chat.use` (Every member).

### Responses

- `200` OK (application/json, TrashedPageList)
  - `pages` (array of TrashedPage, required)
    - `page` (PageSummary, required)
      - `id` (string, required): `pag_…`
      - `title` (string, required): The latest version's title
      - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
      - `latestVersion` (integer, required)
      - `createdAt` (string (date-time), required)
      - `updatedAt` (string (date-time), required): When the latest version was written
    - `trashedAt` (string (date-time), required)
    - `purgeAfter` (string (date-time), required)

### 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 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

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

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

## Change page trash

`PUT /v1/pages/{id}/trash`

Move an owned page to Trash or restore it.

Permission: `chat.use` (Every member).

### Parameters

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

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

- `trashed` (boolean, required)

### Responses

- `204` OK

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X PUT "$NEXUS_URL/v1/pages/<id>/trash" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "trashed": false
  }'
```

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

## Purge page trash

`DELETE /v1/pages/{id}/trash`

Permanently delete an owned page that is in Trash.

Permission: `chat.use` (Every member).

### Parameters

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

### Responses

- `204` OK

### 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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/pages/<id>/trash" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#delete%3A%2Fv1%2Fpages%2F%7Bid%7D%2Ftrash)

## Get page

`GET /v1/pages/{id}`

One of your pages and its versions, newest first. Each version lists its title and size, not its content: read the content with getPageSource.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |

### Responses

- `200` OK (application/json, PageDetail)
  - `id` (string, required): `pag_…`
  - `title` (string, required): The latest version's title
  - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
  - `latestVersion` (integer, required)
  - `createdAt` (string (date-time), required)
  - `updatedAt` (string (date-time), required): When the latest version was written
  - `versions` (array of PageVersion, required): Newest first
    - `pageId` (string, required)
    - `version` (integer, required)
    - `title` (string, required)
    - `contentSha256` (string, required): The content's SHA-256, lowercase hex
    - `bytes` (integer, required): The content's size in bytes (UTF-8)
    - `createdVia` ("chat_tool" | "api" | "cli" | "restore" | "remix", required)
    - `restoredFrom` (integer): A restore's source version
    - `remixedFrom` (PageRemixedFrom): A remix's source: the share it was read through and the page version it copies.
      - `artifactId` (string, required)
      - `pageId` (string, required)
      - `version` (integer, required)
    - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

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

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

## Delete page

`DELETE /v1/pages/{id}`

Delete one of your pages, every version and its content, for good. Audited as page.deleted.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` Deleted (application/json, PageDeleted)
  - `deleted` (boolean, required)
  - `id` (string, required)
  - `versions` (integer, required): How many versions went with it
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/pages/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

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

## Write page version

`POST /v1/pages/{id}/versions`

Write the next version of one of your pages, or of a page shared with you with edit access (a viewer gets 403 page_read_only). With `baseVersion`, refused with 409 `page_version_conflict` when that is no longer the latest. Audited as page.version_written.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `routes` (array of SiteRouteWrite): Additional saved HTML or React Site routes. The content field holds the root. On a version write, omission carries the previous routes and an empty list removes them. [at most 31 items]
  - `path` (string, required) [max length 128]
  - `title` (string, required) [max length 120]
  - `content` (string, required): Document source in the Site’s format.
- `content` (string, required): The page's source: HTML, or Markdown. At most 16 MiB of UTF-8.
- `title` (string): A new title; unset keeps the latest one [min length 1; max length 120]
- `format` ("html" | "md" | "jsx" | "sheet" | "board"): Must be the page's format when set
- `baseVersion` (integer): The version this was built on: refused with 409 `page_version_conflict` when it is no longer the latest [min 1]
- `agent` (string): An agent writing for you: its name, such as Claude. People with the page open see it on the canvas, next to your name, on the boards this write changes. Unset from an MCP server: Agent [min length 1; max length 40]

### Responses

- `201` Written (application/json, PageWritten)
  - `page` (PageSummary, required)
    - `id` (string, required): `pag_…`
    - `title` (string, required): The latest version's title
    - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written
  - `version` (PageVersion, required)
    - `pageId` (string, required)
    - `version` (integer, required)
    - `title` (string, required)
    - `contentSha256` (string, required): The content's SHA-256, lowercase hex
    - `bytes` (integer, required): The content's size in bytes (UTF-8)
    - `createdVia` ("chat_tool" | "api" | "cli" | "restore" | "remix", required)
    - `restoredFrom` (integer): A restore's source version
    - `remixedFrom` (PageRemixedFrom): A remix's source: the share it was read through and the page version it copies.
      - `artifactId` (string, required)
      - `pageId` (string, required)
      - `version` (integer, required)
    - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `page_version_conflict` | With `baseVersion`, refused with 409 `page_version_conflict` when that is no longer the latest |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/versions" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "<content>"
  }'
```

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

## Restore page

`POST /v1/pages/{id}/restore`

Restore an old version: the next version gets its title and content. Audited as page.restored.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `version` (integer, required): The version to restore [min 1]
- `baseVersion` (integer): As for writePageVersion [min 1]

### Responses

- `201` Restored (application/json, PageWritten)
  - `page` (PageSummary, required)
    - `id` (string, required): `pag_…`
    - `title` (string, required): The latest version's title
    - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written
  - `version` (PageVersion, required)
    - `pageId` (string, required)
    - `version` (integer, required)
    - `title` (string, required)
    - `contentSha256` (string, required): The content's SHA-256, lowercase hex
    - `bytes` (integer, required): The content's size in bytes (UTF-8)
    - `createdVia` ("chat_tool" | "api" | "cli" | "restore" | "remix", required)
    - `restoredFrom` (integer): A restore's source version
    - `remixedFrom` (PageRemixedFrom): A remix's source: the share it was read through and the page version it copies.
      - `artifactId` (string, required)
      - `pageId` (string, required)
      - `version` (integer, required)
    - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/restore" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1
  }'
```

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

## Get page version

`GET /v1/pages/{id}/versions/{version}`

One version of one of your pages, or of a page shared with you with edit access.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `version` | path | string | yes | A version number, or `latest` |

### Responses

- `200` OK (application/json, PageVersion)
  - `pageId` (string, required)
  - `version` (integer, required)
  - `title` (string, required)
  - `contentSha256` (string, required): The content's SHA-256, lowercase hex
  - `bytes` (integer, required): The content's size in bytes (UTF-8)
  - `createdVia` ("chat_tool" | "api" | "cli" | "restore" | "remix", required)
  - `restoredFrom` (integer): A restore's source version
  - `remixedFrom` (PageRemixedFrom): A remix's source: the share it was read through and the page version it copies.
    - `artifactId` (string, required)
    - `pageId` (string, required)
    - `version` (integer, required)
  - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/versions/<version>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Get site routes

`GET /v1/pages/{id}/versions/{version}/site-routes`

List a saved Site version’s routes

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `version` | path | string | yes | A version number, or `latest` |

### Responses

- `200` OK (application/json, SiteRoutes)
  - `pageId` (string, required)
  - `version` (integer, required) [min 1]
  - `routes` (array of SiteRoute, required) [at most 32 items]
    - `path` (string, required) [max length 128]
    - `title` (string, required) [max length 120]
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/versions/<version>/site-routes" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fversions%2F%7Bversion%7D%2Fsite-routes)

## Get page source

`GET /v1/pages/{id}/versions/{version}/source`

A version's source as written, as plain text: the HTML, Markdown or JSX to edit and write back with writePageVersion. Use version `latest` for the newest. It is never rendered on the API's origin.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `version` | path | string | yes | A version number, or `latest` |

### Responses

- `200` The source, `text/plain`; the `x-nexus-page-version` header names the version (text/plain, string)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/versions/<version>/source" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Stream page events

`GET /v1/pages/{id}/events`

A page's live events, as server-sent events: a version event when a version is written, a preview event when an editor posts unsaved text, and its shared draft's updates, to whoever may open the page. A query event (PageQueryEvent) says one of the page's queries has a new result (Nexus Data).

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |

### Responses

- `200` The event stream (text/event-stream, PageVersionEvent)
  - `pageId` (string, required)
  - `version` (integer, required)
  - `title` (string, required)
  - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
  - `contentSha256` (string): SHA-256 of the content, lowercase hex: a shared draft tells its own saves from other writes by it. Gateway sends it; a client treats an event without it as a write from elsewhere.
- `404` Not a page you may open, or a pinned share (`page_not_found`) (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` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 readers on this Gateway copy (`page_events_full`): poll 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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | Not a page you may open, or a pinned share (`page_not_found`) |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |
| 503 |  | Too many live readers on this Gateway copy (`page_events_full`): poll instead |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/events" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Get page doc

`GET /v1/pages/{id}/doc`

The page's shared draft: the Yjs updates its editors posted, oldest first, for an editor that joins late. Its owner and the editors of an edit share.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |

### Responses

- `200` The draft (application/json, PageDoc)
  - `seed` (integer): The version the draft was started from. Unset: no draft.
  - `last` (integer): The newest update's id.
  - `updates` (array of string, required): The Yjs updates, oldest first, base64url.
- `403` A reader who may only view the page (`page_read_only`) (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.
- `404` Not a page you may edit (`page_not_found`) (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` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | Not a page you may edit (`page_not_found`) |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/doc" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Post page doc

`POST /v1/pages/{id}/doc`

Post to the page's shared draft: a Yjs update, a compacted snapshot, an editor's awareness (cursor and name), or their presence.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |

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

- `seed` (integer): The version the draft was started from: required with `update`. [min 1]
- `update` (string): A Yjs update, or with `snapshot` the whole draft (`Y.encodeStateAsUpdate`), base64url. [pattern ^[A-Za-z0-9_-]+$]
- `snapshot` (boolean): `update` is a snapshot that replaces the updates up to `upTo`.
- `upTo` (integer): A snapshot's last update: the `last` of the read it applied. Unset: the snapshot replaces nothing. [min 1]
- `awareness` (string): An awareness update (y-protocols), base64url: relayed, never stored. [pattern ^[A-Za-z0-9_-]+$]
- `presence` (object): A reader's presence, a JSON object of at most 4 KiB, relayed as posted: Nexus UI sends `client`, `at` (its pointer, or null) and `leave`. Never stored.

### Responses

- `200` Stored (its id) or relayed (application/json, PageDocPosted)
  - `id` (integer): The stored update's id; unset for an awareness or presence post.
- `400` A malformed body, or a `seed` that is not one of the page's versions (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.
- `403` A reader who may only view the page posted an update or a snapshot (`page_read_only`) (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.
- `404` Not a page you may edit, or for presence, open at its latest version (`page_not_found`) (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.
- `409` The draft started over from a newer version (`page_doc_stale`, `details.seed`): read it again (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.
- `413` Over its size limit (`page_doc_too_large`) (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` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | A malformed body, or a `seed` that is not one of the page's versions |
| 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 |  | Not a page you may edit, or for presence, open at its latest version (`page_not_found`) |
| 409 |  | The draft started over from a newer version (`page_doc_stale`, `details.seed`): read it again |
| 413 |  | Over its size limit (`page_doc_too_large`) |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/doc" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "seed": 1,
    "update": "<update>",
    "snapshot": false,
    "upTo": 1,
    "awareness": "<awareness>",
    "presence": {}
  }'
```

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

## Put page preview

`PUT /v1/pages/{id}/preview`

Post the shared draft's text as the page's live preview, so every reader sees an edit before it is saved.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |

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

- `baseVersion` (integer, required): The version the text is built on: the page's latest. [min 1]
- `content` (string, required): The draft's whole text, at most 16 MiB, checked as a version's content.

### Responses

- `200` Stored and announced (application/json, PagePreviewEvent)
  - `pageId` (string, required)
  - `version` (integer, required): The version the text is built on.
  - `contentSha256` (string, required): SHA-256 of the text, lowercase hex.
- `400` A malformed body, content a page may not hold (`page_content_blocked`), a `sheet` that breaks its schema (`page_sheet_invalid`, with the first problem at `error.nexus.path`), or a board that does not parse (`page_board_invalid`) (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.
- `403` A reader who may only view the page (`page_read_only`) (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.
- `404` Not a page you may edit (`page_not_found`) (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.
- `409` A version was written since `baseVersion` (`page_preview_stale`, `details.latestVersion`): post the draft built on it (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.
- `413` Over a page's 16 MiB (`page_too_large`) (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` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 400 |  | A malformed body, content a page may not hold (`page_content_blocked`), a `sheet` that breaks its schema (`page_sheet_invalid`, with the first problem at `error.nexus.path`), or a board that does not parse (`page_board_invalid`) |
| 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 |  | Not a page you may edit (`page_not_found`) |
| 409 |  | A version was written since `baseVersion` (`page_preview_stale`, `details.latestVersion`): post the draft built on it |
| 413 |  | Over a page's 16 MiB (`page_too_large`) |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X PUT "$NEXUS_URL/v1/pages/<id>/preview" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "baseVersion": 1,
    "content": "<content>"
  }'
```

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

## Share page

`POST /v1/pages/{id}/share`

Share one of your pages as an artifact, with the same audiences as a chat: the organization, chosen teams or people, or outside it (named people by email, or anyone with the link) as its settings allow. Pin a version, or follow the latest. Sharing again makes a new version of the artifact. Audited as artifact.shared.

Permission: `artifacts.share` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `audience` ("org" | "teams" | "people" | "external" | "public", required)
- `teams` (array of string): Team slugs or ids (audience teams)
- `people` (array of string): Kind people: members' emails or ids; kind external: the emails of people outside the organization (checked against artifacts.external.domains)
- `expiresIn` (string | number): Kind public: 30d, 12h or a number of days (within artifacts.external.expiry)
- `expiresAt` (string (date-time)): Kind public: when the link stops opening
- `version` ("latest" | integer): The version readers see: latest (follows new versions) or a number (pinned) [default "latest"]
- `role` ("view" | "edit"): Edit lets the readers join the page's shared draft and write its versions. Only for audiences org, teams and people, on the latest version. Deleting, sharing and restoring stay the owner's. [default "view"]

### Responses

- `201` Shared (application/json, Artifact)
  - `id` (string, required): Art_…; one per version
  - `version` (integer, required): 1 for a session's first share, then 2, 3… [min 1]
  - `sessionId` (string, required): The session it was shared from (which may have changed or been deleted since)
  - `title` (string, required)
  - `mode` ("chat" | "ask", required): `chat` with any model you may use; `ask` (Ask your code) answers from your organization's Nexus Wiki, citing its pages
  - `model` (string, required): The session's model when shared: nexus/auto or a pinned model
  - `models` (array of string, required): The models that answered, in order of first use
  - `author` (ArtifactAuthor, required): Readers outside the organization get the name only
    - `email` (string)
    - `name` (string)
  - `audience` (ArtifactAudience, required): Who may read an artifact, besides its author: inside the organization, the whole organization, chosen teams (their members and the members of the teams under them) or chosen people; outside it, named people by email (`external`) or anyone with the link (`public`). Readers outside the organization see the kind only.
    - `kind` ("org" | "teams" | "people" | "external" | "public", required)
    - `teams` (array of string, required): Team slugs (kind teams)
    - `people` (array of string, required): Members' emails (kind people); the outsiders with access (kind external). Empty for readers outside the organization.
  - `allowContinue` (boolean, required): Readers may continue it in a new private chat of their own
  - `status` ("active" | "revoked", required): Only its author sees a revoked artifact
  - `mine` (boolean, required): You shared it
  - `latest` (boolean): No newer active version you can read
  - `messageCount` (integer, required)
  - `costUsd` (number): What the shared answers cost; absent for readers outside the organization
  - `url` (string, required): The link to hand out: a public link (kind public), the fast viewer (kind external, and for every reader outside), else the artifact in Nexus UI; absolute when the Gateway knows Nexus UI's URL, else a path
  - `path` (string, required): /app/<org>/artifacts/<id>
  - `markdownUrl` (string, required): GET /v1/artifacts/{id}.md
  - `createdAt` (string (date-time), required): When it was shared
  - `sessionCreatedAt` (string (date-time))
  - `revokedAt` (string (date-time))
  - `viewerUrl` (string): The fast viewer outside the app shell: <origin>/a/<id> (read through a public link: that link)
  - `publicUrl` (string): Kind public, for its author and the organization's owners and admins (and whoever holds it): <origin>/a/<token>
  - `expiresAt` (string (date-time)): Kind public: when the link stops opening
  - `external` (boolean): Shared outside the organization (kind external or public)
  - `includeCode` (boolean): Outside the organization: whether Ask your code's sources are in the snapshot
  - `organization` (string): The organization's name, shown to every reader
  - `kind` ("page" | "session"): Page for a shared page (no messages; open it with GET /v1/artifacts/{id}/frame); session for a shared coding-agent session (its messages derived from its timeline, `session` on ArtifactDetail); absent for a chat
  - `pageId` (string): A shared page: the page
  - `pageFormat` ("html" | "md" | "jsx" | "sheet" | "board")
  - `pageVersion` (integer): A shared page: the version it pins; absent: the latest
  - `pageRole` ("view" | "edit"): A shared page: edit when its readers in the organization may edit the page; absent for a chat
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/share" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "audience": "org"
  }'
```

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

## List page comments

`GET /v1/pages/{id}/comments`

The comments on a page, oldest first, with whether you own it. Whoever may open the page: its owner, or anyone who may open one of its active shares (a comment is a read: the shares have no comment role). A public link alone is not enough. Anyone else: 404 page_not_found. A reader of a pinned share sees the threads on the versions it shows.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |

### Responses

- `200` OK (application/json, PageComments)
  - `comments` (array of PageComment, required): Oldest first
    - `id` (string, required): `pcm_…`
    - `pageId` (string, required)
    - `threadId` (string): The thread's first comment; absent on that first comment
    - `author` (string): The author's name or email. Absent for a reader outside the page's organization, except on their own comments
    - `mine` (boolean, required): Whether you wrote it
    - `body` (string, required)
    - `quote` (string): The passage the thread is about
    - `prefix` (string): Up to 200 characters just before the passage, to find it again in a later version
    - `suffix` (string): Up to 200 characters just after the passage
    - `pin` (PagePin): The point on a design's board the thread is pinned to
      - `board` (string, required): The board's data-id, else its data-artboard name [min length 1; max length 200]
      - `x` (number, required): From the board's left edge, in its pixels [min 0; max 100000]
      - `y` (number, required): From the board's top edge, in its pixels [min 0; max 100000]
      - `at` (integer): The part's data-nx-at: its place in the source of the comment's version [min 0; max 2147483647]
      - `tag` (string): The part's tag, lower case [pattern ^[a-z][a-z0-9:-]{0,40}$]
      - `layer` (string): The part's data-layer name [min length 1; max length 200]
      - `path` (string): The part's place under the board, as child indices: finds it again in a later version [pattern ^\d{1,5}(\.\d{1,5}){0,63}$]
      - `px` (number): The point inside the part, as a fraction of its width; with py [min 0; max 1]
      - `py` (number): The point inside the part, as a fraction of its height; with px [min 0; max 1]
    - `version` (integer, required): The version it was made on
    - `resolvedAt` (string (date-time)): When the thread was resolved; absent while it is open
    - `chatSessionId` (string): The chat Ask Nexus opened, on the reply it posted
    - `createdAt` (string (date-time), required)
  - `owner` (boolean, required): Whether you own the page: you may delete any comment, resolve any thread, and ask Nexus
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/comments" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Create page comment

`POST /v1/pages/{id}/comments`

Comment on a page: a new thread on a passage (quote, with the text before and after it, on a version) or on a point of a design's board (pin), or a reply (threadId). Whoever may open the page: its owner, or anyone who may open one of its active shares (a comment is a read: the shares have no comment role). A public link alone is not enough. Anyone else: 404 page_not_found. 403 pages_off when the organization turned pages off; 400 page_comment_limit at 1000 comments.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `body` (string, required) [min length 1; max length 4000]
- `threadId` (string): Reply in this thread (a reply's id joins its thread). A reply has no quote, prefix, suffix or pin
- `quote` (string): The passage a new thread is about; unset comments on the whole page [max length 2000]
- `prefix` (string): The text just before the quote [max length 200]
- `suffix` (string): The text just after the quote [max length 200]
- `pin` (PagePin): A new thread's point on a design's board, instead of a quote. A reply has none
  - `board` (string, required): The board's data-id, else its data-artboard name [min length 1; max length 200]
  - `x` (number, required): From the board's left edge, in its pixels [min 0; max 100000]
  - `y` (number, required): From the board's top edge, in its pixels [min 0; max 100000]
  - `at` (integer): The part's data-nx-at: its place in the source of the comment's version [min 0; max 2147483647]
  - `tag` (string): The part's tag, lower case [pattern ^[a-z][a-z0-9:-]{0,40}$]
  - `layer` (string): The part's data-layer name [min length 1; max length 200]
  - `path` (string): The part's place under the board, as child indices: finds it again in a later version [pattern ^\d{1,5}(\.\d{1,5}){0,63}$]
  - `px` (number): The point inside the part, as a fraction of its width; with py [min 0; max 1]
  - `py` (number): The point inside the part, as a fraction of its height; with px [min 0; max 1]
- `version` (integer): The version the passage is on; unset: the newest you can open [min 1]

### Responses

- `201` Created (application/json, PageComment)
  - `id` (string, required): `pcm_…`
  - `pageId` (string, required)
  - `threadId` (string): The thread's first comment; absent on that first comment
  - `author` (string): The author's name or email. Absent for a reader outside the page's organization, except on their own comments
  - `mine` (boolean, required): Whether you wrote it
  - `body` (string, required)
  - `quote` (string): The passage the thread is about
  - `prefix` (string): Up to 200 characters just before the passage, to find it again in a later version
  - `suffix` (string): Up to 200 characters just after the passage
  - `pin` (PagePin): The point on a design's board the thread is pinned to
    - `board` (string, required): The board's data-id, else its data-artboard name [min length 1; max length 200]
    - `x` (number, required): From the board's left edge, in its pixels [min 0; max 100000]
    - `y` (number, required): From the board's top edge, in its pixels [min 0; max 100000]
    - `at` (integer): The part's data-nx-at: its place in the source of the comment's version [min 0; max 2147483647]
    - `tag` (string): The part's tag, lower case [pattern ^[a-z][a-z0-9:-]{0,40}$]
    - `layer` (string): The part's data-layer name [min length 1; max length 200]
    - `path` (string): The part's place under the board, as child indices: finds it again in a later version [pattern ^\d{1,5}(\.\d{1,5}){0,63}$]
    - `px` (number): The point inside the part, as a fraction of its width; with py [min 0; max 1]
    - `py` (number): The point inside the part, as a fraction of its height; with px [min 0; max 1]
  - `version` (integer, required): The version it was made on
  - `resolvedAt` (string (date-time)): When the thread was resolved; absent while it is open
  - `chatSessionId` (string): The chat Ask Nexus opened, on the reply it posted
  - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/comments" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "body": "<body>"
  }'
```

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

## Resolve page comment

`PATCH /v1/pages/{id}/comments/{commentId}`

Resolve a thread, or open it again: its first comment, by its author or the page's owner (else 403 page_comment_forbidden).

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `commentId` | path | string | yes | The comment's id (`pcm_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `resolved` (boolean, required)

### Responses

- `200` OK (application/json, PageComment)
  - `id` (string, required): `pcm_…`
  - `pageId` (string, required)
  - `threadId` (string): The thread's first comment; absent on that first comment
  - `author` (string): The author's name or email. Absent for a reader outside the page's organization, except on their own comments
  - `mine` (boolean, required): Whether you wrote it
  - `body` (string, required)
  - `quote` (string): The passage the thread is about
  - `prefix` (string): Up to 200 characters just before the passage, to find it again in a later version
  - `suffix` (string): Up to 200 characters just after the passage
  - `pin` (PagePin): The point on a design's board the thread is pinned to
    - `board` (string, required): The board's data-id, else its data-artboard name [min length 1; max length 200]
    - `x` (number, required): From the board's left edge, in its pixels [min 0; max 100000]
    - `y` (number, required): From the board's top edge, in its pixels [min 0; max 100000]
    - `at` (integer): The part's data-nx-at: its place in the source of the comment's version [min 0; max 2147483647]
    - `tag` (string): The part's tag, lower case [pattern ^[a-z][a-z0-9:-]{0,40}$]
    - `layer` (string): The part's data-layer name [min length 1; max length 200]
    - `path` (string): The part's place under the board, as child indices: finds it again in a later version [pattern ^\d{1,5}(\.\d{1,5}){0,63}$]
    - `px` (number): The point inside the part, as a fraction of its width; with py [min 0; max 1]
    - `py` (number): The point inside the part, as a fraction of its height; with px [min 0; max 1]
  - `version` (integer, required): The version it was made on
  - `resolvedAt` (string (date-time)): When the thread was resolved; absent while it is open
  - `chatSessionId` (string): The chat Ask Nexus opened, on the reply it posted
  - `createdAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X PATCH "$NEXUS_URL/v1/pages/<id>/comments/<commentId>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "resolved": false
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#patch%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fcomments%2F%7BcommentId%7D)

## Delete page comment

`DELETE /v1/pages/{id}/comments/{commentId}`

Delete a comment, by its author or the page's owner (else 403 page_comment_forbidden). A thread's replies go with it. Deleting the page deletes all its comments.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `commentId` | path | string | yes | The comment's id (`pcm_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` Deleted (application/json, PageCommentDeleted)
  - `deleted` (boolean, required)
  - `id` (string, required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/pages/<id>/comments/<commentId>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#delete%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fcomments%2F%7BcommentId%7D)

## Ask nexus on page comment

`POST /v1/pages/{id}/comments/{commentId}/ask`

Ask Nexus to make the change a thread asks for (the page's owner only, else 403 page_owner_only): opens a new chat of yours that holds the page's latest version, posts a reply in the thread that names the chat, and answers the instruction to send there as your first message. That turn is an ordinary chat turn, billed to you, and its write_page writes the page's next version. Audited as chat.session_created.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `commentId` | path | string | yes | The comment's id (`pcm_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `201` Created (application/json, PageCommentAsked)
  - `comment` (PageComment, required): A comment on a page. A thread's first comment quotes a passage or pins a point on a design's board; a reply names its thread.
    - `id` (string, required): `pcm_…`
    - `pageId` (string, required)
    - `threadId` (string): The thread's first comment; absent on that first comment
    - `author` (string): The author's name or email. Absent for a reader outside the page's organization, except on their own comments
    - `mine` (boolean, required): Whether you wrote it
    - `body` (string, required)
    - `quote` (string): The passage the thread is about
    - `prefix` (string): Up to 200 characters just before the passage, to find it again in a later version
    - `suffix` (string): Up to 200 characters just after the passage
    - `pin` (PagePin): The point on a design's board the thread is pinned to
      - `board` (string, required): The board's data-id, else its data-artboard name [min length 1; max length 200]
      - `x` (number, required): From the board's left edge, in its pixels [min 0; max 100000]
      - `y` (number, required): From the board's top edge, in its pixels [min 0; max 100000]
      - `at` (integer): The part's data-nx-at: its place in the source of the comment's version [min 0; max 2147483647]
      - `tag` (string): The part's tag, lower case [pattern ^[a-z][a-z0-9:-]{0,40}$]
      - `layer` (string): The part's data-layer name [min length 1; max length 200]
      - `path` (string): The part's place under the board, as child indices: finds it again in a later version [pattern ^\d{1,5}(\.\d{1,5}){0,63}$]
      - `px` (number): The point inside the part, as a fraction of its width; with py [min 0; max 1]
      - `py` (number): The point inside the part, as a fraction of its height; with px [min 0; max 1]
    - `version` (integer, required): The version it was made on
    - `resolvedAt` (string (date-time)): When the thread was resolved; absent while it is open
    - `chatSessionId` (string): The chat Ask Nexus opened, on the reply it posted
    - `createdAt` (string (date-time), required)
  - `session` (ChatSession, required): A chat session, private to its author unless shared as an artifact.
    - `id` (string, required)
    - `title` (string, required): The first question until you rename it
    - `mode` ("chat" | "ask", required): `chat` with any model you may use; `ask` (Ask your code) answers from your organization's Nexus Wiki, citing its pages
    - `model` (string, required): The model asked for: nexus/auto by default
    - `lastModel` (string): The model that ran last
    - `team` (string): The team its spend is attributed to
    - `archived` (boolean, required)
    - `webSearch` (boolean): Whether the model may search the web in this session (default false)
    - `messageCount` (integer, required)
    - `costUsd` (number, required): The sum of its model calls and of the web searches that returned results, settled in the ledger; a search that fails after the provider billed it is in the ledger, not in this sum
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required)
    - `visibility` ("private" | "shared"): Private (the default) or shared: at least one active artifact
    - `sharing` (ChatSessionSharing): How a shared session is shared: its newest active artifact
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `audience` (ArtifactAudience, required): Who may read an artifact, besides its author: inside the organization, the whole organization, chosen teams (their members and the members of the teams under them) or chosen people; outside it, named people by email (`external`) or anyone with the link (`public`). Readers outside the organization see the kind only.
        - `kind` ("org" | "teams" | "people" | "external" | "public", required)
        - `teams` (array of string, required): Team slugs (kind teams)
        - `people` (array of string, required): Members' emails (kind people); the outsiders with access (kind external). Empty for readers outside the organization.
      - `allowContinue` (boolean, required)
      - `url` (string, required): The link to hand out: a public link (kind public), the fast viewer (kind external), else the artifact in Nexus UI; absolute when the Gateway knows Nexus UI's URL (NEXUS_UI_URL), else a path
      - `path` (string, required): /app/<org>/artifacts/<id>
      - `viewerUrl` (string): The fast viewer: <origin>/a/<id>
      - `publicUrl` (string): Kind public: <origin>/a/<token>
      - `expiresAt` (string (date-time)): Kind public: when the link stops opening
    - `artifacts` (array of ArtifactLink): Every version shared from this session, newest first (revoked ones included)
      - `id` (string, required)
      - `version` (integer, required) [min 1]
      - `status` ("active" | "revoked", required)
      - `audience` ("org" | "teams" | "people" | "external" | "public", required)
      - `createdAt` (string (date-time), required)
      - `revokedAt` (string (date-time))
    - `author` (ArtifactAuthor): You (listed and read sessions)
      - `email` (string)
      - `name` (string)
    - `forkedFrom` (object): The artifact this session continues (POST /v1/artifacts/{id}/continue)
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `title` (string)
  - `instruction` (string, required): Send it as the chat's next message: the comment, with the passage it is about
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/comments/<commentId>/ask" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fcomments%2F%7BcommentId%7D%2Fask)

## Ask nexus on page comments

`POST /v1/pages/{id}/comments/ask`

Ask Nexus to make the changes several threads ask for, in one chat (the page's owner only, else 403 page_owner_only): the threads threadIds names (a reply names its thread), else every open thread, oldest first. Opens a new chat of yours that holds the page's latest version, posts a reply in each thread that names the chat, and answers one instruction with every comment and its passage or pin. 400 page_comment_none_open when there is none, page_comment_ask_limit above 50 threads, page_comment_ask_too_long when the instruction would pass a chat message's 32000 characters; 404 page_comment_not_found for an id not on the page. That turn is an ordinary chat turn, billed to you. Audited as chat.session_created.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json)

- `threadIds` (array of string): The threads to send (a reply's id names its thread); unset: every open thread [at most 50 items]

### Responses

- `201` Created (application/json, PageCommentsAsked)
  - `comments` (array of PageComment, required): The reply in each thread, in the threads' order
    - `id` (string, required): `pcm_…`
    - `pageId` (string, required)
    - `threadId` (string): The thread's first comment; absent on that first comment
    - `author` (string): The author's name or email. Absent for a reader outside the page's organization, except on their own comments
    - `mine` (boolean, required): Whether you wrote it
    - `body` (string, required)
    - `quote` (string): The passage the thread is about
    - `prefix` (string): Up to 200 characters just before the passage, to find it again in a later version
    - `suffix` (string): Up to 200 characters just after the passage
    - `pin` (PagePin): The point on a design's board the thread is pinned to
      - `board` (string, required): The board's data-id, else its data-artboard name [min length 1; max length 200]
      - `x` (number, required): From the board's left edge, in its pixels [min 0; max 100000]
      - `y` (number, required): From the board's top edge, in its pixels [min 0; max 100000]
      - `at` (integer): The part's data-nx-at: its place in the source of the comment's version [min 0; max 2147483647]
      - `tag` (string): The part's tag, lower case [pattern ^[a-z][a-z0-9:-]{0,40}$]
      - `layer` (string): The part's data-layer name [min length 1; max length 200]
      - `path` (string): The part's place under the board, as child indices: finds it again in a later version [pattern ^\d{1,5}(\.\d{1,5}){0,63}$]
      - `px` (number): The point inside the part, as a fraction of its width; with py [min 0; max 1]
      - `py` (number): The point inside the part, as a fraction of its height; with px [min 0; max 1]
    - `version` (integer, required): The version it was made on
    - `resolvedAt` (string (date-time)): When the thread was resolved; absent while it is open
    - `chatSessionId` (string): The chat Ask Nexus opened, on the reply it posted
    - `createdAt` (string (date-time), required)
  - `session` (ChatSession, required): A chat session, private to its author unless shared as an artifact.
    - `id` (string, required)
    - `title` (string, required): The first question until you rename it
    - `mode` ("chat" | "ask", required): `chat` with any model you may use; `ask` (Ask your code) answers from your organization's Nexus Wiki, citing its pages
    - `model` (string, required): The model asked for: nexus/auto by default
    - `lastModel` (string): The model that ran last
    - `team` (string): The team its spend is attributed to
    - `archived` (boolean, required)
    - `webSearch` (boolean): Whether the model may search the web in this session (default false)
    - `messageCount` (integer, required)
    - `costUsd` (number, required): The sum of its model calls and of the web searches that returned results, settled in the ledger; a search that fails after the provider billed it is in the ledger, not in this sum
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required)
    - `visibility` ("private" | "shared"): Private (the default) or shared: at least one active artifact
    - `sharing` (ChatSessionSharing): How a shared session is shared: its newest active artifact
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `audience` (ArtifactAudience, required): Who may read an artifact, besides its author: inside the organization, the whole organization, chosen teams (their members and the members of the teams under them) or chosen people; outside it, named people by email (`external`) or anyone with the link (`public`). Readers outside the organization see the kind only.
        - `kind` ("org" | "teams" | "people" | "external" | "public", required)
        - `teams` (array of string, required): Team slugs (kind teams)
        - `people` (array of string, required): Members' emails (kind people); the outsiders with access (kind external). Empty for readers outside the organization.
      - `allowContinue` (boolean, required)
      - `url` (string, required): The link to hand out: a public link (kind public), the fast viewer (kind external), else the artifact in Nexus UI; absolute when the Gateway knows Nexus UI's URL (NEXUS_UI_URL), else a path
      - `path` (string, required): /app/<org>/artifacts/<id>
      - `viewerUrl` (string): The fast viewer: <origin>/a/<id>
      - `publicUrl` (string): Kind public: <origin>/a/<token>
      - `expiresAt` (string (date-time)): Kind public: when the link stops opening
    - `artifacts` (array of ArtifactLink): Every version shared from this session, newest first (revoked ones included)
      - `id` (string, required)
      - `version` (integer, required) [min 1]
      - `status` ("active" | "revoked", required)
      - `audience` ("org" | "teams" | "people" | "external" | "public", required)
      - `createdAt` (string (date-time), required)
      - `revokedAt` (string (date-time))
    - `author` (ArtifactAuthor): You (listed and read sessions)
      - `email` (string)
      - `name` (string)
    - `forkedFrom` (object): The artifact this session continues (POST /v1/artifacts/{id}/continue)
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `title` (string)
  - `instruction` (string, required): Send it as the chat's next message: every comment, numbered, with its passage or pin
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/comments/ask" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "threadIds": [
      "<threadId>"
    ]
  }'
```

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

## Ask nexus on page board

`POST /v1/pages/{id}/boards/ask`

Ask Nexus about one board of a design (the page's owner only, else 403 page_owner_only): regenerate it, make 3 variants of it under it (each data-status="proposed" with data-variant-of and a one-line data-note), or keep a variant in place of its original. Opens a new chat of yours that holds the page's latest version and answers the instruction to send there as its first message, so that turn writes the next version and the one before stays in the versions. 400 when ask or board is malformed (read after the page's access check); 404 page_board_not_found when the latest version has no board with that data-id. That turn is an ordinary chat turn, billed to you. Audited as chat.session_created.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `ask` ("regenerate" | "variants" | "keep", required): Regenerate: write that board again. variants: add 3 proposed variants under it. keep: keep this variant in place of its original
- `board` (string, required): The board's data-id (for keep, the variant's) [pattern ^[A-Za-z0-9_.:-]{1,64}$]

### Responses

- `201` Created (application/json, PageBoardAsked)
  - `session` (ChatSession, required): A chat session, private to its author unless shared as an artifact.
    - `id` (string, required)
    - `title` (string, required): The first question until you rename it
    - `mode` ("chat" | "ask", required): `chat` with any model you may use; `ask` (Ask your code) answers from your organization's Nexus Wiki, citing its pages
    - `model` (string, required): The model asked for: nexus/auto by default
    - `lastModel` (string): The model that ran last
    - `team` (string): The team its spend is attributed to
    - `archived` (boolean, required)
    - `webSearch` (boolean): Whether the model may search the web in this session (default false)
    - `messageCount` (integer, required)
    - `costUsd` (number, required): The sum of its model calls and of the web searches that returned results, settled in the ledger; a search that fails after the provider billed it is in the ledger, not in this sum
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required)
    - `visibility` ("private" | "shared"): Private (the default) or shared: at least one active artifact
    - `sharing` (ChatSessionSharing): How a shared session is shared: its newest active artifact
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `audience` (ArtifactAudience, required): Who may read an artifact, besides its author: inside the organization, the whole organization, chosen teams (their members and the members of the teams under them) or chosen people; outside it, named people by email (`external`) or anyone with the link (`public`). Readers outside the organization see the kind only.
        - `kind` ("org" | "teams" | "people" | "external" | "public", required)
        - `teams` (array of string, required): Team slugs (kind teams)
        - `people` (array of string, required): Members' emails (kind people); the outsiders with access (kind external). Empty for readers outside the organization.
      - `allowContinue` (boolean, required)
      - `url` (string, required): The link to hand out: a public link (kind public), the fast viewer (kind external), else the artifact in Nexus UI; absolute when the Gateway knows Nexus UI's URL (NEXUS_UI_URL), else a path
      - `path` (string, required): /app/<org>/artifacts/<id>
      - `viewerUrl` (string): The fast viewer: <origin>/a/<id>
      - `publicUrl` (string): Kind public: <origin>/a/<token>
      - `expiresAt` (string (date-time)): Kind public: when the link stops opening
    - `artifacts` (array of ArtifactLink): Every version shared from this session, newest first (revoked ones included)
      - `id` (string, required)
      - `version` (integer, required) [min 1]
      - `status` ("active" | "revoked", required)
      - `audience` ("org" | "teams" | "people" | "external" | "public", required)
      - `createdAt` (string (date-time), required)
      - `revokedAt` (string (date-time))
    - `author` (ArtifactAuthor): You (listed and read sessions)
      - `email` (string)
      - `name` (string)
    - `forkedFrom` (object): The artifact this session continues (POST /v1/artifacts/{id}/continue)
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `title` (string)
  - `instruction` (string, required): Send it as the chat's next message: what to do with the board, by its data-id
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/boards/ask" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "ask": "regenerate",
    "board": "<board>"
  }'
```

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

## Frame page version

`GET /v1/pages/{id}/versions/{version}/frame`

Your own preview of a version, or of the page's live state (`live`: its unsaved preview, else its latest version): a signed URL on the sandbox origin, valid five minutes. 503 pages_viewer_unconfigured when this Gateway has no sandbox origin.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `siteVersion` | query | integer | no | Request signed routes for this exact authorized saved Site version. |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `version` | path | string | yes | A version number, `latest`, or `live` |

### Responses

- `200` OK (application/json, PageFrame)
  - `siteRoutes` (array of SiteFrameRoute): The root and signed additional routes of the authorized saved Site version.
    - `path` (string, required)
    - `title` (string, required)
    - `url` (string, required)
  - `url` (string (uri), required): The signed URL on the sandbox origin; frame it with sandbox="allow-scripts" only
  - `expiresAt` (string (date-time), required): When the URL stops opening; mint another to reload
  - `pageId` (string, required)
  - `version` (integer, required)
  - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
  - `title` (string, required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/versions/<version>/frame" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Get page poster

`GET /v1/pages/{id}/versions/{version}/poster`

A small WebP picture of a page version (640 by 400), for the Artifacts library's cards. Only html, jsx and md pages have one; any other format is 404 poster_unavailable. The page checker renders it on the first request, and Gateway stores it; later requests serve the stored bytes. Without a checker, 503 poster_not_configured; a busy checker is 503 poster_busy; a checker that cannot render the page is 404 poster_unavailable; any other failure is 502 poster_failed. To whoever may open the version: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `version` | path | string | yes | A version number, or `latest`: the newest version the caller may open |

### Responses

- `200` The poster (image/webp, 640 by 400). Like every credentialed answer, it is cache-control: no-store. (image/webp, string (binary))
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/versions/<version>/poster" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## List page storage

`GET /v1/pages/{id}/storage/{scope}`

A page's storage: the keys of one scope, in order. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only: a public link's reader with no Nexus identity is refused.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `scope` | path | string | yes | `personal`: the caller's own copy, which no other reader sees. `shared`: one copy for everyone who may open the page |
| `prefix` | query | string | no | Only the keys that start with it |
| `limit` | query | integer | no | At most this many (default 1000) |
| `cursor` | query | string | no | `nextCursor` from the previous list |

### Responses

- `200` OK (application/json, PageStorageKeys)
  - `scope` ("personal" | "shared", required)
  - `prefix` (string, required)
  - `keys` (array of string, required)
  - `nextCursor` (string): Pass as `cursor` for the next keys; absent on the last list
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/storage/<scope>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Get page storage value

`GET /v1/pages/{id}/storage/{scope}/{key}`

One value of a page's storage. 404 page_storage_key_not_found when the key has none. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only: a public link's reader with no Nexus identity is refused.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `scope` | path | string | yes | `personal`: the caller's own copy, which no other reader sees. `shared`: one copy for everyone who may open the page |
| `key` | path | string | yes | 1 to 200 characters, with no whitespace, control character, slash, backslash or quote, and not . or .. (400 page_storage_key_invalid) |

### Responses

- `200` OK (application/json, PageStorageValue)
  - `key` (string, required)
  - `scope` ("personal" | "shared", required)
  - `value` (string, required)
  - `updatedAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/storage/<scope>/<key>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Set page storage value

`PUT /v1/pages/{id}/storage/{scope}/{key}`

Write one value of a page's storage, replacing the key's. Text only: 400 page_storage_value_invalid for anything else; 413 page_storage_value_too_large over 5 MiB; 413 page_storage_full when the caller would reach over 20 MiB of keys and values on the page: the shared scope and their own personal one. Other readers' personal values do not count. Not audited. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only: a public link's reader with no Nexus identity is refused.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `scope` | path | string | yes | `personal`: the caller's own copy, which no other reader sees. `shared`: one copy for everyone who may open the page |
| `key` | path | string | yes | 1 to 200 characters, with no whitespace, control character, slash, backslash or quote, and not . or .. (400 page_storage_key_invalid) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `value` (string, required): UTF-8 text of at most 5 MiB, without NUL; store JSON as text [max length 5242880]

### Responses

- `200` Written (application/json, PageStorageWritten)
  - `key` (string, required)
  - `scope` ("personal" | "shared", required)
  - `bytes` (integer, required): The key's and the value's size in UTF-8 bytes, as the page's 20 MiB counts them
  - `updatedAt` (string (date-time), required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X PUT "$NEXUS_URL/v1/pages/<id>/storage/<scope>/<key>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "value": "<value>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#put%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fstorage%2F%7Bscope%7D%2F%7Bkey%7D)

## Delete page storage value

`DELETE /v1/pages/{id}/storage/{scope}/{key}`

Delete one value of a page's storage. A missing key is no error (`deleted: false`). Deleting the page deletes all of its storage. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only: a public link's reader with no Nexus identity is refused.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `scope` | path | string | yes | `personal`: the caller's own copy, which no other reader sees. `shared`: one copy for everyone who may open the page |
| `key` | path | string | yes | 1 to 200 characters, with no whitespace, control character, slash, backslash or quote, and not . or .. (400 page_storage_key_invalid) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` OK (application/json, PageStorageDeleted)
  - `key` (string, required)
  - `scope` ("personal" | "shared", required)
  - `deleted` (boolean, required): Whether there was a value
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/pages/<id>/storage/<scope>/<key>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#delete%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fstorage%2F%7Bscope%7D%2F%7Bkey%7D)

## List page files

`GET /v1/pages/{id}/files`

A page version's data files, by name, without their bytes: read-only copies of the files its source names, attached in the chat that wrote it. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only: a public link's reader with no Nexus identity is refused.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `version` | query | string | no | The version whose files to read: one the caller may open. Default: the newest they may open (a pinned share's version). Another is 404 page_not_found. |

### Responses

- `200` OK (application/json, PageFiles)
  - `files` (array of PageFile, required)
    - `name` (string, required)
    - `mediaType` ("text/csv" | "text/tab-separated-values" | "application/json" | "text/plain" | "text/markdown" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", required)
    - `bytes` (integer, required)
    - `version` (integer, required): The page version it belongs to
    - `createdAt` (string (date-time), required)
    - `data` (string): Standard base64. Only when one file is read (getPageFile)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/files" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Get page file

`GET /v1/pages/{id}/files/{name}`

One of a page version's data files with its bytes, for the page's window.fs.readFile. 404 page_file_not_found when it has none by that name. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only: a public link's reader with no Nexus identity is refused.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `name` | path | string | yes | The file's name |
| `version` | query | string | no | The version whose files to read: one the caller may open. Default: the newest they may open (a pinned share's version). Another is 404 page_not_found. |

### Responses

- `200` OK (application/json, PageFile)
  - `name` (string, required)
  - `mediaType` ("text/csv" | "text/tab-separated-values" | "application/json" | "text/plain" | "text/markdown" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", required)
  - `bytes` (integer, required)
  - `version` (integer, required): The page version it belongs to
  - `createdAt` (string (date-time), required)
  - `data` (string): Standard base64. Only when one file is read (getPageFile)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/files/Platform" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## List page queries

`GET /v1/pages/{id}/queries`

A page's queries (Nexus Data), by name. Its owner reads every field, pending ones included. A reader who is not the owner reads only the approved ones' names, parameters and refresh intervals, never a statement or a connection. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. 403 page_queries_off while the organization's artifacts.pages.queries is off (the default). A person only.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |

### Responses

- `200` OK (application/json, PageQueryList)
  - `queries` (array of PageQuery, required)
    - `name` (string, required)
    - `params` (array of PageQueryParam, required)
      - `name` (string, required) [pattern ^[A-Za-z][A-Za-z0-9_]{0,62}$]
      - `type` ("text" | "integer" | "number" | "boolean" | "date", required): `date` is `YYYY-MM-DD`
      - `default` (any): What a run that names no value binds, of the parameter's type; with none, a run must name one
    - `refreshSeconds` (integer, required): How long a result is reused before a run reads it again [min 60; max 86400]
    - `status` ("approved" | "pending"): The owner's only. pending: chat proposed it and the owner has not approved it
    - `connector` ("postgres" | "snowflake"): The owner's only
    - `account` (string): The owner's only: the connection's account, as GET /v1/connections lists it
    - `statement` (string): The owner's only
    - `statementSha256` (string): The owner's only
    - `reason` (string): The owner's only: why it was proposed
    - `proposedBy` (string): The owner's only
    - `approvedBy` (string): The owner's only
    - `approvedAt` (string (date-time)): The owner's only
    - `createdAt` (string (date-time)): The owner's only
    - `updatedAt` (string (date-time)): The owner's only
    - `lastReadAt` (string (date-time)): When its most recent result was read: every reader sees it
    - `lastRowCount` (integer): The owner's only: that result's rows
    - `lastError` (PageQueryError): The owner's only: why its last refresh failed
      - `code` (string, required)
      - `message` (string, required): Fixed per code: never the database's own message
  - `owner` (boolean, required): Whether the caller owns the page and reads every field
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/queries" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Save page query

`PUT /v1/pages/{id}/queries/{name}`

Save and approve one of your page's queries (Nexus Data): a new one, or a change to one, a pending one included. One SELECT or WITH statement on a connection of postgres or snowflake that you may use, as a call of yours would pick it (403 connection_required, connector_disabled or not_granted otherwise). 503 page_query_unconfigured when this Gateway does not offer the connector. Parameters are declared with a type and bound as $1, $2… when it runs, never spliced into the text; a Snowflake query declares none. 400 page_query_statement_invalid for anything but one SELECT or WITH of at most 100,000 bytes, page_query_connector_unsupported, page_query_params_invalid, page_query_refresh_invalid, page_query_limit past 20 per page. Only the page's owner: 403 page_query_owner_only for a reader, 404 page_not_found for anyone else; 403 page_queries_off while artifacts.pages.queries is off. Audited as page_query.saved, with the statement's SHA-256, never its text. 201 when new, 200 when changed.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `name` | path | string | yes | The query's name: what the page's code passes to `window.nexus.query` |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

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

- `connector` ("postgres" | "snowflake", required)
- `account` (string, required): The connection: its account, name or host, as a connector call's `account` names it
- `statement` (string, required): One SELECT or WITH statement, with $1-style parameters [max length 100000]
- `params` (array of PageQueryParam) [at most 10 items]
  - `name` (string, required) [pattern ^[A-Za-z][A-Za-z0-9_]{0,62}$]
  - `type` ("text" | "integer" | "number" | "boolean" | "date", required): `date` is `YYYY-MM-DD`
  - `default` (any): What a run that names no value binds, of the parameter's type; with none, a run must name one
- `refreshSeconds` (integer) [min 60; max 86400; default 300]
- `reason` (string) [max length 500]

### Responses

- `200` Changed (application/json, PageQuerySaved)
  - `query` (PageQuery, required): One of a page's queries (Nexus Data). A reader who is not the page's owner gets name, params and refreshSeconds only
    - `name` (string, required)
    - `params` (array of PageQueryParam, required)
      - `name` (string, required) [pattern ^[A-Za-z][A-Za-z0-9_]{0,62}$]
      - `type` ("text" | "integer" | "number" | "boolean" | "date", required): `date` is `YYYY-MM-DD`
      - `default` (any): What a run that names no value binds, of the parameter's type; with none, a run must name one
    - `refreshSeconds` (integer, required): How long a result is reused before a run reads it again [min 60; max 86400]
    - `status` ("approved" | "pending"): The owner's only. pending: chat proposed it and the owner has not approved it
    - `connector` ("postgres" | "snowflake"): The owner's only
    - `account` (string): The owner's only: the connection's account, as GET /v1/connections lists it
    - `statement` (string): The owner's only
    - `statementSha256` (string): The owner's only
    - `reason` (string): The owner's only: why it was proposed
    - `proposedBy` (string): The owner's only
    - `approvedBy` (string): The owner's only
    - `approvedAt` (string (date-time)): The owner's only
    - `createdAt` (string (date-time)): The owner's only
    - `updatedAt` (string (date-time)): The owner's only
    - `lastReadAt` (string (date-time)): When its most recent result was read: every reader sees it
    - `lastRowCount` (integer): The owner's only: that result's rows
    - `lastError` (PageQueryError): The owner's only: why its last refresh failed
      - `code` (string, required)
      - `message` (string, required): Fixed per code: never the database's own message
  - `created` (boolean, required)
- `201` Created (application/json, PageQuerySaved)
  - `query` (PageQuery, required): One of a page's queries (Nexus Data). A reader who is not the page's owner gets name, params and refreshSeconds only
    - `name` (string, required)
    - `params` (array of PageQueryParam, required)
      - `name` (string, required) [pattern ^[A-Za-z][A-Za-z0-9_]{0,62}$]
      - `type` ("text" | "integer" | "number" | "boolean" | "date", required): `date` is `YYYY-MM-DD`
      - `default` (any): What a run that names no value binds, of the parameter's type; with none, a run must name one
    - `refreshSeconds` (integer, required): How long a result is reused before a run reads it again [min 60; max 86400]
    - `status` ("approved" | "pending"): The owner's only. pending: chat proposed it and the owner has not approved it
    - `connector` ("postgres" | "snowflake"): The owner's only
    - `account` (string): The owner's only: the connection's account, as GET /v1/connections lists it
    - `statement` (string): The owner's only
    - `statementSha256` (string): The owner's only
    - `reason` (string): The owner's only: why it was proposed
    - `proposedBy` (string): The owner's only
    - `approvedBy` (string): The owner's only
    - `approvedAt` (string (date-time)): The owner's only
    - `createdAt` (string (date-time)): The owner's only
    - `updatedAt` (string (date-time)): The owner's only
    - `lastReadAt` (string (date-time)): When its most recent result was read: every reader sees it
    - `lastRowCount` (integer): The owner's only: that result's rows
    - `lastError` (PageQueryError): The owner's only: why its last refresh failed
      - `code` (string, required)
      - `message` (string, required): Fixed per code: never the database's own message
  - `created` (boolean, required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X PUT "$NEXUS_URL/v1/pages/<id>/queries/Platform" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "connector": "postgres",
    "account": "<account>",
    "statement": "<statement>"
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#put%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fqueries%2F%7Bname%7D)

## Delete page query

`DELETE /v1/pages/{id}/queries/{name}`

Remove one of your page's queries, approved or pending. The page's code gets 404 page_query_not_found for it from then on. Only the page's owner: 403 page_query_owner_only for a reader, 404 page_not_found for anyone else; 403 page_queries_off while artifacts.pages.queries is off. Audited as page_query.deleted.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `name` | path | string | yes | The query's name: what the page's code passes to `window.nexus.query` |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `200` OK (application/json, PageQueryDeleted)
  - `name` (string, required)
  - `deleted` (true, required)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X DELETE "$NEXUS_URL/v1/pages/<id>/queries/Platform" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#delete%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fqueries%2F%7Bname%7D)

## Run page query

`POST /v1/pages/{id}/queries/{name}/run`

A page query's result (Nexus Data): the snapshot every reader of the page shares for these parameter values. A run inside the query's refresh interval answers it; past it, Gateway reads it again as the query's approver, one refresh at a time, and announces the new result on the page's events (`query`). The body names parameter values, and `refresh` for the owner's Refresh now: 400 page_query_run_invalid for any other field, page_query_params_invalid for an undeclared name, a missing value or a value of another type. 409 page_query_pending until the owner approves it, 404 page_query_not_found once removed. When the approver left the organization or their access to the connection ended, every snapshot of the query is deleted and the run is refused with the connector call's code (connection_required, connector_disabled, not_granted) or 409 page_query_approver_gone. 503 page_query_unconfigured when this Gateway does not offer the connector. A refresh that fails answers the last rows with `error`, or 502 page_query_failed with none; its message never quotes the database. 429 past 240 runs a minute per person or 2,400 per page. To whoever may open the page: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. 403 page_queries_off while artifacts.pages.queries is off. A person only.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `name` | path | string | yes | The query's name: what the page's code passes to `window.nexus.query` |

### Request body (application/json)

- `params` (object): The query's parameter values by name; a missing one takes its default
- `refresh` (boolean): Read it again now, whatever its interval: the page's owner only (403 page_query_owner_only for a reader)

### Responses

- `200` OK (application/json, PageQueryResult)
  - `name` (string, required)
  - `paramsKey` (string, required): The SHA-256 of the bound values: which parameter set this is
  - `columns` (array of PageQueryColumn, required)
    - `name` (string, required)
    - `type` (string, required): The database's type name
  - `rows` (array of array of any, required): Each row as an array, in the columns' order. Columns named like secrets come back as "[hidden]"
  - `truncated` (boolean, required)
  - `readAt` (string (date-time), required)
  - `refreshSeconds` (integer, required)
  - `error` (PageQueryError): Set when the last refresh failed: these rows are older than the interval
    - `code` (string, required)
    - `message` (string, required): Fixed per code: never the database's own message
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/queries/Platform/run" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "params": {},
    "refresh": false
  }'
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#post%3A%2Fv1%2Fpages%2F%7Bid%7D%2Fqueries%2F%7Bname%7D%2Frun)

## Export page

`GET /v1/pages/{id}/export`

A page version as a file: PNG (one board, at 1x or 2x), SVG (one board, as shapes and text: its box shadows and filters are dropped, and it names its fonts without embedding them), PDF (one page per board, at its size), PPTX (one slide per board), standalone HTML (the page with the canvas, its scripts and fonts inlined) or zip (the PNGs, the HTML and the source). A Nexus Design page's boards are its top-level data-artboard elements. A Nexus Slides deck's boards are its top-level section[data-slide] elements, each at its own size, and its PPTX carries each slide's data-notes as speaker notes by default. Hidden slides are excluded. Any other html or jsx page is one board. Markdown exports as a printable PDF. It renders in the page checker's Chrome; without one, 503 export_not_configured. A board that did not render is named in x-nexus-export-failed (percent-encoded JSON, [{ board, error }]) and the others still export. To whoever may open the version: its owner, or a reader of one of its active shares; anyone else gets 404 page_not_found. A person only.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `format` | query | "png" \| "svg" \| "pdf" \| "pptx" \| "html" \| "zip" | yes | The file's format |
| `board` | query | string | no | One board or slide, by its data-id, its name or its number from 1. Required for a PNG or SVG of a design or a deck with several (400 board_required); one that matches none is 404 board_not_found. |
| `scale` | query | "1" \| "2" | no | The pixel ratio the boards render at. Default: 2 for pdf and pptx, 1 otherwise. |
| `notes` | query | boolean | no | Include speaker notes in deck exports. Defaults to true in PowerPoint and false in PDF. |
| `version` | query | string | no | The version to export: one the caller may open. Default: the newest they may open. |

### Responses

- `200` The file, as an attachment; x-nexus-export-failed names the boards that did not render (image/png, string (binary))
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl "$NEXUS_URL/v1/pages/<id>/export?format=png" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Remix artifact

`POST /v1/artifacts/{id}/remix`

Remix a shared page (its artifact's id, or a public link's token): copy the version it shows into a new page of your own, in the organization you call with, and open a new chat on the copy, so the chat's next write_page writes its version 2. The original page and its shares do not change. Needs your organization's pages on (403 pages_off). A page shared in one of your organizations is remixed there (403 stays_in_organization). From outside the sharer's organization, its artifacts.external.continue must be on (403 external_remix_off). A shared chat id returns 404 artifact_not_found. A shared chat's public token returns 400 not_a_page. Audited as page.created (via remix) and chat.session_created.

Permission: `artifacts.read` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The artifact's id (`art_…`), or a public link's token |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Responses

- `201` Created (application/json, PageRemixed)
  - `page` (PageSummary, required)
    - `id` (string, required): `pag_…`
    - `title` (string, required): The latest version's title
    - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
    - `latestVersion` (integer, required)
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required): When the latest version was written
  - `version` (PageVersion, required)
    - `pageId` (string, required)
    - `version` (integer, required)
    - `title` (string, required)
    - `contentSha256` (string, required): The content's SHA-256, lowercase hex
    - `bytes` (integer, required): The content's size in bytes (UTF-8)
    - `createdVia` ("chat_tool" | "api" | "cli" | "restore" | "remix", required)
    - `restoredFrom` (integer): A restore's source version
    - `remixedFrom` (PageRemixedFrom): A remix's source: the share it was read through and the page version it copies.
      - `artifactId` (string, required)
      - `pageId` (string, required)
      - `version` (integer, required)
    - `createdAt` (string (date-time), required)
  - `session` (ChatSession, required): A chat session, private to its author unless shared as an artifact.
    - `id` (string, required)
    - `title` (string, required): The first question until you rename it
    - `mode` ("chat" | "ask", required): `chat` with any model you may use; `ask` (Ask your code) answers from your organization's Nexus Wiki, citing its pages
    - `model` (string, required): The model asked for: nexus/auto by default
    - `lastModel` (string): The model that ran last
    - `team` (string): The team its spend is attributed to
    - `archived` (boolean, required)
    - `webSearch` (boolean): Whether the model may search the web in this session (default false)
    - `messageCount` (integer, required)
    - `costUsd` (number, required): The sum of its model calls and of the web searches that returned results, settled in the ledger; a search that fails after the provider billed it is in the ledger, not in this sum
    - `createdAt` (string (date-time), required)
    - `updatedAt` (string (date-time), required)
    - `visibility` ("private" | "shared"): Private (the default) or shared: at least one active artifact
    - `sharing` (ChatSessionSharing): How a shared session is shared: its newest active artifact
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `audience` (ArtifactAudience, required): Who may read an artifact, besides its author: inside the organization, the whole organization, chosen teams (their members and the members of the teams under them) or chosen people; outside it, named people by email (`external`) or anyone with the link (`public`). Readers outside the organization see the kind only.
        - `kind` ("org" | "teams" | "people" | "external" | "public", required)
        - `teams` (array of string, required): Team slugs (kind teams)
        - `people` (array of string, required): Members' emails (kind people); the outsiders with access (kind external). Empty for readers outside the organization.
      - `allowContinue` (boolean, required)
      - `url` (string, required): The link to hand out: a public link (kind public), the fast viewer (kind external), else the artifact in Nexus UI; absolute when the Gateway knows Nexus UI's URL (NEXUS_UI_URL), else a path
      - `path` (string, required): /app/<org>/artifacts/<id>
      - `viewerUrl` (string): The fast viewer: <origin>/a/<id>
      - `publicUrl` (string): Kind public: <origin>/a/<token>
      - `expiresAt` (string (date-time)): Kind public: when the link stops opening
    - `artifacts` (array of ArtifactLink): Every version shared from this session, newest first (revoked ones included)
      - `id` (string, required)
      - `version` (integer, required) [min 1]
      - `status` ("active" | "revoked", required)
      - `audience` ("org" | "teams" | "people" | "external" | "public", required)
      - `createdAt` (string (date-time), required)
      - `revokedAt` (string (date-time))
    - `author` (ArtifactAuthor): You (listed and read sessions)
      - `email` (string)
      - `name` (string)
    - `forkedFrom` (object): The artifact this session continues (POST /v1/artifacts/{id}/continue)
      - `artifactId` (string, required)
      - `version` (integer, required)
      - `title` (string)
- `429` Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). (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 |
| 404 | `not_found` | Nothing matches the path in your organization |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 |  | Over the caller's rate limit (`rate_limit_error`): retry after `Retry-After` seconds. Also a 429 `concurrency_limit`, with `Retry-After: 1`, when the organization already has its most requests in flight (off unless Gateway sets a cap). |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/artifacts/<id>/remix" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

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

## Get page frame content

`GET /v1/page-frames/{pageId}/{version}`

The bytes a signed frame URL names (a version, or `live`: the page's preview, else its latest version), for the sandbox host (which checks the same signature and serves them with the page's CSP). No credential but the signature: 403 page_frame_invalid when it is wrong or expired. Plain text here: Gateway's origin never runs a page.

Permission: `public` (Anyone, signed in or not).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `sitePath` | query | string | no | The canonical path covered by a saved Site route signature. |
| `pageId` | path | string | yes | The page's id (`pag_…`) |
| `version` | path | string | yes | The version number, or `live` |
| `exp` | query | integer | yes | When the URL stops opening (unix seconds) |
| `sig` | query | string | yes | HMAC-SHA256 of the page, version and exp, hex |

### Responses

- `200` The source, `text/plain`; `x-nexus-page-format` (html, md, jsx or sheet) and `x-nexus-page-version` name it; `x-nexus-design-system` names the design system it links, when it links one (text/plain, string)

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 404 | `not_found` | Nothing matches the path in your organization |

### Example

```sh
curl "$NEXUS_URL/v1/page-frames/<pageId>/<version>?exp=1&sig=%3Csig%3E"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fpage-frames%2F%7BpageId%7D%2F%7Bversion%7D)

## Check page

`POST /v1/pages/{id}/check`

Check a design: load a version of an html or jsx page you may open in the page checker, with the CSS of the design system it links (else the organization's default), and list the colours, font sizes and spacing that are not on its tokens, and text below WCAG AA contrast. It never changes the page. Each finding names its board, its layer and a selector, and its box from the board's corner. 400 page_check_unsupported for Markdown, 503 page_check_not_configured without a page checker, 502 page_check_failed when it does not answer.

Permission: `chat.use` (Every member).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The page's id (`pag_…`) |
| `Idempotency-Key` | header | string | no | Send the same key again to retry safely: the request runs once. See [Idempotency keys](/docs/concepts/idempotency). |

### Request body (application/json)

- `version` (integer): The version to check (default: the latest) [min 1]

### Responses

- `200` What Check found (application/json, PageCheck)
  - `pageId` (string, required)
  - `version` (integer, required)
  - `designSystem` (DesignSystem, required): A design system for Nexus Design, as the organization lists it.
    - `id` (string, required): `ds_…`; the built-in is `ds_nexus_brand`
    - `name` (string, required): `@nexus/brand`, or the organization's own name (`acme`, `@acme/web`)
    - `builtIn` (boolean, required): Compiled into Gateway: it cannot be changed or deleted
    - `isDefault` (boolean, required): The organization's default: new designs use it
    - `source` (string, required): Where it came from, in words
    - `variableCount` (integer, required)
    - `componentCount` (integer, required)
    - `updatedAt` (string (date-time)): Unset for the built-in
  - `linked` (boolean, required): Whether the page links it; else it is the organization's default
  - `findings` (array of PageCheckFinding, required) [at most 200 items]
    - `kind` ("color" | "font-size" | "spacing" | "contrast" | "overflow" | "clipped-text" | "outside-board" | "misaligned-rows", required)
    - `board` (string): The board's `data-artboard` name
    - `boardId` (string): The board's `data-id`
    - `layer` (string): The nearest `data-layer` name
    - `selector` (string, required): A CSS selector for the element, from its board
    - `box` (PageCheckBox, required): CSS pixels from the board's top-left corner (the page's, outside a board).
      - `x` (number, required)
      - `y` (number, required)
      - `w` (number, required)
      - `h` (number, required)
    - `property` (string, required)
    - `value` (string, required): The computed value
    - `expected` (string): The nearest token, or the contrast needed
    - `ratio` (number): A contrast finding's ratio
    - `message` (string, required)
  - `counts` (PageCheckCounts, required): Findings by kind, before the list is cut.
    - `color` (integer, required)
    - `fontSize` (integer, required)
    - `spacing` (integer, required)
    - `contrast` (integer, required)
    - `overflow` (integer)
    - `clippedText` (integer)
    - `outsideBoard` (integer)
    - `misalignedRows` (integer)
  - `truncated` (boolean, required)
  - `elements` (integer, required): How many elements were checked

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 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 |
| 409 | `idempotency_in_progress` | A request with the same Idempotency-Key is still running |
| 409 | `idempotency_interrupted` | The first request with this Idempotency-Key was cut off and may have run in part |
| 422 | `idempotency_key_reused` | The Idempotency-Key was used with a different request |
| 429 | `rate_limit_error` | Too many requests from this key in a minute |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/pages/<id>/check" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "version": 1
  }'
```

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

## Get page frame design system

`GET /v1/page-frames/{pageId}/{version}/design-system`

The CSS custom properties of the design system a framed page links, for the sandbox host to inject before the page's own styles, under the same signature as the page's bytes. The page's frame answer names the link in `x-nexus-design-system`. 204 when the page links none, or one its organization does not have.

Permission: `public` (Anyone, signed in or not).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `sitePath` | query | string | no | The canonical path covered by a saved Site route signature. |
| `pageId` | path | string | yes | The page's id (`pag_…`) |
| `version` | path | string | yes | The version number, or `live` |
| `exp` | query | integer | yes | When the URL stops opening (unix seconds) |
| `sig` | query | string | yes | HMAC-SHA256 of the page, version and exp, hex |

### Responses

- `200` `text/css`: only `selector { --name: value; }` blocks (text/css, string)
- `204` The page links no design system

### Errors

| Status | Code | When |
| --- | --- | --- |
| 400 | `invalid_request_error` | A field is missing or not valid; the message names it |
| 404 | `not_found` | Nothing matches the path in your organization |

### Example

```sh
curl "$NEXUS_URL/v1/page-frames/<pageId>/<version>/design-system?exp=1&sig=%3Csig%3E"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fpage-frames%2F%7BpageId%7D%2F%7Bversion%7D%2Fdesign-system)
