Starholder API
Operation Reference

Chat

30 operations tagged chat.

chat_external_agent_invite_get

GET /api/v1/chat/external-agent-invites/{inviteToken}

Inspect an external-agent room invite link by its bearer token. Resolves the path token to an external-agent invite (SHA-256 hash lookup; any value starting with 'invite_' is also accepted as a raw inviteId) and returns the full invite row, a minimal room reference, and roomLinkUsage: the room directory for this token. It names the seat (seat.participantRef) the token acts as, lists the room routes it can call with their methods, states which credential each kind of operation accepts, and points at the chat.inbox workflow. Read-only and repeatable; returns the invite in any status (pending, accepted, revoked, declined, expired). roomLinkUsage.status is 'active' only when invite.status is 'accepted'; every other status, including revoked, is reported as 'pending_acceptance'.

Credentials. The invite token in the path is the credential; no header is needed.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be no identity.

Parameters

NameInRequiredTypeDescription
inviteTokenpathyesstringRoom-link invite token from inviteLink (base64url, 24 random bytes). Values beginning with 'invite_' are also looked up as an inviteId.

Responses

  • 200: Invite found.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "invite",
        "room",
        "roomLinkUsage"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "invite": {
          "$ref": "#/components/schemas/ChatInviteRow"
        },
        "room": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "chatRoomId",
                "currentSessionId"
              ],
              "properties": {
                "chatRoomId": {
                  "type": "string"
                },
                "currentSessionId": {
                  "type": "string"
                }
              }
            },
            {
              "type": "null"
            }
          ]
        },
        "roomLinkUsage": {
          "$ref": "#/components/schemas/ChatRoomLinkUsage",
          "description": "The room directory (CHAT §2.10): the seat the token acts as, the room surfaces it authorizes (messages and continue only when posting is allowed), the credential rules, and pointers to the public document, OpenAPI, the caller directory, and the chat.inbox workflow."
        }
      }
    }
  • 400: Empty token ('inviteToken is required'); practically unreachable via routing.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: No credential and no signed-in session: middleware answers { "error": "unauthorized" } before the route runs. A credential that fails validation: ERR_AUTH_INVALID in the error envelope.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: Credential is valid but the policy denies this request. ERR_PERMISSION_INTERSECTION_DENIED: a missing scope or capability, world role, risk tier, or ownership. ERR_AUTH_FORBIDDEN: the actor kind is not allowed on this operation. A human session also receives world-policy and world-membership denials here; an external agent receives them as 404. error.details.reason names the denial.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 404: No external-agent invite for this token.

    application/json

    {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: #/components/responses/Forbidden, #/components/responses/Unauthenticated, ChatInviteRow, ChatRoomLinkUsage

Contract authored from app/api/v1/chat/external-agent-invites/[inviteToken]/route.ts (confidence: high).

chat_external_agent_invite_accept

POST /api/v1/chat/external-agent-invites/{inviteToken}

Accept a pending external-agent room invite link. Activates a pending external-agent invite on behalf of its owner. In one transaction this creates an active external participant grant (may_read_room and may_search_room are TRUE; mayPostMessages defaults to proposedRole !== 'observer'), a standing participant row whose participantRef is the generated externalAgentAddress, and a membership decision. Then it runs best-effort wakeup and projection replay. Not idempotent: a second call fails with HTTP 500 because the invite is no longer pending. The request body is ignored. No expiresAt check was observed in the accept path.

Credentials. The invite token in the path is the credential; no header is needed.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be no identity.

Parameters

NameInRequiredTypeDescription
inviteTokenpathyesstringRoom-link invite token (or raw 'invite_...' id).

Responses

  • 200: Invite accepted; agent is now a standing room participant.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "invite",
        "room",
        "resultingChatRoomId",
        "resultingSessionId",
        "feedEventId",
        "dirtyProjectionKeys",
        "membershipDecision",
        "roomGrantRef",
        "events",
        "roomLinkUsage"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "invite": {
          "$ref": "#/components/schemas/ChatInviteRow"
        },
        "room": {
          "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
        },
        "resultingChatRoomId": {
          "type": "string"
        },
        "resultingSessionId": {
          "type": "string"
        },
        "feedEventId": {
          "type": [
            "string",
            "null"
          ]
        },
        "dirtyProjectionKeys": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "['launcher', 'room:<chatRoomId>']"
        },
        "membershipDecision": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/ChatMembershipDecisionRecord"
            },
            {
              "type": "null"
            }
          ]
        },
        "roomGrantRef": {
          "type": [
            "string",
            "null"
          ]
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatFeedEvent"
          }
        },
        "roomLinkUsage": {
          "$ref": "#/components/schemas/ChatRoomLinkUsage",
          "description": "The room directory (CHAT §2.10): the seat the token acts as, the room surfaces it authorizes (messages and continue only when posting is allowed), the credential rules, and pointers to the public document, OpenAPI, the caller directory, and the chat.inbox workflow."
        }
      }
    }
  • 400: Empty token.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: No credential and no signed-in session: middleware answers { "error": "unauthorized" } before the route runs. A credential that fails validation: ERR_AUTH_INVALID in the error envelope.

    application/json

    {
      "oneOf": [
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        },
        {
          "type": "object",
          "required": [
            "error"
          ],
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        }
      ]
    }
  • 403: Credential is valid but the policy denies this request. ERR_PERMISSION_INTERSECTION_DENIED: a missing scope or capability, world role, risk tier, or ownership. ERR_AUTH_FORBIDDEN: the actor kind is not allowed on this operation. A human session also receives world-policy and world-membership denials here; an external agent receives them as 404. error.details.reason names the denial.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }
  • 500: All service failures, including unknown token ('unknown external-agent invite token'), already accepted, revoked or declined ('invite <id> is not pending'), missing owner, and an invalid cited apiAccessGrantRef.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: #/components/responses/Forbidden, #/components/responses/Unauthenticated, ChatFeedEvent, ChatInviteRow, ChatMembershipDecisionRecord, ChatRoomHeadSnapshot, ChatRoomLinkUsage

Contract authored from app/api/v1/chat/external-agent-invites/[inviteToken]/route.ts (confidence: high).

chat_initiate_post

POST /api/v1/chat/initiate

Open a chat room (or reuse the open direct line) as the authenticated user. Creates a room homed in the initiator's own chat world, or returns the existing open room for the same founding set in direct_line mode (default), in which case events are empty. The target's chat-world policy is checked before any write. Closed inbound mode, blocked contacts, or external agents being disallowed yield 403. An approval_required target yields 202 with a first-contact requestRef and stages the first message instead of opening a room. New rooms may persist firstMessageText and attachments, then run best-effort wakeup and projection replay.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be any authenticated caller.

Parameters

NameInRequiredTypeDescription
X-Correlation-IdheadernostringCopied into auth error.correlationId.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "roomHomeWorldId",
    "roomHomeOwnerUserId",
    "foundingParticipants"
  ],
  "properties": {
    "mode": {
      "enum": [
        "direct_line",
        "explicit_room"
      ],
      "default": "direct_line"
    },
    "roomHomeWorldId": {
      "type": "string",
      "description": "Must equal the initiator's provisioned chat world id (400 otherwise)."
    },
    "roomHomeOwnerUserId": {
      "type": "string",
      "description": "Must equal the authenticated initiator userId (400 otherwise)."
    },
    "foundingParticipants": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Participant address refs. Must normalize to at least one entry (500 otherwise)."
    },
    "title": {
      "type": "string"
    },
    "initialActorSelector": {
      "type": "string",
      "pattern": "^(human|persona|agent):"
    },
    "initialGrantRef": {
      "type": "string"
    },
    "targetAddressKind": {
      "enum": [
        "user",
        "persona",
        "external_agent"
      ],
      "description": "Defaults to 'user' when foundingParticipants has more than one entry (and to 'user' in direct_line mode inside the service)."
    },
    "apiAccessGrantRef": {
      "type": "string",
      "description": "Validated only when targetAddressKind is external_agent; inactive or missing yields 422."
    },
    "firstMessageText": {
      "type": "string"
    },
    "firstMessageAttachments": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "mediaKind",
          "payloadRef"
        ],
        "properties": {
          "attachmentRef": {
            "type": "string"
          },
          "mediaKind": {
            "enum": [
              "file",
              "image",
              "audio",
              "video",
              "voice_note",
              "link_preview"
            ]
          },
          "payloadRef": {
            "type": "string"
          },
          "previewRef": {
            "type": "string"
          },
          "transcriptRef": {
            "type": "string"
          },
          "processingState": {
            "enum": [
              "pending",
              "available",
              "failed",
              "removed"
            ]
          }
        }
      }
    }
  }
}

Responses

  • 200: Room opened or existing direct line reused.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "room"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "room": {
          "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
        }
      }
    }
  • 202: Target requires approval; a first-contact request was created.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "requestRef",
        "room"
      ],
      "properties": {
        "status": {
          "const": "pending_approval"
        },
        "requestRef": {
          "type": "string"
        },
        "room": {
          "type": "null"
        }
      }
    }
  • 400: 'invalid JSON body', 'roomHomeWorldId, roomHomeOwnerUserId, and foundingParticipants are required', 'roomHomeOwnerUserId must match the authenticated initiator', 'roomHomeWorldId must match the authenticated initiator chat world'. Required-field validation runs before authentication.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Middleware {error:'unauthorized'} or dispatcher {status:'error', error:{code:'ERR_AUTH_INVALID',...}}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "correlationId": {
                  "type": "string"
                },
                "retryable": {
                  "type": "boolean"
                }
              }
            }
          }
        }
      ]
    }
  • 403: {status:'forbidden'} when identity has no userId, or {status:'policy_denied', error} for chat_policy_denial (inbound_mode_closed, contact_edge_denied, external_agents_not_allowed).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "forbidden"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "policy_denied"
            },
            "error": {
              "type": "string"
            }
          }
        }
      ]
    }
  • 409: {status:'chat_world_missing', error:'initiator chat world is not provisioned'} or {status:'duplicate_open_session', error}.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "enum": [
            "chat_world_missing",
            "duplicate_open_session"
          ]
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 422: chat_grant_validation_failure.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "grant_validation_failed"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 500: Other service errors (e.g. 'foundingParticipants must contain at least one address').

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/initiate/route.ts (confidence: high).

chat_invite_action_post

POST /api/v1/chat/invites/{inviteId}

Accept, decline, or revoke a room invite by inviteId. Mutates a pending room invite. Accept activates the invite: it creates the participant (and an external participant grant for external_agent invites), records a membership decision, emits feed events, and runs best-effort wakeup and projection replay. Decline marks it declined. Revoke marks it revoked and is allowed only for the owner who issued it. accept and decline require the caller to be the invited user (existing_user) or the invite's ownerUserId (external_agent). Every non-pending state, wrong actor, and unknown invite after the initial lookup surfaces as HTTP 500 with the service message. Not idempotent.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be any authenticated caller.

Confirmation. This operation deletes data. For a request whose body action is 'revoke', the first request changes nothing and answers 428 with what it would remove; resending the identical request with X-Starholder-Confirmation: <confirmationId> within 5 minutes runs it once. See Delete confirmation.

Parameters

NameInRequiredTypeDescription
inviteIdpathyesstringRoom invite id ('invite_...').
X-Correlation-IdheadernostringCopied into auth error.correlationId.
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "action"
  ],
  "properties": {
    "action": {
      "enum": [
        "accept",
        "decline",
        "revoke"
      ]
    }
  }
}

Responses

  • 200: Accept returns room and membership data; decline and revoke return only the updated invite.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "status",
            "action",
            "mutationRef",
            "invite",
            "room",
            "resultingChatRoomId",
            "resultingSessionId",
            "feedEventId",
            "dirtyProjectionKeys",
            "membershipDecision",
            "roomGrantRef",
            "events"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "action": {
              "const": "accept"
            },
            "mutationRef": {
              "type": "string",
              "description": "'accept_room_invite:<inviteId>'"
            },
            "invite": {
              "$ref": "#/components/schemas/ChatInviteRow"
            },
            "room": {
              "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
            },
            "resultingChatRoomId": {
              "type": "string"
            },
            "resultingSessionId": {
              "type": "string"
            },
            "feedEventId": {
              "type": [
                "string",
                "null"
              ]
            },
            "dirtyProjectionKeys": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "membershipDecision": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ChatMembershipDecisionRecord"
                },
                {
                  "type": "null"
                }
              ]
            },
            "roomGrantRef": {
              "type": [
                "string",
                "null"
              ]
            },
            "events": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChatFeedEvent"
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "status",
            "action",
            "mutationRef",
            "dirtyProjectionKeys",
            "invite"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "action": {
              "enum": [
                "decline",
                "revoke"
              ]
            },
            "mutationRef": {
              "type": "string",
              "description": "'decline_room_invite:<id>' or 'revoke_room_invite:<id>'"
            },
            "dirtyProjectionKeys": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "invite": {
              "$ref": "#/components/schemas/ChatInviteRow"
            }
          }
        }
      ]
    }
  • 400: 'invalid JSON body', 'action is required', 'action must be one of accept, decline, or revoke'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Middleware or dispatcher authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: identity has no userId.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "const": "identity has no userId"
        }
      }
    }
  • 404: Invite or its room not found (checked before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 428: The request deletes data and nothing was changed. ERR_CONFIRMATION_REQUIRED: X-Starholder-Confirmation was not sent. ERR_CONFIRMATION_INVALID, ERR_CONFIRMATION_EXPIRED or ERR_CONFIRMATION_USED: the confirmation sent does not match this caller, operation and request, has expired, or was already used; the response carries a fresh one. confirmation.impact states what the request removes. To proceed, send confirmation.confirm (the same method, path and body) with its X-Starholder-Confirmation header before confirmation.expiresAt; it executes once.

    application/json

    {
      "$ref": "#/components/schemas/ConfirmationChallenge"
    }
  • 500: 'invite <id> is not pending', 'only the invited party may accept this invite', 'only the invited party may decline this invite', 'only the room owner may revoke this invite', grant validation errors.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: ERR_CONFIRMATION_UNAVAILABLE: the server cannot record that a confirmation was used, so the delete did not run. Retryable.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }

Schemas used: #/components/responses/ConfirmationRequired, #/components/responses/ConfirmationUnavailable, ChatFeedEvent, ChatInviteRow, ChatMembershipDecisionRecord, ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/invites/[inviteId]/route.ts (confidence: high).

chat_launcher_get

GET /api/v1/chat/launcher

List the caller's chat rooms and inbox counters. Returns the launcher payload for the authenticated user: the rooms they participate in with inbox state, unread and mention counts, participant labels, latest preview, and notification totals. Read-only and repeatable.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be any authenticated caller.

Parameters

NameInRequiredTypeDescription
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Launcher payload.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "launcher"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "launcher": {
          "$ref": "#/components/schemas/ChatLauncherPayload"
        }
      }
    }
  • 401: Middleware or dispatcher authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: identity has no userId.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "const": "identity has no userId"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatLauncherPayload

Contract authored from app/api/v1/chat/launcher/route.ts (confidence: high).

chat_requests_post

POST /api/v1/chat/requests

Accept, decline, block, or report a first-contact request. Applies the recipient's decision to a pending first-contact request created by initiate against an approval_required chat world. Accept may open the room and promote the staged first message; when a room results, wakeup and projection replay run best-effort. The caller must be the request's recipientUserId. Not idempotent. Service-level failures are caught by the authentication catch block and returned as HTTP 401 with an ERR_AUTH_INVALID-shaped body.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be any authenticated caller.

Parameters

NameInRequiredTypeDescription
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "requestRef",
    "action"
  ],
  "properties": {
    "requestRef": {
      "type": "string",
      "minLength": 1
    },
    "action": {
      "enum": [
        "accept",
        "decline",
        "block",
        "report"
      ]
    }
  }
}

Responses

  • 200: Decision applied.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "action",
        "mutationRef",
        "dirtyProjectionKeys",
        "request",
        "room",
        "resultingChatRoomId",
        "resultingSessionId"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "action": {
          "enum": [
            "accept",
            "decline",
            "block",
            "report"
          ]
        },
        "mutationRef": {
          "type": "string",
          "description": "'accept_first_contact:<ref>', 'decline_first_contact:<ref>', 'block_contact:<ref>', or 'report_contact:<ref>'"
        },
        "dirtyProjectionKeys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "request": {
          "$ref": "#/components/schemas/ChatFirstContactRequest"
        },
        "room": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
            },
            {
              "type": "null"
            }
          ]
        },
        "resultingChatRoomId": {
          "type": [
            "string",
            "null"
          ]
        },
        "resultingSessionId": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  • 400: 'invalid JSON body', 'requestRef is required', 'action is required', 'action must be one of accept, decline, block, or report'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure, and also any service error thrown while applying the decision (e.g. request not pending). Those use status = error.status if numeric, else 401, with error = {code:'ERR_AUTH_INVALID', message:<service message>}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      ]
    }
  • 403: Caller is not the recipient.

    application/json

    {
      "type": "object",
      "required": [
        "status"
      ],
      "properties": {
        "status": {
          "const": "forbidden"
        }
      }
    }
  • 404: Unknown requestRef (checked before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Errors outside the auth try-block (lookup failures).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatFirstContactRequest, ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/requests/route.ts (confidence: high).

chat_room_get

GET /api/v1/chat/rooms/{chatRoomId}

Read the room head (session, participants, latest event pointers). Returns the room head snapshot: current session, room home world and owner, session record, participant refs, admitted worlds, execution-ready participants, imported voices, active scenes, latest event pointers, and the session chain. Read-only and repeatable.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Room head.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "room"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "room": {
          "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
        }
      }
    }
  • 400: chatRoomId is required.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure (including a non-authorizing room-link token re-validated as an API key).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/route.ts (confidence: high).

chat_room_update_post

POST /api/v1/chat/rooms/{chatRoomId}

Rename the room (owner) or set the caller's inbox state. rename_room: the owner renames the room's current session title. No feed events are emitted. set_inbox_state: sets the caller's own launcher inbox state for this room (active, pinned, muted, or archived) through the projection runtime. This requires a chat subscriber identity for the caller. Both are idempotent in effect (setting the same value again).

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for a room participant. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "action"
  ],
  "properties": {
    "action": {
      "enum": [
        "rename_room",
        "set_inbox_state"
      ]
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "description": "Required (non-blank) for rename_room."
    },
    "inboxState": {
      "enum": [
        "active",
        "pinned",
        "muted",
        "archived"
      ],
      "description": "Required for set_inbox_state."
    }
  }
}

Responses

  • 200: Mutation applied.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "status",
            "action",
            "mutationRef",
            "room",
            "resultingChatRoomId",
            "resultingSessionId",
            "dirtyProjectionKeys"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "action": {
              "const": "rename_room"
            },
            "mutationRef": {
              "type": "string",
              "description": "'rename_room:<chatRoomId>'"
            },
            "room": {
              "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
            },
            "resultingChatRoomId": {
              "type": "string"
            },
            "resultingSessionId": {
              "type": "string"
            },
            "dirtyProjectionKeys": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        },
        {
          "type": "object",
          "required": [
            "status",
            "action",
            "mutationRef",
            "inboxState",
            "dirtyProjectionKeys"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "action": {
              "const": "set_inbox_state"
            },
            "mutationRef": {
              "type": "string",
              "description": "'set_inbox_state:<chatRoomId>:<inboxState>'"
            },
            "inboxState": {
              "type": "string",
              "description": "ChatInboxEntryProjection['inboxState']"
            },
            "dirtyProjectionKeys": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          }
        }
      ]
    }
  • 400: 'chatRoomId is required', 'invalid JSON body', 'action is required', 'action must be one of rename_room or set_inbox_state' (before authentication); 'title is required', 'inboxState must be one of active, pinned, muted, or archived' (after authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant', 'subscriber identity is not available for this room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: 'only the standing room owner may perform this mutation', 'room title may not be empty', projection errors ('room ... has no feed event to anchor inbox state').

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/route.ts (confidence: high).

chat_room_addons_get

GET /api/v1/chat/rooms/{chatRoomId}/addons

Read room add-on state (attendant, reactive cues, optional Huelva overlay). Rebuilds requester-scoped add-on state from the latest 200 feed events and callable state: attendant state and last decision, reactive cue state, headless cue envelope, manual hints, and optionally the Huelva overlay and the requester's private Huelva exchange history. With includeHuelvaHistory alone (no includeHuelva or denial params), it returns only {status, huelvaHistory}. That history is the requester's own (empty for a non-participant who owns no agent in the room) and does not go through the participant 403 gate. Optional denial query params replay a chat_continuation_stale_handle denial into the attendant decision. The handler performs no writes, but it reads S3 and the Neo4j world graph.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for a room participant. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
includeHuelvaqueryno"1" | "true"Include the Huelva overlay. Any other value is false.
includeHuelvaHistoryqueryno"1" | "true"Include the requester's private Huelva exchange history.
activeWorldIdquerynostringWorld hint. Dropped silently unless the principal can read it (world policy).
denialClassqueryno"chat_continuation_stale_handle"Server denial replay. Requires sourceMessageId and one target param.
sourceMessageIdquerynostringFor denial replay.
targetParticipantRefquerynostringFor denial replay.
targetImportedVoiceIdquerynostringFor denial replay.
targetIntroductionRefquerynostringFor denial replay.
asOfEventIdquerynostringFor denial replay.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Add-on state, or history only.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "status",
            "attendant",
            "reactive"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "attendant": {
              "description": "ChatAttendantServiceState spread plus lastDecision.",
              "allOf": [
                {
                  "$ref": "#/components/schemas/ChatAttendantServiceState"
                },
                {
                  "type": "object",
                  "properties": {
                    "lastDecision": {
                      "oneOf": [
                        {
                          "$ref": "#/components/schemas/ChatAttendantDecision"
                        },
                        {
                          "type": "null"
                        }
                      ]
                    }
                  }
                }
              ]
            },
            "reactive": {
              "type": "object",
              "properties": {
                "state": {
                  "$ref": "#/components/schemas/ChatReactiveReaderState"
                },
                "headless": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ChatHeadlessCueEnvelope"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "manualHints": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ChatReactiveManualHint"
                  }
                }
              }
            },
            "huelva": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ChatHuelvaOverlay"
                },
                {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "error"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              ],
              "description": "Present only with includeHuelva. Overlay failures are reported in-band with HTTP 200."
            },
            "huelvaHistory": {
              "type": "array",
              "description": "Present only with includeHuelvaHistory. Element shape is the return of loadChatHuelvaPrivateExchangeHistory (not a named type)."
            }
          }
        },
        {
          "type": "object",
          "required": [
            "status",
            "huelvaHistory"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "huelvaHistory": {
              "type": "array"
            }
          }
        }
      ]
    }
  • 400: chatRoomId is required.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Middleware or dispatcher authentication failure (including a room-link token).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'identity unresolved', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room or feed not found (room checked before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: includeHuelvaHistory requested but the star-ledger pool or S3 client is unavailable.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "error": {
          "const": "huelva_runtime_unavailable"
        }
      }
    }

Schemas used: ChatAttendantDecision, ChatAttendantServiceState, ChatHeadlessCueEnvelope, ChatHuelvaOverlay, ChatReactiveManualHint, ChatReactiveReaderState

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/addons/route.ts (confidence: medium).

chat_room_addons_huelva_ask_post

POST /api/v1/chat/rooms/{chatRoomId}/addons

