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

# Send a message

> Send a message to a chat session and wait for the caregiver's reply.



## OpenAPI

````yaml /openapi/backend.json post /api/v1/chat/message
openapi: 3.0.3
info:
  title: Drive Health operational API
  version: 1.0.0
  description: >-
    Server-to-server API for organizations integrating with Drive Health. It
    starts chat and voice conversations and reads the calls, chats, transcripts,
    and recordings those conversations produce. Authenticate every request with
    an organization API key.
servers:
  - url: https://backend.drivehealth.ai
    description: Production. Use the API origin supplied for your environment.
security:
  - organizationBearer: []
  - organizationApiKey: []
tags:
  - name: Chat
    description: >-
      Start a chat with a caregiver, exchange messages, and end the session.
      These routes also answer on the compatibility mount `/v1/chat/...`.
  - name: Voice
    description: Start phone calls from an owned number and register browser voice calls.
  - name: Results
    description: >-
      Read the calls, chat sessions, transcripts, and recordings your
      organization owns.
paths:
  /api/v1/chat/message:
    post:
      tags:
        - Chat
      summary: Send a message
      description: Send a message to a chat session and wait for the caregiver's reply.
      operationId: sendChatMessage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatMessageRequest'
            example:
              chat_id: 9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f
              message: What time is my appointment?
      responses:
        '200':
          description: The caregiver's reply.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatReplyResponse'
              example:
                err: false
                msg: Success
                results:
                  response: Your appointment is on Thursday at 2pm.
                  chat_id: 9f8e7d6c-5b4a-4938-8271-6a5b4c3d2e1f
        '400':
          description: >-
            Invalid input, a chat session your organization does not own, or a
            model failure.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorEnvelope'
              examples:
                missingMessage:
                  summary: No message
                  value:
                    err: true
                    msg: message is required
                unknownChat:
                  summary: Chat session not found
                  value:
                    err: true
                    msg: Chat session not found
                modelFailure:
                  summary: Model failure
                  value:
                    err: true
                    msg: LLM error
        '403':
          $ref: '#/components/responses/Refused'
components:
  schemas:
    ChatMessageRequest:
      type: object
      required:
        - chat_id
        - message
      properties:
        chat_id:
          type: string
          format: uuid
          description: ID of a chat session your organization owns.
        message:
          type: string
          description: The message to send.
    ChatReplyResponse:
      type: object
      required:
        - err
        - msg
        - results
      properties:
        err:
          type: boolean
          example: false
        msg:
          type: string
          example: Success
        results:
          type: object
          required:
            - response
            - chat_id
          properties:
            response:
              type: string
              description: The caregiver's reply.
            chat_id:
              type: string
              format: uuid
    ErrorEnvelope:
      type: object
      required:
        - err
        - msg
      properties:
        err:
          type: boolean
          example: true
        msg:
          type: string
          description: What went wrong.
    Refusal:
      type: object
      required:
        - detail
      properties:
        detail:
          type: string
          description: Why the request was refused.
  responses:
    Refused:
      description: >-
        Refused before the endpoint ran, with `detail` instead of the standard
        envelope: the key is missing, invalid, or revoked; more than one
        credential was presented; or a selector names a different organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Refusal'
          examples:
            invalidKey:
              summary: Invalid or revoked key
              value:
                detail: Unauthorized
            noCredential:
              summary: No credential
              value:
                detail: Authentication credentials were not provided.
            conflictingCredentials:
              summary: More than one credential
              value:
                detail: >-
                  More than one credential was presented. Send an organization
                  key or a session token, not both.
            foreignSelector:
              summary: Selector names another organization
              value:
                detail: >-
                  This key belongs to a different organization than the request
                  selected.
  securitySchemes:
    organizationBearer:
      type: http
      scheme: bearer
      description: >-
        An organization API key starting with `dh_`, sent as `Authorization:
        Bearer dh_your_api_key`.
    organizationApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Alternative to the Authorization header. Send one credential per
        request.

````

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