---
title: "Schemas: klav-proto"
description: "177 entries."
canonical: "https://klav.everdoc.dev/main/reference/schemas/klav-proto"
channel: "main"
---

# Schemas: klav-proto

> OmarAlex24/klav · channel `main` · main @ [`fe8e2a0c8c24`](https://github.com/OmarAlex24/klav/tree/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92) · 2026-12-05 · generated by Everdoc from source (no LLM).

177 entries.

<a id="schema-accessgranted"></a>

## `AccessGranted`

`POST /v1/agent/access` → `200`: the item with its details.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2036](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2036-L2063)
- Handlers: 0 · Callers: 0
- Shape: `{ item: Item; attachments?: AgentAttachment[]; approval_id?: ApprovalId; person_version?: PersonVersion; sole_author?: boolean }`

<a id="schema-accessrequest"></a>

## `AccessRequest`

`POST /v1/agent/access`: use an item (`list` for its metadata, `fill`, `inject`, `totp`, `reveal`, or `proxy` for one call of the credential proxy, with method, host and path in `claims`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1968](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1968-L2012)
- Handlers: 0 · Callers: 0
- Shape: `{ item_id: ItemId; permission: Permission; reason: string; claims?: Claims; approval_id?: ApprovalId; task_id?: TaskId; include_attachments?: boolean; sandbox?: SandboxId; local_client?: string; items?: ItemId[] }`

<a id="schema-accountdeletefinishrequest"></a>

## `AccountDeleteFinishRequest`

`POST /v1/account/delete/finish`: the last OPAQUE message. If it verifies, the deletion is scheduled in the same request.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:286](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L286-L293)
- Handlers: 0 · Callers: 0
- Shape: `{ handle: string; credential_finalization: Blob }`

<a id="schema-accountdeletestartrequest"></a>

## `AccountDeleteStartRequest`

`POST /v1/account/delete/start`: the first OPAQUE message, computed with the master password and this device's Secret Key (ADR 0037 §1, spec §4.5). The e-mail is the session's account, never the client's.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:267](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L267-L272)
- Handlers: 0 · Callers: 0
- Shape: `{ credential_request: Blob }`

<a id="schema-accountdeletestartresponse"></a>

## `AccountDeleteStartResponse`

Response to [`AccountDeleteStartRequest`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:275](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L275-L282)
- Handlers: 0 · Callers: 0
- Shape: `{ handle: string; credential_response: Blob }`

<a id="schema-accountdeletion"></a>

## `AccountDeletion`

A deletion of the account the person asked for (ADR 0037 §2): the account is deleted at `delete_at` unless a device cancels it first.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:252](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L252-L262)
- Handlers: 0 · Callers: 0
- Shape: `{ requested_at: number; delete_at: number; device_id: DeviceId; device_name: string }`

<a id="schema-accountinfo"></a>

## `AccountInfo`

`GET /v1/account`: the keyset, and the pending deletion, if the person asked for one (ADR 0037 §3). The keyset's fields are at the top level, so a client that reads an [`AccountKeyset`] still works.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:239](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L239-L248)
- Handlers: 0 · Callers: 0
- Shape: `{ deletion?: AccountDeletion } & AccountKeyset`

<a id="schema-accountkeyset"></a>

## `AccountKeyset`

Everything a client needs to unlock the account.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:222](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L222-L234)
- Handlers: 0 · Callers: 0
- Shape: `{ account_id: AccountId; email: string; kdf_params: Blob; public_identity: Blob; sealed_identity: Blob }`

<a id="schema-actorkind"></a>

## `ActorKind`

Who acted.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:29](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L29-L36)
- Handlers: 0 · Callers: 0
- Shape: `"person" | "agent"`

<a id="schema-agentask"></a>

## `AgentAsk`

`POST /v1/agent/approvals`: asks the person about a write **before** its body is sent (ADR 0030 §3, residual risk 35). The runtime uses it when its own policy says `ask` and nothing it verified covers the write: only once the account's signature on the approval checks out does it send the sealed item, with that `approval_id`. Logged as `agent.ask` with its body.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2159](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2159-L2179)
- Handlers: 0 · Callers: 0
- Shape: `{ permission: Permission; vault_id: VaultId; project_id: ProjectId; item_id?: ItemId; reason: string; claims?: Claims; task_id?: TaskId }`

<a id="schema-agentasked"></a>

## `AgentAsked`

`POST /v1/agent/approvals` → `200`: the write needs no new request. `approval_id` is an approval for the same target that still serves (a lease, or an approve-once decision not spent yet: it is spent by the write, not by this answer); `task_id`, a running task that covers it. With neither, the server says the policy allows the write. `202` is a [`PendingApproval`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2187](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2187-L2195)
- Handlers: 0 · Callers: 0
- Shape: `{ approval_id?: ApprovalId; task_id?: TaskId }`

<a id="schema-agentattachment"></a>

## `AgentAttachment`

An attachment delivered to an agent: its metadata (with the wrapped key) and its ciphertext.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2079](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2079-L2085)
- Handlers: 0 · Callers: 0
- Shape: `{ attachment: Attachment; content: Blob }`

<a id="schema-agentcreateitem"></a>

## `AgentCreateItem`

`POST /v1/agent/items`: create an item in a granted project.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2097](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2097-L2115)
- Handlers: 0 · Callers: 0
- Shape: `{ vault_id: VaultId; item: CreateItem; reason: string; claims?: Claims; approval_id?: ApprovalId; task_id?: TaskId }`

<a id="schema-agentendtask"></a>

## `AgentEndTask`

`POST /v1/agent/tasks/{id}/end`: the agent ends its task.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:209](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L209-L214)
- Handlers: 0 · Callers: 0
- Shape: `{ reason: string }`

<a id="schema-agentinfo"></a>

## `AgentInfo`

An agent as the person sees it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1614](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1614-L1647)
- Handlers: 0 · Callers: 0
- Shape: `{ id: AgentId; name: string; note?: string; public_identity: Blob; status: AgentStatus; created_at: number; expires_at: number; approved_at?: number; revoked_at?: number; last_seen_at?: number; grant?: SignedGrant; paused?: AgentPaused }`

<a id="schema-agentitems"></a>

## `AgentItems`

`GET /v1/agent/items`: the items of the granted projects the policy lets the agent list. Overviews and wrapped keys only: details come one item at a time through `POST /v1/agent/access`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1822](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1822-L1828)
- Handlers: 0 · Callers: 0
- Shape: `{ grant_version: number; projects: AgentProjectItems[] }`

<a id="schema-agentlist"></a>

## `AgentList`

`GET /v1/agents`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1726](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1726-L1730)
- Handlers: 0 · Callers: 0
- Shape: `{ agents: AgentInfo[] }`

<a id="schema-agentme"></a>

## `AgentMe`

`GET /v1/agent/me` (signed by the agent).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1743](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1743-L1812)
- Handlers: 0 · Callers: 0
- Shape: `{ id: AgentId; name: string; status: AgentStatus; lapsed?: boolean; account_id: AccountId; account_public_identity: Blob; grant?: SignedGrant; paused?: AgentPaused; account_delete_at?: number; gone_issuers?: AgentId[]; mcp_gateway?: boolean; proxy_tunnels?: boolean; pg_guard?: boolean; sandbox_secret_requests?: boolean; hosted_proxy?: HostedProxyStatus }`

<a id="schema-agentpause"></a>

## `AgentPause`

A pause in effect, with what the account signed (spec §13.9): the person's devices check it before acting on it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1704](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1704-L1716)
- Handlers: 0 · Callers: 0
- Shape: `{ agent_id?: AgentId; at: number; until?: number; signature: Blob }`

<a id="schema-agentpaused"></a>

## `AgentPaused`

