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

# Get a message by ID

> Returns a single message from the session by its ID. This feature is enabled for selected organizations only.



## OpenAPI

````yaml https://api.factory.ai/api/v0/openapi.json get /api/v0/sessions/{sessionId}/messages/{messageId}
openapi: 3.0.1
info:
  title: Factory Public API
  description: >-
    Public API for Factory platform. Requires authentication via the
    `Authorization: Bearer` header.
  version: 0.1.0
servers:
  - url: https://api.factory.ai/
    description: Production
security:
  - BearerAuth: []
paths:
  /api/v0/sessions/{sessionId}/messages/{messageId}:
    get:
      tags:
        - Sessions
      summary: Get a message by ID
      description: >-
        Returns a single message from the session by its ID. This feature is
        enabled for selected organizations only.
      operationId: getMessage
      parameters:
        - name: sessionId
          in: path
          required: true
          schema:
            type: string
            description: Session ID
        - name: messageId
          in: path
          required: true
          schema:
            type: string
            description: Message ID
        - name: computerId
          in: query
          required: false
          schema:
            type: string
            description: Computer ID to query directly
      responses:
        '200':
          description: Response for status 200
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessage200ResponseBody'
        '400':
          description: Response for status 400
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessage400ResponseBody'
        '401':
          description: Response for status 401
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessage401ResponseBody'
        '403':
          description: Response for status 403
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessage403ResponseBody'
        '404':
          description: Response for status 404
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessage404ResponseBody'
        '500':
          description: Response for status 500
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessage500ResponseBody'
        '503':
          description: Response for status 503
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetMessage503ResponseBody'
components:
  schemas:
    GetMessage200ResponseBody:
      type: object
      properties:
        id:
          type: string
        role:
          type: string
          enum:
            - user
            - assistant
            - tool
            - system
        content:
          type: array
          items:
            anyOf:
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    enum:
                      - text
                  text:
                    type: string
                required:
                  - type
                  - text
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    enum:
                      - image
                  source:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - base64
                      data:
                        type: string
                      mediaType:
                        type: string
                        enum:
                          - image/jpeg
                          - image/png
                          - image/gif
                          - image/webp
                    required:
                      - type
                      - data
                      - mediaType
                    additionalProperties: false
                required:
                  - type
                  - source
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    enum:
                      - thinking
                  signature:
                    type: string
                  signatureProvider:
                    anyOf:
                      - type: string
                        enum:
                          - anthropic
                          - openai
                          - generic-chat-completion-api
                          - factory
                          - google
                          - xai
                          - voyage
                      - type: string
                        enum:
                          - unknown
                  thinking:
                    type: string
                  durationMs:
                    type: number
                    minimum: 0
                required:
                  - type
                  - signature
                  - thinking
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    enum:
                      - redacted_thinking
                  data:
                    type: string
                required:
                  - type
                  - data
                additionalProperties: false
              - type: object
                properties:
                  type:
                    type: string
                    enum:
                      - tool_use
                  id:
                    type: string
                  input:
                    type: object
                    additionalProperties: {}
                  name:
                    type: string
                  thoughtSignature:
                    type: string
                required:
                  - type
                  - id
                  - input
                  - name
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    enum:
                      - tool_result
                  toolUseId:
                    type: string
                  content:
                    anyOf:
                      - type: string
                      - type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                id:
                                  type: string
                                type:
                                  type: string
                                  enum:
                                    - text
                                text:
                                  type: string
                              required:
                                - type
                                - text
                              additionalProperties: false
                            - type: object
                              properties:
                                id:
                                  type: string
                                type:
                                  type: string
                                  enum:
                                    - image
                                source:
                                  type: object
                                  properties:
                                    type:
                                      type: string
                                      enum:
                                        - base64
                                    data:
                                      type: string
                                    mediaType:
                                      type: string
                                      enum:
                                        - image/jpeg
                                        - image/png
                                        - image/gif
                                        - image/webp
                                  required:
                                    - type
                                    - data
                                    - mediaType
                                  additionalProperties: false
                              required:
                                - type
                                - source
                              additionalProperties: false
                            - type: object
                              properties:
                                id:
                                  type: string
                                type:
                                  type: string
                                  enum:
                                    - document
                                source:
                                  anyOf:
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - base64
                                        mediaType:
                                          type: string
                                          enum:
                                            - application/pdf
                                        data:
                                          type: string
                                        parsedData:
                                          type: string
                                        name:
                                          type: string
                                        path:
                                          type: string
                                      required:
                                        - type
                                        - mediaType
                                        - data
                                      additionalProperties: false
                                    - type: object
                                      properties:
                                        type:
                                          type: string
                                          enum:
                                            - text
                                        mediaType:
                                          type: string
                                          enum:
                                            - text/plain
                                        data:
                                          type: string
                                        name:
                                          type: string
                                        mime:
                                          type: string
                                      required:
                                        - type
                                        - mediaType
                                        - data
                                      additionalProperties: false
                              required:
                                - type
                                - source
                              additionalProperties: false
                  isError:
                    type: boolean
                required:
                  - type
                  - toolUseId
                additionalProperties: false
              - type: object
                properties:
                  id:
                    type: string
                  type:
                    type: string
                    enum:
                      - document
                  source:
                    anyOf:
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - base64
                          mediaType:
                            type: string
                            enum:
                              - application/pdf
                          data:
                            type: string
                          parsedData:
                            type: string
                          name:
                            type: string
                          path:
                            type: string
                        required:
                          - type
                          - mediaType
                          - data
                        additionalProperties: false
                      - type: object
                        properties:
                          type:
                            type: string
                            enum:
                              - text
                          mediaType:
                            type: string
                            enum:
                              - text/plain
                          data:
                            type: string
                          name:
                            type: string
                          mime:
                            type: string
                        required:
                          - type
                          - mediaType
                          - data
                        additionalProperties: false
                required:
                  - type
                  - source
                additionalProperties: false
        createdAt:
          type: number
        updatedAt:
          type: number
        parentId:
          type: string
        visibility:
          type: string
          enum:
            - both
            - llm_only
            - user_only
        openaiMessageId:
          type: string
        openaiPhase:
          type: string
          enum:
            - commentary
            - final_answer
          nullable: true
        openaiEncryptedContent:
          type: string
        openaiReasoningId:
          type: string
        openaiReasoningSummary:
          type: string
        geminiThoughtSignature:
          type: string
        chatCompletionReasoningField:
          type: string
          enum:
            - reasoning
            - reasoning_content
        chatCompletionReasoningContent:
          type: string
        isUserVisible:
          type: boolean
        isError:
          type: boolean
      required:
        - id
        - role
        - content
        - createdAt
        - updatedAt
      additionalProperties: false
    GetMessage400ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    GetMessage401ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    GetMessage403ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    GetMessage404ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    GetMessage500ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
    GetMessage503ResponseBody:
      type: object
      properties:
        detail:
          type: string
          description: Human-readable error message
        status:
          type: number
          description: HTTP status code
        title:
          type: string
          description: HTTP status title
        metadata:
          type: object
          additionalProperties: {}
          description: Additional error metadata
      required:
        - detail
        - status
        - title
      additionalProperties: false
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Factory API key or JWT token for authentication

````