# Artifacts

> Nexus Artifacts: a chat session shared as an immutable snapshot (its messages, sources, the model of each answer, mode, title, author and cost). Inside the organization: the whole organization, chosen teams or chosen people. Outside it, as the organization's settings allow (`artifacts.external*`: on, with public links, by default): named people by email, who open it signed in with that verified email (a forwarded link opens for nobody else, who can ask for access), or anyone with an unguessable link, never indexed, optionally expiring. Readers outside see the author's name and the organization's name, never the cost, the author's email or team names, and Ask your code's sources only when the organization allows it and the author included them. Sharing again makes a new version; each version survives the chat being edited or deleted, is revocable at once, and is kept for the organization's chat retention from the moment it was shared. Owners and admins see everything shared outside, with open counts, and revoke in bulk. Every artifact and chat downloads as Markdown.

## Share chat session

`POST /v1/chat/sessions/{id}/share`

Share one of your sessions as an artifact: a snapshot for the organization, chosen teams or chosen people, or outside it (named people by email, or anyone with the link) as its settings allow. Sharing again makes a new version. Audited as artifact.shared.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's id (`chs_…`) |
| `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)
- `allowContinue` (boolean) [default false]
- `includeCode` (boolean): Kinds external and public: keep Ask your code's sources (refused, 403 external_code_not_allowed, unless artifacts.external.code is on)
- `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

### 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
- `404` No such session among yours (`chat_session_not_found`): someone else's session answers the same. (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 |
| 401 | `authentication_error` | No key, or a key Gateway does not accept |
| 403 | `role_required` | Your role does not have this permission |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No such session among yours (`chat_session_not_found`): someone else's session answers the same. |
| 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/chat/sessions/<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%2Fchat%2Fsessions%2F%7Bid%7D%2Fshare)

## Unshare chat session

`DELETE /v1/chat/sessions/{id}/share`

Make one of your sessions private again ("Only you"): every active version of its artifact is revoked at once, and Nexus UI's cached pages go with them. Nothing shared is a no-op. Audited as artifact.revoked per version.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's id (`chs_…`) |
| `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, object)
  - `sessionId` (string, required)
  - `visibility` ("private", required)
  - `revoked` (array of object, required): The versions revoked now, oldest first; empty when nothing was shared.
    - `id` (string, required)
    - `version` (integer, required)
- `404` No such session among yours (`chat_session_not_found`): someone else's session answers the same. (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 |  | No such session among yours (`chat_session_not_found`): someone else's session answers the same. |
| 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/chat/sessions/<id>/share" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

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

## Export chat session

`GET /v1/chat/sessions/{id}/export.md`

One of your sessions as Markdown: YAML front matter, the conversation, sources as links, the cost per answer and in total.

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

### Parameters

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

### Responses

- `200` Markdown with YAML front matter (text/markdown, string)
- `404` No such session among yours (`chat_session_not_found`): someone else's session answers the same. (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 |  | No such session among yours (`chat_session_not_found`): someone else's session answers the same. |
| 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/chat/sessions/<id>/export.md" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## List artifacts

`GET /v1/artifacts`

Artifacts shared with you and by you, newest first; shared_with_me includes what other organizations shared with your verified email. Nexus UI's server may call it for a person with no organization.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `order` | query | "recent" \| "name" \| "kind" \| "created" | no | The order for this list. Keep the same filter and order when sending its cursor. |
| `scope` | query | "all" \| "shared_with_me" \| "shared_by_me" | no |  |
| `status` | query | "active" \| "revoked" \| "all" | no | Active, revoked or all (default: all you may read: every active artifact shared with or by you, and your own revoked ones, marked revoked; nobody else sees a revoked artifact) |
| `session` | query | string | no | Only the versions shared from this session of yours |
| `q` | query | string | no | Words in the title |
| `limit` | query | integer | no |  |
| `cursor` | query | string | no | NextCursor of the previous page |

### Responses

- `200` OK (application/json, ArtifactPage)
  - `artifacts` (array of Artifact, required)
    - `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
  - `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/artifacts" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Share agent session

`POST /v1/artifacts/sessions`

Share a coding-agent session (a Code session in Nexus for desktop, or a nexus claude session) as an artifact, from a snapshot your app builds: with the same audiences as a chat, as the organization's settings allow. Sharing the same session again makes a new version. Readers cannot continue it. Thinking stays out unless included. Common key and token formats are hidden, and home folders become ~; images are not checked. Audited as artifact.shared.

Permission: `artifacts.share` (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)

- `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
- `replace` (boolean): Revoke the session's earlier active versions in the same step, so it has exactly this audience
- `follow` (boolean): Keep updated: later snapshots sent with update replace this share's content in place, so its link stays the same
- `update` (boolean): Write this snapshot over the session's Keep updated share in place: same link, readers and expiry, no new version, no email. The audience fields are ignored; includeThinking must match the share (else 400). 200; no such share is 404 artifact_not_found. Audited as artifact.updated
- `includeThinking` (boolean): Keep the agent's thinking; left out by default
- `session` (object, required): The snapshot your app built from its own log. The checked timeline is at most 4 MB
  - `source` ("desktop" | "claude-code", required)
  - `id` (string, required): Your app's id for the session: the same id shares its next version [min length 1; max length 200]
  - `title` (string): Cut to 200 characters. Absent: the first prompt's first line
  - `agent` ("claude" | "codex" | "antigravity" | "cursor" | "opencode"): A coding agent's id. It names the agent in sessions, policies and routes. Its command may differ: `antigravity` runs as `nexus agy`.
  - `model` (string) [max length 200]
  - `costUsd` (number) [min 0]
  - `startedAt` (integer) [min 0]
  - `events` (array of SessionEvent, required) [at most 20000 items]
    - `kind` ("user" | "text" | "thinking" | "tool" | "toolResult" | "approval" | "approvalResolved" | "usage" | "turnStart" | "turnEnd" | "task" | "notice" | "error", required)
    - `at` (integer): When it happened, in milliseconds [min 0]
    - `id` (string) [max length 200]
    - `text` (string)
    - `parent` (string | null): The sub-agent's tool call that made it; absent or null: the session's own agent [max length 200]
    - `name` (string) [max length 200]
    - `input` (any): A tool's input, as the agent sent it
    - `output` (string): A tool's result: at most 64 KiB, the desktop timeline's cap [max length 65536]
    - `isError` (boolean)
    - `truncated` (boolean)
    - `images` (array of string): Ids of the request's images
    - `requestId` (string) [max length 200]
    - `toolUseId` (string) [max length 200]
    - `tool` (string) [max length 200]
    - `description` (string)
    - `decision` ("allow" | "allowSession" | "deny" | "expired")
    - `message` (string)
    - `model` (string) [max length 200]
    - `inputTokens` (integer) [min 0]
    - `outputTokens` (integer) [min 0]
    - `cacheReadTokens` (integer) [min 0]
    - `cacheWriteTokens` (integer) [min 0]
    - `costUsd` (number) [min 0]
    - `turnId` (string) [max length 200]
    - `status` (string): TurnEnd: completed, interrupted or error; task: running, completed, failed or stopped
    - `durationMs` (integer) [min 0]
    - `error` (string)
    - `taskId` (string) [max length 200]
    - `agentType` (string) [max length 200]
    - `detail` (string)
