> ## 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.

# Send Message

> Send a message to a conversation

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>
    </>;
};

Creates a new message in a conversation. The caller must be an active member. At least one of `content`, `gif`, or a file attachment is required.

For space conversations with `postingPermission: "admins"`, only users with `admin` or `moderator` role in the parent Space can send messages.

This endpoint accepts `multipart/form-data` to support file attachments alongside message content.

## Path Parameters

<ParamField path="conversationId" type="string" required>
  The ID of the conversation to send the message to.
</ParamField>

## Body Parameters

<ParamField body="content" type="string">
  Text content of the message. Optional if a GIF or file is provided.
</ParamField>

<ParamField body="gif" type="object">
  GIF attachment. Optional. See [GifData](/v8/data-models/chat-message#gifdata) for the expected shape.
</ParamField>

<ParamField body="mentions" type="array">
  Array of [Mention](/v8/data-models/chat-message#mention) objects for @mentions in the message content. Optional.
</ParamField>

<ParamField body="parentMessageId" type="string">
  ID of a message in this conversation to reply to in a thread. The referenced message must be a main-stream message (threads are one level deep only). Optional.
</ParamField>

<ParamField body="quotedMessageId" type="string">
  ID of a message to quote inline. The message stays in the main stream but renders the quoted content as a preview. Must be a message in this conversation. Optional.
</ParamField>

<ParamField body="metadata" type="object">
  Custom key-value data. Limited to 10 KB. Optional.
</ParamField>

<ParamField body="localId" type="string">
  Client-generated identifier for optimistic deduplication. The server echoes it back in the response but never stores it. Optional.
</ParamField>

<ParamField body="files" type="file[]">
  File attachments (multipart/form-data). Up to 10 files per message. Optional.
</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 the message sender's `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 the created [ChatMessage](/v8/data-models/chat-message) object, fully populated with `user`, `quotedMessage`, `files`, `reactionCounts` (empty on creation), and `userReactions` (empty on creation). If `localId` was provided, it is echoed in the response.

## Error Responses

<AccordionGroup>
  <Accordion title="Empty Message — 400 Bad Request">
    ```json theme={null}
    { "error": "Message must have content, a GIF, or at least one file.", "code": "chat/empty-message" }
    ```
  </Accordion>

  <Accordion title="Forbidden — 403">
    ```json theme={null}
    { "error": "You are not a member of this conversation.", "code": "chat/not-a-member" }
    ```
  </Accordion>

  <Accordion title="Invalid Parent — 400 Bad Request">
    ```json theme={null}
    { "error": "Parent message not found, not in this conversation, already removed, or is itself a reply.", "code": "chat/invalid-parent" }
    ```
  </Accordion>

  <Accordion title="Invalid Quote — 400 Bad Request">
    The quoted message is not in this conversation, or was removed.

    ```json theme={null}
    { "error": "Quoted message not found in this conversation.", "code": "chat/invalid-quote" }
    ```
  </Accordion>
</AccordionGroup>


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