A pause in effect on an agent: in [`AgentInfo`], [`AgentMe`] and the `403 agents_paused` error body (ADR 0033 §7.4).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1663](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1663-L1672)
- Handlers: 0 · Callers: 0
- Shape: `{ scope: PauseScope; since: number; until?: number }`

<a id="schema-agentpauses"></a>

## `AgentPauses`

Answer to [`PauseAgents`]: every pause of the account still in effect.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1719](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1719-L1723)
- Handlers: 0 · Callers: 0
- Shape: `{ pauses: AgentPause[] }`

<a id="schema-agentprojectitems"></a>

## `AgentProjectItems`

Items of one granted project.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1831](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1831-L1852)
- Handlers: 0 · Callers: 0
- Shape: `{ vault_id: VaultId; project_id: ProjectId; project_version: number; project_meta: Blob; items: Item[]; attachments?: Attachment[] }`

<a id="schema-agentproof"></a>

## `AgentProof`

The agent's signed request behind an event (spec §13.3).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:39](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L39-L56)
- Handlers: 0 · Callers: 0
- Shape: `{ method: string; path: string; timestamp: number; nonce: Blob; body_digest: Blob; body?: Blob; signature: Blob }`

<a id="schema-agentrequestproof"></a>

## `AgentRequestProof`

An agent's signed request, as it went to the server (spec §13.3), handed to the person's `klavd` as proof that this agent asked for this step (ADR 0020 §9, step 3, applied to ADR 0022 §5): `klavd` checks the signature with the agent's identity from its verified grant, the path, the body and the time before it fills or writes anything. It carries no secret: the body is the step's JSON (IDs and a reason).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/rotate.rs:126](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/rotate.rs#L126-L141)
- Handlers: 0 · Callers: 0
- Shape: `{ method: string; path: string; timestamp_ms: number; nonce: Blob; body: Blob; signature: Blob }`

<a id="schema-agentrotatefinish"></a>

## `AgentRotateFinish`

`POST /v1/agent/rotations/{id}/confirm` and `…/cancel`: the agent says whether the site took the new password (`rotate_confirm`, `rotate_cancel`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/rotate.rs:36](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/rotate.rs#L36-L44)
- Handlers: 0 · Callers: 0
- Shape: `{ item_id: ItemId; reason: string }`

<a id="schema-agentrotatestart"></a>

## `AgentRotateStart`

`POST /v1/agent/rotations`: the agent starts changing an item's password (`rotate_password`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/rotate.rs:17](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/rotate.rs#L17-L31)
- Handlers: 0 · Callers: 0
- Shape: `{ item_id: ItemId; reason: string; claims?: Claims; task_id?: TaskId }`

<a id="schema-agentstatus"></a>

## `AgentStatus`

State of an agent.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:34](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L34-L45)
- Handlers: 0 · Callers: 0
- Shape: `"pending" | "active" | "denied" | "revoked"`

<a id="schema-agenttrashitem"></a>

## `AgentTrashItem`

`POST /v1/agent/items/{item_id}/trash`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2137](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2137-L2151)
- Handlers: 0 · Callers: 0
- Shape: `{ reason: string; claims?: Claims; approval_id?: ApprovalId; task_id?: TaskId }`

<a id="schema-agenttrashed"></a>

## `AgentTrashed`

`POST /v1/agent/items/{item_id}/trash` → `200`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2211](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2211-L2216)
- Handlers: 0 · Callers: 0
- Shape: `{ approval_id?: ApprovalId }`

<a id="schema-agentupdateitem"></a>

## `AgentUpdateItem`

`PUT /v1/agent/items/{item_id}`: a new version of an item.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2118](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2118-L2134)
- Handlers: 0 · Callers: 0
- Shape: `{ item: UpdateItem; reason: string; claims?: Claims; approval_id?: ApprovalId; task_id?: TaskId }`

<a id="schema-agentwritten"></a>

## `AgentWritten`

`POST /v1/agent/items` → `201` and `PUT /v1/agent/items/{item_id}` → `200`: the item written, and the approval that let the write through, if one did (see [`AccessGranted::approval_id`]).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2200](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2200-L2208)
- Handlers: 0 · Callers: 0
- Shape: `{ approval_id?: ApprovalId } & Item`

<a id="schema-approvalcaller"></a>

## `ApprovalCaller`

Who a proxied call is for, as the person signs it (ADR 0049 §5.4): exactly one of the two.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2306](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2306-L2315)
- Handlers: 0 · Callers: 0
- Shape: `{ sandbox_id?: SandboxId; local_client?: string }`

<a id="schema-approvalinfo"></a>

## `ApprovalInfo`

An approval request as stored.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2422](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2422-L2454)
- Handlers: 0 · Callers: 0
- Shape: `{ id: ApprovalId; agent_id: AgentId; status: ApprovalStatus; request: Blob; created_at: number; expires_at: number; decided_at?: number; lease_until?: number; signature?: Blob; used_at?: number; sealed_blob?: Blob }`

<a id="schema-approvallist"></a>

## `ApprovalList`

`GET /v1/approvals`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2460](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2460-L2464)
- Handlers: 0 · Callers: 0
- Shape: `{ approvals: ApprovalInfo[] }`

<a id="schema-approvalrequest"></a>

## `ApprovalRequest`

What the person is asked to approve. The server builds it once and stores its JSON bytes; the person signs exactly those bytes (spec §13.5).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2259](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2259-L2302)
- Handlers: 0 · Callers: 0
- Shape: `{ v: number; approval_id: ApprovalId; agent_id: AgentId; agent_name: string; permission: Permission; vault_id: VaultId; project_id: ProjectId; item_id?: ItemId; reason: string; claims?: Claims; grant_version: number; requested_at: number; caller?: ApprovalCaller; items?: ItemId[] }`

<a id="schema-approvalstatus"></a>

## `ApprovalStatus`

State of an approval request.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2221](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2221-L2232)
- Handlers: 0 · Callers: 0
- Shape: `"pending" | "approved" | "denied" | "expired"`

<a id="schema-attachment"></a>

## `Attachment`

An encrypted attachment.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:127](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L127-L153)
- Handlers: 0 · Callers: 0
- Shape: `{ id: AttachmentId; vault_id: VaultId; item_id: ItemId; size: number; received: number; wrapped_key?: Blob; revision: number; created_at: number; completed_at?: number; deleted_at?: number }`

<a id="schema-attestanswer"></a>

## `AttestAnswer`

`GET /v1/attest?account&nonce` answer (ADR 0051 §2.2 step 1).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/hosted.rs:25](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/hosted.rs#L25-L35)
- Handlers: 0 · Callers: 0
- Shape: `{ document: Blob; agent_id: AgentId; generation: number; manifest_seq: number }`

<a id="schema-auditentry"></a>

## `AuditEntry`

A stored event.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:236](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L236-L244)
- Handlers: 0 · Callers: 0
- Shape: `{ seq: number; event: Blob; hash: Blob }`

<a id="schema-auditevent"></a>

## `AuditEvent`

One event of the log. Readers ignore unknown fields: the hash covers the stored bytes, so a newer server can add fields without breaking it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:60](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L60-L190)
- Handlers: 0 · Callers: 0
- Shape: `{ v: number; seq: number; at: number; actor: ActorKind; device_id?: DeviceId; approved_by_device_id?: DeviceId; new_device_id?: DeviceId; link_id?: LinkId; agent_id?: AgentId; action: string; vault_id?: VaultId; project_id?: ProjectId; item_id?: ItemId; permission?: Permission; outcome?: string; reason?: string; domain?: string; method?: string; path?: string; attachments?: AttachmentId[]; approval_id?: ApprovalId; task_id?: TaskId; lease_until?: number; decided_at?: number; …+11 }`

<a id="schema-audithead"></a>

## `AuditHead`

A chain head signed by a device of the person.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:268](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L268-L280)
- Handlers: 0 · Callers: 0
- Shape: `{ seq: number; hash: Blob; signature: Blob; device_id: DeviceId; signed_at: number }`