- `images` (array of object): The images the events name, at most 20 MB in all; PNG, JPEG, GIF or WebP, at most 5 MB each [at most 32 items]
  - `id` (string, required) [pattern ^[A-Za-z0-9_-]{1,64}$]
  - `data` (string, required): Base64, or a data: URL
  - `name` (string)

### Responses

- `200` Updated in place (update) (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
- `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
- `413` The timeline is over 4 MB, or the images over their limits (session_too_large, image_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 |
| 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 |
| 413 |  | The timeline is over 4 MB, or the images over their limits (session_too_large, image_too_large) |
| 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/sessions" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "audience": "org",
    "session": {
      "source": "desktop",
      "id": "<id>",
      "events": [
        {
          "kind": "user"
        }
      ]
    }
  }'
```

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

## Unshare agent session

`DELETE /v1/artifacts/sessions/{id}`

Stop sharing one of your coding sessions: every active version of its artifact is revoked at once, as a chat's unshare. Your own session with nothing active left changes nothing. A key you never shared under is 404 artifact_not_found. Each version is audited as artifact.revoked.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The session's key (`cds_…`): the `sessionId` its share answered |
| `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, object)
  - `sessionId` (string, required)
  - `visibility` ("private", required)
  - `revoked` (array of object, required): The versions revoked now, oldest first; empty when nothing was shared.
    - `id` (string, required)
    - `version` (integer, required)
- `404` You shared no coding session under this key (artifact_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 |  | You shared no coding session under this key (artifact_not_found) |
| 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/artifacts/sessions/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

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

## Get artifact

`GET /v1/artifacts/{id}`

An artifact shared with you (or by you), with its messages: as members see it, or (outside the organization) the external variant. Outside its audience: 404; a signed-in person with a verified email outside an external artifact's audience: 403 artifact_access_required (they may ask). A named outsider's open is counted.

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

### Parameters

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

### Responses

- `200` OK (application/json, ArtifactDetail)
  - `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
  - `messages` (array of ChatSessionMessage, required): The snapshot, oldest first; citations from repositories you cannot see are left out
    - `id` (string, required)
    - `sessionId` (string, required)
    - `role` ("user" | "assistant", required)
    - `content` (string, required): Markdown (a question with images may have none)
    - `status` ("complete" | "failed" | "refused", required): Refused: the policy or budget refused the call (error says why); failed: it broke mid-way (content is what arrived)
    - `mode` ("chat" | "ask"): `chat` with any model you may use; `ask` (Ask your code) answers from your organization's Nexus Wiki, citing its pages
    - `requestedModel` (string)
    - `model` (string): The model that ran
    - `costUsd` (number)
    - `usage` (object)
      - `promptTokens` (integer)
      - `completionTokens` (integer)
    - `citations` (array of ChatCitation)
      - `n` (integer, required): The number the answer cites it by
      - `repo` (string, required): Owner/name
      - `page` (string, required)
      - `slug` (string, required)
      - `section` (string)
      - `path` (string, required): <slug>#<anchor> in the repository's wiki
      - `files` (array of string): Repository files the section names
      - `runId` (string, required): The Nexus Wiki run that wrote the page
    - `error` (object)
      - `code` (string)
      - `message` (string)
      - `status` (integer)
      - `notified` (boolean): A budget refusal told the organization's owners and admins (licensed build). Absent otherwise.
      - `remainingUsdDecimal` (string): A budget refusal's `remainingUsdDecimal`: what was left of that level's budget, as an exact decimal. Absent when the 402 had none.
      - `requestedUsd` (string): A usage-limit refusal's (`usage_limit_reached`) `requestedUsd`: the most the call may cost with Nexus's rate, as an exact decimal. Absent for any other refusal, or when the 402 had none.
      - `remainingUsd` (string): A usage-limit refusal's (`usage_limit_reached`) `remainingUsd`: what this month's usage limit had left, as an exact decimal. Absent for any other refusal, or when the 402 had none.
      - `details` (object): A 402's details, as the live error's `error.nexus` had them, cut to an allow-list: short codes, ways forward, `notified` and decimal dollar amounts. Absent for any other status, when none was kept, and on an answer stored before it.
        - `reason` (string): Why the refusal happened, such as `authentication_required` or `disputed` for `payment_failed`.
        - `level` (string): A budget refusal's level.
        - `freeStart` (string): `cheaper_models_only` when the free start pays for cheaper models only.
        - `next` (array of string): The ways forward, such as `billing` and `own_key`; at most 4.
        - `notified` (boolean): The organization's owners and admins were told.
        - `owedUsd` (string)
        - `unpaidUsd` (string)
        - `remainingUsd` (string)
        - `remainingUsdDecimal` (string)
        - `requestedUsd` (string)
        - `limitUsd` (string)
        - `chargeUsd` (string)
        - `capUsd` (string)
    - `createdAt` (string (date-time), required)
    - `attachments` (array of ChatAttachmentRef): The images attached to a question
      - `id` (string, required)
      - `type` ("image" | "file", required)
      - `mediaType` ("image/png" | "image/jpeg" | "image/gif" | "image/webp" | "text/csv" | "text/tab-separated-values" | "application/json" | "text/plain" | "text/markdown" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", required): An image's from the bytes, not as it was named; a data file's from its extension, checked against the bytes
      - `bytes` (integer, required)
      - `width` (integer)
      - `height` (integer)
      - `name` (string)
    - `page` (ChatPageBlock): A page this answer created or revised through write_page
      - `pageId` (string, required)
      - `version` (integer, required) [min 1]
      - `title` (string, required)
      - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
    - `skills` (array of ChatSkillBlock): The skills this answer loaded through load_skill, in the order it loaded them. The file stays in the skills store
      - `skillId` (string, required): Skl_… For a library skill, the library skill's id, which getSkill and getSkillVersion also take
      - `name` (string, required): The name the version had when it was served
      - `version` (integer, required): The version served: a personal skill's latest, or a library skill's latest approved version that nobody withdrew [min 1]
      - `scope` ("personal" | "team" | "org"): Where the skill came from: your own skills, a team's library, or the organization's. Left out on an answer stored before skills had a scope: read it as personal
      - `teamId` (string): The team (team_…), for scope team. Map it to the team's name with listTeams
    - `connectors` (array of ChatConnectorBlock): The connector reads this answer ran through read_connector, in order. What they returned is never kept. In a shared artifact, a reader sees only the reads of connectors they may use
      - `connector` (string, required)
      - `operation` (string, required)
      - `input` (object, required)
      - `account` (object): The connection the read ran with: whose it is and the account's name. Absent while the read streams, and on reads kept before it was recorded
        - `scope` ("org" | "team" | "user", required)
        - `name` (string, required)
    - `sources` (array of ChatWebSource): The web pages this answer's searches gave the model, one per URL, in the order they were found. Only the session's author reads them; a shared artifact keeps none
      - `title` (string, required)
      - `url` (string, required)
      - `date` (string): The page's date as the engine gave it, cut as the model read it
      - `query` (string, required): The first query in the turn that found this page
    - `rewound` (boolean): Retained for the author, but excluded from future model context after a conversation rewind.
  - `hiddenSources` (integer, required): Citations left out: from repositories the reader cannot see, or (outside the organization) Ask your code's sources not included
  - `versions` (array of ArtifactLink): Every version of the session's artifact you can read, newest first
    - `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))
  - `variant` ("member" | "external"): Member: as the organization's members see it; external: no cost, author email or team names, and no code sources unless included
  - `session` (SessionSnapshot): A shared coding-agent session (kind session): its timeline as the sharer's app showed it. Outside the organization: no cost and no usage events
    - `format` (integer, required): 1
    - `source` ("desktop" | "claude-code", required): Desktop: a Code session in Nexus for desktop; claude-code: a nexus claude session's Claude Code transcript
    - `agent` ("claude" | "codex" | "antigravity" | "cursor" | "opencode"): A coding agent's id. It names the agent in sessions, policies and routes. Its command may differ: `antigravity` runs as `nexus agy`.
    - `model` (string)
    - `costUsd` (number): The agent's own estimate. Hidden from readers outside the organization
    - `startedAt` (integer): When the session started, in milliseconds
    - `thinking` (boolean, required): Whether the sharer included the agent's thinking
    - `events` (array of SessionEvent, required)
      - `kind` ("user" | "text" | "thinking" | "tool" | "toolResult" | "approval" | "approvalResolved" | "usage" | "turnStart" | "turnEnd" | "task" | "notice" | "error", required)
      - `at` (integer): When it happened, in milliseconds [min 0]
      - `id` (string) [max length 200]
      - `text` (string)
      - `parent` (string | null): The sub-agent's tool call that made it; absent or null: the session's own agent [max length 200]
      - `name` (string) [max length 200]
      - `input` (any): A tool's input, as the agent sent it
      - `output` (string): A tool's result: at most 64 KiB, the desktop timeline's cap [max length 65536]
      - `isError` (boolean)
      - `truncated` (boolean)
      - `images` (array of string): Ids of the request's images
      - `requestId` (string) [max length 200]
      - `toolUseId` (string) [max length 200]
      - `tool` (string) [max length 200]
      - `description` (string)
      - `decision` ("allow" | "allowSession" | "deny" | "expired")
      - `message` (string)
      - `model` (string) [max length 200]
      - `inputTokens` (integer) [min 0]
      - `outputTokens` (integer) [min 0]
      - `cacheReadTokens` (integer) [min 0]
      - `cacheWriteTokens` (integer) [min 0]
      - `costUsd` (number) [min 0]
      - `turnId` (string) [max length 200]
      - `status` (string): TurnEnd: completed, interrupted or error; task: running, completed, failed or stopped
      - `durationMs` (integer) [min 0]
      - `error` (string)
      - `taskId` (string) [max length 200]
      - `agentType` (string) [max length 200]
      - `detail` (string)
    - `images` (array of object, required): The images the events name; read each with getArtifactAttachment
      - `id` (string, required)
      - `mediaType` ("image/png" | "image/jpeg" | "image/gif" | "image/webp", required)
      - `bytes` (integer, required)
      - `width` (integer)
      - `height` (integer)
      - `name` (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/artifacts/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Revoke artifact

`DELETE /v1/artifacts/{id}`

Revoke an artifact at once: its author, or an owner or admin of its organization. Nexus UI's cached page goes with it (the signed hook). Audited as artifact.revoked.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The artifact's id (`art_…`) |
| `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, object)
  - `revoked` (boolean, required)
  - `id` (string, required)
  - `version` (integer, 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/artifacts/<id>" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)"
```

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

## Export artifact

`GET /v1/artifacts/{id}.md`

An artifact as Markdown: YAML front matter, a link back to it, the conversation, sources as links, the cost per answer and in total.

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

### Parameters

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

### Responses

- `200` Markdown with YAML front matter (text/markdown, 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/artifacts/<id>.md" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Continue artifact

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

Continue an artifact (its id, or a public link's token) in a new private session of your own, in one of your organizations and at its expense (when its author allows, and from outside when artifacts.external.continue is on). Shared inside one of your organizations: in that organization (another `org`: 403 stays_in_organization). From outside the sharer's organization: in `org` when given (one of yours, else 404 not_a_member), else in the sharer's organization when you belong to it, else in your personal organization, made then if you have none. Someone Nexus does not know yet: 409 organization_required. Audited as artifact.continued in the organization the copy is made in.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The artifact's id (`art_…`) |
| `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)

- `title` (string) [max length 120]
- `team` (string)
- `org` (string): Where the copy goes: one of your organizations (a slug, an id, or `personal`). Default: see the summary.

### Responses

- `201` Created (application/json, ContinuedChatSession)
  - `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)
  - `org` (OrgSummary, required)
    - `id` (string, required)
    - `name` (string, required)
    - `slug` (string)
    - `clerkOrgId` (string): Its sign-in provider organization's id: Nexus UI's URL segment when it has no slug
    - `kind` ("company" | "personal", required): A company organization, or a person's own personal organization (one per person, one member)
    - `role` ("owner" | "admin" | "member")
    - `current` (boolean): The organization this request is in
    - `imageUrl` (string): Its logo, as the tenant's imageUrl (https://img.clerk.com/…); unset when it has none.
  - `orgCreated` (boolean, required): Whether that organization was made now: your personal organization, which you did not have yet.
- `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/artifacts/<id>/continue" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "<title>",
    "team": "platform",
    "org": "<org>"
  }'
