> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Search Content

> Semantic search over entities, comments, and messages

export const SpaceReputationParams = ({variant = "context", field = "path"}) => {
  const isUser = variant === "user";
  return <>
      <ParamField {...{
    [field]: "spaceReputation",
    type: "object"
  }}>
        Opt-in. Adds a <code>spaceReputation</code> number to each returned user,
        scoped to a single space. Requires the <code>reputation</code> bundle.
        The <code>reputation</code> total is always present regardless;{" "}
        <code>spaceReputation</code> is purely additive and only appears when you
        pass this object. <strong>This object is the primary form</strong> — it
        replaces the deprecated flat props below. See the{" "}
        <a href="/v8/data-models/reputation">Reputation data model</a> for the
        full contract.

        <Expandable title="spaceReputation">
          {isUser ? <ParamField name="spaceId" type="string | &quot;none&quot;" required>
              Which bucket to read. A space <strong><code>&lt;uuid&gt;</code></strong> reads that
              space's bucket; <strong><code>"none"</code></strong> reads the
              project-general (space-less) bucket.{" "}
              <strong><code>"context"</code> is rejected (400)</strong> on this
              endpoint — there is no space context to derive. The empty string
              and the legacy <code>general</code> / <code>null</code> aliases are
              also rejected. Missing buckets read as <code>0</code>.
            </ParamField> : <ParamField name="spaceId" type="string | &quot;none&quot; | &quot;context&quot;" required>
              Which bucket to read. One of: a space <strong><code>&lt;uuid&gt;</code></strong>{" "}
              (that space's bucket), <strong><code>"none"</code></strong> (the
              project-general, space-less bucket), or{" "}
              <strong><code>"context"</code></strong> (the space derived from the
              request context — resolved per-row on lists, or the single space on
              member/team/conversation surfaces). The empty string and the legacy{" "}
              <code>general</code> / <code>null</code> aliases are rejected (400).
              Missing buckets read as <code>0</code>.
            </ParamField>}
          <ParamField name="includeDescendants" type="boolean">
            Only honored when <code>spaceId</code> is an explicit space <code>&lt;uuid&gt;</code>.
            When <code>true</code>, <code>spaceReputation</code> is the{" "}
            <strong>subtree sum</strong> — the named space plus all of its
            descendant spaces (the root space's own bucket included). Ignored for{" "}
            <code>"none"</code>; not allowed with <code>"context"</code>.
          </ParamField>
        </Expandable>
      </ParamField>

      {isUser ? <ParamField {...{
    [field]: "spaceReputationId",
    type: "string",
    deprecated: true
  }}>
          <strong>Deprecated</strong> — use the <code>spaceReputation</code>{" "}
          object instead. The flat form of <code>spaceReputation.spaceId</code>.
          Still accepted (the object wins if both are passed); removal is a later
          major version. Accepts a space <code>&lt;uuid&gt;</code> or <code>"none"</code> only —{" "}
          <code>"context"</code> is rejected (400) on this endpoint.
        </ParamField> : <ParamField {...{
    [field]: "spaceReputationId",
    type: "string",
    deprecated: true
  }}>
          <strong>Deprecated</strong> — use the <code>spaceReputation</code>{" "}
          object instead. The flat form of <code>spaceReputation.spaceId</code>.
          Still accepted (the object wins if both are passed); removal is a later
          major version. Accepts a space <code>&lt;uuid&gt;</code>, <code>"none"</code>, or{" "}
          <code>"context"</code>.
        </ParamField>}

      <ParamField {...{
    [field]: "spaceReputationDescendants",
    type: "boolean",
    deprecated: true
  }}>
        <strong>Deprecated</strong> — use{" "}
        <code>spaceReputation.includeDescendants</code> instead. The flat form,
        only honored alongside an explicit <code>spaceReputationId</code> <code>&lt;uuid&gt;</code>.
      </ParamField>
    </>;
};

Performs vector-similarity search over project content (entities, comments, and chat messages) using AI embeddings. Returns the most semantically relevant results for the given query.

**Requires a paid plan with semantic search enabled.**

**Authentication required.** Send a user's access token as `Authorization: Bearer <token>` — missing token → `401`, invalid/expired token → `403` (refresh and retry). A service or master key is accepted too; such a request has no signed-in user, so the per-user filtering under [What's left out](#whats-left-out) doesn't apply to it.

## Body Parameters

<ParamField body="query" type="string" required>
  The natural language search query.
</ParamField>

<ParamField body="sourceTypes" type="string[]" default="[&#x22;entity&#x22;, &#x22;comment&#x22;, &#x22;message&#x22;]">
  Content types to search. Any combination of `entity`, `comment`, `message`.
</ParamField>

<ParamField body="spaceId" type="string">
  Restrict search to a specific space.
</ParamField>

<ParamField body="includeChildSpaces" type="boolean" default="false">
  Only applies with a `spaceId`. When `true`, the search also includes every space nested under it — children, grandchildren, the whole subtree at any depth — not just the named space. Ignored without a `spaceId`.
</ParamField>

<ParamField body="conversationId" type="string">
  Restrict message search to a specific conversation.
</ParamField>

<ParamField body="limit" type="number" default="20">
  Maximum number of results to return. A whole number from `1` to `50`, sent as a JSON number. A value outside that range is rejected with `400 search/invalid-body` — a `limit` above `50` isn't lowered to `50`.
</ParamField>

## Query Parameters

### Space-scoped reputation

This endpoint has a space in context, so it accepts the opt-in reputation params. They add a `spaceReputation` field to each result record's populated `user`, alongside the always-present `reputation` total. Requires the `reputation` bundle. See the [Reputation data model](/v8/data-models/reputation) for the full contract.

<SpaceReputationParams variant="context" field="query" />

## Response

Returns an array of result objects ordered by similarity (highest first):

```json theme={null}
[
  {
    "sourceType": "entity",
    "similarity": 0.87,
    "record": { ...Entity | Comment | ChatMessage... }
  }
]
```

Each result includes:

* `sourceType` — one of `"entity"`, `"comment"`, or `"message"`, indicating which type of record was matched.
* `similarity` — cosine similarity score between the query and the matched content.
* `record` — the fully populated entity, comment, or chat message object. Entity records carry `commentsCount`. A record's `user` is the author's public [User](/v8/data-models/user) — no email or other private fields.

### What's left out

Comments their author deleted are never returned. Comments a moderator removed are never returned either — to anyone, including the removed comment's author and requests made with a service or master key.

Results are also filtered for the signed-in user (with the `moderation` bundle installed):

* Content by users they are block-edged with, in either direction, is left out.
* Comments on an entity whose author has blocked them are left out — their own comments there included.

## Error Responses

<AccordionGroup>
  <Accordion title="Authentication Required — 401 / 403">
    The endpoint requires a user token or a service or master key. A missing token returns a bare `401`; an invalid or expired token returns a bare `403` — refresh the access token and retry.
  </Accordion>

  <Accordion title="Invalid Body — 400">
    Returned when the body fails validation: `query` is missing or empty, `limit` isn't a whole number from `1` to `50`, `sourceTypes` contains a value other than `entity`, `comment` or `message`, `spaceId` or `conversationId` isn't a UUID, or `includeChildSpaces` isn't a boolean.

    ```json theme={null}
    { "error": "limit: Too big: expected number to be <=50", "code": "search/invalid-body" }
    ```
  </Accordion>

  <Accordion title="Plan Required — 403">
    ```json theme={null}
    { "error": "Semantic search requires a paid plan", "code": "project/plan-required" }
    ```
  </Accordion>
</AccordionGroup>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.