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

# Send a batch of emails

> Queue up to 100 emails for delivery in a single request. Uses partial success model — individual message failures do not fail the entire batch. Requires `email.send` permission.



## OpenAPI

````yaml /openapi-sending.json post /emails/send/batch
openapi: 3.1.0
info:
  description: >-
    Send emails programmatically via the Sendmux email infrastructure. Every
    response carries an `X-Request-Id` header; errors include a `retryable`
    flag. 429 and 503 responses include `Retry-After`. Mutating endpoints accept
    an `Idempotency-Key` header for safe retries.
  title: Sendmux Sending API
  version: 1.0.0
servers:
  - description: Production
    url: https://smtp.sendmux.ai/api/v1
security:
  - BearerAuth: []
  - OAuth2:
      - email.send
paths:
  /emails/send/batch:
    post:
      tags:
        - Emails
      summary: Send a batch of emails
      description: >-
        Queue up to 100 emails for delivery in a single request. Uses partial
        success model — individual message failures do not fail the entire
        batch. Requires `email.send` permission.
      operationId: sendingSendEmailBatch
      parameters:
        - description: >-
            Optional client-generated key to make the request idempotent for 24
            hours. Replays under the same key return the cached response; a
            reused key with a different body returns 409 idempotency_conflict.
          example: order-12345-2026-04-24
          in: header
          name: Idempotency-Key
          required: false
          schema:
            maxLength: 255
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchSendRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchSendSuccessResponse'
          description: Batch processed (check individual results for per-message status)
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Malformed request (invalid JSON or syntactic parameter error)
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Authentication required
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Insufficient credits for entire batch
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Insufficient permissions
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Idempotency conflict
        '413':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Request body exceeds 25 MB
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: All messages failed validation
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: >-
            Rate limit exceeded or Free daily sending limit reached (Retry-After
            header included)
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Service unavailable or all messages failed with transient errors
      security:
        - BearerAuth: []
        - OAuth2:
            - email.send