```

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

## List external artifacts

`GET /v1/artifacts/external`

Everything the organization shared outside it, newest first, with open counts, readers, requests and reports (owners and admins).

Permission: `artifacts.manage_external` (Owner, Admin).

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `audience` | query | "external" \| "public" | no |  |
| `author` | query | string | no | An author's email or user id |
| `team` | query | string | no | A team (slug or id) and the teams under it: the team of the session it was shared from |
| `status` | query | "active" \| "revoked" \| "all" | no |  |
| `q` | query | string | no | Words in the title |
| `limit` | query | integer | no |  |
| `cursor` | query | string | no |  |

### Responses

- `200` OK (application/json, ExternalArtifactPage)
  - `artifacts` (array of ExternalArtifact, required)
    - `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
    - `opens` (integer, required)
    - `readers` (integer, required): Named outsiders with access
    - `requests` (integer, required): Requests for access waiting for an answer
    - `reports` (integer, required)
    - `team` (string): The team of the session it was shared from
  - `nextCursor` (string)
  - `totals` (object, required)
    - `active` (integer, required)
    - `named` (integer, required)
    - `public` (integer, 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 |
| 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/artifacts/external" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Revoke artifacts

`POST /v1/artifacts/revoke`

Revoke several of the organization's artifacts at once (at most 100; owners and admins). Each is audited as artifact.revoked.

Permission: `artifacts.manage_external` (Owner, Admin).

### 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)

- `ids` (array of string, required) [at most 100 items]

### Responses

- `200` OK (application/json, object)
  - `revoked` (array of object, required)
    - `id` (string, required)
    - `version` (integer, required)
  - `skipped` (array of object, required)
    - `id` (string, required)
    - `reason` ("not_found" | "already_revoked", 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/artifacts/revoke" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": [
      "<id>"
    ]
  }'
```

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

## Get artifact access

`GET /v1/artifacts/{id}/access`

Who has an artifact shared outside, who asked for access, opens and reports: its author, owners and admins.

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

### Parameters

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

### Responses

- `200` OK (application/json, ArtifactAccess)
  - `id` (string, required)
  - `audience` ("org" | "teams" | "people" | "external" | "public", required)
  - `status` ("active" | "revoked", required)
  - `people` (array of ArtifactAccessPerson, required)
    - `email` (string, required)
    - `status` ("granted" | "requested" | "denied" | "removed", required)
    - `opens` (integer, required)
    - `lastOpenedAt` (string (date-time))
    - `requestedAt` (string (date-time))
    - `grantedAt` (string (date-time))
    - `message` (string): What the person asking wrote
  - `opens` (integer, required)
  - `lastOpenedAt` (string (date-time))
  - `reports` (integer, required)
  - `expiresAt` (string (date-time))
  - `publicUrl` (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/artifacts/<id>/access" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Change artifact access

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

Grant (approve a request, or add someone), deny a request, or remove someone's access to an artifact shared with named people outside: its author, owners and admins. Audited as artifact.access_changed (counts and domains).

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The artifact's id (`art_…`) |
| `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)

- `grant` (array of string)
- `deny` (array of string)
- `remove` (array of string)

### Responses

- `200` OK (application/json, ArtifactAccess)
  - `id` (string, required)
  - `audience` ("org" | "teams" | "people" | "external" | "public", required)
  - `status` ("active" | "revoked", required)
  - `people` (array of ArtifactAccessPerson, required)
    - `email` (string, required)
    - `status` ("granted" | "requested" | "denied" | "removed", required)
    - `opens` (integer, required)
    - `lastOpenedAt` (string (date-time))
    - `requestedAt` (string (date-time))
    - `grantedAt` (string (date-time))
    - `message` (string): What the person asking wrote
  - `opens` (integer, required)
  - `lastOpenedAt` (string (date-time))
  - `reports` (integer, required)
  - `expiresAt` (string (date-time))
  - `publicUrl` (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 |
| 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>/access" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "grant": [
      "<grant>"
    ],
    "deny": [
      "<deny>"
    ],
    "remove": [
      "<remove>"
    ]
  }'
```

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

## Request artifact access

`POST /v1/artifacts/{id}/access-requests`

Ask an artifact's author for access (someone outside its audience, signed in with a verified email). Nexus UI's server may call it for a person with no organization. Audited as artifact.access_requested (the domain).

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The artifact's id (`art_…`) |
| `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)

