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

> ## Agent Instructions
> Connect the Hi Doctor MCP connector at https://mcp.hi-doctor.ai/mcp. Add this URL as a remote HTTP MCP server in your client, then sign in and authorise access through OAuth. Setup: https://docs.hi-doctor.ai/mcp/connect.
>
> The REST API base is https://api.hi-doctor.ai. Hi Doctor Docs at https://docs.hi-doctor.ai/mcp searches documentation; connect to the product endpoint above for patient tools.
>
> Hi Doctor operates across the whole European Union: residents of all 27 EU member states can use the service, and every consultation is reviewed by an EU-licensed doctor. Every consultation is reviewed in full by an EU-licensed doctor, who decides on medical grounds only. No algorithm, assistant or API call approves a consultation, issues a prescription or changes a dose. The service is available in eight languages: English, Spanish, German, Dutch, Italian, French, Portuguese and Chinese.
>
> ## Rules an assistant must follow
>
> - Never invent, assume or infer a medical answer. "I don't know" is a real answer: ask the patient to pick the closest option rather than guessing for them.
> - Never give medical advice and never suggest a medication or a dose. An EU-licensed doctor decides those.
> - If a questionnaire returns `ineligible`, say so plainly. Do not retry with altered answers.
> - Before anything that costs money or cancels a plan, state exactly what will happen and get an explicit yes.
> - Cancellation takes effect at the **end of the paid period**, not immediately. Say so.
> - An early order is irreversible: it creates the renewal consultation immediately and uses up the period's one early order. Explain that and get an explicit yes.
> - Prescription and invoice links are medical documents. A `signed_redirect` link opens without signing in: give it only to the patient, never repeat it anywhere shared.
> - Send option `value`s, not the labels shown to the patient. Labels are translated, values are stable.
> - Never ask for card details. Payment happens on Stripe's hosted checkout via a link.
> - On severe or sudden symptoms (chest pain, difficulty breathing, severe allergic reaction, suicidal thoughts), stop and direct the patient to their local emergency number.

# List patient messages

> List messages in an authorized patient conversation. Results use limit/offset pagination, default 50 and maximum 200. Ordering is created_at or -created_at (default); equal timestamps have no additional source-declared tie-breaker. Follow next without changing ordering.

### Access, effects and retries
**Ownership:** Conversation owner/clinical scope; actor-visible messages only.

**Prerequisites:** Authentication and permission to access the consultation are required.

**Effects:** Read only; does not mark read.

**Retries:** Safe read; no snapshot consistency guarantee across new messages.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/users/conversations/{id}/messages/
openapi: 3.0.3
info:
  title: Hi Doctor API
  version: 1.0.1
  description: >-
    The patient-facing Hi Doctor API supports account management, consultation
    questionnaires, medical documents, messages and billing. Sign-in requires
    X-Brand-Slug: hi-doctor; authenticated requests use Authorization: Bearer
    <access> with a JWT access token. See
    https://docs.hi-doctor.ai/api-reference/introduction for integration guides.
  contact:
    name: Hi Doctor
    email: hello@hi-doctor.ai
    url: https://docs.hi-doctor.ai
servers:
  - url: https://api.hi-doctor.ai
    description: Production
security: []
tags:
  - name: Account
    description: Register, verify, authenticate and manage the signed-in account.
  - name: Questionnaires
    description: Discover, save and submit consultation questionnaires.
  - name: Consultations
    description: Read consultation state and manage consultation photographs.
  - name: Prescriptions
    description: Retrieve issued prescription documents and request reissue.
  - name: Messages
    description: Read and send messages to the medical team, and download attachments.
  - name: Billing
    description: >-
      Create checkout, manage subscriptions and retrieve
      payments/invoices/credit notes.
  - name: Records
    description: Read orders and manage patient health documents.
  - name: Safety reports
    description: Submit and read suspected side-effect reports; no automated diagnosis.
  - name: Progress
    description: Record and review eligible weight-loss progress.
  - name: Referrals
    description: Read the signed-in account's referral summary and referral activity.