<a id="schema-auditheads"></a>

## `AuditHeads`

`GET /v1/audit/heads`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:283](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L283-L287)
- Handlers: 0 · Callers: 0
- Shape: `{ heads: AuditHead[] }`

<a id="schema-auditpage"></a>

## `AuditPage`

`GET /v1/audit?after=&limit=`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:247](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L247-L253)
- Handlers: 0 · Callers: 0
- Shape: `{ entries: AuditEntry[]; head_seq: number }`

<a id="schema-auditquery"></a>

## `AuditQuery`

`GET /v1/audit` query.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:256](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L256-L265)
- Handlers: 0 · Callers: 0
- Shape: `{ after?: number; limit?: number }`

<a id="schema-changeevent"></a>

## `ChangeEvent`

Payload of a `change` server-sent event on `GET /v1/events`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:88](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L88-L94)
- Handlers: 0 · Callers: 0
- Shape: `{ vault_id: VaultId; revision: number }`

<a id="schema-changes"></a>

## `Changes`

Everything in a vault that changed after `since`, up to `revision`. Deleted projects and purged items come as tombstones (`deleted_at` / `purged_at` set, no blobs).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:66](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L66-L85)
- Handlers: 0 · Callers: 0
- Shape: `{ vault_id: VaultId; since: number; revision: number; vault?: Vault; members: Member[]; projects: Project[]; items: Item[]; attachments: Attachment[] }`

<a id="schema-changesquery"></a>

## `ChangesQuery`

Query of `GET /v1/vaults/{vault_id}/changes`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:55](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L55-L61)
- Handlers: 0 · Callers: 0
- Shape: `{ since?: number }`

<a id="schema-claims"></a>

## `Claims`

What the agent says about the item it acts on. The server cannot read tags or check the page it fills: it evaluates the policy with these claims, and the agent's runtime checks them against the decrypted item (ADR 0014 §4).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1858](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1858-L1908)
- Handlers: 0 · Callers: 0
- Shape: `{ tags?: string[]; domain?: string; method?: string; path?: string; mcp_tool?: string; mcp_args?: string; upgrade?: Upgrade; pg_database?: string; pg_class?: SqlClass; pg_verbs?: string[]; pg_sql?: string }`

<a id="schema-createattachment"></a>

## `CreateAttachment`

`POST /v1/vaults/{vault_id}/items/{item_id}/attachments`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:107](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L107-L124)
- Handlers: 0 · Callers: 0
- Shape: `{ id: AttachmentId; size: number; wrapped_key: Blob; item_version?: number }`

<a id="schema-createitem"></a>

## `CreateItem`

`POST /v1/vaults/{vault_id}/items`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:237](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L237-L261)
- Handlers: 0 · Callers: 0
- Shape: `{ id: ItemId; project_id: ProjectId; version: number; wrapped_key: Blob; project_version: number; overview: Blob; details: Blob; expires_at?: number }`

<a id="schema-createproject"></a>

## `CreateProject`

`POST /v1/vaults/{vault_id}/projects`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:137](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L137-L146)
- Handlers: 0 · Callers: 0
- Shape: `{ id: ProjectId; wrapped_key: Blob; meta: Blob }`

<a id="schema-createsecretrequest"></a>

## `CreateSecretRequest`

`POST /v1/agent/secret-requests`: an agent asks the person for a secret.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/secret_request.rs:62](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/secret_request.rs#L62-L85)
- Handlers: 0 · Callers: 0
- Shape: `{ id: SecretRequestId; mode: SecretRequestMode; target_item_id?: ItemId; reason: string; proposal_digest: Blob; proposal_blob: Blob; sandbox?: SandboxId }`

<a id="schema-createvault"></a>

## `CreateVault`

`POST /v1/vaults`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:40](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L40-L53)
- Handlers: 0 · Callers: 0
- Shape: `{ id: VaultId; meta: Blob; shared_key: Blob; shared_key_signature: Blob }`

<a id="schema-decideapproval"></a>

## `DecideApproval`

`POST /v1/approvals/{id}/decide`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2467](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2467-L2484)
- Handlers: 0 · Callers: 0
- Shape: `{ approve: boolean; lease_until: number; decided_at: number; signature: Blob; task_id?: TaskId }`

<a id="schema-decidesecretrequest"></a>

## `DecideSecretRequest`

`POST /v1/secret-requests/{id}/decide`: the person's signed decision.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/secret_request.rs:160](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/secret_request.rs#L160-L169)
- Handlers: 0 · Callers: 0
- Shape: `{ decision: Blob; signature: Blob; decided_at: number }`

<a id="schema-decidetask"></a>

## `DecideTask`

`POST /v1/tasks/{id}/decide`: the first decision, a denial, or a revision («Add to the task», ADR 0021 §6).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:165](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L165-L176)
- Handlers: 0 · Callers: 0
- Shape: `{ approve: boolean; decision: Blob; decided_at: number; signature: Blob }`

<a id="schema-device"></a>

## `Device`

A device of the account (`GET /v1/devices`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:322](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L322-L345)
- Handlers: 0 · Callers: 0
- Shape: `{ id: DeviceId; name: string; kind: DeviceKind; created_at: number; last_seen_at: number; revoked_at?: number; current: boolean; added_from_device_id?: DeviceId; added_from_device_name?: string }`

<a id="schema-deviceinfo"></a>

## `DeviceInfo`

The device a login is for.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:170](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L170-L181)
- Handlers: 0 · Callers: 0
- Shape: `{ id?: DeviceId; name: string; kind: DeviceKind }`

<a id="schema-devicekind"></a>

## `DeviceKind`

Kind of client installation.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:120](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L120-L138)
- Handlers: 0 · Callers: 0
- Shape: `"cli" | "daemon" | "browser" | "ios" | "macos" | "android" | "other"`

<a id="schema-devicelinkmode"></a>

## `DeviceLinkMode`

Slot mode (ADR 0029 §2): the new device shows the QR (`a`) or the existing device shows it (`b`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:17](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L17-L24)
- Handlers: 0 · Callers: 0
- Shape: `"a" | "b"`

<a id="schema-devicelist"></a>

## `DeviceList`

`GET /v1/devices`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:348](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L348-L352)
- Handlers: 0 · Callers: 0
- Shape: `{ devices: Device[] }`

<a id="schema-endtask"></a>

## `EndTask`

`POST /v1/tasks/{id}/end`: the person ends a task.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:199](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L199-L206)
- Handlers: 0 · Callers: 0
- Shape: `{ ended_at: number; signature: Blob }`

<a id="schema-enrollanswer"></a>

## `EnrollAnswer`