- `message` (string) [max length 500]

### Responses

- `200` Already answered (application/json, object)
  - `status` ("granted" | "requested" | "denied", required)
  - `requested` (boolean, required)
- `202` Requested (application/json, object)
  - `status` ("requested", required)
  - `requested` (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 POST "$NEXUS_URL/v1/artifacts/<id>/access-requests" \
  -H "Authorization: Bearer $NEXUS_API_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{
    "message": "<message>"
  }'
```

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

## Get artifact attachment

`GET /v1/artifacts/{id}/attachments/{attachmentId}`

An image attached to one of an artifact's questions, with its bytes as base64 (`data:<mediaType>;base64,<data>` shows it), to everyone who may read the artifact (getArtifact's rules: its audience inside the organization, named people outside it by verified email; its author always). The snapshot keeps its own copy, so it outlives the session. Not one of its images: 404 artifact_attachment_not_found. Reading it is not counted as an open.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The artifact's id (`art_…`) |
| `attachmentId` | path | string | yes | The image's id (`cha_…`), from the message's `attachments` |

### Responses

- `200` The image (application/json, ArtifactAttachment)
  - `id` (string, required): The image's id as the artifact's messages list it
  - `artifactId` (string, required)
  - `messageId` (string, required)
  - `mediaType` ("image/png" | "image/jpeg" | "image/gif" | "image/webp", required)
  - `bytes` (integer, required)
  - `width` (integer)
  - `height` (integer)
  - `name` (string)
  - `data` (string, required): Standard base64
  - `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/artifacts/<id>/attachments/<attachmentId>" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Get public artifact