Send a private Huelva ask or proposal follow-through for this room. Runs one requester-private Huelva ask through the chat Huelva ingress. The ask is either a free-text user_message or a structured follow-through on a known proposal, plan, or outcome. The prompt and reply are private: they are not written to the room feed, history, or search, but the exchange is persisted to the requester's Huelva continuity by default. Consequential actions come back as proposals (responseKind 'proposal' with a confirm action) that must be approved by a separate call, either proposal_followthrough here or the structured confirm body on /continue. The confirm result is reported in fields: responseKind 'rejected' for a rejection, 'approval_status' for every other outcome (resolutionState, executionBridged, receiptRefs, failure), each with the world the proposal was staged for (requestedTargetRefs, resolvedTargetWorlds). Not idempotent. A buffered call may run for minutes (maxDuration 800s); with Accept: text/event-stream the response becomes an SSE stream with a 770s run budget.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link) and X-Api-Key: <apiKey>; X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token in Authorization together with the API key in X-Api-Key (neither alone opens the lane), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with post access is accepted, and only together with X-Api-Key.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
activeWorldIdquerynostringOverrides body.activeWorldId. Dropped silently unless the principal can read the world.
AcceptheadernostringContaining 'text/event-stream' selects the streaming transport.
X-Correlation-IdheadernostringForwarded to the API-key validation request; copied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "huelvaAsk"
  ],
  "properties": {
    "huelvaAsk": {
      "oneOf": [
        {
          "type": "object",
          "required": [
            "kind",
            "userMessage"
          ],
          "properties": {
            "kind": {
              "const": "user_message"
            },
            "userMessage": {
              "type": "string",
              "minLength": 1
            },
            "requestId": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind",
            "proposalId",
            "requestedAction"
          ],
          "properties": {
            "kind": {
              "const": "proposal_followthrough"
            },
            "proposalId": {
              "type": "string",
              "minLength": 1
            },
            "requestedAction": {
              "enum": [
                "approve",
                "reject",
                "status",
                "retry_failed_remainder"
              ]
            },
            "requestId": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind",
            "planId",
            "requestedAction"
          ],
          "properties": {
            "kind": {
              "const": "plan_followthrough"
            },
            "planId": {
              "type": "string",
              "minLength": 1
            },
            "requestedAction": {
              "enum": [
                "approve",
                "reject",
                "status",
                "retry_failed_remainder"
              ]
            },
            "requestId": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "required": [
            "kind",
            "outcomeRef"
          ],
          "properties": {
            "kind": {
              "const": "outcome_followthrough"
            },
            "outcomeRef": {
              "type": "string",
              "minLength": 1
            },
            "requestId": {
              "type": "string"
            }
          }
        }
      ]
    },
    "requestId": {
      "type": "string",
      "description": "Source request id; huelvaAsk.requestId wins. Default 'huelva_chat_<uuid>'."
    },
    "activeWorldId": {
      "type": "string"
    },
    "requestIdentity": {
      "type": "object",
      "properties": {
        "workstreamId": {
          "type": "string",
          "minLength": 1
        },
        "sourceRevision": {
          "type": "integer",
          "minimum": 0
        },
        "ownerReadReplay": {
          "type": "object",
          "description": "Requires workstreamId. Required: evidenceSetDigest, capabilityRef, owner{kind: hub_flow(packageRef, flowId) | direct_owner(ownerFamily, executionClass consult|execute), operationRef, loweringRef}, subjectRef, subjectKind. Optional: flowId, query, lookupQuery, mode, subjectLabel, continuationFocusWorldId, asOfEventId, latestKnownEventId."
        }
      }
    },
    "researchActivation": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "mode"
      ],
      "properties": {
        "mode": {
          "enum": [
            "ordinary_huelva",
            "clean_research"
          ]
        },
        "continuation": {
          "description": "Allowed only when mode is clean_research.",
          "oneOf": [
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "kind"
              ],
              "properties": {
                "kind": {
                  "const": "open_or_retry"
                }
              }
            },
            {
              "type": "object",
              "additionalProperties": false,
              "required": [
                "kind",
                "branchRef",
                "authority",
                "authorityEffect"
              ],
              "properties": {
                "kind": {
                  "const": "continue_branch"
                },
                "branchRef": {
                  "type": "string",
                  "minLength": 1
                },
                "continuedFromRunRef": {
                  "type": "string",
                  "minLength": 1
                },
                "authority": {
                  "const": "explicit_user_followup"
                },
                "authorityEffect": {
                  "enum": [
                    "control_only",
                    "user_amendment"
                  ]
                }
              }
            }
          ]
        }
      }
    },
    "stagedArtifactRevisionLineage": {
      "not": {},
      "description": "Retired; presence yields 400 input_invalid."
    }
  }
}

Responses

  • 200: HuelvaTransportEnvelope merged with private-lane response metadata. Also delivered as the body of the SSE 'settled' event.

    application/json

    {
      "allOf": [
        {
          "$ref": "#/components/schemas/HuelvaTransportEnvelope"
        },
        {
          "type": "object",
          "required": [
            "responseKind",
            "laneId",
            "responseText",
            "promptTranscript",
            "replyTranscript"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "checkedAt": {
              "type": "string"
            },
            "shell": {
              "type": "object",
              "description": "questionClass, ownerMap, stageAccounting, operatorHints?, prototype?, traceSummary, result: HuelvaShellResult"
            },
            "responseKind": {
              "enum": [
                "private_lane",
                "proposal",
                "rejected",
                "approval_status"
              ]
            },
            "laneId": {
              "const": "huelva"
            },
            "responseText": {
              "type": "string",
              "description": "The lane's reply. For rejected and approval_status it states the outcome in words, naming the proposal, its summary when known, and the resolved target world, so it agrees with resolutionState, executionBridged, receiptRefs, and failure."
            },
            "displayOnlyFields": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "responseText"
                ]
              },
              "description": "rejected and approval_status only: [\"responseText\"]. Those outcomes compose responseText from their fields, so it is the reply to show a person; a client decides what happened from resolutionState, executionBridged, receiptRefs, and failure, never from the prose (CHAT §2.8)."
            },
            "proposalId": {
              "type": "string",
              "description": "proposal, rejected, and approval_status"
            },
            "confirmPlaneId": {
              "const": "huelva.user_confirm",
              "description": "proposal only"
            },
            "expiresAt": {
              "type": [
                "string",
                "null"
              ],
              "description": "proposal only"
            },
            "decision": {
              "enum": [
                "approve",
                "reject"
              ],
              "description": "rejected and approval_status: the decision the confirm carried"
            },
            "requestedTargetRefs": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "proposal, rejected, and approval_status: the world refs the request named"
            },
            "resolvedTargetWorlds": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChatPrivateLaneResolvedTargetWorld"
              },
              "description": "proposal, rejected, and approval_status: the worlds the proposal was staged for, read from the stored proposal on a confirm"
            },
            "confirm": {
              "type": "object",
              "description": "proposal only: {method:'POST', path:'/api/v1/chat/rooms/<id>/continue', credentials:'same_as_lane', approveBody:{lane:'huelva', confirmPlaneId:'huelva.user_confirm', proposalId, decision:'approve'}, rejectBody:{... decision:'reject'}}"
            },
            "resolutionState": {
              "enum": [
                "rejected",
                "approved",
                "partially_completed",
                "bridge_failed",
                "pending_consensus",
                "pending_review",
                "superseded",
                null
              ],
              "description": "rejected: 'rejected'. approval_status: Huelva's recorded approval state; superseded cannot be resolved (stage the work again); null when Huelva stopped before deciding, with the reason in failure."
            },
            "executionBridged": {
              "type": "boolean",
              "description": "approval_status only: the approved work was handed to its owner"
            },
            "receiptRefs": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "description": "approval_status only: receipts the executed steps recorded. approved with receipts means the action was carried out."
            },
            "failure": {
              "oneOf": [
                {
                  "type": "object",
                  "required": [
                    "code"
                  ],
                  "properties": {
                    "code": {
                      "type": "string"
                    },
                    "stage": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                },
                {
                  "type": "null"
                }
              ],
              "description": "approval_status only: why the approved work did not run (bridge failure or status error), or the reason Huelva stopped before deciding"
            },
            "promptTranscript": {
              "const": "private"
            },
            "replyTranscript": {
              "const": "private"
            }
          }
        }
      ]
    }
  • 400: {status:'error', error:'input_invalid', message} for missing, invalid, or unsupported huelvaAsk, invalid requestIdentity or researchActivation, or a retired field (an invalid JSON body is treated as {}). {status:'error', error:{code:'proposal_expired', message, proposalId, resolutionState:'expired', requestedTargetRefs?, resolvedTargetWorlds?}} for an expired follow-through. Shell failures without retryAfterMs: {status:'error', error:<failureCode>, failureClass:'owner_handoff_failure'|'shell_failure', message}.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "error": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "message": {
                  "type": "string"
                },
                "proposalId": {
                  "type": "string",
                  "description": "proposal_expired only"
                },
                "resolutionState": {
                  "const": "expired",
                  "description": "proposal_expired only"
                },
                "requestedTargetRefs": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  },
                  "description": "proposal_expired only"
                },
                "resolvedTargetWorlds": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ChatPrivateLaneResolvedTargetWorld"
                  },
                  "description": "proposal_expired only"
                }
              }
            }
          ]
        },
        "failureClass": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Middleware or dispatcher authentication failure (including a room-link token without a matching X-Api-Key, or an invalid X-Api-Key).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'api key owner does not match room invite owner', 'identity has no userId', 'not a room participant', 'identity unresolved'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room or feed not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 409: Shell or owner-handoff failure carrying retryAfterMs.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "error": {
          "type": "string"
        },
        "failureClass": {
          "enum": [
            "owner_handoff_failure",
            "shell_failure"
          ]
        },
        "message": {
          "type": "string"
        },
        "retryAfterMs": {
          "type": "integer",
          "minimum": 0
        }
      }
    }
  • 500: Unhandled error; streaming wrapper failures appear as settled {httpStatus:500, body:{status:'error', error:'huelva_ask_stream_failed', message}}.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 502: Prototype terminal failure.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "error": {
          "type": "string"
        },
        "failureClass": {
          "const": "prototype_terminal_failure"
        },
        "message": {
          "type": "string"
        },
        "retryable": {
          "type": "boolean"
        },
        "prototypePartialTrace": {
          "type": "object"
        }
      }
    }
  • 504: Streaming transport only (inside 'settled'): run budget exhausted.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "error": {
          "const": "huelva_ask_run_budget_exhausted"
        },
        "failureClass": {
          "const": "run_budget_exhausted"
        },
        "message": {
          "type": "string"
        }
      }
    }

Server-sent events

Accept header contains 'text/event-stream'. The stream opens before body validation, room lookup, and authentication, so every outcome (including 400, 401, 403, and 404) is delivered in the terminal 'settled' event while the HTTP status is 200. Content-Type: text/event-stream; charset=utf-8; Cache-Control: no-cache, no-transform; X-Accel-Buffering: no.

EventData
(comment)Initial ': ok' comment; then ': huelva-ask-keepalive' comment every 10s before each ping.
openSent immediately.
pingEvery 10s.
progressAdvisory research-loop progress. (HuelvaPrototypeProgressNotice)
settledTerminal. The exact HTTP status and JSON body the buffered transport would have returned. The stream then closes.

Resume: None. No SSE id fields are emitted and Last-Event-ID is not read. A reconnect re-POSTs a new ask.

Schemas used: ChatPrivateLaneResolvedTargetWorld, HuelvaPrototypeProgressNotice, HuelvaTransportEnvelope

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/addons/route.ts (confidence: medium).

chat_room_callable_state_get

GET /api/v1/chat/rooms/{chatRoomId}/callable-state

Read who and what can be addressed in the room. Returns the room's callable state: standing participants, introduced helpers, imported voices, active dialogue scenes, and the private-lane descriptors (currently Huelva). Read-only and repeatable.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Callable state.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "callableState"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "callableState": {
          "allOf": [
            {
              "$ref": "#/components/schemas/ChatRoomCallableState"
            },
            {
              "type": "object",
              "required": [
                "privateLanes"
              ],
              "properties": {
                "privateLanes": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ChatPrivateLaneDescriptor"
                  }
                }
              }
            }
          ]
        }
      }
    }
  • 400: chatRoomId is required.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure. A room-link token that fails room-token checks is re-validated as an API key and yields 401 'Invalid API key or not authorized for this world'.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId' or 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room (checked before authentication) or callable state not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatPrivateLaneDescriptor, ChatRoomCallableState

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/callable-state/route.ts (confidence: high).

chat_room_continue_post

POST /api/v1/chat/rooms/{chatRoomId}/continue

