Skip to main content
Ask Content
Answers a natural language question using content from your project as context. The endpoint first performs semantic retrieval to find relevant content, then sends the context to an LLM to generate a grounded answer. Responds via Server-Sent Events (SSE) for streaming output. Requires a paid plan with semantic search enabled. Authentication required. Send the user’s access token as Authorization: Bearer <token>. Requests without a valid token are rejected before any work is done — missing token → 401, invalid/expired token → 403 (refresh the access token and retry). A service key is accepted too: with actingUserId it gets exactly what that user’s own token would get, and without it exactly the anonymous view — no chat messages as context, only content from spaces anyone can read, no block filtering, and no comment moderation details on the sources.

Body Parameters

string
required
The question to answer. Typos and ambiguous phrasing are handled gracefully.
string[]
default:"[\"entity\", \"comment\", \"message\"]"
Content types to use as context. Any combination of entity, comment, message.
string
Restrict the context lookup to a specific space. It narrows the lookup; it never widens what the user can read. Without includeChildSpaces, a space the user can’t read, or one that doesn’t exist, gives no context and an empty sources array, not an error.
boolean
default:"false"
Only applies with a spaceId. When true, the context lookup also includes every space nested under it — children, grandchildren, the whole subtree at any depth — not just the named space. Use it to ask across a space and all of its sub-spaces at once. Only the spaces in the subtree the user can read are used: a readable sub-space is used even when the user can’t read the named space itself, whose own content is then left out. Ignored without a spaceId.
string
Restrict message context lookup to a specific conversation.
string
Service key only: the user to search as. Results follow that user’s access — their chats, their blocks. Without it, a service key gets the anonymous view: entities and comments from spaces anyone can read, but no chat messages. A user token always acts as its own user and must not send it (400 search/acting-user-not-allowed).
number
default:"20"
Maximum number of content chunks to retrieve for context. Maximum 50.

Space-scoped reputation

This endpoint has a space in context, so it accepts the opt-in reputation params, in the body with the other fields (spaceReputationDescendants as a JSON boolean). They add a spaceReputation field to each source record’s populated user, alongside the always-present reputation total. Only spaces the viewer can read count: a space they can’t read reads 0 (see Who sees space reputation). Requires the reputation bundle. See the Reputation data model for the full contract.
Every field goes in the body. A body field sent in the query string returns 400 search/wrong-location.

Response

The response is a Server-Sent Events stream with Content-Type: text/event-stream. Three event types are emitted: token — streamed LLM answer tokens:
sources — the content records used as context, sent after the answer is complete:
Each source object follows the same shape as the Search Content response — sourceType, similarity, and a fully populated record. An empty array is sent when no relevant context was found. The answer is generated only from content the user (the signed-in user, or the actingUserId a service key sends) can see: content by users they are block-edged with (in either direction), comments on an entity whose author has blocked them, and comments their author deleted, are never used as context or returned as sources. Entities and comments come only from spaces the user can read: they can see the space and either are an active member of it, or its readingPermission is "anyone" and they can read the space above it (see Who can read content). A comment counts as being in its entity’s space; content in no space is always included. Chat messages come only from conversations the user can read in the chat itself: ones they’re an active member of, and, for a conversation they left or were removed or banned from, messages sent before they left. A space chat counts only while the user is an active member of its space and can see it, so a former member of the space gets none of its messages. conversationId narrows the search; it never widens what the user can read. Messages their author deleted or a moderator removed are never returned. done — signals the stream is finished:
If no relevant content is found above the similarity threshold, the LLM response is skipped and the answer event immediately says “I couldn’t find any relevant content to answer your question.”

Error Responses

The endpoint requires a user token or a service key. A missing token returns a bare 401; an invalid or expired token returns a bare 403 — refresh the access token and retry. These are returned before streaming starts.
Returned when a body field — query, actingUserId, spaceReputationId, spaceReputationDescendants or any other — is sent in the query string.
Returned when a user token, or a request with no credentials, sends actingUserId, even naming its own user. Only a service key names the user it acts as; a user token always acts as its own user.
Returned when a service key names an actingUserId that isn’t a user in this project.
Only returned when headers have not yet been sent (i.e., before streaming starts).
If an error occurs after streaming starts: