# Build on the same shared context.

Read and update documents, connect discussions, and keep your integration in step with the people doing the work.

## Start with an approved connection.

Install Dee from the installation guide, then approve access in your browser. The default installation places the CLI at ~/.dee/bin/dee; these examples use that path directly. The CLI detects supported local agents, links the Dee skill, configures optional MCP tools, and keeps its own credential private in ~/.dee. Skill + CLI works without MCP. The connection works under your Dee account’s current permissions.

The examples below use https://dee.cool. The CLI remembers the selected service address. Check your connection before continuing; revoke it when it is no longer needed.

### Connect and check access

```sh
~/.dee/bin/dee agent connect
~/.dee/bin/dee agent status
```

### Disconnect this connection

```sh
~/.dee/bin/dee agent logout
```

[Installation guide](https://dee.cool/install)

[Independent Agent Service protocol](https://dee.cool/docs/agent-service)

## Create your first document.

The CLI can call declared HTTP operations by operation ID. This example sends a complete personal document through stdin and returns its actual document and revision IDs. The CLI creates and records the operation ID before sending the request.

Use the returned document_id in the read command. Your title and Markdown are separate fields; an H1 in the content does not replace the title. A document keeps the same URL when its content changes.

Discover operation names and inspect the shipped field definitions without making a network request. JSON output preserves the API response shape. The CLI’s generic write command handles supported business operations; browser sign-in exchange and browser logout use their dedicated protocols.

### Create a document through the API client

```sh
~/.dee/bin/dee api call create_document --input - --json <<'JSON'
{
  "origin": { "kind": "personal" },
  "title": "Integration notes",
  "markdown": "# Integration notes\n\nA shared starting point."
}
JSON
```

### Read the returned document

```sh
~/.dee/bin/dee api read get_document --path id=DOCUMENT_ID --json
```

### Explore operations and schemas

```sh
~/.dee/bin/dee api list --json
~/.dee/bin/dee api schemas --json
~/.dee/bin/dee api schema SaveDocumentRequest --references --json
```

## Use the right credential for the right entry.

External HTTP clients use Authorization: Bearer with an opaque Dee credential obtained through browser approval. This is distinct from the identity provider’s token. The same Dee Bearer can access ordinary restricted business endpoints and the document MCP, subject to current account, role, and lifecycle checks.

A custom client generates two independent secrets: a device secret and the future Dee credential, each 32 random bytes encoded as unpadded base64url. It sends the device secret and SHA-256 credential digest to /agent/login/start, opens the returned verification URL for the person, and polls using the original device secret. Approval activates the credential that the client already retained; polling never returns its plaintext. These fields are documented in the runtime protocol reference below.

The approval request lasts ten minutes. An ordinary human-account connection lasts no longer than the approving browser session or thirty days. An independent Agent Service connection uses its own Agent identity and persists until revoked; see the Agent Service guide. Automatic renewal and generic remote-MCP OAuth discovery are not currently provided. A denied, expired, or invalid request needs a new approval request.

### External requests

Send only the Dee Bearer, without a Cookie header. Origin may be omitted; if supplied, it must equal the application origin. An optional X-Dee-Expected-Account-Id pins the original account and returns 409 AccountChanged if it differs.

### Browser requests

The application uses its HttpOnly Dee Cookie. Cookie mutations require the exact application Origin. Agent connection listing and revocation require the browser Cookie and reject Authorization headers. Google sign-in uses a one-time, browser-bound authorization-code callback; account resolution and browser logout keep their dedicated Cookie and Origin protocols.

### Direct HTTP

The example below is for a custom client that has completed the browser-approved flow and retained its own credential in DEE_TOKEN. CLI users can use dee api read and dee api call without extracting any private CLI state.

### Inspect your approved HTTP connection

```sh
DEE_ORIGIN='https://api.dee.cool'
# DEE_TOKEN is retained privately by your approved custom client.
curl --fail-with-body "$DEE_ORIGIN/api/session" \
  -H "Authorization: Bearer $DEE_TOKEN"
```

## Save deliberately and recover the original result.

JSON business requests use snake_case fields and Content-Type: application/json. Success returns the declared object directly, without a universal success or data wrapper. IDs encode an unsigned 128-bit value using the exact Base62 alphabet ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789, left-padded with A to 22 characters. Arbitrary 22-character strings can overflow. Reuse returned IDs; for a new operation encode 16 random bytes with that alphabet.

A direct HTTP document save submits the complete title and Markdown with expected_revision_id from the version you read. Space, access, and attention writes use their own expected_revision; message maintenance uses expected_version; Trash and restoration use the complete reviewed management token. These conditions are distinct and are checked before a new change is committed.

When the response is lost, retain the original operation_id, target, conditions, complete input, and original upload bytes. Query the matching operation receipt or resend the identical request. A different valid intent under the same ID returns OperationConflict. A missing receipt does not prove an in-flight request never committed; an old receipt does not prove current content or access.

A 409 conflict requires reading the relevant current facts and deciding how to continue. A changed or merged intent uses a new operation ID. The CLI records direct document operation metadata and receipts without a local body copy; retrying a direct write requires the original input. Full local recovery is an explicit CLI option.

### Document receipts

GET /api/documents/operations/{operation_id} checks original creation and save results. Lifecycle results use /api/documents/lifecycle/operations/{operation_id}.

### Other write receipts

Spaces, access, communication, attention, and resource uploads each expose their own operation lookup. Their exact paths and response fields appear in the generated reference.

### Current permission

Read requires current document access; new content writes require editor or administrator permission. Some management operations require an administrator. Reading an original minimal receipt does not grant access to current or historical content.

### Find and inspect a recorded CLI operation

```sh
~/.dee/bin/dee operation list --json
~/.dee/bin/dee operation inspect OPERATION_ID --owner documents --json
```

## Page collections and follow changes separately.

Collections use page_index, page_size, and order_by. The index starts at zero and defaults to 0; size defaults to 50 and accepts 0 through 100. A zero size returns empty items and total_pages=0 while retaining the true total_items. Responses contain items, page_index, page_size, total_pages, and total_items, with authorization applied before counting.

Encode ordering as one comma-separated query value, such as title.asc,id.asc. Each endpoint declares its supported columns and default order. Invalid columns, duplicate fields, or invalid directions are rejected; the service adds an ID tie-breaker when needed. The current page_index upper bound is 9007199254740991 and the computed offset must also fit the server’s range.

Message pagination can return read_boundary_message_id. Reuse that boundary with the same document, main-discussion or thread scope, ordering, and page size to keep later pages within the original message collection. The boundary is not the last item on the page and does not mark messages as read.

Change feeds use a separate opaque cursor. A request without a cursor returns a bootstrap fence; read current facts and then poll from that fence. Preserve complete batch cursors after consuming the batch. Change positions, revisions, and versions are decimal strings and must remain lossless. ChangeCursorInvalid returns resync_required, reset_cursor, and current_urls for rebuilding the current view.

Change polling accepts max_events from 1 to 200, default 100, and wait_ms from 0 to 25000, default 0. Bootstrap is immediate. Current identity, scope access, and document lifecycle are rechecked; a cursor does not preserve revoked access.

### Read a stable, explicitly ordered page

```sh
~/.dee/bin/dee api read list_documents --query scope=mine --query page_index=0 --query page_size=20 --query order_by=title.asc,id.asc --json
```

## Work with the whole document context.

Documents, discussions, resources, and personal follow-up share the same current access rules while keeping their own identities and write conditions. A direct grant to one Space document does not grant Space membership or access to the Space’s collection.

Personal documents begin with their owner; Space documents use current membership and direct access sources. Effective roles combine applicable grants. Closing link joining blocks new joins but retains access that was already granted.

### Documents and versions

Title and Markdown save together. Titles allow up to 1000 Unicode characters; Markdown allows up to 1,000,000 UTF-8 bytes. Both reject NUL. Exact saved versions remain subject to current document access.

### Messages, threads, and quotes

Send ordered content parts and complete mentions. A thread uses its root message ID. Quoted ranges are UTF-8 byte half-open intervals, not JavaScript string indexes; message quotes include the version read. Ordinary reads and messages do not confirm a person’s read progress.

### Resource originals

Upload raw bytes with the declared MIME and filename query, not multipart or base64 JSON. Originals are limited to 20 MiB. Upload reservation, confirmed upload, and publication are distinct states. Reading metadata or original bytes always checks current resource and document access.

### Follow-up and Trash

Message read progress, follow/mute preferences, and notification confirmation are separate personal states. Administrators review a current management token before Trash or restoration. Restoration preserves the document identity and saved content, applies current grants, and closes link joining.

## Interpret errors and tool results accurately.

HTTP errors use name, message, and data. Branch on HTTP status and the stable name; message is explanatory text. Validation may include data.fields with JSON Pointer locations. The x-request-id header identifies the request for diagnosis. Restricted /api/ responses, including errors and resource content, use Cache-Control: no-store.

401 means the current identity cannot be used. 403 can mean an invalid Origin or insufficient permission; unavailable and inaccessible targets generally share 404. A currently accessible document in Trash returns 410 for ordinary content. 409 identifies a particular version, management, cursor, or original-operation conflict. 503 means availability or confirmation failed; retain the original request before deciding to retry. The reference lists declared responses; shared authentication, recovery readiness, and request extraction can produce additional runtime failures.

MCP uses the same saved documents and current permissions. The local connector serves JSON-RPC over stdio; the HTTP document endpoint is /mcp. Initialize with protocolVersion 2025-11-25, capabilities, and clientInfo, then discover actual tools through tools/list. HTTP MCP requires an opaque Dee Bearer; a browser Cookie cannot substitute.

Tool success returns structuredContent and may include a resource_link with the real document URL. Domain failures return result.isError=true; malformed JSON, invalid requests, and invalid parameters use JSON-RPC errors. Valid notifications have no JSON-RPC reply; HTTP returns 202 with an empty body. The stdio adapter also exposes list_operations for interrupted local writes. Reading through a tool does not mark a person’s discussions as read.

The HTTP operation and model reference below is generated from the current OpenAPI declaration. Browser approval and MCP runtime protocols are listed separately because they are not yet part of that declaration. Missing OpenAPI security schemes do not make restricted endpoints public.

### Example HTTP error shape

```json
{
  "name": "RevisionConflict",
  "message": "The document changed since the version you read.",
  "data": { "current_revision_id": "RETURNED_REVISION_ID" }
}
```

## API reference

142 HTTP operations from the current OpenAPI contract, plus 2 supplemental runtime protocols. Download [OpenAPI JSON](/openapi.json).

### Accounts and sessions

Inspect the current account, handle browser sign-in, and resolve registered collaborators.

#### POST /agent/logout

Operation: `logout_agent_connection`. Logout agent connection

Authentication: The connection’s own opaque Dee Bearer; no Cookie. Any supplied Origin must match. Revocation leaves browser sign-in intact.

Responses:

```json
{
  "204": {
    "description": "The connection credential was revoked."
  }
}
```

#### GET /api/account/login-identities

Operation: `login_identities`. Login identities

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Responses:

```json
{
  "200": {
    "description": "All sign-in methods belonging to this browser account; provider subjects are never exposed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/LoginIdentitiesResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "A browser session is required; Agent credentials are not accepted",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Identity storage unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/account/login-identities/google

Operation: `link_google`. Link google

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/GoogleLoginRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Start explicit Google linking, bound to this browser session and account. Callback preserves the session and returns to the validated target.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/GoogleLoginResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or return target",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "A browser session is required; Agent credentials are not accepted",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid application origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "The initiating session changed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Identity storage or provider unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/account/login-identities/{id}

Operation: `unlink_login_identity`. Unlink login identity

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). Sign-in method owned by the current account

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Responses:

```json
{
  "204": {
    "description": "Sign-in method removed. Existing browser and Agent sessions remain active."
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "A browser session is required; Agent credentials are not accepted",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid application origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Sign-in method is unavailable to this account",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "The last sign-in method cannot be removed, or the session changed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Identity storage unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/accounts/resolve

Operation: `resolve_account`. Resolve account

Authentication: Registered-account lookup uses the browser Cookie and exact application Origin. A Dee Bearer alone does not replace this protocol.

Parameter `Origin` (header, optional). Required and equal to APP_ORIGIN when using a Cookie session

```json
{
  "type": [
    "string",
    "null"
  ]
}
```

Parameter `Cookie` (header, optional). Current Dee browser session, or use an approved Agent Bearer credential

```json
{
  "type": [
    "string",
    "null"
  ]
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ResolveAccountRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "One active, verified account already registered in Dee v0.1",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ResolvedAccountResponse"
        }
      }
    }
  },
  "400": {
    "description": "A complete email address is required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity is required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No available registered v0.1 account matches",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "No unique account can be confirmed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Identity lookup unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/auth/config

Operation: `login_config`. Login config

Authentication: Public endpoint; readiness or recovery conditions can still affect availability.

Parameter `return_to` (query, optional). Same-origin relative return target

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Configured sign-in providers, default provider and validated navigation target; enabled is true when any provider is available. Grants no document access.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/LoginConfigResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid return target",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/auth/google

Operation: `google_login`. Google login

Authentication: Begin Google sign-in with the exact application Origin. The backend binds its one-time callback to this browser and creates a Dee session after Google verification.

Parameter `Origin` (header, required). Must equal APP_ORIGIN

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/GoogleLoginRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Start one browser-bound Google login. Navigate the browser to authorization_url.",
    "headers": {
      "Set-Cookie": {
        "schema": {
          "type": "string"
        },
        "description": "Short-lived host-only dee_google_login, HttpOnly, SameSite=Lax; Secure under HTTPS"
      }
    },
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/GoogleLoginResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid JSON or navigation target",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Origin is not the configured application",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "422": {
    "description": "JSON fields do not match the login request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Identity storage or Google configuration is unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/auth/google/callback

Operation: `google_callback`. Google callback

Authentication: Google redirect callback: no existing Dee session, Dee Bearer, or Origin header is required. The backend verifies the one-time state and the browser’s dee_google_login Cookie, then returns a 303 redirect. Successful callbacks establish the Dee session; failures return a fixed safe error to sign-in.

Parameter `code` (query, optional). Single-use Google authorization code

```json
{
  "type": "string"
}
```

Parameter `state` (query, optional). State from the browser-bound login

```json
{
  "type": "string"
}
```

Parameter `error` (query, optional). Google authorization failure

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "303": {
    "description": "Sign-in establishes a Dee HttpOnly session and returns to the validated application path. Explicit linking requires the initiating browser session, preserves its cookie, and returns with login_identity=linked or login_identity_error=conflict|session_changed|google_link_failed. Failed sign-in returns to /sign-in with a fixed error code. Only matched browser binding retains the original target; unmatched callbacks use /app.",
    "headers": {
      "Location": {
        "schema": {
          "type": "string"
        },
        "description": "APP_ORIGIN plus a validated return target, or /sign-in?error=google_login_failed"
      },
      "Set-Cookie": {
        "schema": {
          "type": "string"
        },
        "description": "New Dee session only for sign-in; linking preserves it. Always clears the one-time Google login cookie."
      }
    }
  }
}
```

#### GET /api/session

Operation: `current`. Current

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `Cookie` (header, required). Current Dee v0.1 session cookie

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Login-synchronized account and currently valid Dee session; no document grant",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CurrentSessionResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "No valid current session",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Current identity cannot be verified",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/session

Operation: `logout`. Logout

Authentication: Browser session logout: Cookie and exact application Origin, with the optional original-session condition. Use POST /agent/logout for an external connection.

Parameter `Origin` (header, required). Must equal APP_ORIGIN

```json
{
  "type": "string"
}
```

Parameter `Cookie` (header, optional). Local session to revoke, if present

```json
{
  "type": [
    "string",
    "null"
  ]
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "oneOf": [
          {
            "type": "null"
          },
          {
            "$ref": "#/components/schemas/LogoutRequest"
          }
        ]
      }
    }
  }
}
```

Responses:

```json
{
  "204": {
    "description": "Cookie-derived Dee session is durably revoked. Conditional requests confirm only a matching original SID, including an already-revoked row, and leave browser cookies unchanged to preserve newer logins. Unconditional requests also succeed for absent credentials.",
    "headers": {
      "Set-Cookie": {
        "schema": {
          "type": "string"
        },
        "description": "Only an unconditional request clears the Dee v0.1 cookie"
      }
    }
  },
  "400": {
    "description": "Invalid logout condition",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid request origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Conditional Cookie is absent, unknown, or identifies a different SID. Original logout is unconfirmed; no session is revoked or cookie cleared.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Local revocation could not be confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Documents and saved versions

Create and read documents, save complete snapshots, and inspect original operation receipts.

#### GET /api/documents

Operation: `list_documents`. List documents

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `scope` (query, optional). mine (default), collaborating, space, accessible

```json
{
  "type": "string"
}
```

Parameter `space_id` (query, optional). Required only with space scope

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `title` (query, optional). Literal case-insensitive title substring

```json
{
  "type": "string"
}
```

Parameter `view` (query, optional). updated (default), viewed or favorites; intersects scope

```json
{
  "type": "string"
}
```

Parameter `extension` (query, optional). Exact explicit stored type, including unknown types. Nonempty lowercase identifier; omitted preserves all types, md differs from null.

```json
{
  "type": "string"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Comma-separated updated_at,created_at,title,readers_30d,last_viewed_at,favorited_at,pinned_at,id with asc/desc; mine/space updated views default to pinned_at.desc,updated_at.desc,id.asc; other defaults use the view timestamp descending,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current authorized summaries and counts from one snapshot",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_DocumentSummary"
        }
      }
    }
  },
  "400": {
    "description": "Invalid filter or pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents

Operation: `create_document`. Create document

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreateDocumentRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Committed creation and first immutable snapshot",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid input",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid Origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Origin unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/operations/{operation_id}

Operation: `get_document_operation`. Get document operation

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Only the actor's original result, without private content or current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No result for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}

Operation: `get_document`. Get document

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current authorized Markdown, metadata, safe HTML and TOC",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}

Operation: `save_document`. Save document

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/SaveDocumentRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed title and body snapshot, or unchanged original version",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid input",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Insufficient role or Origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Revision or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/metadata

Operation: `get_document_metadata`. Get document metadata

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Authorized metadata without body or rendered content",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentSummary"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/revisions/{revision_id}

Operation: `get_document_revision`. Get document revision

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `revision_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Immutable snapshot under current document permission",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/RevisionResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document or version unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}/view

Operation: `record_document_view`. Record document view

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Explicit actual opening retained for the current account; does not mark discussion messages read",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentViewResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid document ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current account required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid Origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Opening could not be confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Spaces and members

Manage shared workspaces and membership using current roles and revision conditions.

#### GET /api/spaces

Operation: `list`. List

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `page_index` (query, optional). Zero-based safe integer, default 0

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0..100, default 50; 0 returns count only

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Comma separated name/updated_at/id.asc|desc; default updated_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current membership-filtered Space page and count",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_SpaceResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid paging",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/spaces

Operation: `create`. Create

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreateRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Committed actor-scoped Space creation result; exact retries return it",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReceiptResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Operation ID conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Operation not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/spaces/operations/{operation_id}

Operation: `operation`. Operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Only the original actor's retained write fact; not current Space access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReceiptResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No result for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/spaces/{id}

Operation: `get`. Get

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current Space facts and role, members only",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SpaceResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No current membership or nonexistent Space",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/spaces/{id}

Operation: `update`. Update

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/UpdateRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed metadata replacement result, administrator only",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReceiptResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Insufficient role or invalid origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Revision or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/spaces/{id}/leave

Operation: `leave`. Leave

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RevisionRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed removal of this account's membership only; exact retry retains result",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReceiptResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Invalid origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Last administrator or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/spaces/{id}/members

Operation: `members`. Members

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0..100, default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Comma separated joined_at/role/account_id.asc|desc; default joined_at.asc,account_id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Member page, available only to Space members; minimum registered profiles",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_MemberResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid paging",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/spaces/{id}/members

Operation: `add_member`. Add member

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AddMemberRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Committed member addition, default editor, administrator only",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReceiptResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Insufficient role or invalid origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space or registered account unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Already member or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/spaces/{id}/members/{account_id}

Operation: `set_role`. Set role

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `account_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/SetRoleRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed member role result, administrator only",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReceiptResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Insufficient role or origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space or member unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Last administrator or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/spaces/{id}/members/{account_id}

Operation: `remove_member`. Remove member

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `account_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RevisionRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed member removal, does not change document holding or direct grants",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReceiptResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Insufficient role or origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space or member unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Last administrator or revision/operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Document access and sharing

Inspect effective access, maintain direct collaborators, and configure explicit link joining.

#### GET /api/access/operations/{operation_id}

Operation: `get_access_operation`. Get access operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Only this actor's original committed fact, independent of current document access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AccessReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No result for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/access

Operation: `get_document_access`. Get document access

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current actor's effective document role and independent sources",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentAccessResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/collaborators

Operation: `list_document_collaborators`. List document collaborators

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0..100, default 50; 0 returns count only

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Comma separated joined_at/role/account_id.asc|desc; default joined_at.asc,account_id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Direct collaborators and their effective sources, document administrator only",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_CollaboratorResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID or paging",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Administrator permission required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}/collaborators/{account_id}

Operation: `set_document_collaborator`. Set document collaborator

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `account_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/SetCollaboratorRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed direct grant creation or replacement; inherited sources remain",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AccessReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Administrator permission or valid origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document or registered account unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Access revision, operation or last administrator conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/documents/{id}/collaborators/{account_id}

Operation: `remove_document_collaborator`. Remove document collaborator

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `account_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RemoveCollaboratorRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed direct grant removal; inherited sources remain",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AccessReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Administrator permission or valid origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Access revision, operation or last administrator conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{id}/join

Operation: `join_document`. Join document

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/JoinDocumentRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed join or existing-access result; existing access is never upgraded",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AccessReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Valid origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable or joining closed for an unauthorized actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/sharing

Operation: `get_document_sharing`. Get document sharing

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current link rule and access revision, document administrator only",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SharingResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Administrator permission required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}/sharing

Operation: `set_document_sharing`. Set document sharing

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/SetSharingRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed link rule for future joins; existing grants remain",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AccessReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Administrator permission or valid origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Access revision or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Images and resources

Upload original bytes, inspect upload status, and read currently authorized resource content.

#### POST /api/resources/uploads

Operation: `upload_resource`. Upload resource

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (query, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `filename` (query, required). 

```json
{
  "type": "string"
}
```

Parameter `document_id` (query, optional). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `create_operation_id` (query, optional). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "description": "Raw file bytes, 1 byte to 20 MiB. Use a concrete Content-Type, default application/octet-stream when omitted or empty. PNG/JPEG/GIF/WebP retain matching raster-signature checks; other file types download as attachments.",
  "content": {
    "*/*": {
      "schema": {
        "type": "string",
        "format": "binary"
      }
    },
    "application/octet-stream": {
      "schema": {
        "type": "string",
        "format": "binary"
      }
    },
    "image/gif": {
      "schema": {
        "type": "string",
        "format": "binary"
      }
    },
    "image/jpeg": {
      "schema": {
        "type": "string",
        "format": "binary"
      }
    },
    "image/png": {
      "schema": {
        "type": "string",
        "format": "binary"
      }
    },
    "image/webp": {
      "schema": {
        "type": "string",
        "format": "binary"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Confirmed private upload; content is not yet published",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/UploadReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid scope, MIME or raster signature",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Current edit permission or Origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Changed upload intent AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "413": {
    "description": "File exceeds 20 MiB",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Upload pending or unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/resources/uploads/{operation_id}

Operation: `get_upload_operation`. Get upload operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Actor-only reservation or confirmed result; no current access grant",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/UploadReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No reservation for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/resources/{id}

Operation: `get_resource`. Get resource

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current authorized resource metadata",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ResourceMetadata"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Resource unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/resources/{id}/content

Operation: `get_resource_content`. Get resource content

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Verified private original bytes; PNG/JPEG/GIF/WebP inline, every other MIME type as an attachment with a UTF-8 filename",
    "content": {
      "image/png": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      },
      "image/jpeg": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      },
      "image/gif": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      },
      "image/webp": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      },
      "application/octet-stream": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      },
      "*/*": {
        "schema": {
          "type": "string",
          "format": "binary"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Resource unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Original unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Messages and threads

Publish and maintain messages, quote exact passages, and read discussions and their context.

#### GET /api/communication/operations/{operation_id}

Operation: `get_communication_operation`. Get communication operation

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Actor-only minimal original receipt; no current content or access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Receipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No result for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/messages

Operation: `list_messages`. List messages

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `thread_id` (query, optional). Absent: main messages. Present: replies in this Thread

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `read_boundary_message_id` (query, optional). Reuse the returned main/Thread boundary to preserve page membership during new messages

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). Default 50, maximum 100; zero returns counts only

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). created_at or id with asc/desc; default created_at.asc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Messages and current authorized counts from one snapshot",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/MessagePageResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid query",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document or Thread unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{id}/messages

Operation: `send_message`. Send message

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/SendRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Committed message and original minimal receipt",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Receipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid content or source selection",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Edit role or Origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document, reply or source unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Operation or source conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Unconfirmed result",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/messages/{message_id}

Operation: `get_message`. Get message

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `message_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Currently authorized message or deletion placeholder",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/MessageResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Unavailable target",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}/messages/{message_id}

Operation: `edit_message`. Edit message

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `message_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/EditRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed edit or unchanged original snapshot",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Receipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid content",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Current author edit role required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Unavailable target or source",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Version, deleted, source or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Unconfirmed result",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/documents/{id}/messages/{message_id}

Operation: `delete_message`. Delete message

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `message_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/DeleteRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed deletion or existing tombstone",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Receipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Current author or administrator role required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Target unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Version or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Unconfirmed result",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/messages/{message_id}/context

Operation: `get_message_context`. Get message context

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `message_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `before` (query, optional). Default 10, maximum 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `after` (query, optional). Default 10, maximum 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Stable-ID context in the message's actual main/Thread range",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ContextResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid context range",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Target unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/threads/{thread_id}

Operation: `get_thread`. Get thread

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `thread_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Root, retained reply count and most recent reply time",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ThreadResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Target unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "New entry shape requires the common entry read_url AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Changes and continuation

Read authorized change batches using opaque cursors, bootstrap fences, and long polling.

#### GET /api/agents/me/changes

Operation: `get_agent_changes`. Get agent changes

Authentication: Independent Agent opaque Bearer with X-Dee-Expected-Agent-Id. No browser Cookie. The authenticated Agent, current scope, resource permissions, and work conditions determine access.

Parameter `cursor` (query, optional). 

```json
{
  "type": "string"
}
```

Parameter `max_events` (query, optional). 

```json
{
  "type": "integer",
  "format": "int32",
  "minimum": 0
}
```

Parameter `wait_ms` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `include_activities` (query, optional). Include typed activities using a separately bound cursor; default false

```json
{
  "type": "boolean"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ChangeFeed"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/changes

Operation: `personal_document_changes`. Personal document changes

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `cursor` (query, optional). 

```json
{
  "type": "string"
}
```

Parameter `max_events` (query, optional). 

```json
{
  "type": "integer",
  "format": "int32",
  "minimum": 0
}
```

Parameter `wait_ms` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `include_activities` (query, optional). Include typed activities using a separately bound cursor; default false

```json
{
  "type": "boolean"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "This account's personal document and tree changes",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ChangeFeed"
        }
      }
    }
  },
  "400": {
    "description": "Invalid parameters",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Explicit resync required AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Discovery unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/changes

Operation: `document_changes`. Document changes

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `cursor` (query, optional). Absent: bootstrap boundary before current reads; reuse for replay/resume

```json
{
  "type": "string"
}
```

Parameter `max_events` (query, optional). Default 100, 1 to 200

```json
{
  "type": "integer",
  "format": "int32",
  "minimum": 0
}
```

Parameter `wait_ms` (query, optional). Default 0, at most 25000; no database connection held during waits

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `include_activities` (query, optional). Include typed activities using a separately bound cursor; default false

```json
{
  "type": "boolean"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Ordered committed identities under current access, or bootstrap boundary",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ChangeFeed"
        }
      }
    }
  },
  "400": {
    "description": "Invalid parameters",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Scope unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Invalid cursor; explicit reset boundary and current reads required AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Resume original cursor after recovery",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/spaces/{id}/changes

Operation: `space_changes`. Space changes

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `cursor` (query, optional). Absent: bootstrap boundary before current reads; scoped to current member

```json
{
  "type": "string"
}
```

Parameter `max_events` (query, optional). Default 100, 1 to 200

```json
{
  "type": "integer",
  "format": "int32",
  "minimum": 0
}
```

Parameter `wait_ms` (query, optional). Default 0, at most 25000

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `include_activities` (query, optional). Include typed activities using a separately bound cursor; default false

```json
{
  "type": "boolean"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Space and its document changes under current membership",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ChangeFeed"
        }
      }
    }
  },
  "400": {
    "description": "Invalid parameters",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Scope unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Explicit resync required AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Discovery unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Personal follow-up

Maintain personal read progress, following, mute preferences, and notification confirmations.

#### GET /api/attention/following

Operation: `list_followed_threads`. List followed threads

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). Default 50, maximum 100; zero returns authorized counts

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). updated_at,id; default updated_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Currently readable followed Threads; no read or follow mutation",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_StateResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/attention/notifications

Operation: `list_notifications`. List notifications

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `unread` (query, optional). Active unread filters exclude deleted sources

```json
{
  "type": "boolean"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). Default 50, maximum 100; zero returns authorized counts

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). updated_at,created_at,id; default updated_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Receiver-only notifications under current document access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_NotificationResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/attention/notifications/{id}

Operation: `get_notification`. Get notification

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current receiver-owned source metadata or deletion placeholder",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/NotificationResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/attention/notifications/{id}/read

Operation: `read_notification`. Read notification

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/NotificationReadRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Explicit notification acknowledgement under its observed revision",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AttentionReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/attention/operations/{id}

Operation: `get_attention_operation`. Get attention operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Actor-only original minimal result; no current content access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AttentionReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/attention/summary

Operation: `attention_summary`. Attention summary

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Receiver-only counts after current access filtering",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SummaryResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/attention

Operation: `main_attention`. Main attention

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Main reading state and current authorized unread counts; no mutation",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/StateResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{id}/attention/read

Operation: `mark_main_read`. Mark main read

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ReadRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Explicit monotone main message read position; independent of notification acknowledgement",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AttentionReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/favorite

Operation: `get_document_favorite`. Get document favorite

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "The current account's document favorite; no reading side effects",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/FavoriteResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}/favorite

Operation: `set_document_favorite`. Set document favorite

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/FavoriteRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Original account-only favorite result; explicit set, without CAS or discussion effects",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AttentionReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/threads/{thread_id}/attention

Operation: `thread_attention`. Thread attention

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `thread_id` (path, required). A main message's stable root identity, including before its first reply

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Thread preferences and independent reply read state",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/StateResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}/threads/{thread_id}/attention

Operation: `set_thread_preferences`. Set thread preferences

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `thread_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/PreferencesRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Original preference result; zero baseline for default state",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AttentionReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{id}/threads/{thread_id}/attention/read

Operation: `mark_thread_read`. Mark thread read

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `thread_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ReadRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Explicit monotone reply read position; main root has a separate reading scope",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AttentionReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in the trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/favorites

Operation: `list_favorite_documents`. List favorite documents

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `space_id` (query, optional). Optional current member Space; omission aggregates all readable sources

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `title` (query, optional). 

```json
{
  "type": "string"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Same document ordering fields; default favorited_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_DocumentSummary"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Trash and restoration

Review current management conditions and move or restore documents without changing their identity.

#### GET /api/documents/lifecycle/operations/{operation_id}

Operation: `get_document_lifecycle_operation`. Get document lifecycle operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Only the actor's original lifecycle result, no current permission",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/LifecycleReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No lifecycle result for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/trash

Operation: `list_document_trash`. List document trash

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `scope` (query, optional). all (default), mine, collaborating, space

```json
{
  "type": "string"
}
```

Parameter `space_id` (query, optional). Only space scope; current membership required

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `title` (query, optional). Literal case-insensitive title substring

```json
{
  "type": "string"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Comma-separated trashed_at,updated_at,title,id asc/desc; default trashed_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current administrator metadata and filtered counts, without contents or tokens",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_TrashSummary"
        }
      }
    }
  },
  "400": {
    "description": "Invalid filter or pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/lifecycle

Operation: `get_document_lifecycle`. Get document lifecycle

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current administrator metadata and comparison token without common content",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/LifecycleResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid 22-character Base62 ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Current administrator required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{id}/restore

Operation: `restore_document`. Restore document

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/LifecycleRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Same Document restored; link joining closed in the same transaction",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/LifecycleReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Current administrator or Origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Review current impact or original intent conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{id}/trash

Operation: `trash_document`. Trash document

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/LifecycleRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed lifecycle result, or original minimal result",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/LifecycleReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Current administrator or Origin required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Management facts or original intent changed AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Service status

Distinguish process health, dependency readiness, and the running version.

#### GET /health

Operation: `health`. Health

Authentication: Public endpoint; readiness or recovery conditions can still affect availability.

Responses:

```json
{
  "200": {
    "description": "The HTTP process is alive; no dependency check.",
    "headers": {
      "x-request-id": {
        "schema": {
          "type": "string"
        },
        "description": "Server-generated request correlation ID"
      }
    },
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/HealthResponse"
        }
      }
    }
  }
}
```

#### GET /ready

Operation: `ready`. Ready

Authentication: Public endpoint; readiness or recovery conditions can still affect availability.

Responses:

```json
{
  "200": {
    "description": "PostgreSQL and storage are available, recovery opening control is verified, and document links initialization is complete.",
    "headers": {
      "x-request-id": {
        "schema": {
          "type": "string"
        },
        "description": "Server-generated request correlation ID"
      }
    },
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ReadyResponse"
        }
      }
    }
  },
  "503": {
    "description": "A dependency or recovery opening control is unavailable. data.dependencies lists safe component statuses.",
    "headers": {
      "x-request-id": {
        "schema": {
          "type": "string"
        },
        "description": "Server-generated request correlation ID"
      }
    },
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /version

Operation: `version`. Version

Authentication: Public endpoint; readiness or recovery conditions can still affect availability.

Responses:

```json
{
  "200": {
    "description": "Version and build commit",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/VersionResponse"
        }
      }
    }
  }
}
```

### Agent login

HTTP operations from the current OpenAPI contract.

#### POST /agent/login/approve

Operation: `approve_agent_login`. Approve agent login

Authentication: Current browser Cookie and exact application Origin. Only the personal owner or Space administrator may approve an independent Agent connection. An opaque Bearer cannot approve a connection. X-Dee-Expected-Account-Id pins the human.

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AgentLoginApproveRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "204": {
    "description": "The browser decision was recorded."
  }
}
```

#### POST /agent/login/poll

Operation: `poll_agent_login`. Poll agent login

Authentication: Prove possession of this request’s original device_secret in the JSON body.

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AgentLoginPollRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentLoginPollResponse"
        }
      }
    }
  }
}
```

#### POST /agent/login/start

Operation: `start_agent_login`. Start agent login