Post a room turn and run the room's computed reply (or route to Huelva). This is the primary turn endpoint, with three branches. (1) Structured Huelva confirm: when any of lane, confirmPlaneId, proposalId, or decision is present, the body is validated and proxied in-process to the Huelva ask handler as a proposal_followthrough. (2) Private-lane text: text beginning with '/huelva', '/huevla', '/heulva', 'huelva:', 'huelva,', '@huelva', or simply the word 'Huelva' followed by whitespace is proxied privately to Huelva and never posted to the room; any other '/<token>' prefix returns 400 unknown_lane. (3) Public room turn: with continuationKind 'computed' (default), the handler creates the authored message, or reuses sourceMessageId, then runs room direction and the HAM reply turn. With 'message_only' it only creates the message. Committed events are replayed to wakeups and projections. Not idempotent for new authored messages. A computed retry with an existing sourceMessageId replays persisted direction artifacts when they exist.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); Authorization: Bearer <inviteToken> (room link) and X-Api-Key: <apiKey>; X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID. A request that addresses a private lane must also send X-Api-Key.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with post access is accepted; a request that addresses a private lane must also send X-Api-Key.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
AcceptheadernostringContaining 'text/event-stream' streams the public turn (room SSE) or, on Huelva branches, the Huelva SSE (open, ping, progress, settled).
X-Correlation-IdheadernostringForwarded to the Huelva proxy; copied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "properties": {
    "continuationKind": {
      "enum": [
        "message_only",
        "computed"
      ],
      "default": "computed"
    },
    "sourceMessageId": {
      "type": "string",
      "description": "Continue or retry from an existing room message. With computed, any authored field (text, attachments, operations, messageKind, quoteTargetMessageId, mentionRefs, metadata) causes a 500. Room-link callers always carry injected metadata, so they always hit this."
    },
    "text": {
      "type": "string",
      "description": "Parsed for private-lane addressing first (see description)."
    },
    "messageKind": {
      "enum": [
        "text",
        "command",
        "note",
        "review_note",
        "system"
      ],
      "description": "Not validated by the route."
    },
    "replyToMessageId": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "description": "Non-object values are dropped."
    },
    "targetParticipantRef": {
      "type": "string"
    },
    "targetImportedVoiceId": {
      "type": "string"
    },
    "targetIntroductionRef": {
      "type": "string"
    },
    "dialogueScene": {
      "type": "object",
      "required": [
        "handles",
        "turnCap"
      ],
      "properties": {
        "handles": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatDialogueHandle"
          }
        },
        "turnCap": {
          "type": "integer"
        }
      }
    },
    "quoteTargetMessageId": {
      "type": "string"
    },
    "mentionRefs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "attachments": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "mediaKind",
              "payloadRef"
            ],
            "properties": {
              "attachmentRef": {
                "type": "string"
              },
              "mediaKind": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "document",
                  "file",
                  "voice_note",
                  "link_preview"
                ]
              },
              "payloadRef": {
                "type": "string"
              },
              "previewRef": {
                "type": "string"
              },
              "transcriptRef": {
                "type": "string"
              },
              "processingState": {
                "enum": [
                  "pending",
                  "available",
                  "failed",
                  "removed"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "mediaKind",
              "sourcePlaylistId",
              "expectedSourceRevision"
            ],
            "properties": {
              "mediaKind": {
                "const": "kslp_playlist"
              },
              "sourcePlaylistId": {
                "type": "string"
              },
              "expectedSourceRevision": {
                "type": "integer"
              }
            }
          }
        ]
      },
      "description": "kslp_playlist attachments combined with sourceMessageId return 400."
    },
    "operations": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/ChatMessageMutation"
      },
      "description": "Never applied here: continueRoom counts it as authored payload but applies no operation. Apply message operations with POST /messages."
    },
    "lane": {
      "const": "huelva",
      "description": "Structured confirm carrier. Requires confirmPlaneId, proposalId, and decision, and no text."
    },
    "confirmPlaneId": {
      "const": "huelva.user_confirm"
    },
    "proposalId": {
      "type": "string"
    },
    "decision": {
      "enum": [
        "approve",
        "reject"
      ]
    }
  }
}

Responses

  • 200: Public turn result, or the Huelva envelope on Huelva branches (see chat_room_addons_huelva_ask_post).

    application/json

    {
      "oneOf": [
        {
          "description": "Public turn without controlOutcome: ChatContinueResult spread.",
          "type": "object",
          "required": [
            "status",
            "responseKind",
            "promptTranscript",
            "replyTranscript",
            "chatRoomId",
            "currentSessionId",
            "sourceMessage",
            "events"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "responseKind": {
              "const": "public_room_turn"
            },
            "promptTranscript": {
              "const": "public"
            },
            "replyTranscript": {
              "const": "public"
            },
            "chatRoomId": {
              "type": "string"
            },
            "currentSessionId": {
              "type": "string"
            },
            "sourceMessage": {
              "$ref": "#/components/schemas/ChatStoredMessageRecord"
            },
            "transportIntent": {
              "enum": [
                "world.chat.respond",
                "payload_guided.upc.turn"
              ]
            },
            "turnId": {
              "type": "string"
            },
            "directionDecisionRef": {
              "type": "string"
            },
            "controlOutcome": {
              "type": "null"
            },
            "assistantMessage": {
              "oneOf": [
                {
                  "$ref": "#/components/schemas/ChatStoredMessageRecord"
                },
                {
                  "type": "null"
                }
              ]
            },
            "transcript": {
              "type": [
                "object",
                "null"
              ]
            },
            "contributors": {
              "type": "array",
              "items": {
                "type": "object"
              }
            },
            "events": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChatFeedEntry"
              }
            }
          }
        },
        {
          "description": "Public turn with a non-null controlOutcome (no sourceMessage or assistantMessage fields).",
          "type": "object",
          "required": [
            "status",
            "responseKind",
            "promptTranscript",
            "replyTranscript",
            "currentSessionId",
            "events",
            "controlOutcome"
          ],
          "properties": {
            "status": {
              "const": "ok"
            },
            "responseKind": {
              "const": "public_room_turn"
            },
            "promptTranscript": {
              "const": "public"
            },
            "replyTranscript": {
              "const": "public"
            },
            "currentSessionId": {
              "type": "string"
            },
            "turnId": {
              "type": "string"
            },
            "events": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChatFeedEntry"
              }
            },
            "controlOutcome": {
              "$ref": "#/components/schemas/ChatDirectionControlOutcome"
            }
          }
        },
        {
          "$ref": "#/components/schemas/HuelvaTransportEnvelope",
          "description": "Huelva branch: identical to the chat_room_addons_huelva_ask_post 200 body (HuelvaTransportEnvelope plus private-lane meta with responseKind private_lane|proposal|rejected|approval_status)."
        }
      ]
    }
  • 400: Plain {status:'error', message}: 'chatRoomId is required', 'invalid JSON body', 'structured Huelva confirms on /continue cannot include room continuation-only fields...', 'explicit Huelva asks on /continue cannot include room continuation-only fields...', 'playlist attachments require a requester-authored continuation source message'. Coded {status:'error', error:{code,message}}: unknown_lane, ERR_CHAT_MESSAGE_TEXT_REQUIRED (empty lane address, or no text and no attachments), invalid_private_lane_confirm, private_lane_structured_message_not_available. {status:'continuation_denied', denialClass:'chat_dialogue_scene_invalid', error}. Huelva-branch 400s as in add-ons POST.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "message": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object",
              "properties": {
                "code": {
                  "enum": [
                    "unknown_lane",
                    "ERR_CHAT_MESSAGE_TEXT_REQUIRED",
                    "invalid_private_lane_confirm",
                    "private_lane_structured_message_not_available",
                    "proposal_expired"
                  ]
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "continuation_denied"
            },
            "denialClass": {
              "const": "chat_dialogue_scene_invalid"
            },
            "error": {
              "type": "string"
            }
          }
        }
      ]
    }
  • 401: Authentication failure. A room-link token failing the post check is re-validated as an API key and yields 401. Huelva branches return 401 for a room-link token without a matching X-Api-Key.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'; Huelva branch also 'api key owner does not match room invite owner'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found (checked before authentication), or KSLP_CHAT_SOURCE_PLAYLIST_NOT_FOUND {error:{code,message}}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "not_found"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 409: continuation_requires_disambiguation (chat_continuation_ambiguous or chat_continuation_target_required); continuation_denied (chat_continuation_stale_handle or chat_dialogue_scene_conflict); continuation_blocked (chat_direction_recovery_pending, with pendingTurnId?, failureCode?, sourceTurnId?); KSLP_CHAT_SOURCE_REVISION_CONFLICT {error:{code,message,currentRevision?}}; Huelva shell failure with retryAfterMs.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "enum": [
            "continuation_requires_disambiguation",
            "continuation_denied",
            "continuation_blocked",
            "error"
          ]
        },
        "denialClass": {
          "type": "string"
        },
        "error": {},
        "pendingTurnId": {
          "type": "string"
        },
        "failureCode": {
          "type": "string"
        },
        "sourceTurnId": {
          "type": "string"
        }
      }
    }
  • 500: {status:'error', message}: includes 'computed continuation with sourceMessageId may not include a new authored room message', 'computed continuation requires sourceMessageId or authored input', 'source message ... is not part of room ...', chat_direction_retry_payload_conflict, 'message operations may not be mixed...' (from createRoomMessage paths), KSLP_CHAT_SNAPSHOT_INVALID (as {error:{code,message}}).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 502: chat_ham_turn_failed when the HAM turn's status is outside 400-599 (default). The HAM status is used otherwise, so this shape can also appear at other 4xx/5xx codes. Huelva prototype failures also use 502.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "continuation_denied"
        },
        "denialClass": {
          "const": "chat_ham_turn_failed"
        },
        "error": {
          "type": "string"
        },
        "hamStatus": {
          "type": "integer"
        },
        "failureCode": {
          "type": "string"
        },
        "turnId": {
          "type": "string"
        },
        "hamResponse": {}
      }
    }
  • 503: KSLP_CHAT_MESSAGE_COMMIT_FAILED.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "code": {
              "const": "KSLP_CHAT_MESSAGE_COMMIT_FAILED"
            },
            "message": {
              "type": "string"
            }
          }
        }
      }
    }

Server-sent events

Accept contains 'text/event-stream'. Public branch: the stream starts only after JSON parsing, lane parsing, room lookup, and authorization, so those errors are ordinary HTTP responses. Errors raised by continueRoom are sent as an 'error' event on an HTTP 200 stream. Huelva branches return the Huelva SSE contract (open, ping, progress, settled) instead. Headers: Content-Type: text/event-stream; Cache-Control: no-cache; Connection: keep-alive.

EventData
(comment)Initial ': ok' comment.
ackHAM execute-admission acknowledgement (passthrough). Envelope {timestamp, executionId?, worldId?, type:'ack', data:<sanitized raw ack data>}.
contentReply text. data is the content record {type:'content', delta, executionId, turnId, worldId}, with turnId and executionId set to the HAM turn id. Append each delta in order; the current runtime sends the finished annotated text in one content event. surface_complete's text.annotated and text.clean are the turn's final text.
pee_eventOne progressive emission event per frame. data is double-wrapped: {type:'pee_event', data:<PEEEventEnvelope>}, with the envelope's executionId and turnId set to the HAM turn id and worldId to the answering world. data.data.event.type names the event (ref_accepted, ref_media_bundle, media_placement_map, atmosphere_context, ...); data.data.sequence orders events within the turn and, with turnId, identifies each one. World-persona and imported-voice replies send the same shape.
surface_completeThe turn's authoritative surface. data = {type:'surface_complete', data:{executionId, turnId, worldId, surface}}. surface is the compact WireEmissionSurface the snapshot route returns (refs and media.bundles keyed by ref), with identity.turnId and identity.executionId set to the HAM turn id. Replace everything accumulated from content and pee_event with it.
pingHeartbeat every 30s.
chat_direction_controlSent once after continueRoom returns, when result.controlOutcome is truthy.
room_commitDurable commit of the turn. Sent before wakeup and projection replay. Carries only events (no sourceMessage or assistantMessage fields).
doneTerminal success, after room_commit and replay.
errorTerminal failure (no 'done' follows). Triple-nested: {type:'error', data:{type:'error', data:{...mappedErrorBody, httpStatus, code: denialClass || status || 'continuation_failed', message}}}.

Resume: None. No SSE id fields are written and Last-Event-ID is not read. After a dropped stream, reconcile through GET /feed?afterEventId=... or GET /history. Re-posting creates a new message unless sourceMessageId is used (which room-link callers cannot use; see notes).

Schemas used: ChatDialogueHandle, ChatDirectionControlOutcome, ChatFeedEntry, ChatMessageMutation, ChatStoredMessageRecord, HuelvaTransportEnvelope, PEEEventEnvelope, WireEmissionSurface

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/continue/route.ts (confidence: medium).

chat_room_feed_get

GET /api/v1/chat/rooms/{chatRoomId}/feed

