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

# Get Message by ID

> Retrieve a message by ID. <br/> *Added in v2.39.0*

#### Recipes

<AccordionGroup>
  <Accordion title="Get message by ID">
    <Steps>
      <Step title="1. Specify the message ID">
        Provide the `message_id` of the message whose reactions you want to retrieve.

        ```curl {4} theme={null}
        curl -X GET \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98
        ```
      </Step>

      <Step title="2. As a result, the API returns a specified message.">
        ```curl theme={null}
        curl -X GET \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Get message with reactions (added in v2.58.0)">
    <Steps>
      <Step title="1. Specify the message ID">
        Provide the `message_id` of the message whose reactions you want to retrieve.

        ```curl {4} theme={null}
        curl -X GET \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>

      <Step title="2. Set the `include_reactions` query parameter">
        To include detailed reactions data in the response, set the `include_reactions=1` query parameter.

        ```curl {4} theme={null}
        curl -X GET \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>

      <Step title="3. As a result, the API returns a specified message with reactions.">
        ```curl theme={null}
        curl -X GET \
        -H "Content-Type: application/json" \
        -H "QB-Token: eddf864695d72d33b959eec2ae6c640d817dfada" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Get message by ID with API key">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {2} theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user id">
        ```curl {3} theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98
        ```
      </Step>

      <Step title="3. Specify the message ID">
        Provide the `message_id` of the message whose reactions you want to retrieve.

        ```curl {4} theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98
        ```
      </Step>

      <Step title="4. As a result, the API returns a specified message.">
        ```curl theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98
        ```
      </Step>
    </Steps>
  </Accordion>

  <Accordion title="Get message with reactions using API key (added in v2.58.0)">
    <Steps>
      <Step title="1. Use 'Authorization' header to pass API key">
        ```curl {2} theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>

      <Step title="2. Use 'On-Behalf-Of' header to pass user id">
        ```curl {3} theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>

      <Step title="3. Specify the message ID">
        Provide the `message_id` of the message whose reactions you want to retrieve.

        ```curl {4} theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>

      <Step title="4. Set the `include_reactions` query parameter">
        To include detailed reactions data in the response, set the `include_reactions=1` query parameter.

        ```curl {4} theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>

      <Step title="3. As a result, the API returns a specified message with reactions.">
        ```curl theme={null}
        curl -X GET \
        -H "Authorization: ApiKey 28irlNAGasWDSupO9Vw0BBMZfuHrAUYKpmroS9yBORI" \
        -H "On-Behalf-Of: 123" \
        https://api.quickblox.com/chat/Message/5d75626ea28f9a1490cb0f98?include_reactions=1
        ```
      </Step>
    </Steps>
  </Accordion>
</AccordionGroup>

#### Path Parameters

<ParamField path="chat_message_id" type="string" required> ID of the message. Generated automatically by the server after message creation. </ParamField>

#### Query Parameters

<ParamField path="include_reactions" type="integer"> Optional. Set to `1` to include reactions data in the message response. Default is `0`. </ParamField>

#### Headers

<ParamField header="QB-Token" type="string" required> A user or application session token. See [Authentication](/reference/authentication) page to learn more about session tokens. Must be used either QB-Token or Authorization. </ParamField>
<ParamField header="Authorization" type="string" default="ApiKey {your_api_key}"> API key from Dashboard. Expected format: `ApiKey {your_api_key}`. Must be used either QB-Token or Authorization.</ParamField>
<ParamField header="On-Behalf-Of" type="string">User ID. The user ID of the user on whose behalf the request is being made.</ParamField>

#### Responses

<AccordionGroup>
  <Accordion title="200">
    A successful response

    <ResponseField name="message" type="string" />

    <ResponseField name="attachments" type="array">
      <Expandable title="properties">
        <ResponseField name="type" type="string" />

        <ResponseField name="id" type="string" />
      </Expandable>
    </ResponseField>

    <ResponseField name="_id" type="string" />

    <ResponseField name="created_at" type="string" />

    <ResponseField name="updated_at" type="string" />

    <ResponseField name="chat_dialog_id" type="string" />

    <ResponseField name="date_sent" type="integer" />

    <ResponseField name="sender_id" type="integer" />

    <ResponseField name="recipient_id" type="integer" />

    <ResponseField name="read_ids" type="array" />

    <ResponseField name="delivered_ids" type="array" />

    <ResponseField name="read" type="integer" />

    <ResponseField name="reactions" type="array of objects">
      List of reactions added to the message.
      *This field is **omitted by default**. To include it, use the query parameter `?include_reactions=1`.*

      <Expandable title="properties">
        <ResponseField name="name" type="string">Type of the reaction, e.g. "like", "love".</ResponseField>
        <ResponseField name="count" type="integer">Number of times this reaction was added.</ResponseField>
        <ResponseField name="user_ids" type="array of integers">IDs of users who added this reaction.</ResponseField>
      </Expandable>
    </ResponseField>
  </Accordion>

  <Accordion title="403">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>

  <Accordion title="404">
    An error response

    <ResponseField name="errors" type="array of strings" />
  </Accordion>
</AccordionGroup>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET \
  -H "Content-Type: application/json" \
  -H "QB-Token: 1319b4991186601ccf4df2d0fa89565f68012bba" \
  https://api.quickblox.com/chat/Message/66f2a030bba14b4c2e000000
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "message": "hello",
    "attachments": [],
    "_id": "66f2a030bba14b4c2e000000",
    "created_at": "2024-09-24T11:19:12Z",
    "updated_at": "2024-09-24T11:19:12Z",
    "chat_dialog_id": "66ed332108a4fb0d2dc2d147",
    "date_sent": 1727176752,
    "sender_id": 20618,
    "recipient_id": 0,
    "read_ids": [
      20618
    ],
    "delivered_ids": [
      20618
    ],
    "read": 0
  }
  ```

  ```json 403 theme={null}
  {
    "errors": [
      "You don't have appropriate permissions to perform this operation"
    ]
  }
  ```

  ```json 404 theme={null}
  {
    "errors": [
      "The resource wasn't found"
    ]
  }
  ```
</ResponseExample>


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