Authentication: No existing Dee credential is required to begin a request. This does not authorize access.

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AgentLoginStartRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentLoginStartResponse"
        }
      }
    }
  }
}
```

### Agent documents

HTTP operations from the current OpenAPI contract.

#### POST /api/agent-documents

Operation: `create_agent_document`. Create agent document

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreateAgentDocumentRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Agent main document and configuration committed at the explicit location; Pages are created as needed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentDocumentReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid input or parent location",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Space administrator required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Origin or parent unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Original operation input conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/agent-documents/operations/{operation_id}

Operation: `get_agent_document_operation`. Get agent document operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Only this actor's original minimal initialization or related-document receipt",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentDocumentOperationReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No result for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/agent-documents/{id}

Operation: `get_agent_document`. Get agent document

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current readable Agent document associations and management qualification",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentDocumentDetail"
        }
      }
    }
  },
  "400": {
    "description": "Invalid identity",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Agent document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Agent document in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/agent-documents/{id}/documents

Operation: `create_agent_related_document`. Create agent related document

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreateRelatedDocumentRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "New ordinary document and association committed together; purpose also fills the empty Configuration binding group atomically, retaining initial document markers",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/RelatedDocumentReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid input or missing expected_revision with purpose",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Management qualification required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Agent document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Original operation input conflict, configuration revision conflict, or built-in already bound AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Agent document in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Agent connections

HTTP operations from the current OpenAPI contract.

#### GET /api/agent/connections

Operation: `agent_connections`. Agent connections

Authentication: Current browser Dee session Cookie only. Authorization headers, including opaque Dee Bearers, are rejected. This read does not require an Origin header. The optional X-Dee-Expected-Account-Id pins the current account.

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Comma-separated id, authorized_at or last_used_at with .asc/.desc; default authorized_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. The current browser Dee session Cookie remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Responses:

```json
{
  "200": {
    "description": "Current account's safe Agent connection metadata; browser session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentConnectionsResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid page or ordering",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current browser session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Identity storage unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/agent/connections

Operation: `revoke_agent_connections`. Revoke agent connections

Authentication: Current browser Dee session Cookie only. Authorization headers, including opaque Dee Bearers, are rejected. Revocation requires the exact application Origin. The optional X-Dee-Expected-Account-Id pins the current account.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. The current browser Dee session Cookie remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RevokeConnectionsRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "204": {
    "description": "Reviewed Agent generation revoked, including legacy clients. Retries preserve newer grants and browser sessions."
  },
  "400": {
    "description": "Invalid generation",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current browser session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Connection generation unavailable; reload the list AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Revocation was not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/agent/connections/{id}

Operation: `revoke_agent_connection`. Revoke agent connection

Authentication: Current browser Dee session Cookie only. Authorization headers, including opaque Dee Bearers, are rejected. Revocation requires the exact application Origin. The optional X-Dee-Expected-Account-Id pins the current account.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. The current browser Dee session Cookie remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Responses:

```json
{
  "204": {
    "description": "Owned client revoked; already-revoked owned connections are idempotent"
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current browser session required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Client unavailable to this account",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Revocation was not confirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Agents

HTTP operations from the current OpenAPI contract.

#### GET /api/agents/me

Operation: `get_agent_me`. Get agent me

Authentication: Independent Agent opaque Bearer with X-Dee-Expected-Agent-Id. No browser Cookie. The authenticated Agent, current scope, resource permissions, and work conditions determine access.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentMe"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/agents/me/documents

Operation: `list_agent_documents`. List agent documents

Authentication: Independent Agent opaque Bearer with X-Dee-Expected-Agent-Id. No browser Cookie. The authenticated Agent, current scope, resource permissions, and work conditions determine access.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_DocumentSummary"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/agents/{agent_id}

Operation: `get_agent_configuration`. Get agent configuration

Authentication: Current authorized browser user or independent Agent Bearer. Bind the original actor with X-Dee-Expected-Account-Id or X-Dee-Expected-Agent-Id respectively. A read is current evidence, not cached authority to execute.

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Configuration"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/agents/{agent_id}

Operation: `save_agent_configuration`. Save agent configuration

Authentication: Real browser Dee session only. Current owner/Space administrator manages Agent settings and connections; current document permissions govern decisions and control. Browser mutations require the exact application Origin and X-Dee-Expected-Account-Id pins the human. A tool or service Bearer cannot replace the browser confirmation.

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AgentConfigurationRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentConfigurationReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/agents/{agent_id}/connections

Operation: `list_agent_service_connections`. List agent service connections

Authentication: Real browser Dee session only. Current owner/Space administrator manages Agent settings and connections; current document permissions govern decisions and control. Browser mutations require the exact application Origin and X-Dee-Expected-Account-Id pins the human. A tool or service Bearer cannot replace the browser confirmation.

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_ServiceConnection"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/agents/{agent_id}/connections/{connection_id}

Operation: `revoke_agent_service_connection`. Revoke agent service connection

Authentication: Real browser Dee session only. Current owner/Space administrator manages Agent settings and connections; current document permissions govern decisions and control. Browser mutations require the exact application Origin and X-Dee-Expected-Account-Id pins the human. A tool or service Bearer cannot replace the browser confirmation.

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `connection_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "204": {
    "description": ""
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/agents

Operation: `list_document_agents`. List document agents

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_MentionCandidate"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{document_id}/collaborators/agents/{agent_id}

Operation: `set_agent_document_grant`. Set agent document grant

Authentication: Real browser Dee session only. Current owner/Space administrator manages Agent settings and connections; current document permissions govern decisions and control. Browser mutations require the exact application Origin and X-Dee-Expected-Account-Id pins the human. A tool or service Bearer cannot replace the browser confirmation.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/AgentGrantRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentGrantReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### DELETE /api/documents/{document_id}/collaborators/agents/{agent_id}

Operation: `remove_agent_document_grant`. Remove agent document grant

Authentication: Real browser Dee session only. Current owner/Space administrator manages Agent settings and connections; current document permissions govern decisions and control. Browser mutations require the exact application Origin and X-Dee-Expected-Account-Id pins the human. A tool or service Bearer cannot replace the browser confirmation.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RemoveAgentGrantRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AgentGrantReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Agent collaboration

HTTP operations from the current OpenAPI contract.

#### POST /api/agents/me/disclosure-check

Operation: `check_agent_disclosure`. Check agent disclosure

Authentication: Independent Agent opaque Bearer with X-Dee-Expected-Agent-Id. No browser Cookie. The authenticated Agent, current scope, resource permissions, and work conditions determine access.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/DisclosureCheckRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Current reader-set relation, not output or write approval",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DisclosureCheckResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/agents/operations/{operation_id}

Operation: `get_agent_protocol_operation`. Get agent protocol operation

Authentication: Current authorized browser user or independent Agent Bearer. Bind the original actor with X-Dee-Expected-Account-Id or X-Dee-Expected-Agent-Id respectively. A read is current evidence, not cached authority to execute.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Original actor's minimal receipt",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ProtocolOperationResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{document_id}/agent-plans

Operation: `submit_agent_plan`. Submit agent plan

Authentication: Independent Agent opaque Bearer with X-Dee-Expected-Agent-Id. No browser Cookie. The authenticated Agent, current scope, resource permissions, and work conditions determine access.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/PlanRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Immutable plan and protected discussion record",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PlanReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/agent-plans/{plan_id}

Operation: `get_agent_plan`. Get agent plan

Authentication: Current authorized browser user or independent Agent Bearer. Bind the original actor with X-Dee-Expected-Account-Id or X-Dee-Expected-Agent-Id respectively. A read is current evidence, not cached authority to execute.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `plan_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current authorized plan and execution facts",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PlanRead"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{document_id}/agent-plans/{plan_id}/decisions

Operation: `decide_agent_plan`. Decide agent plan

Authentication: Real browser Dee session only. Current owner/Space administrator manages Agent settings and connections; current document permissions govern decisions and control. Browser mutations require the exact application Origin and X-Dee-Expected-Account-Id pins the human. A tool or service Bearer cannot replace the browser confirmation.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `plan_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/DecisionRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Browser-human decision",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DecisionReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/threads/{root}/agent-control

Operation: `get_agent_control`. Get agent control

Authentication: Current authorized browser user or independent Agent Bearer. Bind the original actor with X-Dee-Expected-Account-Id or X-Dee-Expected-Agent-Id respectively. A read is current evidence, not cached authority to execute.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `root` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current work control; active does not mean running",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Control"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{document_id}/threads/{root}/agent-control

Operation: `set_agent_control`. Set agent control

Authentication: Real browser Dee session only. Current owner/Space administrator manages Agent settings and connections; current document permissions govern decisions and control. Browser mutations require the exact application Origin and X-Dee-Expected-Account-Id pins the human. A tool or service Bearer cannot replace the browser confirmation.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `root` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ControlRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Human stop/restart recorded",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ControlWriteResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/threads/{root}/agent-feedback/{agent_id}

Operation: `get_agent_feedback`. Get agent feedback

Authentication: Current authorized browser user or independent Agent Bearer. Bind the original actor with X-Dee-Expected-Account-Id or X-Dee-Expected-Agent-Id respectively. A read is current evidence, not cached authority to execute.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `root` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Latest received report and current control",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/FeedbackRead"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{document_id}/threads/{root}/agent-feedback/{agent_id}

Operation: `report_agent_feedback`. Report agent feedback

Authentication: Independent Agent opaque Bearer with X-Dee-Expected-Agent-Id. No browser Cookie. The authenticated Agent, current scope, resource permissions, and work conditions determine access.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `root` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `agent_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/FeedbackRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "New protected factual report",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/FeedbackReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Pages

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/page-operations/{operation_id}

Operation: `get_page_operation`. Get page operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/pages

Operation: `list_document_pages`. List document pages

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `state` (query, optional). active (default) or deleted; deleted requires edit permission

```json
{
  "type": "string"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). created_at,title,updated_at,id; default created_at.asc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_PageSummary"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{document_id}/pages

Operation: `create_document_page`. Create document page

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreatePageRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/pages/by-key

Operation: `find_document_page_by_key`. Find document page by key

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `key` (query, required). Exact current key within this Document

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/pages/{page_id}

Operation: `get_document_page`. Get document page

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{document_id}/pages/{page_id}

Operation: `save_document_page`. Save document page

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/SavePageRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{document_id}/pages/{page_id}/key

Operation: `set_document_page_key`. Set document page key

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/PageKeyRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{document_id}/pages/{page_id}/restore

Operation: `restore_document_page`. Restore document page

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/PageLifecycleRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/pages/{page_id}/revisions

Operation: `list_page_revisions`. List page revisions

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). created_at,id; default created_at.desc,id.desc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageHistoryResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{document_id}/pages/{page_id}/revisions/{revision_id}

Operation: `get_page_revision`. Get page revision

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `revision_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageRevisionResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{document_id}/pages/{page_id}/trash

Operation: `trash_document_page`. Trash document page

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `document_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/PageLifecycleRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PageReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Document pins

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/pin-operations/{operation_id}

Operation: `get_document_pin_operation`. Get document pin operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "This actor's minimal original pin result; grants no current document access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PinReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/pin

Operation: `get_document_pin`. Get document pin

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Origin-owned pin state and current permission, without reading side effects",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PinResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/documents/{id}/pin

Operation: `set_document_pin`. Set document pin

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/PinRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Original explicit pin result; personal holder or Space administrator required for a new operation",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PinReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Document tree

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/tree

Operation: `get_personal_document_tree`. Get personal document tree

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). position,title,id; default position.asc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "This account's active document nodes and structure version",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/PersonalDocumentTree"
        }
      }
    }
  },
  "400": {
    "description": "Invalid pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/tree-operations/{operation_id}

Operation: `get_document_tree_operation`. Get document tree operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Only this actor's original minimal placement receipt",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TreeMoveReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "No result for this actor",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/documents/{id}/move

Operation: `move_document`. Move document

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/MoveDocumentRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Committed placement or original exact retry receipt",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TreeMoveReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid parent or cycle",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Origin authority or document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "Structure or operation conflict AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Result unconfirmed",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/spaces/{id}/tree

Operation: `get_space_document_tree`. Get space document tree

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). position,title,id; default position.asc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Active document nodes and structure version in one Space-member snapshot",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SpaceDocumentTree"
        }
      }
    }
  },
  "400": {
    "description": "Invalid pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space membership unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Attachments

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/{id}/attachments

Operation: `list_document_attachments`. List document attachments

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `scope` (query, optional). body (default), main, or thread; thread includes root and replies

```json
{
  "type": "string"
}
```

Parameter `revision_id` (query, optional). Only body; omission selects the current Revision

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `thread_id` (query, optional). Required root message identity only with scope=thread

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). Zero-based safe integer, default 0

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0..100, default 50; zero returns count only

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). source_created_at/source_id/resource_id with .asc/.desc; unique source/resource ties are appended

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Selected attachment references and object-level sources under current document access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AttachmentList"
        }
      }
    }
  },
  "400": {
    "description": "Invalid target, scope, selectors or pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document or selected source unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in trash under current access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Document links

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/{id}/backlinks

Operation: `list_document_backlinks`. List document backlinks

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). title,updated_at,id asc/desc; default updated_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current visible incoming document relationships",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentLinkPage"
        }
      }
    }
  },
  "400": {
    "description": "Invalid ID or pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Anchor unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Anchor is in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/links

Operation: `list_document_links`. List document links

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). title,updated_at,id asc/desc; default updated_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current visible outgoing document relationships",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/DocumentLinkPage"
        }
      }
    }
  },
  "400": {
    "description": "Invalid ID or pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Anchor unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Anchor is in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Entries

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/{id}/entries

Operation: `list_entries`. List entries

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `thread_id` (query, optional). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `read_boundary_entry_id` (query, optional). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `kind` (query, optional). all (default), messages or activities

```json
{
  "$ref": "#/components/schemas/EntryKind"
}
```

Parameter `event_type` (query, optional). 

```json
{
  "type": "string"
}
```

Parameter `changed_field` (query, optional). 

```json
{
  "type": "string"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). 

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/EntryPageResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/entries/{entry_id}

Operation: `get_entry`. Get entry

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `entry_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/EntryResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/entries/{entry_id}/context

Operation: `get_entry_context`. Get entry context

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `entry_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `before` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `after` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/EntryContextResponse"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/entries/{entry_id}/thread

Operation: `get_entry_thread`. Get entry thread

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `entry_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/EntryThreadResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Document history

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/{id}/revisions

Operation: `list_document_revisions`. List document revisions

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Comma-separated created_at,id asc/desc; default created_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current authorized revision metadata and current identity from one snapshot",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/RevisionHistoryResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid pagination or ID",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/documents/{id}/revisions/diff

Operation: `diff_document_revisions`. Diff document revisions

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `from_revision_id` (query, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `to_revision_id` (query, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Complete immutable comparison or an explicit work/output budget result",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/RevisionDiffResponse"
        }
      }
    }
  },
  "400": {
    "description": "Both exact Revision IDs are required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document or Revision unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read or execution capacity unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Document source

HTTP operations from the current OpenAPI contract.

#### GET /api/documents/{id}/source

Operation: `get_document_source`. Get document source

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `revision_id` (query, optional). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `view` (query, optional). markdown (default) or outline

```json
{
  "type": "string"
}
```

Parameter `start` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `end` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `max_bytes` (query, optional). Markdown bytes, 4 to 131072; default 32768

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). Outline only, 0 to 100; default 50

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). Outline only: position.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Selected immutable source without HTML",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SourceResponse"
        }
      }
    }
  },
  "400": {
    "description": "Invalid source view, range or pagination",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current identity required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Document or Revision unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Document is in trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Read unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Search

HTTP operations from the current OpenAPI contract.

#### POST /api/search

Operation: `search_content`. Search content

Authentication: Current browser user, ordinary human-account connector, or independent Agent Bearer. An Agent uses X-Dee-Expected-Agent-Id and current scope permissions; actual document writes additionally require the approved plan or bound-memory authorization. Browser mutations require the exact application Origin.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/SearchRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Exact scoped content results and count from one authorized snapshot; read-only and no-store",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_SearchResult"
        }
      }
    }
  },
  "400": {
    "description": "Invalid literal terms, scope, ID, kind, JSON or Pos",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "Current session or Agent credential required",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Explicit document or member Space unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "Explicit authorized document is in the trash",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Search storage or execution budget unavailable; no partial results",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Tasks

HTTP operations from the current OpenAPI contract.

#### POST /api/tasks

Operation: `create_task`. Create task

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/CreateTaskRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "201": {
    "description": "Task source, first versions, creation activity and assignment notification committed together",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/tasks/operations/{operation_id}

Operation: `get_task_operation`. Get task operation

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `operation_id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Only the authenticated human actor's original minimal Task receipt; does not grant current target access",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "Invalid request or expected account header.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/tasks/{id}

Operation: `get_task`. Get task

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "Current authorized source, Task fields, three condition identities and newest activity",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskDetail"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### GET /api/tasks/{id}/activities

Operation: `list_task_activities`. List task activities

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `page_index` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `page_size` (query, optional). 

```json
{
  "type": "integer",
  "format": "int64",
  "minimum": 0
}
```

Parameter `order_by` (query, optional). created_at or id, comma-separated asc/desc; default created_at.desc,id.asc

```json
{
  "type": "string"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `X-Dee-Expected-Agent-Id` (header, optional). Required for independent Agent requests; omitted for human requests. Send the original Agent ID with the Agent connection Bearer; a different Agent returns 409 AgentChanged. Do not combine with X-Dee-Expected-Account-Id.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Responses:

```json
{
  "200": {
    "description": "One currently authorized Task's activity in an authorized count/page snapshot; each handoff note is bounded to 8192 UTF-8 bytes",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/Paged_TaskActivity"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/tasks/{id}/claim

Operation: `claim_task`. Claim task

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/ClaimTaskRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PUT /api/tasks/{id}/description

Operation: `save_task_description`. Save task description

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/TaskDescriptionRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Title and complete free description merged with the latest entire frontmatter",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### PATCH /api/tasks/{id}/fields

Operation: `update_task_fields`. Update task fields

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/TaskFieldsRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/tasks/{id}/handoff

Operation: `handoff_task`. Handoff task

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/HandoffTaskRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Explicit assignee and optional status take effect immediately; a note is published only with a real fields change",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/tasks/{id}/restore-description

Operation: `restore_task_description`. Restore task description

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RestoreTaskDescriptionRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Selected historical title and description restored while preserving the latest entire frontmatter",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /api/tasks/{id}/restore-source

Operation: `restore_task_source`. Restore task source

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `id` (path, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/RestoreTaskSourceRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Explicit complete historical source restored under the reviewed full Revision CAS and current assignment qualification",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskReceipt"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": " AccountChanged: current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "410": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Task collections

HTTP operations from the current OpenAPI contract.

#### POST /api/tasks/query

Operation: `query_tasks`. Query tasks

Authentication: Current human-account connector Bearer, or the browser Dee session. Independent Agent Service access is limited to its documented Phase 1 subset. Cookie mutations require the exact application Origin. Bearer requests must omit Cookie; any supplied Origin must match the application. Current resource permissions apply.

Parameter `X-Dee-Expected-Account-Id` (header, optional). Original Dee account ID. Current Dee Cookie or human-authorized native-client Bearer remains the credential; another account returns 409 AccountChanged before reading or writing actor-scoped facts. Same-account new sessions remain compatible.

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

Parameter `Authorization` (header, optional). Bearer opaque Dee credential from agent browser authorization. Browser requests continue to use the current Cookie and Origin.

```json
{
  "type": "string"
}
```

Request body:

```json
{
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/TaskCollectionRequest"
      }
    }
  },
  "required": true
}
```

Responses:

```json
{
  "200": {
    "description": "Current authorized Task summaries, count and five-state totals from one bounded read snapshot; no business mutation",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/TaskCollection"
        }
      }
    }
  },
  "400": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "Cookie POST requires the configured Origin",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "404": {
    "description": "Space membership unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "409": {
    "description": "AccountChanged: the current Cookie belongs to another account; no actor-scoped action was performed.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "Source projection, condition evidence or read budget unavailable",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

### Authorization & MCP

These runtime protocols are documented from the implemented connector. They are supplemental to the downloadable OpenAPI contract.

#### GET /agent/connect

Operation: `agent_consent_page`. Review access in the browser

Current runtime protocol; not part of the downloadable OpenAPI declaration.

Authentication: Browser Dee session. A signed-out person is redirected through sign-in and returns to this request.

Parameter `request` (query, required). 

```json
{
  "$ref": "#/components/schemas/Id"
}
```

Responses:

```json
{
  "200": {
    "description": "HTML approval page displaying the client, signed-in account, and verification code.",
    "content": {
      "text/html": {
        "schema": {
          "type": "string"
        }
      }
    }
  },
  "303": {
    "description": "Continue through browser sign-in."
  },
  "400": {
    "description": "The request could not be accepted or confirmed. Inspect HTTP status, name, and data.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "401": {
    "description": "The request could not be accepted or confirmed. Inspect HTTP status, name, and data.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "The request could not be accepted or confirmed. Inspect HTTP status, name, and data.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

#### POST /mcp

Operation: `document_mcp`. Use the document tools over JSON-RPC

Current runtime protocol; not part of the downloadable OpenAPI declaration.

Authentication: Opaque Dee Bearer only; no browser Cookie. Current document permissions apply to every tool.

Request body:

```json
{
  "required": true,
  "content": {
    "application/json": {
      "schema": {
        "$ref": "#/components/schemas/McpRequest"
      }
    }
  }
}
```

Responses:

```json
{
  "200": {
    "description": "JSON-RPC response. Domain tool failures use result.isError=true; syntax and parameter failures use JSON-RPC error objects.",
    "content": {
      "application/json": {
        "schema": {
          "type": "object"
        }
      }
    }
  },
  "202": {
    "description": "Valid notification accepted; empty response body."
  },
  "401": {
    "description": "The request could not be accepted or confirmed. Inspect HTTP status, name, and data.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "403": {
    "description": "The request could not be accepted or confirmed. Inspect HTTP status, name, and data.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  },
  "503": {
    "description": "The request could not be accepted or confirmed. Inspect HTTP status, name, and data.",
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ErrorBody"
        }
      }
    }
  }
}
```

## Data models

### AccessReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "revision",
    "effect"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision": {
      "type": "integer",
      "format": "int64"
    },
    "role": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/AccessRole"
        }
      ]
    },
    "target_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "target_agent_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### AccessRole

```json
{
  "type": "string",
  "enum": [
    "viewer",
    "editor",
    "administrator"
  ]
}
```

### AccessSourceResponse

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "role",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "agent_scope"
          ]
        },
        "role": {
          "$ref": "#/components/schemas/AccessRole"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "account_id",
        "kind"
      ],
      "properties": {
        "account_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "personal_holding"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "space_id",
        "role",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "space_membership"
          ]
        },
        "role": {
          "$ref": "#/components/schemas/AccessRole"
        },
        "space_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "role",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "direct_grant"
          ]
        },
        "role": {
          "$ref": "#/components/schemas/AccessRole"
        }
      }
    }
  ]
}
```