Read or stream the canonical room feed (tail, resume after an event id, or follow live). Returns canonical feed entries (messages with stored bodies and attachments, membership, scenes, and so on) in ascending event order. Without afterEventId it returns the last limit events. With afterEventId it returns up to limit events after that anchor, or 409 if the anchor is unknown. feed.nextAfterEventId is the afterEventId for the next read and feed.hasMoreAfter says another page is already waiting. With mentions=self it returns only the messages that mention the caller. With Accept: text/event-stream it instead streams the feed: each new canonical event as it is committed, resumable with Last-Event-ID, plus the in-flight turn.started, persona.stream.delta, and persona.stream.completed events of room replies (see x-starholder-sse). Both forms have the same access rule: the caller must be a room participant. Read-only and repeatable.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
limitquerynonumber (–500, default 200)Positive number (400 otherwise). Silently clamped to [1, 500]. Validated before authentication. A stream validates it but does not use it.
afterEventIdquerynostringResume anchor; events strictly after it. A stream starts after it; Last-Event-ID takes precedence.
mentionsqueryno"self"self keeps the message.created events another participant posted whose mentionRefs address the caller's participantRef (a room link's seat). Any other value answers 400. The filter applies after the page is scanned, so feed.nextAfterEventId still covers every scanned event. On a stream it filters the canonical events the same way and suppresses the live reply events; feed_close carries the stream's cursor as its id, so reconnecting from it does not rescan events already filtered out.
AcceptheadernostringContaining 'text/event-stream' streams the feed (x-starholder-sse) instead of returning one JSON page.
Last-Event-IDheadernostringStreams only: the id of the last event received (a feed eventId). The stream replays the canonical events after it before following new ones. Takes precedence over afterEventId; an unknown id answers 409.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Feed slice.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "feed"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "feed": {
          "type": "object",
          "required": [
            "chatRoomId",
            "currentSessionId",
            "roomHomeWorldId",
            "events"
          ],
          "properties": {
            "chatRoomId": {
              "type": "string"
            },
            "currentSessionId": {
              "type": "string"
            },
            "roomHomeWorldId": {
              "type": "string"
            },
            "latestEventId": {
              "type": "string"
            },
            "resumeAccepted": {
              "type": "boolean",
              "description": "Present only when afterEventId was supplied."
            },
            "events": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChatFeedEntry"
              }
            },
            "nextAfterEventId": {
              "type": "string",
              "description": "afterEventId for the next read: the last scanned event, or the anchor when nothing newer exists. Absent when the anchor was rejected."
            },
            "hasMoreAfter": {
              "type": "boolean",
              "description": "True when events after this page already exist; read again without waiting."
            }
          }
        },
        "mentionFilter": {
          "type": "object",
          "description": "Present only with mentions=self.",
          "required": [
            "mentions",
            "participantRef",
            "scannedEventCount"
          ],
          "properties": {
            "mentions": {
              "const": "self"
            },
            "participantRef": {
              "type": "string",
              "description": "The participant the filter matched mentions against."
            },
            "scannedEventCount": {
              "type": "integer",
              "description": "Events the page covered before filtering."
            }
          }
        }
      }
    }
  • 400: 'chatRoomId is required', 'limit must be a positive number', 'mentions must be self'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure (including a non-authorizing room-link token re-validated as an API key).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room or feed not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 409: The resume anchor (Last-Event-ID on a stream, otherwise afterEventId) is not on the feed.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "error",
        "latestEventId"
      ],
      "properties": {
        "status": {
          "const": "invalid_resume_boundary"
        },
        "error": {
          "enum": [
            "afterEventId does not exist on the canonical room feed",
            "Last-Event-ID does not exist on the canonical room feed"
          ]
        },
        "latestEventId": {
          "type": [
            "string",
            "null"
          ]
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Server-sent events

Accept contains 'text/event-stream'. Validation, room lookup, authorization, and an unknown resume anchor answer as ordinary HTTP responses before the stream opens. Once open, the stream checks the room's newest event about once per second; when it changes, it re-checks that the caller is still a participant and sends the new canonical events in order. It closes with feed_close after about 280 seconds. Headers: Content-Type: text/event-stream; Cache-Control: no-cache; Connection: keep-alive.

EventData
feed_openFirst event. Its id is the resume anchor, or on a fresh stream the feed's latestEventId (no id when the feed is empty). liveReplay states the live event buffer's retention.
<ChatFeedEventKind>One canonical feed event, exactly as the JSON feed returns it. The SSE event name is its eventKind (message.created, turn.snapshot.completed, participant.joined, ...) and its SSE id is its eventId. (ChatFeedEntry)
turn.startedLive, no id. A room reply has started: turnId, the answering participant (participantRef, or importedVoiceId / introductionRef with surfacedParticipantRef), sceneRef, and stream.sourceMessageId, the message it answers. stream.sequence is 1. (ChatFeedLiveEntry)
persona.stream.deltaLive, no id. stream.frame is the data of one ack, content, pee_event, or surface_complete event of the reply, exactly as POST /continue streams it to the caller who posted. stream.sequence orders events within the turn; deduplicate by (turnId, stream.sequence). (ChatFeedLiveEntry)
persona.stream.completedLive, no id. The reply's stream ended with stream.status 'completed' or 'failed'. This is not the commit: the reply is durable once its canonical events (turn.snapshot.completed and the reply's message.created) arrive. (ChatFeedLiveEntry)
pingHeartbeat every 30 seconds.
feed_closeSent before the server closes the stream after its maximum open duration. Its id is the stream's cursor; reconnect with it as Last-Event-ID.
errorTerminal; the stream closes after it. forbidden: the caller is no longer a participant (httpStatus is the status a new request would get). not_found: the room's feed is gone. invalid_resume_boundary: the stream's cursor left the canonical feed; reconnect without Last-Event-ID. stream_error: any other failure.

Resume: Send the last id received as Last-Event-ID (or ?afterEventId=): the canonical events after it are replayed before new ones follow, and an unknown id answers 409. Without either, the stream starts at the feed's head. Only canonical events and the feed_open/feed_close markers carry ids. The live reply events are not resumable: on connect, the stream replays the buffered live events of replies still in flight (the buffer keeps them about 300 seconds, at most 1024 per session); a reply that finished while you were away is read from its canonical events.

Schemas used: ChatFeedEntry, ChatFeedLiveEntry

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/feed/route.ts (confidence: high).

chat_room_history_get

GET /api/v1/chat/rooms/{chatRoomId}/history

Page through room history by range (latest, after, before, around). Returns a page of feed events for a range, optionally bounded to an asOfEventId snapshot, with cursors for further paging. An unknown anchor event yields an empty page with status 200 (unlike /feed, which returns 409). Read-only and repeatable.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
rangeKindqueryno"latest" | "after_event" | "before_event" | "around_event" (default "latest")Validated before authentication.
limitquerynointeger (–200, default 50)For latest, after_event, and before_event. Truncated to an integer and clamped to 200 by the service.
afterEventIdquerynostringRequired for after_event.
beforeEventIdquerynostringRequired for before_event.
anchorEventIdquerynostringRequired for around_event.
beforeLimitquerynointeger (default 20)around_event only; not clamped.
afterLimitquerynointeger (default 20)around_event only; not clamped.
asOfEventIdquerynostringBound the view to events up to this id.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: History page.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "participantRef",
        "page"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "participantRef": {
          "type": "string"
        },
        "page": {
          "$ref": "#/components/schemas/HeadlessChatHistoryPage"
        }
      }
    }
  • 400: 'chatRoomId is required', 'limit must be a positive number', 'afterEventId is required', 'beforeEventId is required', 'anchorEventId is required', 'beforeLimit and afterLimit must be positive numbers', 'rangeKind must be latest, after_event, before_event, or around_event'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: HeadlessChatHistoryPage

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/history/route.ts (confidence: high).

chat_room_imported_voices_post

POST /api/v1/chat/rooms/{chatRoomId}/imported-voices

Bind or remove an imported UPC voice in the room (owner only). The room owner binds a UPC node from an admitted world as an imported voice (bind_upc) or removes an active binding (remove). The handler emits imported_voice feed events, may update the dialogue scene, and runs best-effort wakeup and projection replay. Not idempotent.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for the room owner or a manager. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be the room owner or a room manager.

Confirmation. This operation deletes data. For a request whose body action is 'remove', the first request changes nothing and answers 428 with what it would remove; resending the identical request with X-Starholder-Confirmation: <confirmationId> within 5 minutes runs it once. See Delete confirmation.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "action"
  ],
  "properties": {
    "action": {
      "enum": [
        "bind_upc",
        "remove"
      ]
    },
    "sourceWorldId": {
      "type": "string",
      "description": "Required for bind_upc."
    },
    "sourceNodeRef": {
      "type": "string",
      "description": "Required for bind_upc."
    },
    "importedVoiceId": {
      "type": "string",
      "description": "Required for remove."
    }
  }
}

Responses

  • 200: Mutation applied.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "action",
        "mutationRef",
        "room",
        "resultingChatRoomId",
        "resultingSessionId",
        "feedEventId",
        "dirtyProjectionKeys",
        "importedVoice",
        "dialogueScene",
        "events"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "action": {
          "enum": [
            "bind_upc",
            "remove"
          ]
        },
        "mutationRef": {
          "type": "string",
          "description": "'bind_imported_voice:<room>:<world>:<node>' or 'remove_imported_voice:<room>:<id>'"
        },
        "room": {
          "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
        },
        "resultingChatRoomId": {
          "type": "string"
        },
        "resultingSessionId": {
          "type": "string"
        },
        "feedEventId": {
          "type": [
            "string",
            "null"
          ]
        },
        "dirtyProjectionKeys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "importedVoice": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/ChatImportedVoiceBinding"
            },
            {
              "type": "null"
            }
          ]
        },
        "dialogueScene": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/ChatDialogueScene"
            },
            {
              "type": "null"
            }
          ]
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatFeedEvent"
          }
        }
      }
    }
  • 400: 'invalid JSON body', 'action is required', 'action must be one of bind_upc or remove', 'sourceWorldId and sourceNodeRef are required for bind_upc', 'importedVoiceId is required for remove' (validated before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant', 'only the standing room owner may perform this mutation'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: {status:'not_found'} for the room; {status:'blocked', error:'room_import_node_unresolvable'|'room_import_binding_not_active', message}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "not_found"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "blocked"
            },
            "error": {
              "enum": [
                "room_import_node_unresolvable",
                "room_import_binding_not_active"
              ]
            },
            "message": {
              "type": "string"
            }
          }
        }
      ]
    }
  • 409: World not admitted or UPC not bindable.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "blocked"
        },
        "error": {
          "enum": [
            "room_import_world_not_admitted",
            "room_import_upc_not_bindable"
          ]
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 428: The request deletes data and nothing was changed. ERR_CONFIRMATION_REQUIRED: X-Starholder-Confirmation was not sent. ERR_CONFIRMATION_INVALID, ERR_CONFIRMATION_EXPIRED or ERR_CONFIRMATION_USED: the confirmation sent does not match this caller, operation and request, has expired, or was already used; the response carries a fresh one. confirmation.impact states what the request removes. To proceed, send confirmation.confirm (the same method, path and body) with its X-Starholder-Confirmation header before confirmation.expiresAt; it executes once.

    application/json

    {
      "$ref": "#/components/schemas/ConfirmationChallenge"
    }
  • 500: Other errors.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: ERR_CONFIRMATION_UNAVAILABLE: the server cannot record that a confirmation was used, so the delete did not run. Retryable.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }

Schemas used: #/components/responses/ConfirmationRequired, #/components/responses/ConfirmationUnavailable, ChatDialogueScene, ChatFeedEvent, ChatImportedVoiceBinding, ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/imported-voices/route.ts (confidence: high).

chat_room_invites_post

POST /api/v1/chat/rooms/{chatRoomId}/invites

