> ## 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.

# Send emails

> Send emails to patients and/or staff users by their IDs. Returns sent records and any errors.



## OpenAPI

````yaml /openapi-v3.json post /emails/send
openapi: 3.0.0
info:
  title: Max AI Public API
  description: API for third-party marketplace apps
  version: '3.0'
  contact: {}
servers:
  - url: https://api.maxcare.ai/v3
security: []
tags: []
paths:
  /emails/send:
    post:
      tags:
        - Emails
      summary: Send emails
      description: >-
        Send emails to patients and/or staff users by their IDs. Returns sent
        records and any errors.
      operationId: EmailsPublicController_sendEmails
      parameters:
        - name: X-Organization-Id
          in: header
          required: true
          schema:
            type: string
          description: Target clinic organization ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendEmailsBodyV3'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendEmailsSuccessResponseV3'
        '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:
    SendEmailsBodyV3:
      type: object
      properties:
        from:
          type: string
          description: Email sender prefix (becomes <prefix>@accounts.maxcare.ai)
          example: notifications
        subject:
          type: string
          description: Email subject line
          example: Your upcoming appointment on March 25
        html:
          type: string
          description: Email body as raw HTML
          example: >-
            <h1>Appointment Reminder</h1><p>You have an appointment scheduled
            for March 25 at 10:00 AM.</p>
        emailType:
          type: string
          description: Email type for categorization
          example: appointment_reminder
        patientIds:
          description: Patient IDs to send to
          example:
            - pat_8de030393a9e417ab2b3a8b8df183631
          type: array
          items:
            type: string
        userIds:
          description: Staff user IDs to send to
          example:
            - usr_1231b6f32b4f4b8f8eeb4f7806bc45b0
          type: array
          items:
            type: string
        scheduledAt:
          type: string
          description: Schedule send time (ISO 8601)
          example: '2026-03-25T10:00:00Z'
      required:
        - from
        - subject
        - html
        - emailType
    SendEmailsSuccessResponseV3:
      type: object
      properties:
        code:
          type: string
          description: Response code
          example: success
        data:
          $ref: '#/components/schemas/SendEmailsResponseDataV3'
      required:
        - code
        - data
    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
    SendEmailsResponseDataV3:
      type: object
      properties:
        sent:
          type: array
          items:
            $ref: '#/components/schemas/ExternalEmailResponseV3'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ExternalEmailSendErrorV3'
      required:
        - sent
        - errors
    ExternalEmailResponseV3:
      type: object
      properties:
        id:
          type: string
          description: Email send record ID
          example: eml_a7c3f1e28b4d4a9eb5c6d7e8f9012345
        recipientEmail:
          type: string
          description: Recipient email address
          example: jane.doe@example.com
        recipientType:
          type: string
          description: Recipient entity type
          enum:
            - patient
            - user
          nullable: true
          example: patient
        recipientId:
          type: string
          description: Recipient entity ID (patient or user)
          nullable: true
          example: pat_8de030393a9e417ab2b3a8b8df183631
        emailType:
          type: string
          description: Email type
          example: appointment_reminder
        subject:
          type: string
          description: Email subject line
          example: Your upcoming appointment on March 25
        fromAddress:
          type: string
          description: Sender address
          example: notifications@accounts.maxcare.ai
        status:
          type: string
          description: Delivery status
          example: sent
          enum:
            - sent
            - scheduled
        scheduledAt:
          type: string
          description: Scheduled send time (ISO 8601)
          nullable: true
          example: null
        sentAt:
          type: string
          description: When the email was sent
          example: '2026-03-25 10:00:01.234+00'
        deliveredAt:
          type: string
          description: When delivery was confirmed
          nullable: true
          example: '2026-03-25 10:00:03.567+00'
        openedAt:
          type: string
          description: When the email was opened
          nullable: true
          example: null
        bouncedAt:
          type: string
          description: When the email bounced
          nullable: true
          example: null
        createdAt:
          type: string
          description: Created timestamp
          example: '2026-03-25 09:59:58.891+00'
      required:
        - id
        - recipientEmail
        - recipientType
        - recipientId
        - emailType
        - subject
        - fromAddress
        - status
        - scheduledAt
        - sentAt
        - deliveredAt
        - openedAt
        - bouncedAt
        - createdAt
    ExternalEmailSendErrorV3:
      type: object
      properties:
        recipientId:
          type: string
          description: Recipient ID that failed
          example: pat_8de030393a9e417ab2b3a8b8df183631
        recipientType:
          type: string
          description: Recipient type
          enum:
            - patient
            - user
          example: patient
        error:
          type: string
          description: Error message
          example: Patient has no email address on file
      required:
        - recipientId
        - recipientType
        - error
  securitySchemes:
    api-key:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Marketplace API key

````