### AccountResponse

```json
{
  "type": "object",
  "required": [
    "id"
  ],
  "properties": {
    "avatar_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "email": {
      "type": [
        "string",
        "null"
      ]
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### ActivityData

```json
{
  "type": "object",
  "description": "A versioned business payload. Unknown types retain their original structure.",
  "required": [
    "event_type",
    "detail_version",
    "fields",
    "details"
  ],
  "properties": {
    "detail_version": {
      "type": "integer",
      "format": "int32",
      "minimum": 0
    },
    "details": {},
    "event_type": {
      "type": "string"
    },
    "fields": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "legacy_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "source_operation_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "source_operation_owner": {
      "type": [
        "string",
        "null"
      ]
    },
    "source_revision_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### ActivityResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "author",
    "created_at",
    "version",
    "activity",
    "quote_text",
    "source_status",
    "entry_url"
  ],
  "properties": {
    "activity": {
      "$ref": "#/components/schemas/ActivityData"
    },
    "author": {
      "$ref": "#/components/schemas/AuthorResponse"
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "entry_url": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "quote_text": {
      "type": "string"
    },
    "source_status": {
      "type": "string"
    },
    "source_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "thread": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/ThreadSummary"
        }
      ]
    },
    "version": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### ActorId

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "account_id",
        "kind"
      ],
      "properties": {
        "account_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "user"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "agent_id",
        "kind"
      ],
      "properties": {
        "agent_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "agent"
          ]
        }
      }
    }
  ]
}
```

### AddMemberRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "account_id"
  ],
  "properties": {
    "account_id": {
      "$ref": "#/components/schemas/Id"
    },
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "role": {
      "$ref": "#/components/schemas/MemberRole"
    }
  },
  "additionalProperties": false
}
```

### AgentBuiltinPurpose

```json
{
  "type": "string",
  "enum": [
    "definition",
    "memory"
  ]
}
```

### AgentConfigurationReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "agent_id",
    "revision"
  ],
  "properties": {
    "agent_id": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### AgentConfigurationRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "response_mode",
    "scope_role",
    "definition_document_ids",
    "memory_document_ids"
  ],
  "properties": {
    "definition_document_ids": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "expected_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "memory_document_ids": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "response_mode": {
      "$ref": "#/components/schemas/ResponseMode"
    },
    "scope_role": {
      "$ref": "#/components/schemas/AgentRole"
    }
  },
  "additionalProperties": false
}
```

### AgentConnectionResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "client_name",
    "authorized_at",
    "expires_at",
    "status"
  ],
  "properties": {
    "authorized_at": {
      "type": "integer",
      "format": "int64"
    },
    "client_name": {
      "type": "string"
    },
    "expires_at": {
      "type": "integer",
      "format": "int64"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "last_used_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "revoked_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "status": {
      "$ref": "#/components/schemas/ConnectionStatus"
    }
  }
}
```

### AgentConnectionsResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Paged_AgentConnectionResponse"
    },
    {
      "type": "object",
      "required": [
        "generation"
      ],
      "properties": {
        "generation": {
          "type": "string",
          "description": "Opaque decimal generation used to safely retry revoke-all without affecting newer grants."
        }
      }
    }
  ]
}
```

### AgentContext

```json
{
  "type": "object",
  "required": [
    "document_id",
    "root_message_id",
    "control_revision",
    "authorization"
  ],
  "properties": {
    "authorization": {
      "$ref": "#/components/schemas/Authorization"
    },
    "control_revision": {
      "type": "string"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "root_message_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### AgentDocumentDetail

```json
{
  "type": "object",
  "required": [
    "document_id",
    "can_manage",
    "related_documents"
  ],
  "properties": {
    "can_manage": {
      "type": "boolean"
    },
    "definition_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "The immutable initial Definition document. Current bindings are in Agent Configuration."
        }
      ]
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "memory_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "The immutable initial Memory document. Current bindings are in Agent Configuration."
        }
      ]
    },
    "related_documents": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/AgentRelatedDocument"
      },
      "description": "Only active related documents this viewer can currently read; links do not grant access."
    }
  }
}
```

### AgentDocumentOperationReceipt

```json
{
  "oneOf": [
    {
      "$ref": "#/components/schemas/AgentDocumentReceipt"
    },
    {
      "$ref": "#/components/schemas/RelatedDocumentReceipt"
    }
  ]
}
```

### AgentDocumentReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id"
  ],
  "properties": {
    "definition_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "memory_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### AgentGrantReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "revision",
    "effect",
    "target_agent_id"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision": {
      "type": "integer",
      "format": "int64"
    },
    "role": {
      "type": [
        "string",
        "null"
      ]
    },
    "target_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "target_agent_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### AgentGrantRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "role"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "role": {
      "$ref": "#/components/schemas/AgentRole"
    }
  },
  "additionalProperties": false
}
```

### AgentLoginActor

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "agent_id",
        "kind"
      ],
      "properties": {
        "agent_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "agent"
          ]
        }
      }
    }
  ]
}
```

### AgentLoginApproveRequest

```json
{
  "type": "object",
  "required": [
    "request",
    "approve"
  ],
  "properties": {
    "approve": {
      "type": "boolean"
    },
    "request": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### AgentLoginPollRequest

```json
{
  "type": "object",
  "required": [
    "id",
    "device_secret"
  ],
  "properties": {
    "device_secret": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### AgentLoginPollResponse

```json
{
  "oneOf": [
    {
      "$ref": "#/components/schemas/ServiceLoginPollResponse"
    },
    {
      "$ref": "#/components/schemas/HumanLoginPollResponse"
    }
  ]
}
```

### AgentLoginStartRequest

```json
{
  "type": "object",
  "required": [
    "device_secret",
    "credential_sha256",
    "client_name"
  ],
  "properties": {
    "client_name": {
      "type": "string"
    },
    "credential_sha256": {
      "type": "string"
    },
    "device_secret": {
      "type": "string"
    },
    "subject": {
      "$ref": "#/components/schemas/LoginSubject"
    }
  },
  "additionalProperties": false
}
```

### AgentLoginStartResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "client_name",
    "expires_at",
    "verification_code",
    "verification_url"
  ],
  "properties": {
    "client_name": {
      "type": "string"
    },
    "expires_at": {
      "type": "integer",
      "format": "int64"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "verification_code": {
      "type": "string"
    },
    "verification_url": {
      "type": "string"
    }
  }
}
```

### AgentMe

```json
{
  "type": "object",
  "required": [
    "protocol",
    "actor",
    "connection_id",
    "configuration"
  ],
  "properties": {
    "actor": {
      "$ref": "#/components/schemas/ActorId"
    },
    "configuration": {
      "$ref": "#/components/schemas/Configuration"
    },
    "connection_id": {
      "$ref": "#/components/schemas/Id"
    },
    "protocol": {
      "type": "string"
    }
  }
}
```

### AgentRecord

```json
{
  "type": "object",
  "required": [
    "kind",
    "read_url"
  ],
  "properties": {
    "kind": {
      "type": "string"
    },
    "read_url": {
      "type": "string"
    }
  }
}
```

### AgentRelatedDocument

```json
{
  "type": "object",
  "required": [
    "document_id",
    "title",
    "document_url"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "title": {
      "type": "string"
    }
  }
}
```

### AgentRole

```json
{
  "type": "string",
  "enum": [
    "viewer",
    "editor",
    "administrator"
  ]
}
```

### AgentScope

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "owner_account_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "personal"
          ]
        },
        "owner_account_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "space_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "space"
          ]
        },
        "space_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ]
}
```

### AttachmentList

```json
{
  "type": "object",
  "required": [
    "document_id",
    "scope",
    "revision_id",
    "thread_id",
    "references"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "references": {
      "$ref": "#/components/schemas/Paged_AttachmentReference"
    },
    "revision_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "scope": {
      "$ref": "#/components/schemas/AttachmentScope"
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### AttachmentReference

```json
{
  "type": "object",
  "required": [
    "resource",
    "source"
  ],
  "properties": {
    "resource": {
      "$ref": "#/components/schemas/ResourceMetadata"
    },
    "source": {
      "$ref": "#/components/schemas/AttachmentSource"
    }
  }
}
```

### AttachmentScope

```json
{
  "type": "string",
  "enum": [
    "body",
    "main",
    "thread"
  ]
}
```

### AttachmentSource

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "revision_id",
        "created_at",
        "source_url",
        "kind"
      ],
      "properties": {
        "created_at": {
          "type": "integer",
          "format": "int64"
        },
        "kind": {
          "type": "string",
          "enum": [
            "revision"
          ]
        },
        "revision_id": {
          "$ref": "#/components/schemas/Id"
        },
        "source_url": {
          "type": "string"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "message_id",
        "message_version",
        "thread_id",
        "created_at",
        "source_url",
        "kind"
      ],
      "properties": {
        "created_at": {
          "type": "integer",
          "format": "int64"
        },
        "kind": {
          "type": "string",
          "enum": [
            "message"
          ]
        },
        "message_id": {
          "$ref": "#/components/schemas/Id"
        },
        "message_version": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "source_url": {
          "type": "string"
        },
        "thread_id": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Id"
            }
          ]
        }
      }
    }
  ]
}
```

### AttentionReceipt

```json
{
  "type": "object",
  "description": "Past personal-operation confirmation, without content or current access authority.",
  "required": [
    "operation_id",
    "document_id",
    "revision",
    "effect"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "notification_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### AuthorResponse

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "agent_id",
        "kind"
      ],
      "properties": {
        "agent_id": {
          "$ref": "#/components/schemas/Id"
        },
        "avatar_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "display_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "agent"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "account_id",
        "kind"
      ],
      "properties": {
        "account_id": {
          "$ref": "#/components/schemas/Id"
        },
        "avatar_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "display_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "kind": {
          "type": "string",
          "enum": [
            "user"
          ]
        }
      }
    }
  ]
}
```

### Authorization

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "plan_id",
        "decision_id",
        "change_id",
        "qualification_id",
        "kind"
      ],
      "properties": {
        "change_id": {
          "$ref": "#/components/schemas/Id"
        },
        "decision_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "plan"
          ]
        },
        "plan_id": {
          "$ref": "#/components/schemas/Id"
        },
        "qualification_id": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Id"
            }
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "memory"
          ]
        }
      }
    }
  ]
}
```

### Change

```json
{
  "type": "object",
  "required": [
    "id",
    "position",
    "kind",
    "effect",
    "object_id",
    "read_url"
  ],
  "properties": {
    "document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "effect": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "kind": {
      "$ref": "#/components/schemas/ChangeKind"
    },
    "object_id": {
      "$ref": "#/components/schemas/Id"
    },
    "position": {
      "type": "string",
      "description": "Decimal commit position, kept lossless in every client language."
    },
    "read_url": {
      "type": "string"
    },
    "revision": {
      "type": [
        "string",
        "null"
      ]
    },
    "revision_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "structure_version": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "version": {
      "type": [
        "string",
        "null"
      ]
    }
  }
}
```

### ChangeFeed

```json
{
  "type": "object",
  "required": [
    "mode",
    "events",
    "cursor",
    "has_more"
  ],
  "properties": {
    "cursor": {
      "type": "string"
    },
    "events": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Change"
      }
    },
    "has_more": {
      "type": "boolean"
    },
    "mode": {
      "$ref": "#/components/schemas/FeedMode"
    }
  }
}
```

### ChangeKind

```json
{
  "type": "string",
  "enum": [
    "document",
    "document_tree",
    "message",
    "activity",
    "access",
    "space",
    "agent_configuration",
    "agent_plan",
    "agent_decision",
    "agent_control",
    "agent_feedback"
  ]
}
```

### ClaimTaskRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_task_fields_version"
  ],
  "properties": {
    "expected_task_fields_version": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### CollaboratorResponse

```json
{
  "type": "object",
  "required": [
    "role",
    "joined_at",
    "effective_role",
    "sources"
  ],
  "properties": {
    "account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "avatar_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "effective_role": {
      "$ref": "#/components/schemas/AccessRole"
    },
    "joined_at": {
      "type": "integer",
      "format": "int64"
    },
    "role": {
      "$ref": "#/components/schemas/AccessRole"
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/AccessSourceResponse"
      }
    },
    "subject": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/ActorId"
        }
      ]
    }
  }
}
```

### Configuration

```json
{
  "type": "object",
  "required": [
    "agent_id",
    "scope",
    "revision",
    "response_mode",
    "scope_role",
    "definition_document_ids",
    "memory_document_ids"
  ],
  "properties": {
    "agent_id": {
      "$ref": "#/components/schemas/Id"
    },
    "definition_document_ids": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "memory_document_ids": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "response_mode": {
      "$ref": "#/components/schemas/ResponseMode"
    },
    "revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "scope": {
      "$ref": "#/components/schemas/AgentScope"
    },
    "scope_role": {
      "$ref": "#/components/schemas/AgentRole"
    }
  }
}
```

### ConnectionStatus

```json
{
  "type": "string",
  "enum": [
    "active",
    "expired",
    "revoked"
  ]
}
```

### ContextResponse

```json
{
  "type": "object",
  "required": [
    "message",
    "before",
    "after"
  ],
  "properties": {
    "after": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/MessageResponse"
      }
    },
    "before": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/MessageResponse"
      }
    },
    "message": {
      "$ref": "#/components/schemas/MessageResponse"
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### Control

```json
{
  "type": "object",
  "required": [
    "document_id",
    "root_message_id",
    "revision",
    "state",
    "last_action"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "last_action": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/ControlAction"
        }
      ]
    },
    "revision": {
      "type": "string"
    },
    "root_message_id": {
      "$ref": "#/components/schemas/Id"
    },
    "state": {
      "$ref": "#/components/schemas/ControlState"
    }
  }
}
```

### ControlAction

```json
{
  "type": "object",
  "required": [
    "action",
    "actor",
    "created_at",
    "message_id",
    "message_url"
  ],
  "properties": {
    "action": {
      "$ref": "#/components/schemas/WorkAction"
    },
    "actor": {
      "$ref": "#/components/schemas/ActorId"
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "message_id": {
      "$ref": "#/components/schemas/Id"
    },
    "message_url": {
      "type": "string"
    }
  }
}
```

### ControlRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "action"
  ],
  "properties": {
    "action": {
      "$ref": "#/components/schemas/WorkAction"
    },
    "expected_revision": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### ControlState

```json
{
  "type": "string",
  "enum": [
    "active",
    "stopped"
  ]
}
```

### ControlWriteResponse

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "control",
    "message_url"
  ],
  "properties": {
    "control": {
      "$ref": "#/components/schemas/Control"
    },
    "message_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### CreateAgentDocumentRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "origin",
    "title"
  ],
  "properties": {
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "origin": {
      "$ref": "#/components/schemas/CreateOrigin"
    },
    "parent_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "Optional active parent in the same personal account or Space. Omission or null creates at root."
        }
      ]
    },
    "title": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### CreateDocumentRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "title",
    "markdown"
  ],
  "properties": {
    "agent_context": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/AgentContext"
        }
      ]
    },
    "extension": {
      "type": [
        "string",
        "null"
      ]
    },
    "markdown": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "origin": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/CreateOrigin"
        }
      ]
    },
    "parent_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "title": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### CreateOrigin

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "personal"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "space_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "space"
          ]
        },
        "space_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ]
}
```

### CreatePageRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "title",
    "markdown"
  ],
  "properties": {
    "history_policy": {
      "$ref": "#/components/schemas/HistoryPolicy"
    },
    "key": {
      "type": [
        "string",
        "null"
      ]
    },
    "markdown": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "title": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### CreateRelatedDocumentRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "title"
  ],
  "properties": {
    "expected_revision": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Required with purpose. Compared against the Agent configuration revision.",
      "minimum": 0
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "purpose": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/AgentBuiltinPurpose",
          "description": "Create and bind this built-in only when its current binding group is empty."
        }
      ]
    },
    "title": {
      "type": "string",
      "description": "Generic related-document title. With purpose, the fixed Agent Definition or Memory title is used."
    }
  },
  "additionalProperties": false
}
```

### CreateRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "name"
  ],
  "properties": {
    "description": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### CreateTaskRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "title"
  ],
  "properties": {
    "assignee_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "Omitted: personal holder or unassigned in a Space. Explicit null: unassigned."
        }
      ]
    },
    "description": {
      "type": "string"
    },
    "due_date": {
      "type": [
        "string",
        "null"
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "origin": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/CreateOrigin"
        }
      ]
    },
    "parent_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "status": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/TaskStatus"
        }
      ]
    },
    "title": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### CreatedDocument

```json
{
  "type": "object",
  "required": [
    "change_id",
    "document_id",
    "revision_id"
  ],
  "properties": {
    "change_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### CurrentSessionResponse

```json
{
  "type": "object",
  "required": [
    "account",
    "session"
  ],
  "properties": {
    "account": {
      "$ref": "#/components/schemas/AccountResponse"
    },
    "session": {
      "$ref": "#/components/schemas/SessionResponse"
    }
  }
}
```

### Decision

```json
{
  "type": "object",
  "required": [
    "decision_id",
    "actor",
    "action",
    "created_at",
    "control_revision"
  ],
  "properties": {
    "action": {
      "$ref": "#/components/schemas/DecisionAction"
    },
    "actor": {
      "$ref": "#/components/schemas/ActorId"
    },
    "control_revision": {
      "type": "string"
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "decision_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### DecisionAction

```json
{
  "type": "string",
  "enum": [
    "approve",
    "reject"
  ]
}
```

### DecisionReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "decision_id",
    "message_url"
  ],
  "properties": {
    "decision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "message_url": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### DecisionRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_control_revision",
    "expected_decision_id",
    "action"
  ],
  "properties": {
    "action": {
      "$ref": "#/components/schemas/DecisionAction"
    },
    "expected_control_revision": {
      "type": "string"
    },
    "expected_decision_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### DeleteRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_version"
  ],
  "properties": {
    "expected_version": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### DisclosureCheckRequest

```json
{
  "type": "object",
  "required": [
    "source_document_ids",
    "target"
  ],
  "properties": {
    "source_document_ids": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "target": {
      "$ref": "#/components/schemas/Target"
    }
  },
  "additionalProperties": false
}
```

### DisclosureCheckResponse

```json
{
  "type": "object",
  "required": [
    "allowed",
    "checked_at",
    "results"
  ],
  "properties": {
    "allowed": {
      "type": "boolean"
    },
    "checked_at": {
      "type": "integer",
      "format": "int64"
    },
    "results": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/DisclosureResult"
      }
    }
  }
}
```

### DisclosureResult

```json
{
  "type": "object",
  "required": [
    "source_document_id",
    "allowed"
  ],
  "properties": {
    "allowed": {
      "type": "boolean"
    },
    "source_document_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### DocumentAccessResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "role",
    "sources"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "role": {
      "$ref": "#/components/schemas/AccessRole"
    },
    "sources": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/AccessSourceResponse"
      }
    }
  }
}
```

### DocumentLinkPage

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Paged_DocumentLinkSummary"
    },
    {
      "type": "object",
      "required": [
        "document_id",
        "anchor_revision_id"
      ],
      "properties": {
        "anchor_revision_id": {
          "$ref": "#/components/schemas/Id"
        },
        "document_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ]
}
```

### DocumentLinkSummary

```json
{
  "type": "object",
  "required": [
    "id",
    "title",
    "current_revision_id",
    "document_url",
    "updated_at",
    "link_types"
  ],
  "properties": {
    "current_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "link_types": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/LinkType"
      }
    },
    "title": {
      "type": "string"
    },
    "updated_at": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### DocumentReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "revision_id",
    "effect",
    "snapshot_hash"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "snapshot_hash": {
      "type": "string",
      "description": "SHA-256 of UTF-8 compact JSON [title,markdown], lowercase hexadecimal."
    }
  }
}
```

### DocumentResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/DocumentSummary"
    },
    {
      "type": "object",
      "required": [
        "markdown",
        "rendered"
      ],
      "properties": {
        "markdown": {
          "type": "string"
        },
        "rendered": {
          "$ref": "#/components/schemas/RenderedMarkdown"
        }
      }
    }
  ]
}
```

### DocumentSummary

```json
{
  "type": "object",
  "required": [
    "id",
    "origin",
    "created_by",
    "current_revision_id",
    "title",
    "created_at",
    "updated_at",
    "can_pin",
    "readers_30d",
    "my_role",
    "document_url",
    "revision_url"
  ],
  "properties": {
    "agent_document": {
      "type": [
        "boolean",
        "null"
      ],
      "description": "Present only for ordinary documents with an Agent-purpose association record."
    },
    "can_pin": {
      "type": "boolean",
      "description": "Current personal holder or Space administrator; direct grants do not confer pin authority."
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "created_by": {
      "$ref": "#/components/schemas/ActorId"
    },
    "current_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "extension": {
      "type": [
        "string",
        "null"
      ],
      "description": "Explicit immutable document type. Null uses Markdown."
    },
    "favorited_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "This account's current favorite timestamp, in Unix epoch milliseconds."
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "last_viewed_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "This account's last explicitly recorded opening, in Unix epoch milliseconds."
    },
    "my_role": {
      "type": "string",
      "description": "Maximum current role. Creator provenance is not an authorization source."
    },
    "origin": {
      "$ref": "#/components/schemas/OriginResponse"
    },
    "pinned_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64",
      "description": "Origin-owned pin time: personal holding or shared Space, in Unix epoch milliseconds."
    },
    "readers_30d": {
      "type": "integer",
      "format": "int64",
      "description": "Distinct accounts that explicitly recorded an opening during the past 30 days.",
      "minimum": 0
    },
    "response_mode": {
      "type": [
        "string",
        "null"
      ],
      "description": "Agent response mode projected with the collection; ordinary documents omit it."
    },
    "revision_url": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "updated_at": {
      "type": "integer",
      "format": "int64"
    }
  }
}
```

### DocumentTreeNode

```json
{
  "type": "object",
  "required": [
    "id",
    "title",
    "position",
    "document_url",
    "current_revision_id"
  ],
  "properties": {
    "current_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "extension": {
      "type": [
        "string",
        "null"
      ],
      "description": "Explicit stored type; null uses ordinary Markdown, unknown names remain intact."
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "parent_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "position": {
      "type": "integer",
      "format": "int64"
    },
    "title": {
      "type": "string"
    }
  }
}
```

### DocumentViewResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "viewed_at"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "viewed_at": {
      "type": "integer",
      "format": "int64",
      "description": "Unix epoch milliseconds of the retained opening for this account."
    }
  }
}
```

### EditRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_version",
    "parts"
  ],
  "properties": {
    "agent_mentions": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "expected_version": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "mentions": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "parts": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/InputPart"
      }
    }
  },
  "additionalProperties": false
}
```

### EntryContextResponse

```json
{
  "type": "object",
  "required": [
    "entry",
    "before",
    "after"
  ],
  "properties": {
    "after": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/EntryResponse"
      }
    },
    "before": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/EntryResponse"
      }
    },
    "entry": {
      "$ref": "#/components/schemas/EntryResponse"
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### EntryKind

```json
{
  "type": "string",
  "enum": [
    "all",
    "messages",
    "activities"
  ]
}
```

### EntryPageResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Paged_EntryResponse"
    },
    {
      "type": "object",
      "properties": {
        "read_boundary_entry_id": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Id"
            }
          ]
        }
      }
    }
  ]
}
```

### EntryResponse

```json
{
  "oneOf": [
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/MessageResponse"
        },
        {
          "type": "object",
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "message"
              ]
            }
          }
        }
      ]
    },
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/ActivityResponse"
        },
        {
          "type": "object",
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "activity"
              ]
            }
          }
        }
      ]
    }
  ]
}
```

### EntryThreadResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "root",
    "reply_count"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "last_reply_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "reply_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "root": {
      "$ref": "#/components/schemas/EntryResponse"
    }
  }
}
```

### ErrorBody

```json
{
  "type": "object",
  "required": [
    "name",
    "message"
  ],
  "properties": {
    "data": {},
    "message": {
      "type": "string"
    },
    "name": {
      "type": "string"
    }
  }
}
```

### Excerpt

```json
{
  "type": "object",
  "required": [
    "text",
    "field"
  ],
  "properties": {
    "field": {
      "type": "string"
    },
    "part_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "source_range": {
      "$ref": "#/components/schemas/Selection"
    },
    "text": {
      "type": "string"
    }
  }
}
```

### Execution

```json
{
  "type": "object",
  "required": [
    "allowed",
    "blockers",
    "checked_at"
  ],
  "properties": {
    "allowed": {
      "type": "boolean"
    },
    "blockers": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "checked_at": {
      "type": "integer",
      "format": "int64"
    }
  }
}
```

### FavoriteRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "favorited"
  ],
  "properties": {
    "favorited": {
      "type": "boolean"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### FavoriteResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "favorited"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "favorited": {
      "type": "boolean"
    },
    "favorited_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    }
  }
}
```

### FeedMode

```json
{
  "type": "string",
  "enum": [
    "bootstrap",
    "changes"
  ]
}
```

### Feedback

```json
{
  "type": "object",
  "required": [
    "document_id",
    "root_message_id",
    "actor",
    "revision",
    "control_revision",
    "state",
    "markdown",
    "updated_at",
    "message_url"
  ],
  "properties": {
    "actor": {
      "$ref": "#/components/schemas/ActorId"
    },
    "control_revision": {
      "type": "string"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "markdown": {
      "type": "string"
    },
    "message_url": {
      "type": "string"
    },
    "revision": {
      "type": "string"
    },
    "root_message_id": {
      "$ref": "#/components/schemas/Id"
    },
    "state": {
      "$ref": "#/components/schemas/FeedbackState"
    },
    "updated_at": {
      "type": "integer",
      "format": "int64"
    }
  }
}
```

### FeedbackRead

```json
{
  "type": "object",
  "required": [
    "control",
    "feedback"
  ],
  "properties": {
    "control": {
      "$ref": "#/components/schemas/Control"
    },
    "feedback": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Feedback"
        }
      ]
    }
  }
}
```

### FeedbackReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "root_message_id",
    "agent_id",
    "revision",
    "message_url"
  ],
  "properties": {
    "agent_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "message_url": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision": {
      "type": "string"
    },
    "root_message_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### FeedbackRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "control_revision",
    "state",
    "markdown"
  ],
  "properties": {
    "control_revision": {
      "type": "string"
    },
    "expected_revision": {
      "type": "string"
    },
    "markdown": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "state": {
      "$ref": "#/components/schemas/FeedbackState"
    }
  },
  "additionalProperties": false
}
```

### FeedbackState

```json
{
  "type": "string",
  "enum": [
    "processing",
    "waiting",
    "completed",
    "stopped",
    "failed"
  ]
}
```

### GoogleLoginRequest

```json
{
  "type": "object",
  "properties": {
    "return_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "Same-origin relative destination, including a query and fragment if present."
    }
  },
  "additionalProperties": false
}
```

### GoogleLoginResponse

```json
{
  "type": "object",
  "required": [
    "authorization_url"
  ],
  "properties": {
    "authorization_url": {
      "type": "string",
      "description": "Google authorization URL with a one-time state, nonce, and PKCE challenge."
    }
  }
}
```

### HandoffTaskRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_task_fields_version",
    "assignee_account_id"
  ],
  "properties": {
    "assignee_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "expected_task_fields_version": {
      "$ref": "#/components/schemas/Id"
    },
    "note": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional handoff explanation, at most 8192 UTF-8 bytes. Published only with a real field change."
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "status": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/TaskStatus"
        }
      ]
    }
  },
  "additionalProperties": false
}
```

### Heading

```json
{
  "type": "object",
  "required": [
    "id",
    "level",
    "text"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "level": {
      "type": "integer",
      "format": "int32",
      "minimum": 0
    },
    "text": {
      "type": "string"
    }
  }
}
```

### HealthResponse

```json
{
  "type": "object",
  "required": [
    "status"
  ],
  "properties": {
    "status": {
      "type": "string"
    }
  }
}
```

### HistoryLimits

```json
{
  "type": "object",
  "required": [
    "max_versions",
    "max_bytes"
  ],
  "properties": {
    "max_bytes": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "max_versions": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### HistoryPolicy

```json
{
  "type": "string",
  "enum": [
    "standard",
    "limited"
  ]
}
```

### HumanLoginPollResponse

```json
{
  "type": "object",
  "required": [
    "status"
  ],
  "properties": {
    "account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "expires_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "session_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "status": {
      "$ref": "#/components/schemas/LoginStatus"
    }
  }
}
```

### Id

```json
{
  "type": "string",
  "description": "A UUID with one case-sensitive, fixed-width text representation.\nOrdering compares the underlying UUID, independently of its text alphabet.",
  "pattern": "^[A-Za-z0-9]{22}$"
}
```

### IncompleteReason

```json
{
  "type": "string",
  "enum": [
    "work_budget",
    "output_budget"
  ]
}
```

### InputPart

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "id",
        "markdown",
        "kind"
      ],
      "properties": {
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "markdown"
          ]
        },
        "markdown": {
          "type": "string"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "id",
        "resource_id",
        "alt",
        "kind"
      ],
      "properties": {
        "alt": {
          "type": "string"
        },
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "image"
          ]
        },
        "resource_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "id",
        "source",
        "kind"
      ],
      "properties": {
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "quote"
          ]
        },
        "source": {
          "$ref": "#/components/schemas/Source"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "id",
        "revision_id",
        "kind"
      ],
      "properties": {
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "revision_link"
          ]
        },
        "revision_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ],
  "description": "Submitted content. Quote snapshots are supplied only after the workflow verifies their source."
}
```

### JoinDocumentRequest