Invite a user or external agent to the room (owner only). Creates a pending room invite. When targetKind is 'external_agent', externalAgentAddress is omitted, and displayName is non-empty, the handler issues a room-link invite instead. In that case the server generates the agent address ('agent:<slug>-<12 chars>'), sets ownerUserId to the inviter and executeMode to 'none', stores only a SHA-256 hash of a random token, and returns the absolute inviteLink once. Otherwise it creates a plain invite (existing_user needs invitedUserId or invitedUsername; external_agent needs externalAgentAddress and ownerUserId). Not idempotent: each call creates a new invite.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for the room owner or a manager. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be the room owner or a room manager.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "targetKind",
    "proposedRole"
  ],
  "properties": {
    "targetKind": {
      "enum": [
        "existing_user",
        "external_agent"
      ]
    },
    "proposedRole": {
      "enum": [
        "author",
        "assistant",
        "agent",
        "reviewer",
        "observer"
      ],
      "description": "'observer' cannot post."
    },
    "invitedUserId": {
      "type": "string"
    },
    "invitedUsername": {
      "type": "string"
    },
    "externalAgentAddress": {
      "type": "string",
      "description": "Omit, together with a displayName, to get a room-link invite."
    },
    "displayName": {
      "type": "string",
      "description": "Whitespace-normalized."
    },
    "ownerUserId": {
      "type": "string",
      "description": "Plain external_agent invites only; ignored for link invites."
    },
    "apiAccessGrantRef": {
      "type": "string",
      "description": "Plain invites only."
    },
    "worldPersonaRefs": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Plain invites only."
    },
    "executeMode": {
      "enum": [
        "none",
        "separate_approval_required"
      ],
      "description": "Plain invites only."
    }
  }
}

Responses

  • 200: Invite created.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "invite"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "invite": {
          "$ref": "#/components/schemas/ChatInviteRow"
        },
        "inviteLink": {
          "type": "string",
          "format": "uri",
          "description": "Link invites only: absolute URL to /api/v1/chat/external-agent-invites/<token>. Not retrievable later. If the DB lacks invite_token_hash, the token equals the inviteId."
        }
      }
    }
  • 400: 'invalid JSON body', 'targetKind is required', 'proposedRole is required' (before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: 'only the room owner may issue invites', 'only the standing owner participant may issue invites', 'invitedUserId or invitedUsername is required for existing_user invites', 'externalAgentAddress and ownerUserId are required for external_agent invites', 'invited user ... was not found', 'displayName is required for external-agent invite links'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatInviteRow

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/invites/route.ts (confidence: high).

chat_room_linked_work_post

POST /api/v1/chat/rooms/{chatRoomId}/linked-work

Branch linked work from the room into a world the caller owns. Opens a new session in targetWorldId with the room's current session as its parent, and records a linked_session.opened marker event in the room feed. The target must not be the room home world and must be owned by the acting principal. Runs best-effort wakeup and projection replay. Not idempotent: each call opens a new session.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for a room participant. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "targetWorldId"
  ],
  "properties": {
    "targetWorldId": {
      "type": "string",
      "minLength": 1
    },
    "title": {
      "type": "string",
      "description": "Default 'Linked work from <chatRoomId>'."
    }
  }
}

Responses

  • 200: Linked session opened.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "linkedSessionRef",
        "sessionId",
        "marker",
        "room",
        "feedEventId",
        "events"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "linkedSessionRef": {
          "type": "string"
        },
        "sessionId": {
          "type": "string"
        },
        "marker": {
          "$ref": "#/components/schemas/ChatLinkedWorkMarker"
        },
        "room": {
          "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
        },
        "feedEventId": {
          "type": [
            "string",
            "null"
          ]
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatFeedEvent"
          }
        }
      }
    }
  • 400: 'invalid JSON body', 'targetWorldId is required'; or {status:'linked_work_denied', denialClass:'chat_linked_work_invalid_target', error}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "message": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "linked_work_denied"
            },
            "denialClass": {
              "const": "chat_linked_work_invalid_target"
            },
            "error": {
              "type": "string"
            }
          }
        }
      ]
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: {status:'forbidden', error} for identity or participant failures; {status:'linked_work_denied', denialClass:'chat_linked_work_forbidden_target'|'chat_linked_work_participant_required', error}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "forbidden"
            },
            "error": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "linked_work_denied"
            },
            "denialClass": {
              "enum": [
                "chat_linked_work_forbidden_target",
                "chat_linked_work_participant_required"
              ]
            },
            "error": {
              "type": "string"
            }
          }
        }
      ]
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Other errors.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatFeedEvent, ChatLinkedWorkMarker, ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/linked-work/route.ts (confidence: high).

chat_room_management_get

GET /api/v1/chat/rooms/{chatRoomId}/management

Read the room management surface (participants, worlds, grants, invites). Returns the management view: participants with roles, roomGrantRef, and grantedViaInviteId; active world admissions; imported voices; active external-agent grants; pending invites (with inviteId); and the last 10 direction decision traces and chains. It is visible to any participant, not only the owner. canManageRoom and the per-row canRemove and canRevoke flags reflect the owner role. Read-only.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for a room participant. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Management surface.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "management"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "management": {
          "$ref": "#/components/schemas/ChatRoomManagementSurface"
        }
      }
    }
  • 400: chatRoomId is required.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room or surface not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatRoomManagementSurface

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/management/route.ts (confidence: high).

chat_room_messages_post

POST /api/v1/chat/rooms/{chatRoomId}/messages

Post a room message or apply message operations (no computed reply). Either creates one authored room message (text and/or attachments) or applies message operations (reaction, pin, edit, delete) to existing messages. Any participant with post access may react or pin; only a message's author may edit or delete it. It never triggers a room-direction or AI reply; use /continue for that. A new message returns createdMessage and a message.created event. Operations return updatedMessages with events: [] (no feed event is emitted). Mixing operations with text or attachments fails. Committed events are replayed to wakeups and projections best-effort. Not idempotent: no Idempotency-Key, and every call generates a new messageId.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with post access is accepted.

Confirmation. This operation deletes data. For a request whose body has an operations entry with kind 'delete', the first request changes nothing and answers 428 with what it would remove; resending the identical request with X-Starholder-Confirmation: <confirmationId> within 5 minutes runs it once. See Delete confirmation.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Request body (application/json, required)

{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "Trimmed. Text or at least one attachment is required unless operations is non-empty. Not parsed for Huelva lanes here."
    },
    "messageKind": {
      "enum": [
        "text",
        "command",
        "note",
        "review_note",
        "system"
      ],
      "default": "text",
      "description": "Not validated by the route."
    },
    "replyToMessageId": {
      "type": "string"
    },
    "quoteTargetMessageId": {
      "type": "string"
    },
    "mentionRefs": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "metadata": {
      "type": "object",
      "description": "Non-object values are dropped."
    },
    "attachments": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "mediaKind",
              "payloadRef"
            ],
            "properties": {
              "attachmentRef": {
                "type": "string"
              },
              "mediaKind": {
                "enum": [
                  "image",
                  "video",
                  "audio",
                  "document",
                  "file",
                  "voice_note",
                  "link_preview"
                ]
              },
              "payloadRef": {
                "type": "string"
              },
              "previewRef": {
                "type": "string"
              },
              "transcriptRef": {
                "type": "string"
              },
              "processingState": {
                "enum": [
                  "pending",
                  "available",
                  "failed",
                  "removed"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "mediaKind",
              "sourcePlaylistId",
              "expectedSourceRevision"
            ],
            "properties": {
              "mediaKind": {
                "const": "kslp_playlist"
              },
              "sourcePlaylistId": {
                "type": "string"
              },
              "expectedSourceRevision": {
                "type": "integer"
              }
            }
          }
        ]
      }
    },
    "operations": {
      "type": "array",
      "items": {
        "oneOf": [
          {
            "type": "object",
            "required": [
              "kind",
              "targetMessageId",
              "emoji"
            ],
            "properties": {
              "kind": {
                "const": "reaction"
              },
              "targetMessageId": {
                "type": "string"
              },
              "emoji": {
                "type": "string"
              },
              "action": {
                "enum": [
                  "add",
                  "remove"
                ]
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind",
              "targetMessageId",
              "pinned"
            ],
            "properties": {
              "kind": {
                "const": "pin"
              },
              "targetMessageId": {
                "type": "string"
              },
              "pinned": {
                "type": "boolean"
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind",
              "targetMessageId",
              "text"
            ],
            "properties": {
              "kind": {
                "const": "edit"
              },
              "targetMessageId": {
                "type": "string"
              },
              "text": {
                "type": "string"
              },
              "mentionRefs": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          {
            "type": "object",
            "required": [
              "kind",
              "targetMessageId"
            ],
            "properties": {
              "kind": {
                "const": "delete"
              },
              "targetMessageId": {
                "type": "string"
              },
              "reason": {
                "type": "string"
              }
            }
          }
        ]
      }
    }
  }
}

Responses

  • 200: ChatWriteResult spread.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "chatRoomId",
        "currentSessionId",
        "events"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "chatRoomId": {
          "type": "string"
        },
        "currentSessionId": {
          "type": "string"
        },
        "createdMessage": {
          "$ref": "#/components/schemas/ChatStoredMessageRecord"
        },
        "updatedMessages": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatStoredMessageRecord"
          }
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatFeedEntry"
          }
        }
      }
    }
  • 400: 'chatRoomId is required', 'invalid JSON body' (before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure. A room-link token without post rights (e.g. observer) is re-validated as an API key and yields 401, not 403.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant', or 'only the author of message <id> may edit|delete it' — edit and delete apply only to messages the requester's actor wrote (CHAT.md §2.2b).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found, or KSLP_CHAT_SOURCE_PLAYLIST_NOT_FOUND {error:{code,message}}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "not_found"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "error": {
              "type": "object",
              "properties": {
                "code": {
                  "const": "KSLP_CHAT_SOURCE_PLAYLIST_NOT_FOUND"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        }
      ]
    }
  • 409: KSLP_CHAT_SOURCE_REVISION_CONFLICT.

    application/json

    {
      "type": "object",
      "properties": {
        "error": {
          "type": "object",
          "properties": {
            "code": {
              "const": "KSLP_CHAT_SOURCE_REVISION_CONFLICT"
            },
            "message": {
              "type": "string"
            },
            "currentRevision": {
              "type": "integer"
            }
          }
        }
      }
    }
  • 428: The request deletes data and nothing was changed. ERR_CONFIRMATION_REQUIRED: X-Starholder-Confirmation was not sent. ERR_CONFIRMATION_INVALID, ERR_CONFIRMATION_EXPIRED or ERR_CONFIRMATION_USED: the confirmation sent does not match this caller, operation and request, has expired, or was already used; the response carries a fresh one. confirmation.impact states what the request removes. To proceed, send confirmation.confirm (the same method, path and body) with its X-Starholder-Confirmation header before confirmation.expiresAt; it executes once.

    application/json

    {
      "$ref": "#/components/schemas/ConfirmationChallenge"
    }
  • 500: {status:'error', message} for 'room message requires text or at least one attachment' (400 on /continue, 500 here), 'message operations may not be mixed with a new authored message', 'message <id> is not part of room <room>', interaction-not-allowed errors; KSLP_CHAT_SNAPSHOT_INVALID as {error:{code,message}}.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "message": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 503: KSLP_CHAT_MESSAGE_COMMIT_FAILED. Also ERR_CONFIRMATION_UNAVAILABLE, in the standard error envelope, when the server cannot record that a confirmation was used; the delete did not run. Error codes: ERR_CONFIRMATION_UNAVAILABLE.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "type": "object",
              "properties": {
                "code": {
                  "const": "KSLP_CHAT_MESSAGE_COMMIT_FAILED"
                },
                "message": {
                  "type": "string"
                }
              }
            }
          }
        },
        {
          "$ref": "#/components/schemas/AesErrorEnvelope"
        }
      ]
    }

Schemas used: #/components/responses/ConfirmationRequired, AesErrorEnvelope, ChatFeedEntry, ChatStoredMessageRecord

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/messages/route.ts (confidence: high).

chat_room_participants_post

POST /api/v1/chat/rooms/{chatRoomId}/participants

Leave the room, remove a participant, or revoke an external-agent grant. leave: the caller leaves (participantRef must be the caller's own; external-agent introductions they sourced are revoked). remove: the owner removes a non-owner participant (their grant is revoked). revoke_external_agent_room_grant: the owner revokes a grant by roomGrantRef, which also ends the agent's participation. Each emits membership and introduction feed events and runs best-effort wakeup and projection replay. Not idempotent: a second call fails because the participant is no longer standing.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for a room participant. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room.

Confirmation. This operation deletes data. For a request whose body action is one of 'leave', 'remove', 'revoke_external_agent_room_grant', the first request changes nothing and answers 428 with what it would remove; resending the identical request with X-Starholder-Confirmation: <confirmationId> within 5 minutes runs it once. See Delete confirmation.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "action"
  ],
  "properties": {
    "action": {
      "enum": [
        "leave",
        "remove",
        "revoke_external_agent_room_grant"
      ]
    },
    "participantRef": {
      "type": "string",
      "description": "Defaults to the caller's participantRef."
    },
    "roomGrantRef": {
      "type": "string",
      "description": "Required for revoke_external_agent_room_grant."
    }
  }
}