`POST /v1/enroll` answer.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/hosted.rs:56](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/hosted.rs#L56-L66)
- Handlers: 0 · Callers: 0
- Shape: `{ agent_id: AgentId; generation: number; channel: string; expires_at: number }`

<a id="schema-enrollrequest"></a>

## `EnrollRequest`

`POST /v1/enroll` (ADR 0051 §6.1 step 2).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/hosted.rs:38](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/hosted.rs#L38-L53)
- Handlers: 0 · Callers: 0
- Shape: `{ account_id: AccountId; email: string; account_public_identity: Blob; generation: number; at_ms: number; signature: Blob }`

<a id="schema-errorbody-crates-klav-proto-src-common-rs"></a>

## `ErrorBody`

Body of every non-2xx JSON response.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/common.rs:93](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/common.rs#L93-L115)
- Handlers: 0 · Callers: 0
- Shape: `{ error: ErrorCode; message: string; current_version?: number; last_at?: number; delete_at?: number } & AgentPaused`

<a id="schema-errorcode-crates-klav-proto-src-common-rs"></a>

## `ErrorCode`

Machine-readable error code returned in [`ErrorBody::error`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/common.rs:6](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/common.rs#L6-L90)
- Handlers: 0 · Callers: 0
- Shape: `"bad_request" | "unauthorized" | "forbidden" | "not_found" | "conflict" | "payload_too_large" | "too_many_requests" | "internal" | "unavailable" | "agents_paused" | "reauth_failed" | "account_deleting" | "not_issuer" | "profile_not_allowed" | "too_many_sandboxes" | "sandbox_revoked" | "sandbox_claimed" | "sandbox_not_found" | "invite_invalid" | "quota_exceeded" | "mcp_gateway_off" | "proxy_tunnels_off" | "pg_guard_off" | "sandbox_secret_requests_off"`

<a id="schema-grantlabels"></a>

## `GrantLabels`

Names of a granted project, as the person saw them when approving (plaintext of `GrantedProject::labels`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1601](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1601-L1608)
- Handlers: 0 · Callers: 0
- Shape: `{ vault: string; project: string }`

<a id="schema-grantpayload"></a>

## `GrantPayload`

What an agent may do (the signed part of a grant).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:211](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L211-L260)
- Handlers: 0 · Callers: 0
- Shape: `{ v: number; account_id: AccountId; agent_id: AgentId; version: number; issued_at: number; policy: Policy; projects: GrantedProject[]; items?: GrantedItem[]; profiles?: ProxyProfile[]; issuers?: SandboxIssuer[]; sandbox?: IssuerGrant; local_clients?: LocalClient[]; released?: ItemId[] }`

<a id="schema-granteditem"></a>

## `GrantedItem`

One item shared with an agent (a per-item grant, ADR 0036 §2). Its key opens that item only, never another one of its project.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:370](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L370-L383)
- Handlers: 0 · Callers: 0
- Shape: `{ vault_id: VaultId; owner_account_id: AccountId; project_id: ProjectId; item_id: ItemId; shared_key: Blob }`

<a id="schema-grantedproject"></a>

## `GrantedProject`

A project shared with an agent.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1583](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1583-L1597)
- Handlers: 0 · Callers: 0
- Shape: `{ vault_id: VaultId; owner_account_id: AccountId; project_id: ProjectId; shared_key: Blob; labels: Blob }`

<a id="schema-healthresponse"></a>

## `HealthResponse`

`GET /v1/health`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/common.rs:118](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/common.rs#L118-L146)
- Handlers: 0 · Callers: 0
- Shape: `{ status: string; version: string; registration_open?: boolean; account_deletion?: boolean; registration_mode?: RegistrationMode; temporary_items?: boolean }`

<a id="schema-hostedproxystatus"></a>

## `HostedProxyStatus`

Whether an account is entitled to Klav Cloud's hosted proxy (ADR 0051 §3.5): in [`AgentMe::hosted_proxy`] for the hosted proxy's own agents, and the answer of `GET /v1/account/hosted-proxy`. An older server never sends it and answers that route `404`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:147](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L147-L153)
- Handlers: 0 · Callers: 0
- Shape: `{ entitled: boolean }`

<a id="schema-hostedregistrationproof"></a>

## `HostedRegistrationProof`

The hosted proxy's mark on a registration (spec §15.8): its service key signs `tuple("klav/v1/sig/hosted-proxy-registration", account_id(16), agent_id(16), agent_ed25519_pub(32), agent_x25519_pub(32), u32_be(generation))`. The e-mail isn't signed: the server requires it to be the e-mail of `account_id`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:131](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L131-L141)
- Handlers: 0 · Callers: 0
- Shape: `{ account_id: AccountId; generation: number; signature: Blob }`

<a id="schema-invitecheckrequest"></a>

## `InviteCheckRequest`

`POST /v1/auth/invite/check` (ADR 0048 §1.3): whether `invite` can be used by `email` now. `204` or `403 invite_invalid`; `404` on a server that is not in `invite` mode. Not a reservation.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:84](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L84-L91)
- Handlers: 0 · Callers: 0
- Shape: `{ email: string; invite: InviteCode }`

<a id="schema-issuergrant"></a>

## `IssuerGrant`

What an issuer's grant says about sandboxes (ADR 0036 §3): which proxy it talks to, so a malicious sync server cannot change it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:348](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L348-L353)
- Handlers: 0 · Callers: 0
- Shape: `{ proxy?: SandboxProxy }`

<a id="schema-item"></a>

## `Item`

An item. Lists carry only the overview; `details` comes with a single item. Purged items are tombstones without blobs.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:308](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L308-L349)
- Handlers: 0 · Callers: 0
- Shape: `{ id: ItemId; vault_id: VaultId; project_id: ProjectId; version: number; revision: number; wrapped_key?: Blob; overview?: Blob; details?: Blob; expires_at?: number; created_at: number; updated_at: number; trashed_at?: number; purged_at?: number; author_agent_id?: AgentId }`

<a id="schema-itemhistory"></a>

## `ItemHistory`

`GET /v1/vaults/{vault_id}/items/{item_id}/versions`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:371](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L371-L375)
- Handlers: 0 · Callers: 0
- Shape: `{ versions: ItemVersionInfo[] }`

<a id="schema-itemlist"></a>

## `ItemList`

`GET /v1/vaults/{vault_id}/items`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:352](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L352-L356)
- Handlers: 0 · Callers: 0
- Shape: `{ items: Item[] }`

<a id="schema-itemquery"></a>

## `ItemQuery`

Query of `GET /v1/vaults/{vault_id}/items`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:404](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L404-L413)
- Handlers: 0 · Callers: 0
- Shape: `{ project_id?: ProjectId; trash?: TrashFilter }`

<a id="schema-itemversion"></a>

## `ItemVersion`

`GET /v1/vaults/{vault_id}/items/{item_id}/versions/{version}`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:382](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L382-L401)
- Handlers: 0 · Callers: 0
- Shape: `{ item_id: ItemId; project_id: ProjectId; version: number; wrapped_key: Blob; overview: Blob; details: Blob; created_at: number; author_agent_id?: AgentId }`

<a id="schema-itemversioninfo"></a>

## `ItemVersionInfo`

One entry of an item's history.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:359](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L359-L368)
- Handlers: 0 · Callers: 0
- Shape: `{ version: number; created_at: number; author_agent_id?: AgentId }`

<a id="schema-linkclaimrequest"></a>

## `LinkClaimRequest`

`POST /v1/links/claim`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:104](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L104-L114)
- Handlers: 0 · Callers: 0
- Shape: `{ link_id: LinkId; fetch_key: Blob; wait_secs?: number }`

<a id="schema-linkclaimresponse"></a>

## `LinkClaimResponse`

Successful `POST /v1/links/claim`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:123](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L123-L127)
- Handlers: 0 · Callers: 0
- Shape: `{ blob: Blob }`

<a id="schema-linkoffer"></a>

## `LinkOffer`

A mode-B offer as the existing device reads it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:50](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L50-L60)
- Handlers: 0 · Callers: 0
- Shape: `{ pk_n: Blob; device_name: string; device_kind: DeviceKind; created_at: number }`

<a id="schema-linkofferrequest"></a>

## `LinkOfferRequest`

The unauthenticated offer of the new device (mode B), `POST /v1/links/{id}/offer`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:36](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L36-L47)
- Handlers: 0 · Callers: 0
- Shape: `{ pk_n: Blob; claim_hash: Blob; device_name: string; device_kind: DeviceKind }`

<a id="schema-linkpayloadrequest"></a>

## `LinkPayloadRequest`

`PUT /v1/links/{id}/payload`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:86](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L86-L101)
- Handlers: 0 · Callers: 0
- Shape: `{ blob: Blob; signature: Blob; pk_n: Blob; issued_at_ms: number; approved_by_device_id: DeviceId; server: string }`

<a id="schema-linkstate"></a>

## `LinkState`