```json
{
  "type": "object",
  "required": [
    "operation_id"
  ],
  "properties": {
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### Kind

```json
{
  "type": "string",
  "enum": [
    "document",
    "page",
    "message"
  ]
}
```

### LifecycleReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "lifecycle_revision",
    "effect"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "lifecycle_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### LifecycleRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_management_token"
  ],
  "properties": {
    "expected_management_token": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### LifecycleResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "origin",
    "title",
    "current_revision_id",
    "lifecycle_revision",
    "state",
    "sharing",
    "my_access",
    "management_token",
    "collaborators_url",
    "document_url"
  ],
  "properties": {
    "collaborators_url": {
      "type": "string"
    },
    "current_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "lifecycle_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "management_token": {
      "type": "string"
    },
    "my_access": {
      "$ref": "#/components/schemas/DocumentAccessResponse"
    },
    "origin": {
      "$ref": "#/components/schemas/OriginResponse"
    },
    "sharing": {
      "$ref": "#/components/schemas/SharingResponse"
    },
    "state": {
      "$ref": "#/components/schemas/LifecycleState"
    },
    "title": {
      "type": "string"
    },
    "trashed_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "trashed_by": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### LifecycleState

```json
{
  "type": "string",
  "enum": [
    "active",
    "trashed"
  ]
}
```

### LinkType

```json
{
  "type": "string",
  "enum": [
    "current",
    "revision"
  ]
}
```

### LoginConfigResponse

```json
{
  "type": "object",
  "required": [
    "provider",
    "enabled",
    "providers",
    "return_to"
  ],
  "properties": {
    "enabled": {
      "type": "boolean"
    },
    "provider": {
      "type": "string",
      "description": "Default sign-in provider. Only configured providers can be used."
    },
    "providers": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/LoginProviderResponse"
      }
    },
    "return_to": {
      "type": "string"
    }
  }
}
```

### LoginIdentitiesResponse

```json
{
  "type": "object",
  "required": [
    "items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/LoginIdentityResponse"
      }
    }
  }
}
```

### LoginIdentityResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "provider",
    "created_at"
  ],
  "properties": {
    "avatar_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "email": {
      "type": [
        "string",
        "null"
      ]
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "provider": {
      "type": "string"
    }
  }
}
```

### LoginProviderResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "enabled"
  ],
  "properties": {
    "enabled": {
      "type": "boolean"
    },
    "id": {
      "type": "string"
    }
  }
}
```

### LoginStatus

```json
{
  "type": "string",
  "enum": [
    "pending",
    "denied",
    "approved"
  ]
}
```

### LoginSubject

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "user"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "agent_id",
        "kind"
      ],
      "properties": {
        "agent_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "agent"
          ]
        }
      }
    }
  ]
}
```

### LogoutRequest

```json
{
  "type": "object",
  "properties": {
    "expected_session_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "Original public Dee session ID. Cookie alone selects the session to revoke."
        }
      ]
    }
  },
  "additionalProperties": false
}
```

### MaintenanceProvenance

```json
{
  "type": "object",
  "required": [
    "kind",
    "recovery_id",
    "previous_revision_id",
    "performed_at"
  ],
  "properties": {
    "kind": {
      "type": "string",
      "description": "Internal recovery transformation, independent of the retained source author."
    },
    "performed_at": {
      "type": "integer",
      "format": "int64"
    },
    "previous_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "recovery_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### MemberResponse

```json
{
  "type": "object",
  "required": [
    "account_id",
    "role",
    "joined_at"
  ],
  "properties": {
    "account_id": {
      "$ref": "#/components/schemas/Id"
    },
    "avatar_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "joined_at": {
      "type": "integer",
      "format": "int64"
    },
    "role": {
      "type": "string",
      "description": "editor or administrator."
    }
  }
}
```

### MemberRole

```json
{
  "type": "string",
  "enum": [
    "editor",
    "administrator"
  ]
}
```

### MentionCandidate

```json
{
  "type": "object",
  "required": [
    "agent_id",
    "name",
    "response_mode"
  ],
  "properties": {
    "agent_id": {
      "$ref": "#/components/schemas/Id"
    },
    "name": {
      "type": "string"
    },
    "response_mode": {
      "$ref": "#/components/schemas/ResponseMode"
    }
  }
}
```

### MessagePageResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Paged_MessageResponse"
    },
    {
      "type": "object",
      "properties": {
        "read_boundary_message_id": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Id",
              "description": "Reuse this main/Thread message identity to freeze membership on subsequent pages."
            }
          ]
        }
      }
    }
  ]
}
```

### MessageResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "author",
    "parts",
    "mentions",
    "agent_mentions",
    "version",
    "edited",
    "deleted",
    "created_at",
    "updated_at",
    "message_url"
  ],
  "properties": {
    "agent_mentions": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "agent_record": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/AgentRecord"
        }
      ]
    },
    "author": {
      "$ref": "#/components/schemas/AuthorResponse"
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "deleted": {
      "type": "boolean"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "edited": {
      "type": "boolean"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "mentions": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "message_url": {
      "type": "string"
    },
    "parts": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/PartResponse"
      }
    },
    "thread": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/ThreadSummary"
        }
      ]
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "thread_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "updated_at": {
      "type": "integer",
      "format": "int64"
    },
    "version": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### MoveDocumentRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_structure_version"
  ],
  "properties": {
    "expected_structure_version": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "parent_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  },
  "additionalProperties": false
}
```

### NotificationReadRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### NotificationResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "reasons",
    "read",
    "revision",
    "deleted",
    "created_at",
    "updated_at",
    "read_url",
    "message_url"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "deleted": {
      "type": "boolean"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "message_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "message_url": {
      "type": "string"
    },
    "read": {
      "type": "boolean"
    },
    "read_url": {
      "type": "string"
    },
    "reasons": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Reason"
      }
    },
    "revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "task_activity_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "updated_at": {
      "type": "integer",
      "format": "int64"
    }
  }
}
```

### OriginResponse

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "account_id",
        "kind"
      ],
      "properties": {
        "account_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "personal"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "space_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "space"
          ]
        },
        "space_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ]
}
```

### OutlineItem

```json
{
  "type": "object",
  "required": [
    "position",
    "id",
    "level",
    "text",
    "text_truncated",
    "range"
  ],
  "properties": {
    "id": {
      "type": "string"
    },
    "level": {
      "type": "integer",
      "format": "int32",
      "minimum": 0
    },
    "position": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "range": {
      "$ref": "#/components/schemas/Selection"
    },
    "text": {
      "type": "string"
    },
    "text_truncated": {
      "type": "boolean"
    }
  }
}
```

### PageContent

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/PageSummary"
    },
    {
      "type": "object",
      "required": [
        "markdown"
      ],
      "properties": {
        "markdown": {
          "type": "string"
        }
      }
    }
  ]
}
```

### PageHistoryResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Paged_PageRevisionSummary"
    },
    {
      "type": "object",
      "required": [
        "current_revision_id",
        "history_policy"
      ],
      "properties": {
        "current_revision_id": {
          "$ref": "#/components/schemas/Id"
        },
        "history_limits": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/HistoryLimits"
            }
          ]
        },
        "history_policy": {
          "$ref": "#/components/schemas/HistoryPolicy"
        }
      }
    }
  ]
}
```

### PageKeyRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_metadata_revision"
  ],
  "properties": {
    "expected_metadata_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "key": {
      "type": [
        "string",
        "null"
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### PageLifecycleRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_metadata_revision"
  ],
  "properties": {
    "expected_metadata_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "key": {
      "type": [
        "string",
        "null"
      ],
      "description": "Restore may supply a replacement key; omitted/null retains the original key."
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### PageReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "page_id",
    "revision_id",
    "metadata_revision",
    "effect",
    "snapshot_hash"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "metadata_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "page_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "snapshot_hash": {
      "type": "string"
    }
  }
}
```

### PageResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/PageContent"
    },
    {
      "type": "object",
      "required": [
        "rendered"
      ],
      "properties": {
        "rendered": {
          "$ref": "#/components/schemas/RenderedMarkdown"
        }
      }
    }
  ]
}
```

### PageRevisionContent

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "page_id",
    "title",
    "markdown",
    "snapshot_hash",
    "created_by",
    "created_at",
    "document_url",
    "page_url",
    "revision_url"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "created_by": {
      "$ref": "#/components/schemas/ActorId"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "markdown": {
      "type": "string"
    },
    "page_id": {
      "$ref": "#/components/schemas/Id"
    },
    "page_url": {
      "type": "string"
    },
    "revision_url": {
      "type": "string"
    },
    "snapshot_hash": {
      "type": "string"
    },
    "title": {
      "type": "string"
    }
  }
}
```

### PageRevisionResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/PageRevisionContent"
    },
    {
      "type": "object",
      "required": [
        "rendered"
      ],
      "properties": {
        "rendered": {
          "$ref": "#/components/schemas/RenderedMarkdown"
        }
      }
    }
  ]
}
```

### PageRevisionSummary

```json
{
  "type": "object",
  "required": [
    "id",
    "title",
    "snapshot_hash",
    "created_by",
    "created_at",
    "revision_url"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "created_by": {
      "$ref": "#/components/schemas/ActorId"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision_url": {
      "type": "string"
    },
    "snapshot_hash": {
      "type": "string"
    },
    "title": {
      "type": "string"
    }
  }
}
```

### PageSummary

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "title",
    "current_revision_id",
    "metadata_revision",
    "created_at",
    "updated_at",
    "my_role",
    "history_policy",
    "document_url",
    "page_url",
    "revision_url"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "current_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "history_limits": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/HistoryLimits"
        }
      ]
    },
    "history_policy": {
      "$ref": "#/components/schemas/HistoryPolicy"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "key": {
      "type": [
        "string",
        "null"
      ]
    },
    "metadata_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "my_role": {
      "type": "string"
    },
    "page_url": {
      "type": "string"
    },
    "revision_url": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "trashed_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "updated_at": {
      "type": "integer",
      "format": "int64"
    }
  }
}
```

### Paged_AgentConnectionResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "client_name",
          "authorized_at",
          "expires_at",
          "status"
        ],
        "properties": {
          "authorized_at": {
            "type": "integer",
            "format": "int64"
          },
          "client_name": {
            "type": "string"
          },
          "expires_at": {
            "type": "integer",
            "format": "int64"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_used_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "revoked_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "status": {
            "$ref": "#/components/schemas/ConnectionStatus"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_AttachmentReference

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "resource",
          "source"
        ],
        "properties": {
          "resource": {
            "$ref": "#/components/schemas/ResourceMetadata"
          },
          "source": {
            "$ref": "#/components/schemas/AttachmentSource"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_CollaboratorResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "role",
          "joined_at",
          "effective_role",
          "sources"
        ],
        "properties": {
          "account_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "effective_role": {
            "$ref": "#/components/schemas/AccessRole"
          },
          "joined_at": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "$ref": "#/components/schemas/AccessRole"
          },
          "sources": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AccessSourceResponse"
            }
          },
          "subject": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ActorId"
              }
            ]
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_DocumentLinkSummary

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "title",
          "current_revision_id",
          "document_url",
          "updated_at",
          "link_types"
        ],
        "properties": {
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "link_types": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LinkType"
            }
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_DocumentSummary

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "origin",
          "created_by",
          "current_revision_id",
          "title",
          "created_at",
          "updated_at",
          "can_pin",
          "readers_30d",
          "my_role",
          "document_url",
          "revision_url"
        ],
        "properties": {
          "agent_document": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Present only for ordinary documents with an Agent-purpose association record."
          },
          "can_pin": {
            "type": "boolean",
            "description": "Current personal holder or Space administrator; direct grants do not confer pin authority."
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "extension": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicit immutable document type. Null uses Markdown."
          },
          "favorited_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "This account's current favorite timestamp, in Unix epoch milliseconds."
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_viewed_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "This account's last explicitly recorded opening, in Unix epoch milliseconds."
          },
          "my_role": {
            "type": "string",
            "description": "Maximum current role. Creator provenance is not an authorization source."
          },
          "origin": {
            "$ref": "#/components/schemas/OriginResponse"
          },
          "pinned_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Origin-owned pin time: personal holding or shared Space, in Unix epoch milliseconds."
          },
          "readers_30d": {
            "type": "integer",
            "format": "int64",
            "description": "Distinct accounts that explicitly recorded an opening during the past 30 days.",
            "minimum": 0
          },
          "response_mode": {
            "type": [
              "string",
              "null"
            ],
            "description": "Agent response mode projected with the collection; ordinary documents omit it."
          },
          "revision_url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_DocumentTreeNode

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "title",
          "position",
          "document_url",
          "current_revision_id"
        ],
        "properties": {
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "extension": {
            "type": [
              "string",
              "null"
            ],
            "description": "Explicit stored type; null uses ordinary Markdown, unknown names remain intact."
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "parent_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "position": {
            "type": "integer",
            "format": "int64"
          },
          "title": {
            "type": "string"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_EntryResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/MessageResponse"
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "message"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ActivityResponse"
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "activity"
                    ]
                  }
                }
              }
            ]
          }
        ]
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_MemberResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "account_id",
          "role",
          "joined_at"
        ],
        "properties": {
          "account_id": {
            "$ref": "#/components/schemas/Id"
          },
          "avatar_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "display_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "joined_at": {
            "type": "integer",
            "format": "int64"
          },
          "role": {
            "type": "string",
            "description": "editor or administrator."
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_MentionCandidate

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "agent_id",
          "name",
          "response_mode"
        ],
        "properties": {
          "agent_id": {
            "$ref": "#/components/schemas/Id"
          },
          "name": {
            "type": "string"
          },
          "response_mode": {
            "$ref": "#/components/schemas/ResponseMode"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_MessageResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "author",
          "parts",
          "mentions",
          "agent_mentions",
          "version",
          "edited",
          "deleted",
          "created_at",
          "updated_at",
          "message_url"
        ],
        "properties": {
          "agent_mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "agent_record": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/AgentRecord"
              }
            ]
          },
          "author": {
            "$ref": "#/components/schemas/AuthorResponse"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "deleted": {
            "type": "boolean"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "edited": {
            "type": "boolean"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "mentions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Id"
            }
          },
          "message_url": {
            "type": "string"
          },
          "parts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PartResponse"
            }
          },
          "thread": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/ThreadSummary"
              }
            ]
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "thread_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_NotificationResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "reasons",
          "read",
          "revision",
          "deleted",
          "created_at",
          "updated_at",
          "read_url",
          "message_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "deleted": {
            "type": "boolean"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "message_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "message_url": {
            "type": "string"
          },
          "read": {
            "type": "boolean"
          },
          "read_url": {
            "type": "string"
          },
          "reasons": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Reason"
            }
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "task_activity_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_OutlineItem

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "position",
          "id",
          "level",
          "text",
          "text_truncated",
          "range"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "level": {
            "type": "integer",
            "format": "int32",
            "minimum": 0
          },
          "position": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "range": {
            "$ref": "#/components/schemas/Selection"
          },
          "text": {
            "type": "string"
          },
          "text_truncated": {
            "type": "boolean"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_PageRevisionSummary

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "title",
          "snapshot_hash",
          "created_by",
          "created_at",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "revision_url": {
            "type": "string"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_PageSummary

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "title",
          "current_revision_id",
          "metadata_revision",
          "created_at",
          "updated_at",
          "my_role",
          "history_policy",
          "document_url",
          "page_url",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "history_limits": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/HistoryLimits"
              }
            ]
          },
          "history_policy": {
            "$ref": "#/components/schemas/HistoryPolicy"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "key": {
            "type": [
              "string",
              "null"
            ]
          },
          "metadata_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "my_role": {
            "type": "string"
          },
          "page_url": {
            "type": "string"
          },
          "revision_url": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "trashed_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_RevisionSummary

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "title",
          "snapshot_hash",
          "created_by",
          "created_at",
          "revision_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/ActorId"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "maintenance": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/MaintenanceProvenance"
              }
            ]
          },
          "revision_url": {
            "type": "string"
          },
          "snapshot_hash": {
            "type": "string"
          },
          "title": {
            "type": "string"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_SearchResult

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ResultBase"
              },
              {
                "type": "object",
                "required": [
                  "revision_id",
                  "revision_url"
                ],
                "properties": {
                  "revision_id": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "revision_url": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "document"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ResultBase"
              },
              {
                "type": "object",
                "required": [
                  "page_id",
                  "revision_id",
                  "page_url",
                  "revision_url"
                ],
                "properties": {
                  "page_id": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "page_url": {
                    "type": "string"
                  },
                  "revision_id": {
                    "$ref": "#/components/schemas/Id"
                  },
                  "revision_url": {
                    "type": "string"
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "page"
                    ]
                  }
                }
              }
            ]
          },
          {
            "allOf": [
              {
                "$ref": "#/components/schemas/ResultBase"
              },
              {
                "type": "object",
                "required": [
                  "message_version",
                  "message_url"
                ],
                "properties": {
                  "message_url": {
                    "type": "string"
                  },
                  "message_version": {
                    "type": "integer",
                    "format": "int64",
                    "minimum": 0
                  },
                  "thread_id": {
                    "oneOf": [
                      {
                        "type": "null"
                      },
                      {
                        "$ref": "#/components/schemas/Id"
                      }
                    ]
                  }
                }
              },
              {
                "type": "object",
                "required": [
                  "kind"
                ],
                "properties": {
                  "kind": {
                    "type": "string",
                    "enum": [
                      "message"
                    ]
                  }
                }
              }
            ]
          }
        ]
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_ServiceConnection

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "client_name",
          "authorized_by",
          "authorized_at",
          "last_used_at",
          "expires_at",
          "status"
        ],
        "properties": {
          "authorized_at": {
            "type": "integer",
            "format": "int64"
          },
          "authorized_by": {
            "$ref": "#/components/schemas/Id"
          },
          "client_name": {
            "type": "string"
          },
          "expires_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "last_used_at": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64"
          },
          "status": {
            "type": "string"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_SpaceResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "description",
          "created_by",
          "revision",
          "created_at",
          "updated_at",
          "my_role"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "created_by": {
            "$ref": "#/components/schemas/Id"
          },
          "description": {
            "type": "string"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "my_role": {
            "type": "string",
            "description": "editor or administrator; current member role in this Space only."
          },
          "name": {
            "type": "string"
          },
          "overview_document_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id",
                "description": "A stable document identity; the reference is retained while the document is trashed."
              }
            ]
          },
          "overview_document_url": {
            "type": [
              "string",
              "null"
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_StateResponse

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "document_id",
          "following",
          "muted",
          "revision",
          "unread_messages",
          "unread_mentions"
        ],
        "properties": {
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "following": {
            "type": "boolean"
          },
          "last_message_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "muted": {
            "type": "boolean"
          },
          "read_message_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "thread_id": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/Id"
              }
            ]
          },
          "unread_mentions": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "unread_messages": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_TaskActivity

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "document_id",
          "revision_id",
          "kind",
          "actor_id",
          "actor_kind",
          "new_fields",
          "created_at"
        ],
        "properties": {
          "actor_id": {
            "$ref": "#/components/schemas/Id"
          },
          "actor_kind": {
            "$ref": "#/components/schemas/TaskActorKind"
          },
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "id": {
            "$ref": "#/components/schemas/Id"
          },
          "kind": {
            "$ref": "#/components/schemas/TaskActivityKind"
          },
          "new_fields": {
            "$ref": "#/components/schemas/TaskFields"
          },
          "note": {
            "type": [
              "string",
              "null"
            ]
          },
          "old_fields": {
            "oneOf": [
              {
                "type": "null"
              },
              {
                "$ref": "#/components/schemas/TaskFields"
              }
            ]
          },
          "revision_id": {
            "$ref": "#/components/schemas/Id"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_TaskSummary

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "allOf": [
          {
            "$ref": "#/components/schemas/TaskFields"
          },
          {
            "type": "object",
            "required": [
              "id",
              "origin",
              "title",
              "current_revision_id",
              "task_fields_version",
              "description_version",
              "created_at",
              "updated_at",
              "document_url",
              "revision_url"
            ],
            "properties": {
              "created_at": {
                "type": "integer",
                "format": "int64"
              },
              "current_revision_id": {
                "$ref": "#/components/schemas/Id"
              },
              "description_version": {
                "$ref": "#/components/schemas/Id"
              },
              "document_url": {
                "type": "string"
              },
              "id": {
                "$ref": "#/components/schemas/Id"
              },
              "origin": {
                "$ref": "#/components/schemas/OriginResponse"
              },
              "revision_url": {
                "type": "string"
              },
              "task_fields_version": {
                "$ref": "#/components/schemas/Id"
              },
              "title": {
                "type": "string"
              },
              "updated_at": {
                "type": "integer",
                "format": "int64"
              }
            }
          }
        ]
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Paged_TrashSummary

```json
{
  "type": "object",
  "required": [
    "items",
    "page_index",
    "page_size",
    "total_pages",
    "total_items"
  ],
  "properties": {
    "items": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "document_id",
          "origin",
          "title",
          "current_revision_id",
          "lifecycle_revision",
          "state",
          "trashed_at",
          "trashed_by",
          "created_at",
          "updated_at",
          "management_url",
          "document_url"
        ],
        "properties": {
          "created_at": {
            "type": "integer",
            "format": "int64"
          },
          "current_revision_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_id": {
            "$ref": "#/components/schemas/Id"
          },
          "document_url": {
            "type": "string"
          },
          "lifecycle_revision": {
            "type": "integer",
            "format": "int64",
            "minimum": 0
          },
          "management_url": {
            "type": "string"
          },
          "origin": {
            "$ref": "#/components/schemas/OriginResponse"
          },
          "state": {
            "$ref": "#/components/schemas/LifecycleState"
          },
          "title": {
            "type": "string"
          },
          "trashed_at": {
            "type": "integer",
            "format": "int64"
          },
          "trashed_by": {
            "$ref": "#/components/schemas/Id"
          },
          "updated_at": {
            "type": "integer",
            "format": "int64"
          }
        }
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_items": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "total_pages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Part

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "id",
        "markdown",
        "kind"
      ],
      "properties": {
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "markdown"
          ]
        },
        "markdown": {
          "type": "string"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "id",
        "resource_id",
        "alt",
        "kind"
      ],
      "properties": {
        "alt": {
          "type": "string"
        },
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "image"
          ]
        },
        "resource_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "id",
        "source",
        "snapshot",
        "kind"
      ],
      "properties": {
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "quote"
          ]
        },
        "snapshot": {
          "type": "string"
        },
        "source": {
          "$ref": "#/components/schemas/Source"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "id",
        "revision_id",
        "kind"
      ],
      "properties": {
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "revision_link"
          ]
        },
        "revision_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ],
  "description": "Persisted ordered content. The quote snapshot is the verified Markdown at publication time."
}
```

### PartResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Part"
    },
    {
      "type": "object",
      "properties": {
        "source_status": {
          "type": [
            "string",
            "null"
          ]
        },
        "source_url": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  ]
}
```

### PersonalDocumentTree

```json
{
  "type": "object",
  "required": [
    "account_id",
    "structure_version",
    "documents"
  ],
  "properties": {
    "account_id": {
      "$ref": "#/components/schemas/Id"
    },
    "documents": {
      "$ref": "#/components/schemas/Paged_DocumentTreeNode"
    },
    "structure_version": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### PinReceipt

```json
{
  "type": "object",
  "description": "A minimal original result; it does not grant current document access.",
  "required": [
    "operation_id",
    "document_id",
    "pinned",
    "pin_revision",
    "effect"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "pin_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "pinned": {
      "type": "boolean"
    },
    "pinned_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    }
  },
  "additionalProperties": false
}
```

### PinRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "pinned"
  ],
  "properties": {
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "pinned": {
      "type": "boolean"
    }
  },
  "additionalProperties": false
}
```

### PinResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "pinned",
    "can_pin"
  ],
  "properties": {
    "can_pin": {
      "type": "boolean"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "pinned": {
      "type": "boolean"
    },
    "pinned_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    }
  }
}
```

### PlanChange

```json
{
  "type": "object",
  "required": [
    "id",
    "target",
    "action",
    "description"
  ],
  "properties": {
    "action": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "target": {
      "$ref": "#/components/schemas/Target"
    }
  },
  "additionalProperties": false
}
```

### PlanRead

```json
{
  "type": "object",
  "required": [
    "plan_id",
    "document_id",
    "root_message_id",
    "snapshot",
    "superseded_by_plan_id",
    "current_decision",
    "current_qualification",
    "created_documents",
    "control",
    "execution"
  ],
  "properties": {
    "control": {
      "$ref": "#/components/schemas/Control"
    },
    "created_documents": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/CreatedDocument"
      }
    },
    "current_decision": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Decision"
        }
      ]
    },
    "current_qualification": {
      "description": "External qualification submission is reserved for a later implementation."
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "execution": {
      "$ref": "#/components/schemas/Execution"
    },
    "plan_id": {
      "$ref": "#/components/schemas/Id"
    },
    "root_message_id": {
      "$ref": "#/components/schemas/Id"
    },
    "snapshot": {
      "$ref": "#/components/schemas/PlanSnapshot"
    },
    "superseded_by_plan_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### PlanReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "plan_id",
    "message_url"
  ],
  "properties": {
    "message_url": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "plan_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### PlanRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "root_message_id",
    "expected_control_revision",
    "markdown",
    "executor_agent_ids",
    "changes",
    "replaces_plan_id"
  ],
  "properties": {
    "changes": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/PlanChange"
      }
    },
    "executor_agent_ids": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "expected_control_revision": {
      "type": "string"
    },
    "markdown": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "replaces_plan_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "root_message_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### PlanSnapshot

```json
{
  "type": "object",
  "required": [
    "author",
    "created_at",
    "markdown",
    "executor_agent_ids",
    "changes",
    "replaces_plan_id"
  ],
  "properties": {
    "author": {
      "$ref": "#/components/schemas/ActorId"
    },
    "changes": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/PlanChange"
      }
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "executor_agent_ids": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "markdown": {
      "type": "string"
    },
    "replaces_plan_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### PreferencesRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "following": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "muted": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### ProtocolControlReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "root_message_id",
    "revision",
    "state",
    "message_url"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "message_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision": {
      "type": "string"
    },
    "root_message_id": {
      "$ref": "#/components/schemas/Id"
    },
    "state": {
      "$ref": "#/components/schemas/ControlState"
    }
  }
}
```

### ProtocolOperation

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "plan"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/PlanReceipt"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "decision"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/DecisionReceipt"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "control"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/ProtocolControlReceipt"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "feedback"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/FeedbackReceipt"
        }
      }
    }
  ]
}
```