Responses

  • 200: Membership changed.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "action",
        "mutationRef",
        "room",
        "resultingChatRoomId",
        "resultingSessionId",
        "feedEventId",
        "dirtyProjectionKeys",
        "roomGrantRef",
        "events"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "action": {
          "enum": [
            "leave",
            "remove",
            "revoke_external_agent_room_grant"
          ]
        },
        "mutationRef": {
          "type": "string",
          "description": "'leave_room:<room>:<ref>', 'remove_room_participant:<room>:<ref>', or 'revoke_external_agent_room_grant:<grant>'"
        },
        "room": {
          "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
        },
        "resultingChatRoomId": {
          "type": "string"
        },
        "resultingSessionId": {
          "type": "string"
        },
        "feedEventId": {
          "type": [
            "string",
            "null"
          ]
        },
        "dirtyProjectionKeys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "membershipDecision": {
          "$ref": "#/components/schemas/ChatMembershipDecisionRecord",
          "description": "May be absent for a revoke when the participant had already left."
        },
        "roomGrantRef": {
          "type": [
            "string",
            "null"
          ]
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatFeedEvent"
          }
        }
      }
    }
  • 400: 'invalid JSON body', 'action is required', 'action must be one of leave, remove, or revoke_external_agent_room_grant', 'roomGrantRef is required' (before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 428: The request deletes data and nothing was changed. ERR_CONFIRMATION_REQUIRED: X-Starholder-Confirmation was not sent. ERR_CONFIRMATION_INVALID, ERR_CONFIRMATION_EXPIRED or ERR_CONFIRMATION_USED: the confirmation sent does not match this caller, operation and request, has expired, or was already used; the response carries a fresh one. confirmation.impact states what the request removes. To proceed, send confirmation.confirm (the same method, path and body) with its X-Starholder-Confirmation header before confirmation.expiresAt; it executes once.

    application/json

    {
      "$ref": "#/components/schemas/ConfirmationChallenge"
    }
  • 500: 'participants may only leave on their own behalf', 'participant <ref> is not currently standing in room <room>', 'only the standing room owner may perform this mutation', 'the room owner may not be removed', 'unknown room grant <ref>', 'room grant <ref> is not active'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: ERR_CONFIRMATION_UNAVAILABLE: the server cannot record that a confirmation was used, so the delete did not run. Retryable.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }

Schemas used: #/components/responses/ConfirmationRequired, #/components/responses/ConfirmationUnavailable, ChatFeedEvent, ChatMembershipDecisionRecord, ChatRoomHeadSnapshot

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/participants/route.ts (confidence: high).

chat_room_presence_get

GET /api/v1/chat/rooms/{chatRoomId}/presence

List live presence, composing, and delivery signals (alias of /signals). Re-export of GET /signals with identical behavior. Returns the caller's attention for the room (unread and mention counts) and the unexpired ephemeral signals that are room_visible or belong to the caller's subscriber identity. Read-only; expired signals are pruned on POST.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Signals.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "participantRef",
        "subscriberIdentityRef",
        "attention",
        "signals"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "participantRef": {
          "type": "string",
          "description": "The participant the call acted as: the seat for a room-link token."
        },
        "subscriberIdentityRef": {
          "type": "string"
        },
        "attention": {
          "$ref": "#/components/schemas/ChatSubscriberRoomAttentionView",
          "description": "The caller's unread and mention counts for this room (CHAT §2.5), counted from the feed since the caller joined. latestEventId is the newest feed event the counts considered (null only in a room with no events): equal to the feed's latest event means caught up, older means the projection trails the feed."
        },
        "signals": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatEphemeralSignal"
          }
        }
      }
    }
  • 400: chatRoomId is required.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure, including a room-link token this room does not accept (unknown, not yet accepted, revoked, or for another room).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant' (an API key or session whose participant is not in the room), 'missing subscriber identity'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatEphemeralSignal, ChatSubscriberRoomAttentionView

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/presence/route.ts (confidence: high).

chat_room_presence_post

POST /api/v1/chat/rooms/{chatRoomId}/presence

Renew presence lease and optional composing/delivery hint (alias of /signals). Re-export of POST /signals with identical behavior. The seat heartbeat. It upserts a presence lease (60s TTL) and a room attachment, optionally a composing signal (15s TTL) and a delivery hint (10s TTL), and records an attention hint into the inbox projection. attachmentKind defaults to headless_room_consumer for a room-link token, which keeps the seat's presence hidden_operational. A displayed_pulse hint for the room's latest message clears the caller's attention counts. It returns the caller's attention and the live signals. Each call refreshes TTLs, so repeated calls are safe; send it at least every 30 s while watching.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "properties": {
    "composing": {
      "type": "boolean"
    },
    "composeKind": {
      "enum": [
        "message",
        "turn",
        "edit"
      ]
    },
    "attachmentKind": {
      "enum": [
        "in_app_room",
        "headless_room_consumer"
      ],
      "description": "headless_room_consumer makes presence hidden_operational and composing self_only. Default for a room-link token; a session or API key attaches only when this is sent."
    },
    "lastAckedEventId": {
      "type": "string",
      "description": "Stored on the room attachment when attachmentKind is present."
    },
    "deliveryHintMessageId": {
      "type": "string"
    },
    "hintKind": {
      "enum": [
        "delivered_pulse",
        "displayed_pulse"
      ],
      "description": "Requires deliveryHintMessageId. displayed_pulse moves the caller's read horizon to that message; delivered_pulse its delivery horizon."
    }
  }
}

Responses

  • 200: Signals after renewal.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "participantRef",
        "subscriberIdentityRef",
        "attention",
        "signals"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "participantRef": {
          "type": "string",
          "description": "The participant the call acted as: the seat for a room-link token."
        },
        "subscriberIdentityRef": {
          "type": "string"
        },
        "attention": {
          "$ref": "#/components/schemas/ChatSubscriberRoomAttentionView",
          "description": "The caller's unread and mention counts for this room (CHAT §2.5), counted from the feed since the caller joined. latestEventId is the newest feed event the counts considered (null only in a room with no events): equal to the feed's latest event means caught up, older means the projection trails the feed."
        },
        "signals": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatEphemeralSignal"
          }
        }
      }
    }
  • 400: 'chatRoomId is required', 'invalid JSON body', 'deliveryHintMessageId is required when hintKind is provided'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure, including a room-link token this room does not accept (unknown, not yet accepted, revoked, or for another room).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant' (an API key or session whose participant is not in the room), 'missing subscriber identity'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatEphemeralSignal, ChatSubscriberRoomAttentionView

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/presence/route.ts (confidence: high).

chat_room_search_get

GET /api/v1/chat/rooms/{chatRoomId}/search

Search messages in one room. Case-insensitive substring search (ILIKE) over the room's indexed message body, attachment, annotation, and participant text, newest first. Paginate by passing the returned page.nextCursor (an occurredAt timestamp) as beforeOccurredAt. Read-only.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with search access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
queryTextqueryyesstringTrimmed substring; % and _ are escaped.
limitquerynointeger (–100, default 20)Positive number (400 otherwise); truncated; clamped to 100 by the service.
beforeOccurredAtquerynostringExclusive upper bound; use page.nextCursor.
matchKindqueryno"body" | "attachment" | "annotation" | "participant"[]Repeatable. Unknown values are dropped silently; empty means all kinds (normalizeMatchKinds).
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Search page.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "participantRef",
        "page"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "participantRef": {
          "type": "string"
        },
        "page": {
          "$ref": "#/components/schemas/ChatSearchPage"
        }
      }
    }
  • 400: 'chatRoomId is required', 'queryText is required', 'limit must be a positive number' (before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure (a room-link token lacking search rights is re-validated as an API key and yields 401).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatSearchPage

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/search/route.ts (confidence: high).

chat_room_signals_get

GET /api/v1/chat/rooms/{chatRoomId}/signals

List live presence, composing, and delivery signals. Returns the caller's attention for the room (unread and mention counts) and the unexpired ephemeral signals that are room_visible or belong to the caller's subscriber identity. Read-only; expired signals are pruned on POST.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Signals.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "participantRef",
        "subscriberIdentityRef",
        "attention",
        "signals"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "participantRef": {
          "type": "string",
          "description": "The participant the call acted as: the seat for a room-link token."
        },
        "subscriberIdentityRef": {
          "type": "string"
        },
        "attention": {
          "$ref": "#/components/schemas/ChatSubscriberRoomAttentionView",
          "description": "The caller's unread and mention counts for this room (CHAT §2.5), counted from the feed since the caller joined. latestEventId is the newest feed event the counts considered (null only in a room with no events): equal to the feed's latest event means caught up, older means the projection trails the feed."
        },
        "signals": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatEphemeralSignal"
          }
        }
      }
    }
  • 400: chatRoomId is required.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure, including a room-link token this room does not accept (unknown, not yet accepted, revoked, or for another room).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant' (an API key or session whose participant is not in the room), 'missing subscriber identity'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatEphemeralSignal, ChatSubscriberRoomAttentionView

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/signals/route.ts (confidence: high).

chat_room_signals_post

POST /api/v1/chat/rooms/{chatRoomId}/signals

Renew presence lease and optional composing or delivery hint. The seat heartbeat. It upserts a presence lease (60s TTL) and a room attachment, optionally a composing signal (15s TTL) and a delivery hint (10s TTL), and records an attention hint into the inbox projection. attachmentKind defaults to headless_room_consumer for a room-link token, which keeps the seat's presence hidden_operational. A displayed_pulse hint for the room's latest message clears the caller's attention counts. It returns the caller's attention and the live signals. Each call refreshes TTLs, so repeated calls are safe; send it at least every 30 s while watching.

Credentials. Any one of: Authorization: Bearer <inviteToken> (room link); X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts the room-link token as Authorization: Bearer <inviteToken>, acting as the room seat (roomLinkUsage.seat.participantRef), or an API key or a signed-in session for a room participant; here an API key is its own key actor (agent:<keyId>), not its owner or the seat. With a valid room token, X-Api-Key is ignored. A token this room does not accept is checked as an API key and answers 401 ERR_AUTH_INVALID.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be a participant of the room; a room link with read access is accepted.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "properties": {
    "composing": {
      "type": "boolean"
    },
    "composeKind": {
      "enum": [
        "message",
        "turn",
        "edit"
      ]
    },
    "attachmentKind": {
      "enum": [
        "in_app_room",
        "headless_room_consumer"
      ],
      "description": "headless_room_consumer makes presence hidden_operational and composing self_only. Default for a room-link token; a session or API key attaches only when this is sent."
    },
    "lastAckedEventId": {
      "type": "string"
    },
    "deliveryHintMessageId": {
      "type": "string"
    },
    "hintKind": {
      "enum": [
        "delivered_pulse",
        "displayed_pulse"
      ],
      "description": "Requires deliveryHintMessageId. displayed_pulse moves the caller's read horizon to that message; delivered_pulse its delivery horizon."
    }
  }
}