paths:
  /v1/users/conversations/{id}/messages/:
    get:
      tags:
        - Messages
      summary: List patient messages
      description: >-
        List messages in an authorized patient conversation. Results use
        limit/offset pagination, default 50 and maximum 200. Ordering is
        created_at or -created_at (default); equal timestamps have no additional
        source-declared tie-breaker. Follow next without changing ordering.


        ### Access, effects and retries

        **Ownership:** Conversation owner/clinical scope; actor-visible messages
        only.


        **Prerequisites:** Authentication and permission to access the
        consultation are required.


        **Effects:** Read only; does not mark read.


        **Retries:** Safe read; no snapshot consistency guarantee across new
        messages.
      operationId: users_conversations_messages_retrieve
      parameters:
        - in: path
          name: id
          schema:
            type: string
            format: uuid
          required: true
          description: >-
            Identifier returned by the corresponding authorized collection; use
            only a record visible to the signed-in patient.
          example: b9b42152-b531-575c-b67c-c17cd8d6df5c
        - in: query
          name: limit
          description: >-
            Page size; positive values above 200 are capped. Invalid/nonpositive
            values use the default.
          required: false
          schema:
            type: integer
            minimum: 1
            maximum: 200
            default: 50
          example: 50
        - in: query
          name: offset
          description: Number of messages to skip; invalid/negative values use zero.
          required: false
          schema:
            type: integer
            minimum: 0
            default: 0
          example: 0
        - in: query
          name: ordering
          description: Creation-time ordering; unsupported values use newest first.
          required: false
          schema:
            type: string
            enum:
              - created_at
              - '-created_at'
            default: '-created_at'
          example: '-created_at'
      responses:
        '200':
          description: Paginated authorized messages.
          content:
            application/json:
              schema:
                type: object
                properties:
                  count:
                    type: integer
                    minimum: 0
                    description: Total matching records before pagination.
                  next:
                    type: string
                    format: uri
                    nullable: true
                    description: >-
                      URL of the next page, or null after the last page. May be
                      null when unavailable.
                  previous:
                    type: string
                    format: uri
                    nullable: true
                    description: >-
                      URL of the previous page, or null on the first page. May
                      be null when unavailable.
                  results:
                    type: array
                    items:
                      $ref: '#/components/schemas/ConversationMessage'
                    description: Records in this page, in the documented collection order.
                required:
                  - count
                  - next
                  - previous
                  - results
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    count: 0
                    next: null
                    previous: null
                    results: []
                example-2:
                  summary: Illustrative response example
                  value:
                    count: 2
                    next: >-
                      https://api.hi-doctor.ai/v1/users/conversations/b9b42152-b531-575c-b67c-c17cd8d6df5c/messages/?limit=1&offset=1
                    previous: null
                    results:
                      - id: 4374bf40-b1f2-5c01-b29d-7faca3877e0e
                        sender: a921c382-ca9e-5ea0-b7c0-f4896d4362ad
                        sender_type: DOCTOR
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T17:48:45.485556Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                example-3:
                  summary: Illustrative response example
                  value:
                    count: 2
                    next: null
                    previous: >-
                      https://api.hi-doctor.ai/v1/users/conversations/b9b42152-b531-575c-b67c-c17cd8d6df5c/messages/?limit=1
                    results:
                      - id: 6f7f0039-a292-553e-98b1-1dc2ae7ba7c5
                        sender: 0a1b1763-0fca-5634-825c-381c65938c12
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T17:48:43.460171Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                example-4:
                  summary: Captured response example
                  value:
                    count: 16
                    next: null
                    previous: >-
                      https://api.hi-doctor.ai/v1/users/conversations/22d29e0a-2eb4-57e7-8957-081968bbb77a/messages/?limit=1&offset=999999
                    results: []
                example-5:
                  summary: Captured response example
                  value:
                    count: 16
                    next: >-
                      https://api.hi-doctor.ai/v1/users/conversations/22d29e0a-2eb4-57e7-8957-081968bbb77a/messages/?limit=1&offset=1
                    previous: null
                    results:
                      - id: 0ca1c7d8-9dc8-5d0c-ab8a-6f01019836be
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:38:29.490648Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                example-6:
                  summary: Captured response example
                  value:
                    count: 16
                    next: >-
                      https://api.hi-doctor.ai/v1/users/conversations/22d29e0a-2eb4-57e7-8957-081968bbb77a/messages/?limit=1&offset=2
                    previous: >-
                      https://api.hi-doctor.ai/v1/users/conversations/22d29e0a-2eb4-57e7-8957-081968bbb77a/messages/?limit=1
                    results:
                      - id: f91ad6cd-91eb-5a2a-ab0b-836ebe8e68e1
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:38:24.192026Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                example-7:
                  summary: Captured response example
                  value:
                    count: 25
                    next: null
                    previous: null
                    results:
                      - id: f6110c21-3333-5fbd-8fd3-e7f644f0a9d0
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          We have received your side effect report. Your doctor
                          will review it and reply here in this chat.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:51:12.695790Z'
                        audience: patient
                        event_type: adverse_event_received
                        event_params:
                          report_id: 0beb8635-b5df-5e33-abcc-a9e6870f8986
                        translation_enabled: true
                        translation_default_on: true
                      - id: 2b7b084c-475f-594f-82ba-92ad3ce7613b
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          We have received your side effect report. Your doctor
                          will review it and reply here in this chat.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:51:11.760205Z'
                        audience: patient
                        event_type: adverse_event_received
                        event_params:
                          report_id: 2ed4c71a-f8d3-5638-925f-74ed7f2dad6b
                        translation_enabled: true
                        translation_default_on: true
                      - id: 0bddde9a-9ba9-593e-940f-2d27462e54d4
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          We have received your side effect report. Your doctor
                          will review it and reply here in this chat.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:51:10.766600Z'
                        audience: patient
                        event_type: adverse_event_received
                        event_params:
                          report_id: 190944e9-6615-53ea-90db-f73b6ff2fb54
                        translation_enabled: true
                        translation_default_on: true
                      - id: 5b359d4d-4ca0-5557-9df9-3a5276a6674b
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:50:35.756562Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: e3281280-2281-57b0-89b5-70771f69cd4a
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:50:28.582227Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: 9d527c72-e79a-58a7-a2e2-19a04a386b22
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:50:20.856666Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: 32877979-8872-55ab-8797-b8c35ea39621
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:49:30.997680Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: a9348a55-51dd-5a73-ba24-375f5fbc9db2
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:49:29.524408Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: d5a64480-f7a2-53e0-b92e-73a569301198
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:49:28.193572Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: 0ca1c7d8-9dc8-5d0c-ab8a-6f01019836be
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:38:29.490648Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: f91ad6cd-91eb-5a2a-ab0b-836ebe8e68e1
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T19:38:24.192026Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: 6114270a-8800-532e-a51f-82ee2f10e3cd
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T19:38:17.084065Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: 1277fdc3-5654-5142-b4e9-f0a932f2bca7
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          We have received your side effect report. Your doctor
                          will review it and reply here in this chat.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T19:18:15.185780Z'
                        audience: patient
                        event_type: adverse_event_received
                        event_params:
                          report_id: 66865652-cb7e-5b7d-940e-71bb54c34828
                        translation_enabled: true
                        translation_default_on: true
                      - id: 602f45d6-06bc-5229-a8c5-36010b96d4be
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          We have received your side effect report. Your doctor
                          will review it and reply here in this chat.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T19:18:14.228211Z'
                        audience: patient
                        event_type: adverse_event_received
                        event_params:
                          report_id: 49ed1096-388e-57d5-bb46-b420b9e8245c
                        translation_enabled: true
                        translation_default_on: true
                      - id: cb80fbdb-a6a9-557c-8f69-53a57aba47d3
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          We have received your side effect report. Your doctor
                          will review it and reply here in this chat.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T19:18:13.171935Z'
                        audience: patient
                        event_type: adverse_event_received
                        event_params:
                          report_id: 658165cc-697c-529c-b0e2-8076c5932d33
                        translation_enabled: true
                        translation_default_on: true
                      - id: ca320035-c2e3-5c34-80a5-c2fcc758dbf3
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:17:47.264624Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: c314dca8-1113-55e7-9199-7f48e1d1c7b7
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:17:45.661489Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: 79163740-3600-5b7d-93b5-a205066cff25
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T19:17:44.154868Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: be763b33-7e01-5279-9734-93f9a79a6620
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          We have received your side effect report. Your doctor
                          will review it and reply here in this chat.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T18:56:42.491281Z'
                        audience: patient
                        event_type: adverse_event_received
                        event_params:
                          report_id: b53abe6b-421b-52e5-9bee-73f689e16808
                        translation_enabled: true
                        translation_default_on: true
                      - id: 8da53cfc-de65-59e6-932e-6e561baa76ef
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T18:55:33.078205Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: b425c5d5-ee46-55ac-8a53-2b7dd8eab76d
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T18:30:48.868773Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: 9f059a9d-6a72-52b7-ab28-57ad04dfe213
                        sender: 788df1b1-751a-57b4-be60-54c545313bdf
                        sender_type: SYSTEM
                        content: >-
                          Thank you for your order. Our staff will review it
                          shortly.
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T18:25:13.775595Z'
                        audience: patient
                        event_type: order_confirmation
                        event_params: {}
                        translation_enabled: true
                        translation_default_on: true
                      - id: 4dbbb94c-e0fe-5baf-b887-dc725b44181b
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: >-
                          https://api.hi-doctor.ai/v1/users/conversations/22d29e0a-2eb4-57e7-8957-081968bbb77a/messages/4dbbb94c-e0fe-5baf-b887-dc725b44181b/attachment/
                        file_name: synthetic-test.png
                        file_content_type: image/png
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T18:21:49.114670Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: b73217ac-1f86-5dc4-8e3a-5b04da748c57
                        sender: 1d1b5b46-00a7-5c1d-92eb-38a387a8f14d
                        sender_type: DOCTOR
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: true
                        created_at: '2026-10-05T18:21:47.355960Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
                      - id: 5ca014d9-f333-527c-aae8-eb6f9522d699
                        sender: 9fb1a263-c71b-5fe9-b2e7-5a0eb099bad5
                        sender_type: USER
                        content: Synthetic example
                        file: null
                        file_name: null
                        file_content_type: null
                        file_available: true
                        is_read: false
                        created_at: '2026-10-05T18:21:47.133906Z'
                        audience: patient
                        event_type: null
                        event_params: null
                        translation_enabled: true
                        translation_default_on: true
        '401':
          description: >-
            No bearer token, or a token that is expired or malformed.
            Re-authenticate; do not retry the same token.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  Error envelope emitted by the source branch or DRF validation.
                  `detail`, `error` and `code` depend on the branch; field
                  validation uses lists keyed by request field.
                additionalProperties: {}
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    detail: Authentication credentials were not provided.
        '403':
          description: The account lacks permission for this operation.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  Error envelope emitted by the source branch or DRF validation.
                  `detail`, `error` and `code` depend on the branch; field
                  validation uses lists keyed by request field.
                additionalProperties: {}
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    detail: You do not have permission to perform this action.
        '404':
          description: >-
            No such record, **or it belongs to another account**. Every endpoint
            is self-scoped, so a record you cannot see is indistinguishable from
            one that does not exist. Do not retry with a different id.
          content:
            application/json:
              schema:
                type: object
                description: >-
                  Error envelope emitted by the source branch or DRF validation.
                  `detail`, `error` and `code` depend on the branch; field
                  validation uses lists keyed by request field.
                additionalProperties: {}
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    detail: Not found.
        '429':
          description: Source-defined error response; inspect the envelope and retry rules.
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
                description: >-
                  Endpoint/DRF error envelope; field validation is keyed by
                  request field.
              examples:
                example-1:
                  summary: Illustrative response example
                  value:
                    detail: Request was throttled.
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: Shell
          label: curl
          source: >
            set -eu

            umask 077

            # Path values must be URL-encoded; query string excludes the leading
            question mark.

            url="${HD_BASE_URL:?Set API
            origin}/v1/users/conversations/${HD_PATH_ID:?Set the path
            fixture}/messages/${HD_QUERY_STRING:+?${HD_QUERY_STRING}}"

            printf 'X-Brand-Slug: hi-doctor\nAccept: application/json\n' >
            "${HD_REQUEST_HEADERS_FILE:?Private header file}"

            printf 'Authorization: Bearer %s\n' "${HD_ACCESS_TOKEN:?Set backend
            JWT}" >> "$HD_REQUEST_HEADERS_FILE"

            curl --silent --show-error --max-time 30 --request GET \
              --header "@$HD_REQUEST_HEADERS_FILE" \
              --dump-header "${HD_HEADERS_FILE:?Private response header file}" \
              --output "${HD_RESPONSE_FILE:?Private response file}" \
              --write-out '%{http_code}\n%{content_type}\n' \
              "$url"
        - lang: Python
          label: requests
          source: >
            import os, json

            from pathlib import Path

            from urllib.parse import quote

            import requests

            os.umask(0o077)

            url = os.environ["HD_BASE_URL"].rstrip("/") +
            '/v1/users/conversations/{id}/messages/'

            url = url.replace('{id}', quote(os.environ['HD_PATH_ID'], safe=""))

            if os.environ.get("HD_QUERY_STRING"): url += "?" +
            os.environ["HD_QUERY_STRING"]

            headers = {"X-Brand-Slug": "hi-doctor", "Accept":
            'application/json'}

            headers["Authorization"] = "Bearer " + os.environ["HD_ACCESS_TOKEN"]

            kwargs = {}

            response = requests.request('GET', url, headers=headers, timeout=30,
            allow_redirects=False, **kwargs)

            Path(os.environ["HD_RESPONSE_FILE"]).write_bytes(response.content)

            Path(os.environ["HD_HEADERS_FILE"]).write_text(json.dumps(dict(response.headers)))

            print(response.status_code)

            print(response.headers.get("Content-Type", ""))
        - lang: JavaScript
          label: fetch
          source: >
            import { readFileSync, writeFileSync } from "node:fs";

            const env = process.env;

            let url = env.HD_BASE_URL.replace(/\/$/, "") +
            "/v1/users/conversations/{id}/messages/";

            url = url.replace("{id}", encodeURIComponent(env.HD_PATH_ID));

            if (env.HD_QUERY_STRING) url += "?" + env.HD_QUERY_STRING;

            const headers = { "X-Brand-Slug": "hi-doctor", "Accept":
            "application/json" };

            headers.Authorization = "Bearer " + env.HD_ACCESS_TOKEN;

            const options = { method: "GET", headers, redirect: "manual",
            signal: AbortSignal.timeout(30000) };

            const response = await fetch(url, options);

            writeFileSync(env.HD_RESPONSE_FILE, Buffer.from(await
            response.arrayBuffer()), {mode: 0o600});

            writeFileSync(env.HD_HEADERS_FILE,
            JSON.stringify(Object.fromEntries(response.headers)), {mode:
            0o600});

            console.log(response.status);

            console.log(response.headers.get("content-type") ?? "");
