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

# Create a message

> Creates a new message in a conversation. Supports JSON and multipart/form-data with file attachments.



## OpenAPI

````yaml /api-reference/openapi.json post /core/accounts/{account_id}/conversations/{conversation_id}/messages
openapi: 3.0.3
info:
  contact:
    name: HueChat support
    email: support@huechat.ai
    url: https://huechat.ai/contact
  description: >-
    Account-scoped REST API for HueChat: conversations, messages, contacts,
    inboxes, teams, agents, AI agents and knowledge, WhatsApp templates and
    broadcasts, workflows, chat menus, webhooks and API keys. Every route is
    scoped to your own account.
  license:
    name: Proprietary
    url: https://huechat.ai/terms
  termsOfService: https://huechat.ai/terms
  title: HueChat API
  version: 2.0.0
servers:
  - url: https://app.huechat.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: AI Agents
    description: >-
      Assistants you build to answer customers on their own: persona, language,
      guardrails, tools and a knowledge base, published to inboxes, replying in
      Arabic or English until they hand off to a human. Create, publish, test,
      monitor quality and roll back versions.
  - name: API Keys
    description: >-
      Scoped hc_ keys with their own scopes, rate limit, IP allowlist and
      expiry; rotate, revoke and read the usage log.
  - name: Agents
    description: The human agents on your account and their availability.
  - name: Broadcasts
    description: >-
      Send a WhatsApp template to a list of contacts from a CSV or saved
      audience, with scheduling, pause and resume, and delivery reports.
  - name: Chat Menus
    description: >-
      Numbered or button-driven menus a customer sees at the start of a
      conversation.
  - name: Contacts
    description: >-
      The people your team talks to: phone, email, name, custom attributes,
      labels and notes. One contact can have conversations on several channels.
  - name: Conversations
    description: >-
      A conversation is one thread between a contact and your team on one
      channel, with status, assignee, team, labels, priority and custom
      attributes. List, filter, search, assign, resolve and annotate them.
  - name: Inboxes
    description: >-
      Connected channels: a WhatsApp Business number, an Instagram or Messenger
      page, an email address or a website live-chat widget. Inboxes decide where
      a conversation comes from and who can see it.
  - name: Knowledge
    description: >-
      Documents, web pages and text that ground an AI agent's answers. Upload,
      point at a URL or paste text; HueChat indexes it and the agent cites it.
  - name: Messages
    description: >-
      Everything said inside a conversation: text, attachments, WhatsApp
      templates and interactive replies. Sending through the API delivers on the
      conversation's channel and shows in the inbox like any agent reply.
  - name: Outbound Webhooks
    description: >-
      Signed webhooks (v2): HMAC-SHA256 signature on every delivery, test
      events, delivery logs and secret rotation.
  - name: Teams
    description: Groups of agents used for assignment and reporting.
  - name: Templates
    description: >-
      Pre-approved WhatsApp message formats required by Meta for
      business-initiated messages. Create, sync from Meta, AI-generate,
      test-send and read analytics.
  - name: Webhooks
    description: >-
      Account webhooks (v1): a URL plus event subscriptions, as configured in
      the dashboard. Unsigned; prefer Outbound Webhooks for new integrations.
  - name: Workflows
    description: >-
      Automation flows built from triggers and steps: route, tag, reply, wait,
      hand off. Create, publish, version and toggle.
paths:
  /core/accounts/{account_id}/conversations/{conversation_id}/messages:
    post:
      tags:
        - Messages
      summary: Create a message
      description: >-
        Creates a new message in a conversation. Supports JSON and
        multipart/form-data with file attachments.
      parameters:
        - description: Account ID
          in: path
          name: account_id
          required: true
          schema:
            type: integer
        - description: Conversation display ID
          in: path
          name: conversation_id
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/accounts.messageCreateRequest'
            example:
              content: Hello from the HueChat API!
              message_type: outgoing
          multipart/form-data:
            schema:
              type: object
              properties:
                content:
                  type: string
                  description: Message text. A message needs text or an attachment.
                  example: Hello from the HueChat API!
                message_type:
                  type: string
                  enum:
                    - incoming
                    - outgoing
                    - activity
                    - template
                  default: outgoing
                private:
                  type: boolean
                  default: false
                  description: Create an internal note when true.
                content_type:
                  type: string
                  default: text
                  description: Message content format, such as text.
                content_attributes:
                  type: string
                  description: JSON-encoded object sent as a form field.
                  example: '{}'
                additional_attributes:
                  type: string
                  description: JSON-encoded object sent as a form field.
                  example: '{}'
                echo_id:
                  type: string
                  description: Client correlation identifier.
                source_id:
                  type: string
                  description: External message identifier, where supported.
                attachments[]:
                  type: array
                  description: >-
                    Repeat this multipart field for each file. Channel-specific
                    file and size limits apply.
                  items:
                    type: string
                    format: binary
        description: Message payload
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                additionalProperties:
                  type: string
                type: object
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: bash
          label: JSON message
          source: |-
            curl --request POST \
              --url "https://app.huechat.ai/core/accounts/${HUECHAT_ACCOUNT_ID}/conversations/${HUECHAT_CONVERSATION_ID}/messages" \
              --header "Authorization: Bearer ${HUECHAT_API_KEY}" \
              --header 'Content-Type: application/json' \
              --data '{"content":"Hello from the HueChat API!","message_type":"outgoing"}'
        - lang: bash
          label: File attachment
          source: |-
            curl --request POST \
              --url "https://app.huechat.ai/core/accounts/${HUECHAT_ACCOUNT_ID}/conversations/${HUECHAT_CONVERSATION_ID}/messages" \
              --header "Authorization: Bearer ${HUECHAT_API_KEY}" \
              --form-string 'content=Here is your file.' \
              --form-string 'message_type=outgoing' \
              --form 'attachments[]=@./example.pdf'
components:
  schemas:
    accounts.messageCreateRequest:
      type: object
      properties:
        content:
          type: string
          description: Message text. A message needs text or an attachment.
          example: Hello from the HueChat API!
        message_type:
          oneOf:
            - type: string
              enum:
                - incoming
                - outgoing
                - activity
                - template
            - type: integer
              enum:
                - 0
                - 1
                - 2
                - 3
          default: outgoing
          description: >-
            Defaults to outgoing. Numeric values map to incoming (0), outgoing
            (1), activity (2), and template (3). Channel and conversation
            permissions still apply.
        private:
          type: boolean
          default: false
          description: Create an internal note when true.
        content_type:
          type: string
          default: text
          description: Message content format, such as text.
        content_attributes:
          type: object
          additionalProperties: true
          description: Attributes for the selected content format.
        additional_attributes:
          type: object
          additionalProperties: true
        echo_id:
          type: string
          description: Client correlation identifier.
        source_id:
          type: string
          description: External message identifier, where supported.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Your personal access token from Settings → Profile, or a scoped API key
        (`hc_…`) created at Settings → Developer → API keys. Send it as
        `Authorization: Bearer <token>`.

````