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

# Create an email campaign

> Creates a campaign with a list of recipients. If `scheduled_at` is omitted, the campaign is dispatched immediately. The `email_channel_id` must point to a verified channel.



## OpenAPI

````yaml /openapi.json post /api/public/email-campaign
openapi: 3.0.0
info:
  title: Vambe AI API
  description: Vambe AI documentation
  version: '1.0'
  contact: {}
servers:
  - url: https://api.vambe.me
    description: Production Server
security: []
tags:
  - name: Vambe AI
    description: ''
paths:
  /api/public/email-campaign:
    post:
      tags:
        - email-channel
      summary: Create an email campaign
      description: >-
        Creates a campaign with a list of recipients. If `scheduled_at` is
        omitted, the campaign is dispatched immediately. The `email_channel_id`
        must point to a verified channel.
      operationId: PublicEmailCampaignController_create
      parameters:
        - name: x-api-key
          in: header
          description: API key needed to authorize the request
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEmailCampaignPublicDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailCampaignResponseDto'
        '400':
          description: Invalid request body
        '401':
          description: Unauthorized
        default:
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EmailCampaignResponseDto'
components:
  schemas:
    CreateEmailCampaignPublicDto:
      type: object
      properties:
        title:
          type: string
          minLength: 1
        email_template_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        email_channel_id:
          type: string
          format: uuid
          pattern: >-
            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
        scheduled_at:
          type: string
          format: date-time
          pattern: >-
            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        recipients:
          minItems: 1
          type: array
          items:
            type: object
            properties:
              to_emails:
                minItems: 1
                type: array
                items:
                  type: object
                  properties:
                    email:
                      type: string
                      format: email
                      pattern: >-
                        ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                    name:
                      type: string
                  required:
                    - email
              cc_emails:
                type: array
                items:
                  type: object
                  properties:
                    email:
                      type: string
                      format: email
                      pattern: >-
                        ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                    name:
                      type: string
                  required:
                    - email
              bcc_emails:
                type: array
                items:
                  type: object
                  properties:
                    email:
                      type: string
                      format: email
                      pattern: >-
                        ^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$
                    name:
                      type: string
                  required:
                    - email
              variables:
                type: object
                additionalProperties:
                  type: string
              attachments:
                type: array
                items:
                  type: string
                  format: uri
            required:
              - to_emails
      required:
        - title
        - email_template_id
        - email_channel_id
        - recipients
    EmailCampaignResponseDto:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        status:
          type: string
          enum:
            - draft
            - scheduled
            - sending
            - sent
            - failed
        email_template_id:
          type: string
        email_channel_id:
          type: string
        scheduled_at:
          format: date-time
          type: string
          nullable: true
        sent_at:
          format: date-time
          type: string
          nullable: true
        total_recipients:
          type: number
        created_at:
          format: date-time
          type: string
      required:
        - id
        - title
        - status
        - email_template_id
        - email_channel_id
        - scheduled_at
        - sent_at
        - total_recipients
        - created_at

````