`GET /v1/public/artifacts/{token}`

A public artifact through its link, as anyone holding it reads it (the external variant). No credential; never indexed (X-Robots-Tag). Revoked, expired or unknown: 404.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes | A public link's token (the last part of `/a/<token>`) |

### Responses

- `200` OK (application/json, ArtifactDetail)
  - `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
  - `messages` (array of ChatSessionMessage, required): The snapshot, oldest first; citations from repositories you cannot see are left out
    - `id` (string, required)
    - `sessionId` (string, required)
    - `role` ("user" | "assistant", required)
    - `content` (string, required): Markdown (a question with images may have none)
    - `status` ("complete" | "failed" | "refused", required): Refused: the policy or budget refused the call (error says why); failed: it broke mid-way (content is what arrived)
    - `mode` ("chat" | "ask"): `chat` with any model you may use; `ask` (Ask your code) answers from your organization's Nexus Wiki, citing its pages
    - `requestedModel` (string)
    - `model` (string): The model that ran
    - `costUsd` (number)
    - `usage` (object)
      - `promptTokens` (integer)
      - `completionTokens` (integer)
    - `citations` (array of ChatCitation)
      - `n` (integer, required): The number the answer cites it by
      - `repo` (string, required): Owner/name
      - `page` (string, required)
      - `slug` (string, required)
      - `section` (string)
      - `path` (string, required): <slug>#<anchor> in the repository's wiki
      - `files` (array of string): Repository files the section names
      - `runId` (string, required): The Nexus Wiki run that wrote the page
    - `error` (object)
      - `code` (string)
      - `message` (string)
      - `status` (integer)
      - `notified` (boolean): A budget refusal told the organization's owners and admins (licensed build). Absent otherwise.
      - `remainingUsdDecimal` (string): A budget refusal's `remainingUsdDecimal`: what was left of that level's budget, as an exact decimal. Absent when the 402 had none.
      - `requestedUsd` (string): A usage-limit refusal's (`usage_limit_reached`) `requestedUsd`: the most the call may cost with Nexus's rate, as an exact decimal. Absent for any other refusal, or when the 402 had none.
      - `remainingUsd` (string): A usage-limit refusal's (`usage_limit_reached`) `remainingUsd`: what this month's usage limit had left, as an exact decimal. Absent for any other refusal, or when the 402 had none.
      - `details` (object): A 402's details, as the live error's `error.nexus` had them, cut to an allow-list: short codes, ways forward, `notified` and decimal dollar amounts. Absent for any other status, when none was kept, and on an answer stored before it.
        - `reason` (string): Why the refusal happened, such as `authentication_required` or `disputed` for `payment_failed`.
        - `level` (string): A budget refusal's level.
        - `freeStart` (string): `cheaper_models_only` when the free start pays for cheaper models only.
        - `next` (array of string): The ways forward, such as `billing` and `own_key`; at most 4.
        - `notified` (boolean): The organization's owners and admins were told.
        - `owedUsd` (string)
        - `unpaidUsd` (string)
        - `remainingUsd` (string)
        - `remainingUsdDecimal` (string)
        - `requestedUsd` (string)
        - `limitUsd` (string)
        - `chargeUsd` (string)
        - `capUsd` (string)
    - `createdAt` (string (date-time), required)
    - `attachments` (array of ChatAttachmentRef): The images attached to a question
      - `id` (string, required)
      - `type` ("image" | "file", required)
      - `mediaType` ("image/png" | "image/jpeg" | "image/gif" | "image/webp" | "text/csv" | "text/tab-separated-values" | "application/json" | "text/plain" | "text/markdown" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", required): An image's from the bytes, not as it was named; a data file's from its extension, checked against the bytes
      - `bytes` (integer, required)
      - `width` (integer)
      - `height` (integer)
      - `name` (string)
    - `page` (ChatPageBlock): A page this answer created or revised through write_page
      - `pageId` (string, required)
      - `version` (integer, required) [min 1]
      - `title` (string, required)
      - `format` ("html" | "md" | "jsx" | "sheet" | "board", required)
    - `skills` (array of ChatSkillBlock): The skills this answer loaded through load_skill, in the order it loaded them. The file stays in the skills store
      - `skillId` (string, required): Skl_… For a library skill, the library skill's id, which getSkill and getSkillVersion also take
      - `name` (string, required): The name the version had when it was served
      - `version` (integer, required): The version served: a personal skill's latest, or a library skill's latest approved version that nobody withdrew [min 1]
      - `scope` ("personal" | "team" | "org"): Where the skill came from: your own skills, a team's library, or the organization's. Left out on an answer stored before skills had a scope: read it as personal
      - `teamId` (string): The team (team_…), for scope team. Map it to the team's name with listTeams
    - `connectors` (array of ChatConnectorBlock): The connector reads this answer ran through read_connector, in order. What they returned is never kept. In a shared artifact, a reader sees only the reads of connectors they may use
      - `connector` (string, required)
      - `operation` (string, required)
      - `input` (object, required)
      - `account` (object): The connection the read ran with: whose it is and the account's name. Absent while the read streams, and on reads kept before it was recorded
        - `scope` ("org" | "team" | "user", required)
        - `name` (string, required)
    - `sources` (array of ChatWebSource): The web pages this answer's searches gave the model, one per URL, in the order they were found. Only the session's author reads them; a shared artifact keeps none
      - `title` (string, required)
      - `url` (string, required)
      - `date` (string): The page's date as the engine gave it, cut as the model read it
      - `query` (string, required): The first query in the turn that found this page
    - `rewound` (boolean): Retained for the author, but excluded from future model context after a conversation rewind.
  - `hiddenSources` (integer, required): Citations left out: from repositories the reader cannot see, or (outside the organization) Ask your code's sources not included
  - `versions` (array of ArtifactLink): Every version of the session's artifact you can read, newest first
    - `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))
  - `variant` ("member" | "external"): Member: as the organization's members see it; external: no cost, author email or team names, and no code sources unless included
  - `session` (SessionSnapshot): A shared coding-agent session (kind session): its timeline as the sharer's app showed it. Outside the organization: no cost and no usage events
    - `format` (integer, required): 1
    - `source` ("desktop" | "claude-code", required): Desktop: a Code session in Nexus for desktop; claude-code: a nexus claude session's Claude Code transcript
    - `agent` ("claude" | "codex" | "antigravity" | "cursor" | "opencode"): A coding agent's id. It names the agent in sessions, policies and routes. Its command may differ: `antigravity` runs as `nexus agy`.
    - `model` (string)
    - `costUsd` (number): The agent's own estimate. Hidden from readers outside the organization
    - `startedAt` (integer): When the session started, in milliseconds
    - `thinking` (boolean, required): Whether the sharer included the agent's thinking
    - `events` (array of SessionEvent, required)
      - `kind` ("user" | "text" | "thinking" | "tool" | "toolResult" | "approval" | "approvalResolved" | "usage" | "turnStart" | "turnEnd" | "task" | "notice" | "error", required)
      - `at` (integer): When it happened, in milliseconds [min 0]
      - `id` (string) [max length 200]
      - `text` (string)
      - `parent` (string | null): The sub-agent's tool call that made it; absent or null: the session's own agent [max length 200]
      - `name` (string) [max length 200]
      - `input` (any): A tool's input, as the agent sent it
      - `output` (string): A tool's result: at most 64 KiB, the desktop timeline's cap [max length 65536]
      - `isError` (boolean)
      - `truncated` (boolean)
      - `images` (array of string): Ids of the request's images
      - `requestId` (string) [max length 200]
      - `toolUseId` (string) [max length 200]
      - `tool` (string) [max length 200]
      - `description` (string)
      - `decision` ("allow" | "allowSession" | "deny" | "expired")
      - `message` (string)
      - `model` (string) [max length 200]
      - `inputTokens` (integer) [min 0]
      - `outputTokens` (integer) [min 0]
      - `cacheReadTokens` (integer) [min 0]
      - `cacheWriteTokens` (integer) [min 0]
      - `costUsd` (number) [min 0]
      - `turnId` (string) [max length 200]
      - `status` (string): TurnEnd: completed, interrupted or error; task: running, completed, failed or stopped
      - `durationMs` (integer) [min 0]
      - `error` (string)
      - `taskId` (string) [max length 200]
      - `agentType` (string) [max length 200]
      - `detail` (string)
    - `images` (array of object, required): The images the events name; read each with getArtifactAttachment
      - `id` (string, required)
      - `mediaType` ("image/png" | "image/jpeg" | "image/gif" | "image/webp", required)
      - `bytes` (integer, required)
      - `width` (integer)
      - `height` (integer)
      - `name` (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 |
| --- | --- | --- |
| 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). |