### ProtocolOperationResponse

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "configuration"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/AgentConfigurationReceipt"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "plan"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/PlanReceipt"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "decision"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/DecisionReceipt"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "control"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/ProtocolControlReceipt"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "receipt",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "feedback"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/FeedbackReceipt"
        }
      }
    }
  ]
}
```

### ReadRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "message_id"
  ],
  "properties": {
    "message_id": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### ReadyResponse

```json
{
  "type": "object",
  "required": [
    "status"
  ],
  "properties": {
    "status": {
      "type": "string"
    }
  }
}
```

### Reason

```json
{
  "type": "string",
  "enum": [
    "mentioned",
    "thread_reply",
    "task_assignment"
  ]
}
```

### Receipt

```json
{
  "type": "object",
  "description": "Minimal original result; it grants no permission to retrieve current message content.",
  "required": [
    "operation_id",
    "document_id",
    "message_id",
    "version",
    "effect",
    "snapshot_hash"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "message_id": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "snapshot_hash": {
      "type": "string"
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "version": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### ReceiptResponse

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "space_id",
    "revision",
    "effect"
  ],
  "properties": {
    "effect": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision": {
      "type": "integer",
      "format": "int64"
    },
    "role": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/MemberRole"
        }
      ]
    },
    "space_id": {
      "$ref": "#/components/schemas/Id"
    },
    "target_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  }
}
```

### RelatedDocumentReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "related_document_id"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "related_document_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### RemoveAgentGrantRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### RemoveCollaboratorRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### RenderedMarkdown

```json
{
  "type": "object",
  "required": [
    "html",
    "toc"
  ],
  "properties": {
    "html": {
      "type": "string"
    },
    "toc": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Heading"
      }
    }
  }
}
```

### ResolveAccountRequest

```json
{
  "type": "object",
  "required": [
    "email"
  ],
  "properties": {
    "email": {
      "type": "string",
      "description": "A complete verified email address, never a display-name or prefix search."
    }
  },
  "additionalProperties": false
}
```

### ResolvedAccountResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "matched_email"
  ],
  "properties": {
    "avatar_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "display_name": {
      "type": [
        "string",
        "null"
      ]
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "matched_email": {
      "type": "string",
      "description": "Echoes the requested email instead of exposing other email addresses."
    }
  }
}
```

### ResourceMetadata

```json
{
  "type": "object",
  "required": [
    "resource_id",
    "filename",
    "state",
    "sha256",
    "byte_size",
    "content_type",
    "content_url"
  ],
  "properties": {
    "byte_size": {
      "type": "integer",
      "format": "int64"
    },
    "content_type": {
      "type": "string"
    },
    "content_url": {
      "type": "string"
    },
    "document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "filename": {
      "type": "string"
    },
    "resource_id": {
      "$ref": "#/components/schemas/Id"
    },
    "sha256": {
      "type": "string"
    },
    "state": {
      "type": "string"
    }
  }
}
```

### ResponseMode

```json
{
  "type": "string",
  "enum": [
    "mention",
    "automatic"
  ]
}
```

### RestoreTaskDescriptionRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "source_revision_id",
    "expected_description_version"
  ],
  "properties": {
    "expected_description_version": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "source_revision_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### RestoreTaskSourceRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "source_revision_id",
    "expected_revision_id"
  ],
  "properties": {
    "expected_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "source_revision_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### ResultBase

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "title",
    "created_at",
    "updated_at",
    "document_url",
    "excerpt"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "excerpt": {
      "$ref": "#/components/schemas/Excerpt"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "title": {
      "type": "string"
    },
    "updated_at": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### RevisionContent

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "title",
    "markdown",
    "snapshot_hash",
    "created_by",
    "created_at",
    "document_url",
    "revision_url"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "created_by": {
      "$ref": "#/components/schemas/ActorId"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "extension": {
      "type": [
        "string",
        "null"
      ],
      "description": "Explicit immutable document type. Null uses Markdown."
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "maintenance": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/MaintenanceProvenance"
        }
      ]
    },
    "markdown": {
      "type": "string"
    },
    "revision_url": {
      "type": "string"
    },
    "snapshot_hash": {
      "type": "string"
    },
    "title": {
      "type": "string"
    }
  }
}
```

### RevisionDiffResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "from_revision_id",
    "to_revision_id",
    "title_before",
    "title_after",
    "has_changes",
    "complete",
    "incomplete_reason",
    "markdown_diff"
  ],
  "properties": {
    "complete": {
      "type": "boolean"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "from_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "has_changes": {
      "type": "boolean"
    },
    "incomplete_reason": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/IncompleteReason"
        }
      ]
    },
    "markdown_diff": {
      "type": [
        "string",
        "null"
      ]
    },
    "title_after": {
      "type": "string"
    },
    "title_before": {
      "type": "string"
    },
    "to_revision_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### RevisionHistoryResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Paged_RevisionSummary"
    },
    {
      "type": "object",
      "required": [
        "current_revision_id"
      ],
      "properties": {
        "current_revision_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ]
}
```

### RevisionRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    }
  },
  "additionalProperties": false
}
```

### RevisionResponse

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/RevisionContent"
    },
    {
      "type": "object",
      "required": [
        "rendered"
      ],
      "properties": {
        "rendered": {
          "$ref": "#/components/schemas/RenderedMarkdown"
        }
      }
    }
  ]
}
```

### RevisionSummary

```json
{
  "type": "object",
  "required": [
    "id",
    "title",
    "snapshot_hash",
    "created_by",
    "created_at",
    "revision_url"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "created_by": {
      "$ref": "#/components/schemas/ActorId"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "maintenance": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/MaintenanceProvenance"
        }
      ]
    },
    "revision_url": {
      "type": "string"
    },
    "snapshot_hash": {
      "type": "string"
    },
    "title": {
      "type": "string"
    }
  }
}
```

### RevokeConnectionsRequest

```json
{
  "type": "object",
  "required": [
    "expected_generation"
  ],
  "properties": {
    "expected_generation": {
      "type": "string",
      "description": "Use the generation returned by the reviewed connection list."
    }
  },
  "additionalProperties": false
}
```

### SaveDocumentRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision_id",
    "title",
    "markdown"
  ],
  "properties": {
    "agent_context": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/AgentContext"
        }
      ]
    },
    "expected_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "markdown": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "title": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### SavePageRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision_id",
    "title",
    "markdown"
  ],
  "properties": {
    "expected_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "markdown": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "title": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### Scope

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "owner_account_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "personal"
          ]
        },
        "owner_account_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "space_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "space"
          ]
        },
        "space_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    }
  ]
}
```

### SearchRequest

```json
{
  "type": "object",
  "required": [
    "terms"
  ],
  "properties": {
    "document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "Required for document scope; otherwise intersects the selected mine or Space scope."
        }
      ]
    },
    "kinds": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Kind"
      },
      "maxItems": 3,
      "minItems": 1
    },
    "order_by": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "default": 0,
      "maximum": 9007199254740991,
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "default": 50,
      "maximum": 100,
      "minimum": 0
    },
    "scope": {
      "$ref": "#/components/schemas/SearchScope",
      "description": "Omitted: infer space from non-null `space_id`, otherwise mine. Document requires `document_id` and no `space_id`. Explicit null is invalid."
    },
    "space_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "terms": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "AND of 1-16 literal strings. Each 1-256 UTF-8 bytes, total at most 2048 bytes; no NUL.",
      "maxItems": 16,
      "minItems": 1
    }
  },
  "additionalProperties": false
}
```

### SearchResult

```json
{
  "oneOf": [
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/ResultBase"
        },
        {
          "type": "object",
          "required": [
            "revision_id",
            "revision_url"
          ],
          "properties": {
            "revision_id": {
              "$ref": "#/components/schemas/Id"
            },
            "revision_url": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "document"
              ]
            }
          }
        }
      ]
    },
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/ResultBase"
        },
        {
          "type": "object",
          "required": [
            "page_id",
            "revision_id",
            "page_url",
            "revision_url"
          ],
          "properties": {
            "page_id": {
              "$ref": "#/components/schemas/Id"
            },
            "page_url": {
              "type": "string"
            },
            "revision_id": {
              "$ref": "#/components/schemas/Id"
            },
            "revision_url": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "page"
              ]
            }
          }
        }
      ]
    },
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/ResultBase"
        },
        {
          "type": "object",
          "required": [
            "message_version",
            "message_url"
          ],
          "properties": {
            "message_url": {
              "type": "string"
            },
            "message_version": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            },
            "thread_id": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/components/schemas/Id"
                }
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind"
          ],
          "properties": {
            "kind": {
              "type": "string",
              "enum": [
                "message"
              ]
            }
          }
        }
      ]
    }
  ]
}
```

### SearchScope

```json
{
  "type": "string",
  "enum": [
    "mine",
    "space",
    "document"
  ]
}
```

### Selection

```json
{
  "type": "object",
  "description": "A half-open UTF-8 byte range in the source Markdown, checked against source bytes by workflows.",
  "required": [
    "start",
    "end"
  ],
  "properties": {
    "end": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "start": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  },
  "additionalProperties": false
}
```

### SendRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "parts"
  ],
  "properties": {
    "agent_mentions": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "mentions": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Id"
      }
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "parts": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/InputPart"
      }
    },
    "reply_to": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    }
  },
  "additionalProperties": false
}
```

### ServiceConnection

```json
{
  "type": "object",
  "required": [
    "id",
    "client_name",
    "authorized_by",
    "authorized_at",
    "last_used_at",
    "expires_at",
    "status"
  ],
  "properties": {
    "authorized_at": {
      "type": "integer",
      "format": "int64"
    },
    "authorized_by": {
      "$ref": "#/components/schemas/Id"
    },
    "client_name": {
      "type": "string"
    },
    "expires_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "last_used_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "status": {
      "type": "string"
    }
  }
}
```

