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

# Create thread message

> Posts as the authenticated API user, who must be a channel member. Eligible channel agents may respond and consume credits.



## OpenAPI

````yaml post /channels/{channel_id}/threads/{thread_id}/messages
openapi: 3.0.3
info:
  version: 0.1.1
  title: Datagrid API
  description: Datagrid API
servers:
  - url: https://api.datagrid.com/v1
security:
  - BearerAuth: []
paths:
  /channels/{channel_id}/threads/{thread_id}/messages:
    parameters:
      - $ref: '#/components/parameters/channel_id'
      - $ref: '#/components/parameters/thread_id'
    post:
      tags:
        - Channels
      summary: Create thread message
      description: >-
        Posts as the authenticated API user, who must be a channel member.
        Eligible channel agents may respond and consume credits.
      operationId: Channels.createThreadMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChannelMessageRequest'
      responses:
        '201':
          description: Created message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChannelMessage'
components:
  parameters:
    channel_id:
      name: channel_id
      in: path
      required: true
      schema:
        type: string
    thread_id:
      name: thread_id
      in: path
      required: true
      schema:
        type: string
  schemas:
    CreateChannelMessageRequest:
      type: object
      required:
        - content
      properties:
        content:
          type: string
          maxLength: 20000
        file_ids:
          type: array
          items:
            type: string
          nullable: true
    ChannelMessage:
      type: object
      required:
        - object
        - id
        - channel_id
        - thread_id
        - role
        - agent_id
        - content
        - reply_count
        - reactions
        - created_at
        - credits
        - citations
      properties:
        object:
          type: string
          enum:
            - channel.message
        id:
          type: string
        channel_id:
          type: string
        thread_id:
          type: string
          nullable: true
        role:
          type: string
          enum:
            - user
            - agent
        agent_id:
          type: string
        content:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/MessageContentText'
              - $ref: '#/components/schemas/MessageContentJson'
              - $ref: '#/components/schemas/MessageContentVoice'
              - $ref: '#/components/schemas/MessageContentFile'
            discriminator:
              propertyName: type
              mapping:
                text:
                  $ref: '#/components/schemas/MessageContentText'
                json:
                  $ref: '#/components/schemas/MessageContentJson'
                voice:
                  $ref: '#/components/schemas/MessageContentVoice'
                input_file:
                  $ref: '#/components/schemas/MessageContentFile'
        reply_count:
          type: integer
        reactions:
          type: array
          description: Reactions grouped by emoji, ordered by first reaction time.
          items:
            $ref: '#/components/schemas/ChannelMessageReaction'
        created_at:
          type: string
          format: date-time
        credits:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/OperationCredits'
        citations:
          $ref: '#/components/schemas/Citations'
          nullable: true
    MessageContentText:
      type: object
      description: Text content for a message.
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
          x-stainless-const: true
        text:
          type: string
          description: The text content of the message.
    MessageContentJson:
      type: object
      description: JSON content for structured-output responses.
      required:
        - type
        - json
      properties:
        type:
          type: string
          enum:
            - json
          x-stainless-const: true
        json:
          description: The JSON value produced by the agent.
    MessageContentVoice:
      type: object
      description: Voice content for a message.
      required:
        - type
        - audio_clips
        - transcript
        - duration_ms
      properties:
        type:
          type: string
          enum:
            - voice
          x-stainless-const: true
        audio_clips:
          type: array
          description: Array of audio clips with timestamps for synchronized playback.
          items:
            $ref: '#/components/schemas/VoiceAudioClip'
        transcript:
          type: string
          description: User transcript of the voice message.
        agent_transcript:
          type: string
          description: Agent transcript of the voice message (for agent role messages).
          nullable: true
        duration_ms:
          type: number
          description: Total duration of the voice message in milliseconds.
          nullable: true
        timeline_events:
          type: array
          description: >-
            Per-turn transcript, citation, and tool-call status events in
            chronological order. Each entry includes a timestamp offset from the
            start of the voice session. Present only for voice sessions that
            recorded timeline data.
          items:
            $ref: '#/components/schemas/VoiceTimelineEvent'
    MessageContentFile:
      type: object
      description: >-
        File attachment content for a message. Represents a file that was
        uploaded as part of the user's message.
      required:
        - type
        - file_id
      properties:
        type:
          type: string
          enum:
            - input_file
          x-stainless-const: true
        file_id:
          type: string
          description: >-
            The ID of the attached file. Use this ID with the files API to
            download the file content.
    ChannelMessageReaction:
      type: object
      required:
        - reaction
        - users
      properties:
        reaction:
          type: string
          description: Emoji shortcode or unicode emoji.
        users:
          type: array
          items:
            $ref: '#/components/schemas/ChannelMessageReactionUser'
    OperationCredits:
      type: object
      required:
        - consumed
      properties:
        consumed:
          type: number
          description: The number of credits consumed by the operation.
    Citations:
      type: array
      description: >-
        Array of citations that provide sources for factual statements in the
        response. Each citation includes the referenced text and its sources.
      items:
        type: object
        required:
          - citation
          - sources
        properties:
          citation:
            type: string
            description: The text snippet from the response that is being cited.
          sources:
            type: array
            description: Array of sources that support this citation.
            items:
              $ref: '#/components/schemas/CitationSource'
    VoiceAudioClip:
      type: object
      description: A single audio clip from a voice message.
      required:
        - id
        - audio_uri
        - start_time_ms
        - duration_ms
        - participant
      properties:
        id:
          type: string
          description: >-
            Unique identifier for the audio clip file. Use this ID with the
            files API to download the audio content.
        audio_uri:
          type: string
          description: Datagrid file URI for the audio file (WAV format).
        start_time_ms:
          type: number
          description: >-
            Start time of this clip relative to the beginning of the voice
            message, in milliseconds.
        duration_ms:
          type: number
          description: Duration of this audio clip in milliseconds.
        participant:
          type: object
          description: Participant who spoke in this clip.
          required:
            - type
            - id
          properties:
            type:
              type: string
              enum:
                - user
                - agent
            id:
              type: string
    VoiceTimelineEvent:
      type: object
      description: >-
        A single event from a voice session timeline, representing a transcript
        turn, citation, or tool-call status update.
      required:
        - type
        - timestamp_ms
      properties:
        type:
          type: string
          enum:
            - transcript
            - citation
            - tool_call_status
          description: The type of timeline event.
        timestamp_ms:
          type: number
          description: >-
            Timestamp offset from the start of the voice session, in
            milliseconds.
        role:
          type: string
          enum:
            - user
            - agent
          description: The role of the participant for this event.
        text:
          type: string
          description: >-
            Plain text transcript for this turn. Present when type is
            'transcript'.
        citations:
          $ref: '#/components/schemas/Citations'
          description: Citations for this event. Present when type is 'citation'.
        tool_name:
          type: string
          description: >-
            Name of the tool whose status changed. Present when type is
            'tool_call_status'.
        status:
          type: string
          enum:
            - started
            - completed
            - failed
          description: >-
            Tool-call status for this event. Present when type is
            'tool_call_status'.
    ChannelMessageReactionUser:
      type: object
      required:
        - user_id
        - created_at
      properties:
        user_id:
          type: string
        created_at:
          type: string
          format: date-time
    CitationSource:
      type: object
      required:
        - type
        - source_name
        - confirmations
      properties:
        type:
          type: string
          enum:
            - image
            - pdf_page
            - record
            - web_search
            - sql_query_result
            - action
        source_id:
          type: string
          description: >-
            Id of the source when Datagrid holds one (dataset id, or data-lake
            item id for file-backed `pdf_page`). Omitted for `pdf_page` sources
            with no Datagrid-backed file.
        source_name:
          type: string
          description: Name of the source.
        source_uri:
          type: string
          description: >-
            URI of the source. For file-backed sources this is the in-app target
            (signed Datagrid file URI when available); use `external_url` for
            the origin-system deep-link. For `pdf_page` sources with no Datagrid
            file, this is the origin-system deep-link and matches
            `external_url`; locate the page with `page_number`.
        external_url:
          type: string
          description: >-
            Origin-system deep-link for the source (e.g. an `app.procore.com`
            universal link), when one exists. Unlike `source_uri`, it is never
            overridden by the signed Datagrid file URI, so clients can offer an
            "open in source" action.
        confirmations:
          type: array
          description: An array of text snippets from the source that confirm the citation.
          items:
            type: string
        status:
          type: string
          description: >-
            record only. Primary status value for the record (e.g. "Open",
            "Pending Review"), surfaced separately from `fields` so clients can
            render a status chip.
        fields:
          type: array
          description: >-
            record only. Backend-normalized, render-ready structured fields
            promoted from the record row (due date, ball-in-court, assignee,
            revision, type, vendor, scope, …). Excludes `status`, which is
            surfaced on its own.
          items:
            type: object
            required:
              - label
              - value
            properties:
              label:
                type: string
                description: Human-readable field label (e.g. "Due Date").
              value:
                type: string
                description: Human-readable field value (e.g. "2025-09-14").
        item_type:
          type: string
          description: >-
            record / pdf_page only. Procore tool type of the underlying record
            (e.g. "rfi_headers", "submittal_logs"), read from the indexed
            Procore item type on the source row; present only for sources
            ingested from Procore. Lets clients render a reliable type label
            (RFI, Submittal, Observation, …) without parsing the deep-link URL.
        page_number:
          type: integer
          minimum: 1
          description: >-
            pdf_page only. 1-based page number within the source document.
            Omitted when the page is unknown; never `0`.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer

````