`GET /v1/links/{id}` and the response body of `POST /v1/links`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:63](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L63-L83)
- Handlers: 0 · Callers: 0
- Shape: `{ link_id: LinkId; mode: DeviceLinkMode; expires_at: number; waiting: boolean; same_network?: boolean; offer?: LinkOffer; payload_ready: boolean }`

<a id="schema-localclient"></a>

## `LocalClient`

An MCP client on the person's Mac, as the account signed it into the proxy's grant (ADR 0049 §3.2). The proxy names the caller to the server with `name` only after the caller's bearer token matches `token_digest`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:268](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L268-L279)
- Handlers: 0 · Callers: 0
- Shape: `{ name: string; token_digest: Blob; profiles: string[] }`

<a id="schema-loginfinishrequest"></a>

## `LoginFinishRequest`

`POST /v1/auth/login/finish`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:184](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L184-L197)
- Handlers: 0 · Callers: 0
- Shape: `{ login_id: string; credential_finalization: Blob; device: DeviceInfo; link_id?: LinkId }`

<a id="schema-loginfinishresponse"></a>

## `LoginFinishResponse`

Response to [`LoginFinishRequest`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:296](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L296-L304)
- Handlers: 0 · Callers: 0
- Shape: `{ account: AccountKeyset; device_id: DeviceId; session: SessionTokens }`

<a id="schema-loginstartrequest"></a>

## `LoginStartRequest`

`POST /v1/auth/login/start`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:101](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L101-L108)
- Handlers: 0 · Callers: 0
- Shape: `{ email: string; credential_request: Blob }`

<a id="schema-loginstartresponse"></a>

## `LoginStartResponse`

Response to [`LoginStartRequest`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:111](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L111-L117)
- Handlers: 0 · Callers: 0
- Shape: `{ login_id: string; credential_response: Blob }`

<a id="schema-manifestwire"></a>

## `ManifestWire`

`GET /v1/manifest`: the signed Klav Enclave Transparency Manifest, its exact text and the signature in hex (ADR 0051 §2.4).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/hosted.rs:15](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/hosted.rs#L15-L22)
- Handlers: 0 · Callers: 0
- Shape: `{ manifest: string; signature: string }`

<a id="schema-mcpgatewayswitch"></a>

## `McpGatewaySwitch`

`GET /v1/account/mcp-gateway` and `POST /v1/account/mcp-gateway` (ADR 0049 §9): the account's switch. `POST` turns it on, and nothing turns it off. An older server answers `404`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2331](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2331-L2338)
- Handlers: 0 · Callers: 0
- Shape: `{ mcp_gateway: boolean; since?: number }`

<a id="schema-mcpheader"></a>

## `McpHeader`

One fixed header of an MCP profile.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:489](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L489-L496)
- Handlers: 0 · Callers: 0
- Shape: `{ name: string; value: string }`

<a id="schema-mcpprofile"></a>

## `McpProfile`

What makes a profile an MCP profile (ADR 0049 §2.1): the upstream's MCP endpoint, which the proxy reads, checks and filters, and the fixed headers the person signed.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:476](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L476-L486)
- Handlers: 0 · Callers: 0
- Shape: `{ endpoint: string; headers?: McpHeader[] }`

<a id="schema-member"></a>

## `Member`

A member of a vault and the vault key shared with it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:112](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L112-L127)
- Handlers: 0 · Callers: 0
- Shape: `{ member_type: MemberType; member_id: string; role: Role; shared_key: Blob; revision: number; revoked_at?: number }`

<a id="schema-memberlist"></a>

## `MemberList`

`GET /v1/vaults/{vault_id}/members`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:130](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L130-L134)
- Handlers: 0 · Callers: 0
- Shape: `{ members: Member[] }`

<a id="schema-membertype"></a>

## `MemberType`

Kind of vault member.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:30](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L30-L37)
- Handlers: 0 · Callers: 0
- Shape: `"account" | "agent"`

<a id="schema-offertask"></a>

## `OfferTask`

`POST /v1/tasks`: the person offers an agent a task without a request (ADR 0022 §6). The person's client picks the task ID, since it is part of what the account signs; the stored request is empty.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:181](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L181-L196)
- Handlers: 0 · Callers: 0
- Shape: `{ task_id: TaskId; agent_id: AgentId; decision: Blob; decided_at: number; signature: Blob }`

<a id="schema-openlinkrequest"></a>

## `OpenLinkRequest`

`POST /v1/links` (mode B).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/link.rs:27](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/link.rs#L27-L32)
- Handlers: 0 · Callers: 0
- Shape: `{ link_id: LinkId }`

<a id="schema-passkeyaccess"></a>

## `PasskeyAccess`

`POST /v1/agent/access` with `passkey` → `200` (ADR 0020 §9): the task lets the agent use the item's passkey on `domain`. No item and no details: the agent hands its signed request to the person's `klavd`, which checks it all again and signs in the browser.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2025](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2025-L2033)
- Handlers: 0 · Callers: 0
- Shape: `{ task_id: TaskId; item_id: ItemId; domain: string }`

<a id="schema-pauseagents"></a>

## `PauseAgents`

`POST /v1/agents/pause` (every agent) and `POST /v1/agents/{agent_id}/pause` (one): a pause or a resume signed by the account (spec §13.9).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1686](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1686-L1700)
- Handlers: 0 · Callers: 0
- Shape: `{ state: PauseState; at: number; until?: number; signature: Blob }`

<a id="schema-pausescope"></a>

## `PauseScope`

What a pause covers, as an agent sees it (ADR 0033 §7.4).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1652](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1652-L1659)
- Handlers: 0 · Callers: 0
- Shape: `"all" | "agent"`

<a id="schema-pausestate"></a>

## `PauseState`

The `state` a pause decision signs (spec §13.9).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1675](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1675-L1682)
- Handlers: 0 · Callers: 0
- Shape: `"pause" | "resume"`

<a id="schema-pendingapproval"></a>

## `PendingApproval`

`202 Accepted` from any agent action the policy sets to `ask`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2088](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2088-L2094)
- Handlers: 0 · Callers: 0
- Shape: `{ pending_approval_id: ApprovalId; expires_at: number }`

<a id="schema-pendingsecretrequest"></a>

## `PendingSecretRequest`

`POST /v1/agent/secret-requests` → `202`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/secret_request.rs:88](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/secret_request.rs#L88-L94)
- Handlers: 0 · Callers: 0
- Shape: `{ request_id: SecretRequestId; expires_at: number }`

<a id="schema-pendingtask"></a>

## `PendingTask`

`POST /v1/agent/tasks` → `202`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:154](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L154-L161)
- Handlers: 0 · Callers: 0
- Shape: `{ pending_task_id: TaskId; expires_at: number }`

<a id="schema-personevent"></a>

## `PersonEvent`

`POST /v1/audit/person`: an event that happened only on a device of the person (the server never sees it otherwise), such as signing in with a passkey. The server checks the item, the task and the agent, adds the vault, the project and the device, and appends it to the chain. It carries no site: `passkey.used` names only the item.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:310](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L310-L323)
- Handlers: 0 · Callers: 0
- Shape: `{ action: string; item_id: ItemId; agent_id?: AgentId; task_id?: TaskId }`

<a id="schema-personversion"></a>

## `PersonVersion`

The last version of an item the person wrote: enough to read its sites (the overview), never its secrets.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2067](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2067-L2075)
- Handlers: 0 · Callers: 0
- Shape: `{ version: number; wrapped_key: Blob; overview: Blob }`

<a id="schema-pgguardswitch"></a>

## `PgGuardSwitch`

`GET /v1/account/pg-guard` and `POST /v1/account/pg-guard` (ADR 0052 §10): the account's switch for the Postgres proxy's claims and the sealed-blob route. `POST` turns it on, and nothing turns it off. An older server answers `404`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2356](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2356-L2363)
- Handlers: 0 · Callers: 0
- Shape: `{ pg_guard: boolean; since?: number }`

<a id="schema-pgprofile"></a>

## `PgProfile`