### ServiceLoginPollResponse

```json
{
  "type": "object",
  "required": [
    "status",
    "actor",
    "connection_id",
    "expires_at"
  ],
  "properties": {
    "actor": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/AgentLoginActor"
        }
      ]
    },
    "connection_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "expires_at": {
      "default": null
    },
    "status": {
      "$ref": "#/components/schemas/LoginStatus"
    }
  }
}
```

### SessionResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "expires_at"
  ],
  "properties": {
    "expires_at": {
      "type": "integer",
      "format": "int64",
      "description": "Epoch seconds of the persisted Dee session expiry, established at login."
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### SetCollaboratorRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "role"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "role": {
      "$ref": "#/components/schemas/AccessRole"
    }
  },
  "additionalProperties": false
}
```

### SetRoleRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "role"
  ],
  "properties": {
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "role": {
      "$ref": "#/components/schemas/MemberRole"
    }
  },
  "additionalProperties": false
}
```

### SetSharingRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "enabled",
    "role"
  ],
  "properties": {
    "enabled": {
      "type": "boolean"
    },
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "role": {
      "$ref": "#/components/schemas/AccessRole"
    }
  },
  "additionalProperties": false
}
```

### SharingResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "revision",
    "link_enabled"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "link_enabled": {
      "type": "boolean"
    },
    "link_role": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/AccessRole"
        }
      ]
    },
    "revision": {
      "type": "integer",
      "format": "int64",
      "description": "Access revision, independent of the main-body Revision; zero before the first access write."
    }
  }
}
```

### Source

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "entry_id",
        "kind"
      ],
      "properties": {
        "entry_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "activity"
          ]
        },
        "range": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Selection"
            }
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "revision_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "revision"
          ]
        },
        "range": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Selection"
            }
          ]
        },
        "revision_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "page_id",
        "revision_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "page_revision"
          ]
        },
        "page_id": {
          "$ref": "#/components/schemas/Id"
        },
        "range": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Selection"
            }
          ]
        },
        "revision_id": {
          "$ref": "#/components/schemas/Id"
        }
      }
    },
    {
      "type": "object",
      "required": [
        "message_id",
        "expected_version",
        "kind"
      ],
      "properties": {
        "expected_version": {
          "type": "integer",
          "format": "int64",
          "minimum": 0
        },
        "kind": {
          "type": "string",
          "enum": [
            "message"
          ]
        },
        "message_id": {
          "$ref": "#/components/schemas/Id"
        },
        "part_id": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Id"
            }
          ]
        },
        "range": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Selection"
            }
          ]
        }
      }
    }
  ],
  "description": "Source identity remains separate from a quote's retained text and the receiving Thread."
}
```

### SourceBase

```json
{
  "type": "object",
  "required": [
    "document_id",
    "revision_id",
    "title",
    "total_bytes",
    "document_url",
    "revision_url"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision_url": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "total_bytes": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### SourceResponse

```json
{
  "oneOf": [
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/SourceBase"
        },
        {
          "type": "object",
          "required": [
            "markdown",
            "range"
          ],
          "properties": {
            "markdown": {
              "type": "string"
            },
            "next_range": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/components/schemas/Selection"
                }
              ]
            },
            "range": {
              "$ref": "#/components/schemas/Selection"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "view"
          ],
          "properties": {
            "view": {
              "type": "string",
              "enum": [
                "markdown"
              ]
            }
          }
        }
      ]
    },
    {
      "allOf": [
        {
          "$ref": "#/components/schemas/SourceBase"
        },
        {
          "$ref": "#/components/schemas/Paged_OutlineItem"
        },
        {
          "type": "object",
          "properties": {
            "preamble_range": {
              "oneOf": [
                {
                  "type": "null"
                },
                {
                  "$ref": "#/components/schemas/Selection"
                }
              ]
            }
          }
        },
        {
          "type": "object",
          "required": [
            "view"
          ],
          "properties": {
            "view": {
              "type": "string",
              "enum": [
                "outline"
              ]
            }
          }
        }
      ]
    }
  ]
}
```

### SpaceDocumentTree

```json
{
  "type": "object",
  "required": [
    "space_id",
    "structure_version",
    "documents"
  ],
  "properties": {
    "documents": {
      "$ref": "#/components/schemas/Paged_DocumentTreeNode"
    },
    "space_id": {
      "$ref": "#/components/schemas/Id"
    },
    "structure_version": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### SpaceResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "name",
    "description",
    "created_by",
    "revision",
    "created_at",
    "updated_at",
    "my_role"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "created_by": {
      "$ref": "#/components/schemas/Id"
    },
    "description": {
      "type": "string"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "my_role": {
      "type": "string",
      "description": "editor or administrator; current member role in this Space only."
    },
    "name": {
      "type": "string"
    },
    "overview_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "A stable document identity; the reference is retained while the document is trashed."
        }
      ]
    },
    "overview_document_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "revision": {
      "type": "integer",
      "format": "int64"
    },
    "updated_at": {
      "type": "integer",
      "format": "int64"
    }
  }
}
```

### StateResponse

```json
{
  "type": "object",
  "required": [
    "document_id",
    "following",
    "muted",
    "revision",
    "unread_messages",
    "unread_mentions"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "following": {
      "type": "boolean"
    },
    "last_message_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "muted": {
      "type": "boolean"
    },
    "read_message_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "thread_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "unread_mentions": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "unread_messages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### SummaryResponse

```json
{
  "type": "object",
  "required": [
    "unread_notifications",
    "unread_messages",
    "unread_mentions",
    "followed_threads"
  ],
  "properties": {
    "followed_threads": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "unread_mentions": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "unread_messages": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "unread_notifications": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### Target

```json
{
  "oneOf": [
    {
      "type": "object",
      "required": [
        "document_id",
        "kind"
      ],
      "properties": {
        "document_id": {
          "$ref": "#/components/schemas/Id"
        },
        "kind": {
          "type": "string",
          "enum": [
            "dee_document"
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "origin",
        "parent_document_id",
        "kind"
      ],
      "properties": {
        "kind": {
          "type": "string",
          "enum": [
            "dee_document_create"
          ]
        },
        "origin": {
          "$ref": "#/components/schemas/Scope"
        },
        "parent_document_id": {
          "oneOf": [
            {
              "type": "null"
            },
            {
              "$ref": "#/components/schemas/Id"
            }
          ]
        }
      }
    },
    {
      "type": "object",
      "required": [
        "system",
        "resource",
        "display_name",
        "kind"
      ],
      "properties": {
        "display_name": {
          "type": "string"
        },
        "kind": {
          "type": "string",
          "enum": [
            "external"
          ]
        },
        "resource": {
          "type": "string"
        },
        "system": {
          "type": "string"
        }
      }
    }
  ]
}
```

### TaskActivity

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "revision_id",
    "kind",
    "actor_id",
    "actor_kind",
    "new_fields",
    "created_at"
  ],
  "properties": {
    "actor_id": {
      "$ref": "#/components/schemas/Id"
    },
    "actor_kind": {
      "$ref": "#/components/schemas/TaskActorKind"
    },
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "kind": {
      "$ref": "#/components/schemas/TaskActivityKind"
    },
    "new_fields": {
      "$ref": "#/components/schemas/TaskFields"
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "old_fields": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/TaskFields"
        }
      ]
    },
    "revision_id": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### TaskActivityKind

```json
{
  "type": "string",
  "enum": [
    "created",
    "fields_changed"
  ]
}
```

### TaskActorKind

```json
{
  "type": "string",
  "enum": [
    "user",
    "agent"
  ]
}
```

### TaskCollection

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/Paged_TaskSummary"
    },
    {
      "type": "object",
      "required": [
        "status_counts"
      ],
      "properties": {
        "status_counts": {
          "$ref": "#/components/schemas/TaskStatusCounts"
        }
      }
    }
  ]
}
```

### TaskCollectionRequest

```json
{
  "type": "object",
  "properties": {
    "assignee_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "due_date_from": {
      "type": [
        "string",
        "null"
      ],
      "description": "Inclusive positive-year YYYY-MM-DD lower bound, using Task's calendar rules."
    },
    "due_date_to": {
      "type": [
        "string",
        "null"
      ],
      "description": "Inclusive positive-year YYYY-MM-DD upper bound; must not precede `due_date_from`."
    },
    "order_by": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "field.asc/desc items. Default `updated_at.desc,id.asc`; nullable dates always sort last."
    },
    "page_index": {
      "type": "integer",
      "format": "int64",
      "default": 0,
      "maximum": 9007199254740991,
      "minimum": 0
    },
    "page_size": {
      "type": "integer",
      "format": "int64",
      "default": 50,
      "maximum": 100,
      "minimum": 0
    },
    "scope": {
      "$ref": "#/components/schemas/TaskCollectionScope",
      "description": "Personal holding by default; `assigned_to_me` spans all current human read sources."
    },
    "space_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "Required only for space scope, whose current membership is checked independently."
        }
      ]
    },
    "statuses": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/TaskStatus"
      },
      "description": "Omitted: unfinished for `assigned_to_me`, all five states otherwise. Explicit null/[] is invalid.",
      "minItems": 1
    },
    "terms": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Literal AND over title and free description. Default [] browses the collection.",
      "maxItems": 16
    },
    "unassigned": {
      "type": "boolean",
      "description": "Match unassigned Tasks; mutually exclusive with a non-null `assignee_account_id`."
    },
    "without_due_date": {
      "type": "boolean",
      "description": "Match no date; mutually exclusive with either date bound."
    }
  },
  "additionalProperties": false
}
```

### TaskCollectionScope

```json
{
  "type": "string",
  "enum": [
    "personal",
    "space",
    "assigned_to_me"
  ]
}
```

### TaskDescriptionRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_description_version",
    "title",
    "description"
  ],
  "properties": {
    "description": {
      "type": "string"
    },
    "expected_description_version": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "title": {
      "type": "string"
    }
  },
  "additionalProperties": false
}
```

### TaskDetail

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/TaskFields"
    },
    {
      "type": "object",
      "required": [
        "document_id",
        "title",
        "markdown",
        "description",
        "document_revision_id",
        "task_fields_version",
        "description_version",
        "assignee_can_edit",
        "activities",
        "activities_truncated"
      ],
      "properties": {
        "activities": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/TaskActivity"
          },
          "description": "At most fifty newest committed activities, ordered by `created_at` descending and ID ascending."
        },
        "activities_truncated": {
          "type": "boolean"
        },
        "assignee_can_edit": {
          "type": "boolean",
          "description": "False when unassigned or the retained assignee no longer holds effective edit permission."
        },
        "description": {
          "type": "string"
        },
        "description_version": {
          "$ref": "#/components/schemas/Id"
        },
        "document_id": {
          "$ref": "#/components/schemas/Id"
        },
        "document_revision_id": {
          "$ref": "#/components/schemas/Id"
        },
        "markdown": {
          "type": "string"
        },
        "task_fields_version": {
          "$ref": "#/components/schemas/Id"
        },
        "title": {
          "type": "string"
        }
      }
    }
  ]
}
```

### TaskFields

```json
{
  "type": "object",
  "required": [
    "status"
  ],
  "properties": {
    "assignee_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "due_date": {
      "type": [
        "string",
        "null"
      ]
    },
    "status": {
      "$ref": "#/components/schemas/TaskStatus"
    }
  },
  "additionalProperties": false
}
```

### TaskFieldsRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_task_fields_version"
  ],
  "properties": {
    "assignee_account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "due_date": {
      "type": [
        "string",
        "null"
      ]
    },
    "expected_task_fields_version": {
      "$ref": "#/components/schemas/Id"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "status": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/TaskStatus"
        }
      ]
    }
  },
  "additionalProperties": false
}
```

### TaskReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "revision_id",
    "snapshot_hash",
    "effect",
    "task_fields_version",
    "description_version",
    "note_published"
  ],
  "properties": {
    "activity_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "description_version": {
      "$ref": "#/components/schemas/Id"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "note_published": {
      "type": "boolean"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "snapshot_hash": {
      "type": "string"
    },
    "task_fields_version": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### TaskStatus

```json
{
  "type": "string",
  "enum": [
    "todo",
    "progress",
    "review",
    "done",
    "cancelled"
  ]
}
```

### TaskStatusCounts

```json
{
  "type": "object",
  "required": [
    "todo",
    "progress",
    "review",
    "done",
    "cancelled"
  ],
  "properties": {
    "cancelled": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "done": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "progress": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "review": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "todo": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### TaskSummary

```json
{
  "allOf": [
    {
      "$ref": "#/components/schemas/TaskFields"
    },
    {
      "type": "object",
      "required": [
        "id",
        "origin",
        "title",
        "current_revision_id",
        "task_fields_version",
        "description_version",
        "created_at",
        "updated_at",
        "document_url",
        "revision_url"
      ],
      "properties": {
        "created_at": {
          "type": "integer",
          "format": "int64"
        },
        "current_revision_id": {
          "$ref": "#/components/schemas/Id"
        },
        "description_version": {
          "$ref": "#/components/schemas/Id"
        },
        "document_url": {
          "type": "string"
        },
        "id": {
          "$ref": "#/components/schemas/Id"
        },
        "origin": {
          "$ref": "#/components/schemas/OriginResponse"
        },
        "revision_url": {
          "type": "string"
        },
        "task_fields_version": {
          "$ref": "#/components/schemas/Id"
        },
        "title": {
          "type": "string"
        },
        "updated_at": {
          "type": "integer",
          "format": "int64"
        }
      }
    }
  ]
}
```

### ThreadResponse

```json
{
  "type": "object",
  "required": [
    "id",
    "document_id",
    "root",
    "reply_count"
  ],
  "properties": {
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "last_reply_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "reply_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "root": {
      "$ref": "#/components/schemas/MessageResponse"
    }
  }
}
```

### ThreadSummary

```json
{
  "type": "object",
  "required": [
    "id",
    "reply_count"
  ],
  "properties": {
    "id": {
      "$ref": "#/components/schemas/Id"
    },
    "last_reply_at": {
      "type": [
        "integer",
        "null"
      ],
      "format": "int64"
    },
    "reply_count": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    }
  }
}
```

### TrashSummary

```json
{
  "type": "object",
  "required": [
    "document_id",
    "origin",
    "title",
    "current_revision_id",
    "lifecycle_revision",
    "state",
    "trashed_at",
    "trashed_by",
    "created_at",
    "updated_at",
    "management_url",
    "document_url"
  ],
  "properties": {
    "created_at": {
      "type": "integer",
      "format": "int64"
    },
    "current_revision_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "document_url": {
      "type": "string"
    },
    "lifecycle_revision": {
      "type": "integer",
      "format": "int64",
      "minimum": 0
    },
    "management_url": {
      "type": "string"
    },
    "origin": {
      "$ref": "#/components/schemas/OriginResponse"
    },
    "state": {
      "$ref": "#/components/schemas/LifecycleState"
    },
    "title": {
      "type": "string"
    },
    "trashed_at": {
      "type": "integer",
      "format": "int64"
    },
    "trashed_by": {
      "$ref": "#/components/schemas/Id"
    },
    "updated_at": {
      "type": "integer",
      "format": "int64"
    }
  }
}
```

### TreeMoveReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "document_id",
    "position",
    "structure_version",
    "effect"
  ],
  "properties": {
    "account_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "document_id": {
      "$ref": "#/components/schemas/Id"
    },
    "effect": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "parent_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "position": {
      "type": "integer",
      "format": "int64"
    },
    "space_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id"
        }
      ]
    },
    "structure_version": {
      "$ref": "#/components/schemas/Id"
    }
  }
}
```

### UpdateRequest

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "expected_revision",
    "name",
    "description"
  ],
  "properties": {
    "description": {
      "type": "string"
    },
    "expected_revision": {
      "type": "integer",
      "format": "int64"
    },
    "name": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "overview_document_id": {
      "oneOf": [
        {
          "type": "null"
        },
        {
          "$ref": "#/components/schemas/Id",
          "description": "Omit to preserve the current overview, send null to clear, or a document ID to replace it."
        }
      ]
    }
  },
  "additionalProperties": false
}
```

### UploadReceipt

```json
{
  "type": "object",
  "required": [
    "operation_id",
    "resource_id",
    "state",
    "sha256",
    "byte_size",
    "content_type",
    "content_url"
  ],
  "properties": {
    "byte_size": {
      "type": "integer",
      "format": "int64"
    },
    "content_type": {
      "type": "string"
    },
    "content_url": {
      "type": "string"
    },
    "operation_id": {
      "$ref": "#/components/schemas/Id"
    },
    "resource_id": {
      "$ref": "#/components/schemas/Id"
    },
    "sha256": {
      "type": "string"
    },
    "state": {
      "type": "string"
    }
  }
}
```

### VersionResponse

```json
{
  "type": "object",
  "required": [
    "version",
    "git_sha"
  ],
  "properties": {
    "git_sha": {
      "type": "string"
    },
    "version": {
      "type": "string"
    }
  }
}
```

### WorkAction

```json
{
  "type": "string",
  "enum": [
    "stop",
    "restart"
  ]
}
```

### McpRequest

```json
{
  "type": "object",
  "required": [
    "jsonrpc",
    "method"
  ],
  "properties": {
    "jsonrpc": {
      "type": "string",
      "const": "2.0"
    },
    "id": {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "type": "integer"
        }
      ],
      "description": "Omit for a notification. Null IDs are not accepted."
    },
    "method": {
      "type": "string",
      "description": "initialize, ping, tools/list, tools/call, or a notification method."
    },
    "params": {
      "type": "object",
      "description": "Method-specific fields. initialize requires protocolVersion, capabilities, and clientInfo; tools/call requires name and an arguments object."
    }
  },
  "additionalProperties": true
}
```

---

[Open Dee](https://dee.cool/app) · [Explore Dee](https://dee.cool)