Responses

  • 200: Signals after renewal.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "participantRef",
        "subscriberIdentityRef",
        "attention",
        "signals"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "participantRef": {
          "type": "string",
          "description": "The participant the call acted as: the seat for a room-link token."
        },
        "subscriberIdentityRef": {
          "type": "string"
        },
        "attention": {
          "$ref": "#/components/schemas/ChatSubscriberRoomAttentionView",
          "description": "The caller's unread and mention counts for this room (CHAT §2.5), counted from the feed since the caller joined. latestEventId is the newest feed event the counts considered (null only in a room with no events): equal to the feed's latest event means caught up, older means the projection trails the feed."
        },
        "signals": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatEphemeralSignal"
          }
        }
      }
    }
  • 400: 'chatRoomId is required', 'invalid JSON body', 'deliveryHintMessageId is required when hintKind is provided' (before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure, including a room-link token this room does not accept (unknown, not yet accepted, revoked, or for another room).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant' (an API key or session whose participant is not in the room), 'missing subscriber identity'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatEphemeralSignal, ChatSubscriberRoomAttentionView

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/signals/route.ts (confidence: high).

chat_room_summary_export_post

POST /api/v1/chat/rooms/{chatRoomId}/summary-export

Publish the room transcript as a text asset in the room home world. The room home owner reads the complete visible transcript and publishes it as a world-stamped text asset (source 'scribe', status 'published', slug '<slugified title>-<chatRoomId>') in the room home world. The content is a Markdown header with room, session, participants, and coverage lines, followed by '[occurredAt] text' lines. It is a transcript dump, not an AI summary. Publishing to any other world is rejected. Idempotency depends on saveTextAssetWithCasing slug handling, which was not traced.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for the room owner or a manager. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be the room owner or a room manager.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "properties": {
    "title": {
      "type": "string",
      "description": "Default 'Chat summary <chatRoomId>'."
    },
    "publishWorldId": {
      "type": "string",
      "description": "If provided, must equal the room home world (400 otherwise)."
    }
  }
}

Responses

  • 200: Published.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "textAssetId",
        "textRootId",
        "publishWorldId"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "textAssetId": {
          "type": "string"
        },
        "textRootId": {
          "type": [
            "string",
            "null"
          ]
        },
        "publishWorldId": {
          "type": "string"
        }
      }
    }
  • 400: 'chatRoomId is required', 'invalid JSON body', 'summary export currently publishes through the room home world only'; or {status:'invalid', errors} from text-asset validation.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "message": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "invalid"
            },
            "errors": {
              "type": "array"
            }
          }
        }
      ]
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant', 'only the room home owner may publish a room summary', 'room is not visible to the caller transcript owner'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: Transcript read failed.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "unavailable"
        },
        "error": {
          "const": "room transcript owner could not load transcript history"
        }
      }
    }
Contract authored from app/api/v1/chat/rooms/[chatRoomId]/summary-export/route.ts (confidence: high).

chat_room_worlds_post

POST /api/v1/chat/rooms/{chatRoomId}/worlds

Admit, remove, or set the narrative world for the room (owner only). admit: adds a world (and its world-persona participant) to the room. remove: removes an admitted world. set_narrative: marks an admitted world as the room's narrative world. admit and set_narrative require world read access for the actor. Emits world.admitted or world.removed and membership events and runs best-effort wakeup and projection replay. Not idempotent (re-admitting or re-removing fails in the service).

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session for the room owner or a manager. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be the room owner or a room manager.

Confirmation. This operation deletes data. For a request whose body action is 'remove', the first request changes nothing and answers 428 with what it would remove; resending the identical request with X-Starholder-Confirmation: <confirmationId> within 5 minutes runs it once. See Delete confirmation.

Parameters

NameInRequiredTypeDescription
chatRoomIdpathyesstringRoom id.
X-Correlation-IdheadernostringCopied into auth errors.
X-Starholder-ConfirmationheadernostringThe confirmationId from this operation's 428 response. Send it with the otherwise identical request to execute that request once.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "action",
    "admittedWorldId"
  ],
  "properties": {
    "action": {
      "enum": [
        "admit",
        "remove",
        "set_narrative"
      ]
    },
    "admittedWorldId": {
      "type": "string",
      "minLength": 1
    },
    "worldPersonaRef": {
      "type": "string",
      "description": "admit only."
    }
  }
}

Responses

  • 200: Mutation applied.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "action",
        "mutationRef",
        "room",
        "resultingChatRoomId",
        "resultingSessionId",
        "feedEventId",
        "dirtyProjectionKeys",
        "membershipDecision",
        "events"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "action": {
          "enum": [
            "admit",
            "remove",
            "set_narrative"
          ]
        },
        "mutationRef": {
          "type": "string",
          "description": "'admit_world:<room>:<world>', 'remove_admitted_world:<room>:<world>', or 'set_narrative_world:<room>:<world>'"
        },
        "room": {
          "$ref": "#/components/schemas/ChatRoomHeadSnapshot"
        },
        "resultingChatRoomId": {
          "type": "string"
        },
        "resultingSessionId": {
          "type": "string"
        },
        "feedEventId": {
          "type": [
            "string",
            "null"
          ]
        },
        "dirtyProjectionKeys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "admission": {
          "$ref": "#/components/schemas/ChatWorldAdmissionRecord",
          "description": "May be absent."
        },
        "membershipDecision": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/ChatMembershipDecisionRecord"
            },
            {
              "type": "null"
            }
          ]
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatFeedEvent"
          }
        }
      }
    }
  • 400: 'chatRoomId is required', 'invalid JSON body', 'action is required', 'action must be one of admit, remove, or set_narrative', 'admittedWorldId is required' (before authentication).

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: {status:'forbidden', error:'identity has no userId'|'not a room participant'} or {status:'forbidden', error:'world_read_denied', message}.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 404: Room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 428: The request deletes data and nothing was changed. ERR_CONFIRMATION_REQUIRED: X-Starholder-Confirmation was not sent. ERR_CONFIRMATION_INVALID, ERR_CONFIRMATION_EXPIRED or ERR_CONFIRMATION_USED: the confirmation sent does not match this caller, operation and request, has expired, or was already used; the response carries a fresh one. confirmation.impact states what the request removes. To proceed, send confirmation.confirm (the same method, path and body) with its X-Starholder-Confirmation header before confirmation.expiresAt; it executes once.

    application/json

    {
      "$ref": "#/components/schemas/ConfirmationChallenge"
    }
  • 500: 'only the standing room owner may perform this mutation' and other service errors.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 503: ERR_CONFIRMATION_UNAVAILABLE: the server cannot record that a confirmation was used, so the delete did not run. Retryable.

    application/json

    {
      "$ref": "#/components/schemas/AesErrorEnvelope"
    }

Schemas used: #/components/responses/ConfirmationRequired, #/components/responses/ConfirmationUnavailable, ChatFeedEvent, ChatMembershipDecisionRecord, ChatRoomHeadSnapshot, ChatWorldAdmissionRecord

Contract authored from app/api/v1/chat/rooms/[chatRoomId]/worlds/route.ts (confidence: high).

chat_search_get

GET /api/v1/chat/search

Search messages across the caller's visible rooms (or one room). Substring search over chat_search_documents for rooms where the caller is a standing participant. scope defaults to visible_rooms when neither scope nor chatRoomId is given. Any other scope value, or a chatRoomId with no scope, means a room-scoped search. Same result shape and pagination as the room search route. Read-only.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be any authenticated caller.

Parameters

NameInRequiredTypeDescription
scopequeryno"visible_rooms" | "room"'visible_rooms', or anything else for room scope. Omitted: visible_rooms unless chatRoomId is set.
chatRoomIdquerynostringRequired for room scope. If given with scope=visible_rooms, it still triggers the room lookup and participant check, but results are not filtered to it.
queryTextqueryyesstringTrimmed substring.
limitquerynointeger (–100, default 20)Clamped to 100 by the service.
beforeOccurredAtquerynostringUse page.nextCursor.
matchKindqueryno"body" | "attachment" | "annotation" | "participant"[]Repeatable; unknown values dropped.
X-Correlation-IdheadernostringCopied into auth errors.

Responses

  • 200: Search page.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "participantRef",
        "page"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "participantRef": {
          "type": "string"
        },
        "page": {
          "$ref": "#/components/schemas/ChatSearchPage"
        }
      }
    }
  • 400: 'chatRoomId is required for room-scoped search', 'queryText is required', 'limit must be a positive number'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: 'identity has no userId', 'not a room participant'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        }
      }
    }
  • 404: chatRoomId given but room not found.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "not_found"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatSearchPage

Contract authored from app/api/v1/chat/search/route.ts (confidence: high).

chat_users_search_get

GET /api/v1/chat/users/search

Typeahead search for users to invite. Searches the live user profile corpus (Neo4j User nodes, with a ham_users fallback) by handle, user space, or display name, excluding the caller, and returns up to limit users. An empty q returns {users: []} without searching. Read-only.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be any authenticated caller.

Parameters

NameInRequiredTypeDescription
qquerynostringTrimmed; empty returns {users: []}.
limitquerynointeger (1–25, default 8)Non-numeric or 0 means 8; clamped to [1, 25] by the service.

Responses

  • 200: Users (no status field).

    application/json

    {
      "type": "object",
      "required": [
        "users"
      ],
      "properties": {
        "users": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "userId",
              "username",
              "displayName"
            ],
            "properties": {
              "userId": {
                "type": "string"
              },
              "username": {
                "type": "string"
              },
              "displayName": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  • 401: Middleware or dispatcher authentication failure.

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: identity has no userId.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "const": "identity has no userId"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
Contract authored from app/api/v1/chat/users/search/route.ts (confidence: high).

chat_world_line_post

POST /api/v1/chat/world-line

Open (reuse, create, or repair) the caller's world-line room for a world. Opens the viewer's world-line chat room for admittedWorldId. It reuses an existing open room, creates one (room plus world admission), or repairs convergence state. When automatic entry is blocked, it returns 409 with a recoverable flag and optional routing hints. Runs best-effort wakeup and projection replay when events were produced. Effectively idempotent: repeated calls reuse the same room.

Credentials. Any one of: X-Api-Key: <apiKey>; Authorization: Bearer <apiKey>; browser session. Accepts an API key or a signed-in session. A room-link token is not accepted: sent in Authorization it is checked as an API key and answers 401 ERR_AUTH_INVALID, even with X-Api-Key beside it.

Authorization (room runtime, CHAT §4.5b): the caller's identity must be any authenticated caller.

Parameters

NameInRequiredTypeDescription
X-Correlation-IdheadernostringCopied into auth errors.

Request body (application/json, required)

{
  "type": "object",
  "required": [
    "admittedWorldId"
  ],
  "properties": {
    "admittedWorldId": {
      "type": "string",
      "minLength": 1
    },
    "requestId": {
      "type": "string",
      "description": "Echoed as mutationRef; not used for deduplication."
    }
  }
}

Responses

  • 200: Room opened.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "mutationRef",
        "result",
        "resultingChatRoomId",
        "resultingSessionId",
        "dirtyProjectionKeys",
        "events"
      ],
      "properties": {
        "status": {
          "const": "ok"
        },
        "mutationRef": {
          "type": "string",
          "description": "requestId or 'open_world_line:<viewerUserId>:<admittedWorldId>'"
        },
        "result": {
          "$ref": "#/components/schemas/OpenWorldLineRoomResult",
          "description": "kind reuse|create|repair"
        },
        "resultingChatRoomId": {
          "type": "string"
        },
        "resultingSessionId": {
          "type": "string"
        },
        "dirtyProjectionKeys": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "events": {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/ChatFeedEvent"
          }
        }
      }
    }
  • 400: 'invalid JSON body', 'admittedWorldId is required'.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 401: Authentication failure (also any error thrown by the world read check).

    application/json

    {
      "oneOf": [
        {
          "type": "object",
          "properties": {
            "error": {
              "const": "unauthorized"
            }
          }
        },
        {
          "type": "object",
          "properties": {
            "status": {
              "const": "error"
            },
            "error": {
              "type": "object"
            }
          }
        }
      ]
    }
  • 403: {status:'forbidden', error:'identity has no userId'} or {status:'forbidden', error:'world_read_denied', message}.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "forbidden"
        },
        "error": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    }
  • 409: Blocked.

    application/json

    {
      "type": "object",
      "required": [
        "status",
        "error",
        "message",
        "recoverable"
      ],
      "properties": {
        "status": {
          "const": "blocked"
        },
        "error": {
          "enum": [
            "chat_world_missing",
            "world_line_permission_denied",
            "world_persona_ref_unresolvable",
            "world_line_conflict"
          ]
        },
        "message": {
          "type": "string"
        },
        "recoverable": {
          "type": "boolean"
        },
        "routeTo": {
          "const": "chat_launcher"
        },
        "existingChatRoomId": {
          "type": "string"
        },
        "existingSessionId": {
          "type": "string"
        }
      }
    }
  • 500: Unhandled error.

    application/json

    {
      "type": "object",
      "properties": {
        "status": {
          "const": "error"
        },
        "message": {
          "type": "string"
        }
      }
    }

Schemas used: ChatFeedEvent, OpenWorldLineRoomResult

Contract authored from app/api/v1/chat/world-line/route.ts (confidence: high).