What makes a profile a Postgres profile (ADR 0052 §7): how the proxy reaches the database, which databases a session may open, where the role name is, and how the hop is protected. The item's main secret is the password; it never reaches the sandbox.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:553](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L553-L575)
- Handlers: 0 · Callers: 0
- Shape: `{ transport: PgTransport; databases: string[]; user_field: string; tls: PgTls; write_item_id?: ItemId; allow_cleartext_over_tls?: boolean }`

<a id="schema-pgtls"></a>

## `PgTls`

TLS toward the database (ADR 0052 §7).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:606](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L606-L617)
- Handlers: 0 · Callers: 0
- Shape: `"verify-full" | "none"`

<a id="schema-pgtransport"></a>

## `PgTransport`

How a Postgres profile reaches its database (ADR 0052 §8).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:578](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L578-L603)
- Handlers: 0 · Callers: 0
- Shape: `{ direct: { host: string; port: number } } | { northflank_addon: { profile: string; project: string; addon: string; team?: string; port: number } }`

<a id="schema-preloginrequest"></a>

## `PreloginRequest`

`POST /v1/auth/prelogin`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:23](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L23-L28)
- Handlers: 0 · Callers: 0
- Shape: `{ email: string }`

<a id="schema-preloginresponse"></a>

## `PreloginResponse`

Response to [`PreloginRequest`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:31](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L31-L36)
- Handlers: 0 · Callers: 0
- Shape: `{ kdf_params: Blob }`

<a id="schema-project"></a>

## `Project`

A project.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:204](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L204-L227)
- Handlers: 0 · Callers: 0
- Shape: `{ id: ProjectId; vault_id: VaultId; version: number; revision: number; wrapped_key?: Blob; meta?: Blob; created_at: number; updated_at: number; deleted_at?: number }`

<a id="schema-projectkeys"></a>

## `ProjectKeys`

`GET /v1/vaults/{vault_id}/projects/{project_id}/keys`: every item key wrapped with the project key, to rotate it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:177](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L177-L184)
- Handlers: 0 · Callers: 0
- Shape: `{ version: number; keys: WrappedItemKey[] }`

<a id="schema-projectlist"></a>

## `ProjectList`

`GET /v1/vaults/{vault_id}/projects`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:230](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L230-L234)
- Handlers: 0 · Callers: 0
- Shape: `{ projects: Project[] }`

<a id="schema-proxyprofile"></a>

## `ProxyProfile`

A recipe signed by the account (ADR 0036 §2): which item's value goes in which header, and where requests through it go. The hosts, methods and paths it may reach are the `proxy` rules of the policy for its item; `upstream` must be one of those hosts.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:663](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L663-L706)
- Handlers: 0 · Callers: 0
- Shape: `{ name: string; item_id: ItemId; field?: string; header?: string; prefix?: string; upstream?: string; rate_per_minute?: number; mcp?: McpProfile; tunnel?: TunnelProfile; pg?: PgProfile }`

<a id="schema-proxytunnelsswitch"></a>

## `ProxyTunnelsSwitch`

`GET /v1/account/proxy-tunnels` and `POST /v1/account/proxy-tunnels` (ADR 0052 §10): the account's switch for WebSocket tunnels. `POST` turns it on, and nothing turns it off. An older server answers `404`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2343](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2343-L2350)
- Handlers: 0 · Callers: 0
- Shape: `{ proxy_tunnels: boolean; since?: number }`

<a id="schema-pushenvironment"></a>

## `PushEnvironment`

Where the server sends a device's push notifications (APNs).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:355](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L355-L362)
- Handlers: 0 · Callers: 0
- Shape: `"sandbox" | "production"`

<a id="schema-pushregistration"></a>

## `PushRegistration`

`PUT /v1/devices/current/push`: the APNs device token of this device (hex). Pushes only carry an approval or agent ID (ADR 0018 §5).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:385](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L385-L392)
- Handlers: 0 · Callers: 0
- Shape: `{ token: string; environment: PushEnvironment }`

<a id="schema-refreshrequest"></a>

## `RefreshRequest`

`POST /v1/auth/refresh`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:307](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L307-L313)
- Handlers: 0 · Callers: 0
- Shape: `{ refresh_token: string }`

<a id="schema-registeragent"></a>

## `RegisterAgent`

`POST /v1/agents/register` (no authentication).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:71](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L71-L85)
- Handlers: 0 · Callers: 0
- Shape: `{ id: AgentId; email: string; name: string; public_identity: Blob; note?: string }`

<a id="schema-registeragentresponse"></a>

## `RegisterAgentResponse`

Response to [`RegisterAgent`]: the same for every e-mail, so the endpoint does not reveal which accounts exist.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:157](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L157-L165)
- Handlers: 0 · Callers: 0
- Shape: `{ id: AgentId; status: AgentStatus; expires_at: number }`

<a id="schema-registerfinishrequest"></a>

## `RegisterFinishRequest`

`POST /v1/auth/register/finish`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:60](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L60-L79)
- Handlers: 0 · Callers: 0
- Shape: `{ email: string; account_id: AccountId; registration_upload: Blob; kdf_params: Blob; public_identity: Blob; sealed_identity: Blob; invite?: InviteCode }`

<a id="schema-registerfinishresponse"></a>

## `RegisterFinishResponse`

Response to [`RegisterFinishRequest`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:94](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L94-L98)
- Handlers: 0 · Callers: 0
- Shape: `{ account_id: AccountId }`

<a id="schema-registerhostedagent"></a>

## `RegisterHostedAgent`

What `POST /v1/agents/register` accepts: [`RegisterAgent`] and, only from Klav Cloud's hosted proxy, [`Self::hosted`] (ADR 0051 §8). Every other agent keeps sending [`RegisterAgent`], which parses as this with `hosted` absent; older servers refuse `hosted` as an unknown field.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:91](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L91-L111)
- Handlers: 0 · Callers: 0
- Shape: `{ id: AgentId; email: string; name: string; public_identity: Blob; note?: string; hosted?: HostedRegistrationProof }`

<a id="schema-registerstartrequest"></a>

## `RegisterStartRequest`

`POST /v1/auth/register/start`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:39](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L39-L50)
- Handlers: 0 · Callers: 0
- Shape: `{ email: string; registration_request: Blob; invite?: InviteCode }`

<a id="schema-registerstartresponse"></a>

## `RegisterStartResponse`

Response to [`RegisterStartRequest`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:53](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L53-L57)
- Handlers: 0 · Callers: 0
- Shape: `{ registration_response: Blob }`

<a id="schema-registrationmode"></a>

## `RegistrationMode`

How a server takes new accounts (`registration_mode`, ADR 0048 §1.1).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/common.rs:149](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/common.rs#L149-L162)
- Handlers: 0 · Callers: 0
- Shape: `"open" | "invite" | "closed" | "unknown"`

<a id="schema-revokeagent"></a>

## `RevokeAgent`

`POST /v1/agents/{agent_id}/revoke`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:1733](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L1733-L1740)
- Handlers: 0 · Callers: 0
- Shape: `{ revoked_at: number; signature: Blob }`

<a id="schema-rewrappedattachmentkey"></a>

## `RewrappedAttachmentKey`

An attachment key wrapped again for a new item key.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:297](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L297-L304)
- Handlers: 0 · Callers: 0
- Shape: `{ attachment_id: AttachmentId; wrapped_key: Blob }`

<a id="schema-role"></a>

## `Role`

Role of a member in a vault.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:20](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L20-L27)
- Handlers: 0 · Callers: 0
- Shape: `"owner" | "member"`

<a id="schema-rotateproject"></a>

## `RotateProject`

`POST /v1/vaults/{vault_id}/projects/{project_id}/rotate`: a new project key, and every item key of [`ProjectKeys`] wrapped with it, applied in one transaction.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:189](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L189-L201)
- Handlers: 0 · Callers: 0
- Shape: `{ version: number; wrapped_key: Blob; meta: Blob; keys: WrappedItemKey[] }`

