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

# Retrieve a message

> Retrieves the message with the given ID.

<RequestExample>
  ```ts TypeScript/JavaScript SDK theme={null}
  import { ProficientClient } from "@proficient/client";

  const proficient = new ProficientClient({
    apiKey: process.env.PROFICIENT_AI_PUBLISHABLE_KEY,
    userExternalId: "...", // The user's unique ID in your system
  });

  const messageId = "msg_BlzvLJ8h2QZY8QOK3vjhIlqK43zciPzpPgIhvTo8ai2VnQIW";

  const message = await proficient.messages.get(messageId);
  ```
</RequestExample>


## OpenAPI

````yaml client-openapi GET /messages/{message_id}
openapi: 3.0.1
info:
  title: api
  version: 0.0.1
servers:
  - url: https://api.proficientai.com
    description: Production (The production environment)
  - url: https://main-64bxvpctea-uc.a.run.app
    description: Staging (The staging environment)
  - url: http://localhost:8080
    description: Development (The local environment)
security: []
paths:
  /messages/{message_id}:
    get:
      tags:
        - Messages
      summary: Retrieve a message
      description: Retrieves the message with the given ID.
      operationId: messages_get
      parameters:
        - name: message_id
          in: path
          required: true
          schema:
            $ref: '#/components/schemas/MessageId'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
components:
  schemas:
    MessageId:
      title: MessageId
      type: string
      description: The unique identifier of the message
    Message:
      title: Message
      type: object
      description: >-
        <p>Each interaction holds a number of <i>messages</i> and every message
        belongs to an interaction. The `sent_by` property of a message indicates
        whether a message was created by an agent or a user.</p>
      properties:
        id:
          $ref: '#/components/schemas/MessageId'
        object:
          $ref: '#/components/schemas/MessageObjectType'
        content:
          $ref: '#/components/schemas/MessageContent'
        created_at:
          $ref: '#/components/schemas/CreatedAt'
        depth:
          $ref: '#/components/schemas/MessageDepth'
        interaction_id:
          $ref: '#/components/schemas/InteractionId'
        parent_id:
          $ref: '#/components/schemas/MessageParentId'
          nullable: true
        sent_by:
          $ref: '#/components/schemas/InteractionParticipant'
      required:
        - id
        - object
        - content
        - created_at
        - depth
        - interaction_id
        - sent_by
    ApiError:
      title: ApiError
      type: object
      description: >-
        Represents the general interface of an API error. The body of every
        error returned by the API contains `code` and `message` fields.
      properties:
        error:
          $ref: '#/components/schemas/ApiErrorBody'
      required:
        - error
    MessageObjectType:
      title: MessageObjectType
      type: string
      enum:
        - message
      description: The type of the `Message` object
    MessageContent:
      title: MessageContent
      type: string
      description: The content of the message
    CreatedAt:
      title: CreatedAt
      type: integer
      description: >-
        The time at which the object was created, measured in milliseconds since
        the Unix epoch
    MessageDepth:
      title: MessageDepth
      type: integer
      description: >-
        The depth of the message node in the interaction tree. This will be 0
        for all root-level messages that mark the beginning of the interaction
        and increase as the conversation grows longer.
    InteractionId:
      title: InteractionId
      type: string
      description: The unique identifier of the interaction
    MessageParentId:
      title: MessageParentId
      type: string
      nullable: true
      description: >-
        The ID of the message that directly precedes a given message within a
        particular conversation.
    InteractionParticipant:
      title: InteractionParticipant
      type: string
      enum:
        - user
        - agent
      description: >-
        Represents the type of the participant in a given interaction. As an
        example, message are created by interaction participants so the
        `sent_by` property of a `Message` object must be an
        `InteractionParticipant`.
    ApiErrorBody:
      title: ApiErrorBody
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ApiErrorCode'
        message:
          type: string
      required:
        - code
        - message
    ApiErrorCode:
      title: ApiErrorCode
      type: string
      enum:
        - invalid_request
        - invalid_credentials
        - forbidden
        - resource_not_found
        - conflict
        - unavailable
        - unknown

````