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

# List intramail messages

> One folder of the user's mailbox (see `X-Session-Token`), newest first, as of the last sync (see `syncedAt` and `GET /intramail/status`).



## OpenAPI

````yaml /openapi-v4.json get /intramail/messages
openapi: 3.0.0
info:
  title: Max AI Public API
  description: API for third-party marketplace apps
  version: '4.0'
  contact: {}
servers:
  - url: https://api.maxcare.ai/v4
security: []
tags: []
paths:
  /intramail/messages:
    get:
      tags:
        - Intramail
      summary: List intramail messages
      description: >-
        One folder of the user's mailbox (see `X-Session-Token`), newest first,
        as of the last sync (see `syncedAt` and `GET /intramail/status`).
      operationId: IntramailPublicController_list
      parameters:
        - name: folder
          required: false
          in: query
          schema:
            default: inbox
            enum:
              - inbox
              - archived
              - sent
              - draft
            type: string
        - name: patientId
          required: false
          in: query
          description: Only messages linked to this patient (`pat_…`)
          schema:
            type: string
        - name: mailboxId
          required: false
          in: query
          description: >-
            Mailbox (`imb_…`) from `GET /intramail/status`: one of the acting
            user's EHR logins. Defaults to the one marked `isDefault`.
          schema:
            type: string
        - name: page
          required: false
          in: query
          schema:
            minimum: 1
            default: 1
        - name: pageSize
          required: false
          in: query
          schema:
            minimum: 1
            maximum: 100
            default: 25
        - name: x-session-token
          required: false
          in: header
          description: >-
            The App Bridge token of the logged-in user (`maxcare.appToken()`),
            verified for this app and organization. With it the request reaches
            that user's own mail; without it, the mail of the API key's creator.
            A token that does not verify is `401 authorizer_unverified`. Sent as
            a header so GET requests keep it out of URLs.
          schema:
            type: string
        - name: X-Organization-Id
          in: header
          required: true
          schema:
            type: string
          description: Target clinic organization ID
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListIntramailSuccessResponse'
        '400':
          description: Missing or invalid request parameter
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiBadRequestResponse'
        '401':
          description: Invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiUnauthorizedResponse'
        '403':
          description: Insufficient scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiForbiddenResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicApiRateLimitResponse'
      security:
        - api-key: []
components:
  schemas:
    ListIntramailSuccessResponse:
      type: object
      properties:
        code:
          type: string
          description: Response code
          example: success
        data:
          $ref: '#/components/schemas/IntramailListData'
      required:
        - code
        - data
    PublicApiBadRequestResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: bad_request
        message:
          type: string
          description: Human-readable error message
          example: '''id'' must be a valid UUID'
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiUnauthorizedResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: unauthorized
        message:
          type: string
          description: Human-readable error message
          example: Invalid or missing API key
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiForbiddenResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: forbidden
        message:
          type: string
          description: Human-readable error message
          example: Insufficient scope
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    PublicApiRateLimitResponse:
      type: object
      properties:
        code:
          type: string
          description: Error code
          example: rate_limit_exceeded
        message:
          type: string
          description: Human-readable error message
          example: Rate limit exceeded. Maximum 1000 requests per 60 seconds.
        trace_id:
          type: string
          description: Trace ID for debugging
          example: 550e8400-e29b-41d4-a716-446655440000
      required:
        - code
        - message
        - trace_id
    IntramailListData:
      type: object
      properties:
        messages:
          type: array
          items:
            $ref: '#/components/schemas/ExternalIntramailMessage'
        pagination:
          $ref: '#/components/schemas/IntramailPagination'
      required:
        - messages
        - pagination
    ExternalIntramailMessage:
      type: object
      properties:
        id:
          type: string
          description: Intramail message ID (`iml_…`)
          example: iml_5f1c0000000040000000000000000001
        mailboxId:
          type: string
          description: The mailbox (`imb_…`) this copy belongs to
          example: imb_5f1c0000000040000000000000000003
        folder:
          type: string
          enum:
            - inbox
            - archived
            - sent
            - draft
          description: The folder of the acting user's mailbox this copy is in
        subject:
          type: string
          nullable: true
        body:
          type: string
          nullable: true
        priority:
          type: string
          enum:
            - low
            - normal
            - high
        author:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/ExternalIntramailParticipant'
        to:
          description: As addressed (groups stay groups)
          type: array
          items:
            $ref: '#/components/schemas/ExternalIntramailParticipant'
        cc:
          type: array
          items:
            $ref: '#/components/schemas/ExternalIntramailParticipant'
        deliveredTo:
          description: >-
            Who the message reached: `to` and `cc` with groups expanded to their
            members when it was sent
          type: array
          items:
            $ref: '#/components/schemas/ExternalIntramailParticipant'
        patientId:
          type: string
          nullable: true
          description: Linked patient (`pat_…`), when synced
        noteId:
          type: string
          nullable: true
          description: Linked visit note (`nte_…`), when synced
        attachments:
          description: Read-only; Max cannot attach files yet
          type: array
          items:
            $ref: '#/components/schemas/ExternalIntramailAttachment'
        read:
          type: boolean
          description: Received copies only; sent and draft copies read true
        flagged:
          type: boolean
        createdAt:
          type: string
          description: >-
            ISO 8601. EHR creation time; a draft sent later keeps its creation
            time
        modifiedAt:
          type: string
          nullable: true
          description: ISO 8601. The send time of a draft sent later
        syncedAt:
          type: string
          description: ISO 8601. When a sync last saw this copy in the EHR
      required:
        - id
        - mailboxId
        - folder
        - subject
        - body
        - priority
        - author
        - to
        - cc
        - deliveredTo
        - patientId
        - noteId
        - attachments
        - read
        - flagged
        - createdAt
        - modifiedAt
        - syncedAt
    IntramailPagination:
      type: object
      properties:
        page:
          type: number
        pageSize:
          type: number
        totalCount:
          type: number
        totalPages:
          type: number
      required:
        - page
        - pageSize
        - totalCount
        - totalPages
    ExternalIntramailParticipant:
      type: object
      properties:
        type:
          type: string
          enum:
            - staff
            - group
            - patient
        ehrId:
          type: string
          description: >-
            The EHR's own id for the staff member, group or patient, from `GET
            /intramail/recipients`
          example: '1671336'
        name:
          type: string
          nullable: true
          example: Enea Gjoka
      required:
        - type
        - ehrId
        - name
    ExternalIntramailAttachment:
      type: object
      properties:
        ehrId:
          type: string
          example: '9'
        name:
          type: string
          nullable: true
        size:
          type: string
          nullable: true
          example: 12 KB
      required:
        - ehrId
        - name
        - size
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Marketplace API key

````

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