<a id="schema-rotationinfo"></a>

## `RotationInfo`

One change, as the server keeps it: IDs, host and times, never values.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/rotate.rs:86](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/rotate.rs#L86-L107)
- Handlers: 0 · Callers: 0
- Shape: `{ id: RotationId; task_id: TaskId; vault_id: VaultId; project_id: ProjectId; item_id: ItemId; host: string; status: RotationStatus; started_at: number; finished_at?: number }`

<a id="schema-rotationstarted"></a>

## `RotationStarted`

`POST /v1/agent/rotations` → `201`: the change and the task that covers it, whose signed decision `klavd` verifies before it fills anything (ADR 0022 §5, step 2).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/rotate.rs:112](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/rotate.rs#L112-L118)
- Handlers: 0 · Callers: 0
- Shape: `{ rotation: RotationInfo; task: TaskInfo }`

<a id="schema-rotationstatus"></a>

## `RotationStatus`

Where a change stands.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/rotate.rs:47](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/rotate.rs#L47-L59)
- Handlers: 0 · Callers: 0
- Shape: `"started" | "confirmed" | "cancelled" | "abandoned"`

<a id="schema-sandboxclaimed"></a>

## `SandboxClaimed`

`POST /v1/agent/sandboxes/{sandbox_id}/claimed`: a forwarder claimed the sandbox with its secret, from the channel key it presented (`sandbox.claimed`, ADR 0036 §5, E3.3). The proxy sends this before it counts the secret as spent. The proxy that calls it arrives with layer 6.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:131](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L131-L137)
- Handlers: 0 · Callers: 0
- Shape: `{ channel_key_sha256: Blob }`

<a id="schema-sandboxend"></a>

## `SandboxEnd`

Why the proxy ended a sandbox (`sandbox.revoked`, ADR 0036 §9, E3.3).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:140](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L140-L162)
- Handlers: 0 · Callers: 0
- Shape: `"stop" | "ttl" | "inactivity" | "theft" | "released" | "issuer_removed" | "person" | "person_local"`

<a id="schema-sandboxheartbeat"></a>

## `SandboxHeartbeat`

`PUT /v1/agent/sandboxes/state`: the proxy's heartbeat (ADR 0036 E3.3, spec §13.12). A signed request, kept by the server out of the log (only the last one of each proxy), and checked by each device: the proxy's signature, the epoch of the proxy's last `sandbox.store_reset` in the verified chain, a `seq` that never goes down within it, and its age from `sent_at_ms`. It never makes a sandbox live: the chain does.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:322](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L322-L337)
- Handlers: 0 · Callers: 0
- Shape: `{ v: number; store_epoch: Blob; seq: number; sent_at_ms: number; sandboxes: SandboxLink[] }`

<a id="schema-sandboxissue"></a>

## `SandboxIssue`

`POST /v1/agent/sandboxes`: the proxy started a sandbox for an issuer (`sandbox.issued`). It sends this before it hands the issuer the package; if the server refuses, there is no package.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:67](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L67-L80)
- Handlers: 0 · Callers: 0
- Shape: `{ sandbox_id: SandboxId; issuer_id: AgentId; label: string; profiles: string[]; expires_at: number }`

<a id="schema-sandboxissuer"></a>

## `SandboxIssuer`

An agent that may start sandboxes through the credential proxy, as the account signed it into the proxy's grant (ADR 0036 §4). The proxy checks the issuer's requests with this identity, never one from the server.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:298](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L298-L318)
- Handlers: 0 · Callers: 0
- Shape: `{ agent_id: AgentId; public_identity: Blob; profiles: string[]; max_ttl_secs: number; max_live: number; secret_requests?: boolean }`

<a id="schema-sandboxlink"></a>

## `SandboxLink`

One sandbox in a heartbeat, as the proxy sees it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:303](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L303-L314)
- Handlers: 0 · Callers: 0
- Shape: `{ id: SandboxId; connected: boolean; last_seen_at?: number }`

<a id="schema-sandboxproxy"></a>

## `SandboxProxy`

The proxy an issuer starts sandboxes at.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:356](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L356-L366)
- Handlers: 0 · Callers: 0
- Shape: `{ agent_id: AgentId; public_identity: Blob; url: string }`

<a id="schema-sandboxrevocation"></a>

## `SandboxRevocation`

A person's revocation as the server keeps it: the answer to [`PATH_PERSON_REVOKE`] and an entry of [`PATH_REVOCATIONS`].

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:411](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L411-L427)
- Handlers: 0 · Callers: 0
- Shape: `{ seq: number; proxy_id: AgentId; scope: string; at: number; signature: Blob; sandbox_ids: SandboxId[] }`

<a id="schema-sandboxrevocations"></a>

## `SandboxRevocations`

`GET /v1/agent/sandboxes/revocations?since=`: the proxy's revocations after `since`, oldest first.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:431](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L431-L437)
- Handlers: 0 · Callers: 0
- Shape: `{ revocations: SandboxRevocation[]; more: boolean }`

<a id="schema-sandboxrevoke"></a>

## `SandboxRevoke`

`POST /v1/sandboxes/revoke`: the person revokes one sandbox of the proxy, or all of them, with the account's signature (spec §13.11, ADR 0036 E3.3).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:240](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L240-L251)
- Handlers: 0 · Callers: 0
- Shape: `{ proxy_id: AgentId; scope: string; at: number; signature: Blob }`

<a id="schema-sandboxrevoked"></a>

## `SandboxRevoked`

`POST /v1/agent/sandboxes/{sandbox_id}/revoked`: the proxy ended a sandbox (`sandbox.revoked`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:187](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L187-L202)
- Handlers: 0 · Callers: 0
- Shape: `{ reason: SandboxEnd; at?: number }`

<a id="schema-sandboxsecretrequestsswitch"></a>

## `SandboxSecretRequestsSwitch`

`GET /v1/account/sandbox-secret-requests` and `POST /v1/account/sandbox-secret-requests` (ADR 0053 §9): the account's switch for secret requests a credential proxy raises on behalf of one of its live sandboxes, decisions with `attach_sandbox` and `v: 6` grants. `POST` turns it on, and nothing turns it off. An older server answers `404`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:2370](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L2370-L2377)
- Handlers: 0 · Callers: 0
- Shape: `{ sandbox_secret_requests: boolean; since?: number }`

<a id="schema-sandboxstate"></a>

## `SandboxState`

The last heartbeat of one proxy of the account, as `GET /v1/sync` gives it (ADR 0036 E3.3, spec §13.12): the proxy's signed `PUT /v1/agent/sandboxes/state`, body included, for each device to check against the proxy's key and the verified chain. The server only keeps it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:398](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L398-L407)
- Handlers: 0 · Callers: 0
- Shape: `{ proxy_id: AgentId; proof: AgentProof; received_at: number }`

<a id="schema-sandboxstorereset"></a>

## `SandboxStoreReset`

`POST /v1/agent/sandboxes/epochs`: a new store of the proxy, logged as `sandbox.store_reset` before its first heartbeat (ADR 0036 E3.3). Each store, the first one too, has its own epoch, and a proxy never uses one twice: a heartbeat from before a reset carries the old epoch and no device takes it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sandbox.rs:284](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sandbox.rs#L284-L289)
- Handlers: 0 · Callers: 0
- Shape: `{ store_epoch: Blob }`

<a id="schema-secretrequestevent"></a>

## `SecretRequestEvent`

Payload of a `secret_request` server-sent event on `GET /v1/events` (ADR 0046 §1). Carries only the request ID and its current state.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:98](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L98-L104)
- Handlers: 0 · Callers: 0
- Shape: `{ request_id: SecretRequestId; status: SecretRequestState }`

<a id="schema-secretrequestinfo"></a>