### Example

```sh
curl "$NEXUS_URL/v1/public/artifacts/<token>"
```

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

## Export public artifact

`GET /v1/public/artifacts/{token}.md`

A public artifact through its link, as Markdown (no cost, no author email). No credential.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes | The token followed by .md |

### Responses

- `200` Markdown with YAML front matter (text/markdown, 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 |
| --- | --- | --- |
| 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). |

### Example

```sh
curl "$NEXUS_URL/v1/public/artifacts/<token>.md"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fpublic%2Fartifacts%2F%7Btoken%7D.md)

## Get public artifact attachment

`GET /v1/public/artifacts/{token}/attachments/{attachmentId}`

An image of a public artifact through its link, with its bytes as base64. No credential; never indexed (X-Robots-Tag). Revoked, expired or unknown link: 404 artifact_not_found; not one of its images: 404 artifact_attachment_not_found.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes | A public link's token (the last part of `/a/<token>`) |
| `attachmentId` | path | string | yes | The image's id (`cha_…`), from the message's `attachments` |

### Responses

- `200` The image (application/json, ArtifactAttachment)
  - `id` (string, required): The image's id as the artifact's messages list it
  - `artifactId` (string, required)
  - `messageId` (string, required)
  - `mediaType` ("image/png" | "image/jpeg" | "image/gif" | "image/webp", required)
  - `bytes` (integer, required)
  - `width` (integer)
  - `height` (integer)
  - `name` (string)
  - `data` (string, required): Standard base64
  - `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 |
