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

# Send a follow-up message to an agent chat

> Queues the message and starts the agent on it as soon as the chat is idle. With `queued: false` the turn has started: poll GET /ai/trigger/runs?agent_ids={id} until the run is not `running`, then GET /ai/agents/{id}. With `queued: true` an earlier turn is still running and the run status finishes for that turn first, so poll GET /ai/agents/{id} until the reply to this message is in the transcript.



## OpenAPI

````yaml /openapi/customer-api.json post /ai/agents/{id}/messages
openapi: 3.0.0
info:
  contact: {}
  description: >-
    Flow customer API reference. Start with the [quickstart](/api/quickstart)
    and [authentication guide](/api/authentication).
  title: Customer API
  version: 1.0.0
servers:
  - description: Flow API
    url: '{baseUrl}'
    variables:
      baseUrl:
        default: https://backend.branch.flowengineering.com
security: []
tags:
  - name: Automations
  - name: Branches
  - name: Comments
  - name: Convert
  - name: Data Model
  - name: Diagrams
  - name: Entities
  - name: Files
  - name: Import
  - name: Notifications
  - name: Projects
  - name: ReqIF
  - name: ReqIF Import
  - name: Shared Access Grants
  - name: User Groups
  - name: Users
paths:
  /ai/agents/{id}/messages:
    post:
      tags:
        - Automations
      summary: Send a follow-up message to an agent chat
      description: >-
        Queues the message and starts the agent on it as soon as the chat is
        idle. With `queued: false` the turn has started: poll GET
        /ai/trigger/runs?agent_ids={id} until the run is not `running`, then GET
        /ai/agents/{id}. With `queued: true` an earlier turn is still running
        and the run status finishes for that turn first, so poll GET
        /ai/agents/{id} until the reply to this message is in the transcript.
      operationId: AgentChatController_sendMessage
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
        - description: Workspace identifier
          in: header
          name: customer
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageDto'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponseDto'
          description: ''
      security:
        - api-key: []
        - bearer: []
components:
  schemas:
    SendMessageDto:
      properties:
        branch_id:
          nullable: true
          type: string
        messages:
          description: >-
            The next turn: one or more `{ "role": "user", "content": "…" }`
            messages. The agent answers in the background; poll the chat for the
            reply.
          items:
            type: object
          type: array
      required:
        - messages
      type: object
    SendMessageResponseDto:
      properties:
        job_id:
          description: Identifies this send within the chat.
          type: string
        queued:
          description: >-
            False: the chat was idle and this message became a turn at once.
            True: a turn was already running and this message runs after it
            finishes.
          type: boolean
      required:
        - job_id
        - queued
      type: object
  securitySchemes:
    api-key:
      in: header
      name: X-API-Key
      type: apiKey
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````

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