## `SecretRequestInfo`

A secret request as stored and returned by the API.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/secret_request.rs:97](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/secret_request.rs#L97-L142)
- Handlers: 0 · Callers: 0
- Shape: `{ id: SecretRequestId; agent_id: AgentId; agent_name: string; mode: SecretRequestMode; target_item_id?: ItemId; reason: string; proposal_digest: Blob; proposal_blob?: Blob; status: SecretRequestState; created_at: number; expires_at: number; decided_at?: number; decision?: Blob; signature?: Blob; sandbox_id?: SandboxId; sandbox_label?: string }`

<a id="schema-secretrequestlist"></a>

## `SecretRequestList`

`GET /v1/secret-requests`: the account's secret requests, newest first.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/secret_request.rs:153](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/secret_request.rs#L153-L157)
- Handlers: 0 · Callers: 0
- Shape: `{ secret_requests: SecretRequestInfo[] }`

<a id="schema-secretrequeststate"></a>

## `SecretRequestState`

Lifecycle state of a secret request on the server.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/secret_request.rs:22](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/secret_request.rs#L22-L33)
- Handlers: 0 · Callers: 0
- Shape: `"pending" | "fulfilled" | "denied" | "expired"`

<a id="schema-sessiontokens"></a>

## `SessionTokens`

Session credentials. Access tokens go in `Authorization: Bearer …`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/auth.rs:200](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/auth.rs#L200-L210)
- Handlers: 0 · Callers: 0
- Shape: `{ access_token: string; access_expires_at: number; refresh_token: string; refresh_expires_at: number }`

<a id="schema-signhead"></a>

## `SignHead`

`POST /v1/audit/heads`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/audit.rs:290](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/audit.rs#L290-L299)
- Handlers: 0 · Callers: 0
- Shape: `{ seq: number; hash: Blob; signature: Blob }`

<a id="schema-signvaultkey"></a>

## `SignVaultKey`

`PUT /v1/vaults/{vault_id}/signature`: the owner signs the vault key of a vault created before the signature existed (TOFU, ADR 0030 §1).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:57](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L57-L62)
- Handlers: 0 · Callers: 0
- Shape: `{ shared_key_signature: Blob }`

<a id="schema-signedgrant"></a>

## `SignedGrant`

A grant as stored: the payload bytes (JSON of [`GrantPayload`]) exactly as signed, and the account's signature (spec §13.4).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:169](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L169-L176)
- Handlers: 0 · Callers: 0
- Shape: `{ payload: Blob; signature: Blob }`

<a id="schema-syncstate"></a>

## `SyncState`

`GET /v1/sync`: every vault the caller belongs to, with its revision. A vault that disappears from this list was purged or the caller lost access to it.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:32](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L32-L52)
- Handlers: 0 · Callers: 0
- Shape: `{ vaults: VaultRevision[]; agent_pauses?: AgentPause[]; deletion?: AccountDeletion; sandbox_state?: SandboxState[] }`

<a id="schema-taskendedby"></a>

## `TaskEndedBy`

Who or what ended an approved task (ADR 0021 §9).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:68](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L68-L79)
- Handlers: 0 · Callers: 0
- Shape: `"person" | "agent" | "expiry" | "revocation"`

<a id="schema-taskinfo"></a>

## `TaskInfo`

A task as stored.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:105](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L105-L144)
- Handlers: 0 · Callers: 0
- Shape: `{ id: TaskId; agent_id: AgentId; agent_name: string; status: TaskStatus; request: Blob; created_at: number; decide_by: number; decided_at?: number; decision?: Blob; signature?: Blob; revision?: number; expires_at?: number; ended_at?: number; ended_by?: TaskEndedBy }`

<a id="schema-tasklist"></a>

## `TaskList`

`GET /v1/tasks` and `GET /v1/agent/tasks`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:147](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L147-L151)
- Handlers: 0 · Callers: 0
- Shape: `{ tasks: TaskInfo[] }`

<a id="schema-taskstatus"></a>

## `TaskStatus`

State of a task.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/task.rs:27](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/task.rs#L27-L40)
- Handlers: 0 · Callers: 0
- Shape: `"pending" | "approved" | "denied" | "expired" | "ended"`

<a id="schema-trashfilter"></a>

## `TrashFilter`

Trash filter for listings.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:416](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L416-L426)
- Handlers: 0 · Callers: 0
- Shape: `"exclude" | "only" | "include"`

<a id="schema-tunnelprofile"></a>

## `TunnelProfile`

What lets a profile open WebSocket tunnels (ADR 0052 §2–§4): the hosts they may reach and under which path. The rules that let a handshake through are `proxy` rules with `upgrades: [websocket]` for the profile's item; this says only where the proxy accepts one at all.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/agent.rs:502](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/agent.rs#L502-L521)
- Handlers: 0 · Callers: 0
- Shape: `{ hosts: TunnelHost[]; path_prefix: PathPrefix; idle_secs?: number; max_secs?: number }`

<a id="schema-updateitem"></a>

## `UpdateItem`

`PUT /v1/vaults/{vault_id}/items/{item_id}`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:264](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L264-L294)
- Handlers: 0 · Callers: 0
- Shape: `{ version: number; wrapped_key: Blob; project_version: number; overview: Blob; details: Blob; expires_at?: number; attachment_keys?: RewrappedAttachmentKey[] }`

<a id="schema-updateproject"></a>

## `UpdateProject`

`PUT /v1/vaults/{vault_id}/projects/{project_id}`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:149](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L149-L159)
- Handlers: 0 · Callers: 0
- Shape: `{ version: number; wrapped_key: Blob; meta: Blob }`

<a id="schema-updatevault"></a>

## `UpdateVault`

`PUT /v1/vaults/{vault_id}`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:65](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L65-L72)
- Handlers: 0 · Callers: 0
- Shape: `{ version: number; meta: Blob }`

<a id="schema-uploadprogress"></a>

## `UploadProgress`

Response to an uploaded chunk.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:164](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L164-L170)
- Handlers: 0 · Callers: 0
- Shape: `{ received: number; size: number }`

<a id="schema-uploadquery"></a>

## `UploadQuery`

Query of `PUT /v1/vaults/{vault_id}/attachments/{attachment_id}/content`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:156](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L156-L161)
- Handlers: 0 · Callers: 0
- Shape: `{ offset: number }`

<a id="schema-vault"></a>

## `Vault`

A vault as seen by one of its members.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:75](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L75-L102)
- Handlers: 0 · Callers: 0
- Shape: `{ id: VaultId; owner_account_id: AccountId; role: Role; revision: number; version: number; meta: Blob; shared_key: Blob; shared_key_signature?: Blob; created_at: number; updated_at: number; deleted_at?: number }`

<a id="schema-vaultlist"></a>

## `VaultList`

`GET /v1/vaults`.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:105](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L105-L109)
- Handlers: 0 · Callers: 0
- Shape: `{ vaults: Vault[] }`

<a id="schema-vaultrevision"></a>

## `VaultRevision`

Revision of one vault (`GET /v1/sync`).

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/sync.rs:18](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/sync.rs#L18-L27)
- Handlers: 0 · Callers: 0
- Shape: `{ vault_id: VaultId; revision: number; deleted_at?: number }`

<a id="schema-wrappeditemkey"></a>

## `WrappedItemKey`

An item key wrapped with a project key (kind `0x03`), in the current row of an item or in one of its stored versions.

- Kind: schema
- Workspace: [klav-proto](../../architecture/klav-proto.md)
- Source: [crates/klav-proto/src/vault.rs:163](https://github.com/OmarAlex24/klav/blob/fe8e2a0c8c248c44514c31c7f73b89c3f9cafc92/crates/klav-proto/src/vault.rs#L163-L173)
- Handlers: 0 · Callers: 0
- Shape: `{ item_id: ItemId; version?: number; wrapped_key: Blob }`
