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

# Queue batch email send

> Queue a batch email send for asynchronous processing via Cloudflare Queue. Supports template-based emails with parameter substitution. Requires X-App-Key header for authentication.



## OpenAPI

````yaml https://api.sapt.ai/openapi.json post /emails/batch/queue
openapi: 3.1.0
info:
  title: Sapt Platform API
  version: 1.0.0
  description: >-
    API for Sapt platform - project management, authentication, and email
    services
servers:
  - url: https://api.sapt.ai
    description: Production
  - url: http://localhost:8787
    description: Local development
security: []
tags:
  - name: Accounts
    description: >-
      The social accounts connected to a project. Start here — the `id` of an
      account is the `socialAccountId` that every posting, scheduling and
      analytics call takes.
  - name: Actions
  - name: Ads
  - name: Agents
  - name: Analytics
    description: >-
      Account- and post-level organic performance for connected Instagram and
      Facebook accounts.
  - name: Assets
  - name: Auth
  - name: CMS
  - name: CRM
  - name: Calendar
  - name: Comments
    description: >-
      Read, reply to, hide and delete comments on published Instagram and
      Facebook posts.
  - name: Content Calendar
    description: >-
      Create, schedule, update and publish organic posts, and stage the media
      they carry. Publishing a post whose status is `failed` retries it.
  - name: Contracts
  - name: Conversions
    description: >-
      Meta server-side Conversions API (CAPI): discover pixels, connect a pixel
      + CAPI token, and send deduped server-side conversions.
  - name: Dashboard Sidebar
  - name: Emails
  - name: Engagement
    description: >-
      Act as the Page or account on published posts: comment, like, unlike, and
      delete a published post.
  - name: Geo
  - name: Google Ads
  - name: Google Analytics
  - name: Google Business
  - name: Integrations
    description: >-
      Connect third-party providers (Meta, Gmail, Google Business Profile, …).
      List providers, mint OAuth connect links, and poll connection status.
  - name: Invitations
  - name: Memory
  - name: OAuth Clients
  - name: Project Roles
  - name: Project Templates
  - name: Projects
  - name: Schedules
  - name: Service Accounts
  - name: Socials
    description: >-
      Organic social: the connected accounts, the content calendar, media
      staging, publishing, comments and engagement across Instagram, Facebook,
      TikTok, YouTube and Google Business Profile.
  - name: Team
  - name: Users
  - name: Web Analytics
  - name: Workflows
paths:
  /emails/batch/queue:
    post:
      tags:
        - Emails
      summary: Queue batch email send
      description: >-
        Queue a batch email send for asynchronous processing via Cloudflare
        Queue. Supports template-based emails with parameter substitution.
        Requires X-App-Key header for authentication.
      operationId: queueBatchEmail
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                recipients:
                  type: array
                  items:
                    type: object
                    properties:
                      email:
                        type: string
                        format: email
                        example: user@example.com
                        description: Recipient email address
                      params:
                        type: object
                        additionalProperties:
                          type: string
                        example:
                          name: John Doe
                          company: Acme Corp
                        description: >-
                          Per-recipient template parameters for personalization
                          (optional)
                    required:
                      - email
                  minItems: 1
                  maxItems: 10000
                  example:
                    - email: user1@example.com
                      params:
                        name: Alice
                        company: Acme
                    - email: user2@example.com
                      params:
                        name: Bob
                        company: Tech Co
                    - email: user3@example.com
                  description: >-
                    List of recipients with optional per-recipient template
                    parameters (1-10,000)
                template:
                  type: object
                  properties:
                    subject:
                      type: string
                      minLength: 1
                      maxLength: 200
                      example: Welcome {{name}}!
                      description: >-
                        Email subject (supports {{variable}} syntax with
                        per-recipient params)
                    html:
                      type: string
                      minLength: 1
                      maxLength: 500000
                      example: >-
                        <html><body><h1>Hello {{name}}!</h1><p>Welcome to
                        {{company}}</p></body></html>
                      description: >-
                        HTML content (supports {{variable}} syntax with
                        per-recipient params)
                    text:
                      type: string
                      maxLength: 100000
                      example: Hello {{name}}! Welcome to {{company}}
                      description: >-
                        Plain text fallback (optional, supports {{variable}}
                        syntax)
                  required:
                    - subject
                    - html
                  description: >-
                    Email template with variable placeholders for per-recipient
                    substitution
                trackingId:
                  type: string
                  minLength: 1
                  maxLength: 100
                  example: campaign_2024_11_newsletter
                  description: Custom tracking ID for this batch send
                emailType:
                  type: string
                  example: marketing
                  description: Email category for tracking (optional)
                clientProjectId:
                  type: string
                  format: uuid
                  example: 550e8400-e29b-41d4-a716-446655440000
                  description: Client project ID for tracking (optional)
                metadata:
                  type: object
                  additionalProperties: {}
                  example:
                    campaign: november-newsletter
                    source: api
                  description: Additional metadata for tracking (optional)
              required:
                - recipients
                - template
                - trackingId
      responses:
        '200':
          description: Batch email queued successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  trackingId:
                    type: string
                  totalBatches:
                    type: number
                  totalRecipients:
                    type: number
                  message:
                    type: string
                required:
                  - success
                  - trackingId
                  - totalBatches
                  - totalRecipients
                  - message
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: Error message
                  code:
                    type: string
                    description: Error code for programmatic handling
                required:
                  - message
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT token obtained from /api/auth/token endpoint. Token is verified
        using JWKS and must include a valid user identifier.

````