components:
  schemas:
    ConversationMessage:
      type: object
      description: A single message in the patient's thread with the medical team.
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier of this resource.
        sender:
          type: string
          format: uuid
          description: Account id of the sender.
        sender_type:
          type: string
          enum:
            - USER
            - ADMIN
            - DOCTOR
            - SYSTEM
          description: >-
            Sender class, including automatic system messages; visibility is
            filtered to the caller.
        content:
          type: string
          nullable: true
          description: Text content of the resource. May be null when unavailable.
        file:
          type: string
          format: uri
          nullable: true
          description: File for this conversation message. May be null when unavailable.
        is_read:
          type: boolean
          description: Whether read applies to this conversation message.
        created_at:
          type: string
          format: date-time
          description: Created at timestamp in ISO 8601 format.
        translation_enabled:
          type: boolean
          description: Whether translation enabled applies to this conversation message.
        translation_default_on:
          type: boolean
          description: Whether translation default on applies to this conversation message.
        source_text:
          type: string
          description: Original message text, emitted only to internal actors.
          nullable: true
        file_name:
          type: string
          description: Display name of the attached file, or null.
          nullable: true
        file_content_type:
          type: string
          description: Attachment media type, or null.
          nullable: true
        event_type:
          type: string
          description: Machine event identifier, or null for an ordinary message.
          nullable: true
        file_available:
          type: boolean
          description: Whether the authorized attachment remains available.
        audience:
          type: string
          description: >-
            Message audience. Patient requests return only patient-visible
            messages.
          enum:
            - patient
            - staff
        event_params:
          description: Structured JSON event parameters; null for an ordinary message.
        translation:
          type: object
          description: Cached translation, present only when available.
          properties:
            translated_text:
              type: string
              description: Translated message text.
            detected_source_lang:
              type: string
              description: Detected language code; null when unknown.
              nullable: true
          required:
            - translated_text
            - detected_source_lang
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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