components:
  schemas:
    BatchSendRequest:
      additionalProperties: false
      properties:
        messages:
          description: Array of email messages to send (max 100)
          items:
            $ref: '#/components/schemas/EmailSendRequest'
          maxItems: 100
          minItems: 1
          type: array
      required:
        - messages
      type: object
    BatchSendSuccessResponse:
      allOf:
        - $ref: '#/components/schemas/SuccessEnvelope'
        - properties:
            data:
              $ref: '#/components/schemas/BatchSendSuccessData'
          required:
            - data
          type: object
      unevaluatedProperties: false
    ErrorResponse:
      additionalProperties: false
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
        meta:
          $ref: '#/components/schemas/Meta'
        ok:
          enum:
            - false
          type: boolean
      required:
        - ok
        - error
        - meta
      type: object
    EmailSendRequest:
      additionalProperties: false
      properties:
        attachments:
          description: >-
            File attachments (max 10). Use attachment_id refs for uploaded
            files.
          items:
            $ref: '#/components/schemas/Attachment'
          maxItems: 10
          type: array
        bcc:
          description: BCC recipients (subject to 50 total To, CC, and BCC recipients)
          items:
            $ref: '#/components/schemas/Recipient'
          maxItems: 49
          type: array
        cc:
          description: CC recipients (subject to 50 total To, CC, and BCC recipients)
          items:
            $ref: '#/components/schemas/Recipient'
          maxItems: 49
          type: array
        custom_headers:
          additionalProperties:
            maxLength: 500
            pattern: ^[^\r\n]*$
            type: string
          description: Custom X-* headers to include in the email
          type: object
        delivery_group:
          description: One delivery group public ID or a non-empty array of up to 50 IDs
          oneOf:
            - pattern: ^dgrp_[a-z0-9][a-z0-9_-]{0,122}$
              type: string
            - items:
                pattern: ^dgrp_[a-z0-9][a-z0-9_-]{0,122}$
                type: string
              maxItems: 50
              minItems: 1
              type: array
        from:
          $ref: '#/components/schemas/Address'
        html_body:
          description: HTML email content (max 25MB)
          maxLength: 26214400
          minLength: 1
          type: string
        reply_to:
          allOf:
            - $ref: '#/components/schemas/Address'
            - description: Reply-To address
        return_path:
          description: Envelope sender for VERP support
          format: email
          maxLength: 254
          type: string
        subject:
          description: Email subject line (max 998 chars, RFC 5322)
          example: Welcome to Sendmux
          maxLength: 998
          minLength: 1
          pattern: ^[^\r\n]*$
          type: string
        text_body:
          description: Plain text alternative (max 25MB)
          maxLength: 26214400
          type: string
        to:
          allOf:
            - $ref: '#/components/schemas/Address'
            - description: Primary recipient
      required:
        - from
        - to
        - subject
        - html_body
      type: object
    SuccessEnvelope:
      properties:
        meta:
          $ref: '#/components/schemas/Meta'
        ok:
          enum:
            - true
          type: boolean
      required:
        - ok
        - meta
      type: object
    BatchSendSuccessData:
      additionalProperties: false
      properties:
        results:
          items:
            $ref: '#/components/schemas/BatchResultItem'
          type: array
        summary:
          $ref: '#/components/schemas/BatchSummary'
      required:
        - results
        - summary
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        code:
          description: Machine-readable error code
          example: validation_error
          type: string
        doc_url:
          description: Link to error documentation
          format: uri
          type: string
        errors:
          description: Accumulated per-field issues (validation errors)
          items:
            $ref: '#/components/schemas/ErrorIssue'
          type: array
        message:
          description: Human-readable error description
          type: string
        param:
          description: Parameter that caused the error
          type: string
        retryable:
          description: >-
            True when the client may safely retry the same request. 429 and 5xx
            default true; 4xx default false.
          type: boolean
      required:
        - code
        - message
        - retryable
      type: object
    Meta:
      additionalProperties: false
      properties:
        request_id:
          description: Unique request identifier
          example: req_clxxxxxxxxxxxxxxxxxxxxxxxxx
          type: string
      required:
        - request_id
      type: object
    Attachment:
      anyOf:
        - $ref: '#/components/schemas/InlineAttachment'
        - $ref: '#/components/schemas/UploadedAttachmentRef'
    Recipient:
      additionalProperties: false
      properties:
        email:
          description: Recipient email address
          format: email
          maxLength: 254
          type: string
        name:
          description: Recipient display name
          maxLength: 100
          pattern: ^[^\r\n]*$
          type: string
      required:
        - email
      type: object
    Address:
      additionalProperties: false
      description: Sender address
      properties:
        email:
          description: Email address
          example: user@example.com
          format: email
          maxLength: 254
          type: string
        name:
          description: Display name
          example: John Smith
          maxLength: 100
          pattern: ^[^\r\n]*$
          type: string
      required:
        - email
      type: object
    BatchResultItem:
      additionalProperties: false
      properties:
        error:
          allOf:
            - $ref: '#/components/schemas/ErrorDetail'
            - description: Error details (only if failed)
        index:
          description: Position in the input array
          type: integer
        message_id:
          description: Message ID (null if failed)
          pattern: ^eml_[a-z0-9]{24}$
          type:
            - string
            - 'null'
        status:
          description: Result status
          enum:
            - queued
            - failed
          type: string
      required:
        - index
        - message_id
        - status
      type: object
    BatchSummary:
      additionalProperties: false
      properties:
        failed:
          description: Failed count
          type: integer
        queued:
          description: Successfully queued count
          type: integer
        total:
          description: Total messages in batch
          type: integer
      required:
        - total
        - queued
        - failed
      type: object
    ErrorIssue:
      additionalProperties: false
      properties:
        code:
          description: Issue code from the validator
          example: invalid_string
          type: string
        field:
          description: Dot-path to the failing field
          example: to.email
          type: string
        message:
          description: Human-readable issue message
          type: string
      required:
        - field
        - code
        - message
      type: object
    InlineAttachment:
      additionalProperties: false
      properties:
        content:
          description: Base64-encoded file content
          minLength: 1
          type: string
        encoding:
          default: base64
          enum:
            - base64
          type: string
        filename:
          description: Filename with allowed extension
          example: invoice.pdf
          maxLength: 255
          minLength: 1
          type: string
        type:
          description: MIME type override
          example: application/pdf
          type: string
      required:
        - filename
        - content
      type: object
    UploadedAttachmentRef:
      additionalProperties: false
      properties:
        attachment_id:
          description: >-
            Temporary uploaded attachment ID returned by POST
            /emails/attachments.
          example: att_tz4a98xxat96iws9zmbrgj3a
          pattern: ^att_[a-z0-9]{24}$
          type: string
      required:
        - attachment_id
      type: object
  securitySchemes:
    BearerAuth:
      description: Sendmux API key (smx_...)
      scheme: bearer
      type: http
    OAuth2:
      description: >-
        Use the authorisation-code flow with S256 PKCE and
        resource=https://sendmux.ai/api. The user must grant Sending API access
        and email.send. OAuth access tokens authenticate HTTP requests; use a
        send-capable API key for SMTP.
      flows:
        authorizationCode:
          authorizationUrl: https://app.sendmux.ai/oauth/authorize
          refreshUrl: https://app.sendmux.ai/oauth/token
          scopes:
            email.send: Send email and manage temporary sending attachments
          tokenUrl: https://app.sendmux.ai/oauth/token
      type: oauth2

````

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