| --- | --- | --- |
| 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). |

### Example

```sh
curl "$NEXUS_URL/v1/public/artifacts/<token>/attachments/<attachmentId>"
```

Try it: [API Explorer](/app?next=%2Fapi-explorer#get%3A%2Fv1%2Fpublic%2Fartifacts%2F%7Btoken%7D%2Fattachments%2F%7BattachmentId%7D)

## Count public artifact open

`POST /v1/public/artifacts/{token}/opened`

Count one open of a public link's page (its beacon: the page itself is cached). A count, never who. No credential; limited per address.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes | A public link's token (the last part of `/a/<token>`) |

### Responses

- `204` Counted
- `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 |
| --- | --- | --- |
| 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). |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/public/artifacts/<token>/opened"
```

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

## Report public artifact

`POST /v1/public/artifacts/{token}/report`

Report a public artifact ("Report" on its page) for Trust and Safety: recorded and audited in its organization as artifact.reported, and members with artifacts.manage_external get a requests.artifact_reported notification. No credential; limited per address.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes | A public link's token (the last part of `/a/<token>`) |

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

- `reason` ("spam" | "phishing" | "malware" | "illegal" | "other", required)
- `details` (string) [max length 1000]

### Responses

- `202` Reported (application/json, object)
  - `reported` (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 |
| --- | --- | --- |
| 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 |
| 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). |

### Example

```sh
curl -X POST "$NEXUS_URL/v1/public/artifacts/<token>/report" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "spam"
  }'
```

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

## Frame artifact

`GET /v1/artifacts/{id}/frame`

A shared page's frame URL on the sandbox origin, valid five minutes, to anyone who may read the artifact. An unpinned page share's frame shows the page's live state, unsaved edits included; a pinned share's frame shows its version. Frame it with sandbox="allow-scripts" only. 404 artifact_not_found for a shared chat id; 404 artifact_revoked once revoked; 403 pages_off; 503 pages_viewer_unconfigured.

Permission: `artifacts.read` (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 artifact's id (`art_…`) |

### 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/artifacts/<id>/frame" \
  -H "Authorization: Bearer $NEXUS_API_KEY"
```

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

## Stream artifact events

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

A shared page's live events, as server-sent events, by the share's id: for readers without the page's own stream (the /a/ viewer, the phone app). Anyone who may frame the share reads it, and it counts no open. A query event (PageQueryEvent) says one of the page's queries has a new result (Nexus Data).

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

### Parameters

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

### 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` A shared chat id, missing share, or inaccessible share (`artifact_not_found`). Revoked shares may return `artifact_revoked`. (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 pinned share: it shows one version, so it has nothing to follow (`page_share_pinned`) (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`) (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 |  | A shared chat id, missing share, or inaccessible share (`artifact_not_found`). Revoked shares may return `artifact_revoked`. |
| 409 |  | A pinned share: it shows one version, so it has nothing to follow (`page_share_pinned`) |
| 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`) |

### Example

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

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

## Frame public artifact

`GET /v1/public/artifacts/{token}/frame`

A public page link's frame URL, valid five minutes. An unpinned link's frame shows the page's live state, unsaved edits included; a pinned link's frame shows its version. No credential; rate limited per address. Revoked, expired, unknown, or its organization turned pages or public page links off: 404.

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `siteVersion` | query | integer | no | Request signed routes for this exact authorized saved Site version. |
| `token` | path | string | yes | A public link's token (the last part of `/a/<token>`) |

### 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 |
| 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). |

### Example

```sh
curl "$NEXUS_URL/v1/public/artifacts/<token>/frame"
```

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

## Stream public artifact events

`GET /v1/public/artifacts/{token}/events`

A public page link's live events, as server-sent events. No credential. Each stream open counts against the address's public reads, and an address holds at most 32 open on each Gateway copy. A query event (PageQueryEvent) says one of the page's queries has a new result (Nexus Data).

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

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `token` | path | string | yes | A public link's token (the last part of `/a/<token>`) |

### 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` No link opens here (`artifact_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 pinned link: it shows one version, so it has nothing to follow (`page_share_pinned`) (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 address's public reads a minute, or 32 streams open from it (`page_events_per_address`) (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`) (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 |
| --- | --- | --- |
| 404 | `not_found` | Nothing matches the path in your organization |
| 404 |  | No link opens here (`artifact_not_found`) |
| 409 |  | A pinned link: it shows one version, so it has nothing to follow (`page_share_pinned`) |
| 429 |  | Over the address's public reads a minute, or 32 streams open from it (`page_events_per_address`) |
| 503 |  | Too many live readers on this Gateway copy (`page_events_full`) |

### Example

```sh
curl "$NEXUS_URL/v1/public/artifacts/<token>/events"
```

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