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

# Create a campaign

> The campaign is born a draft. The finer settings (segment, sender, UTM, A/B test, spreading, time zone) are made in the interface.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/campaigns
openapi: 3.1.0
info:
  title: Lekalao API
  version: 1.0.0
  description: >-
    Everything the interface does, your application can do too. Every call
    carries an API token (Settings → API tokens).
servers:
  - url: https://{host}
    description: Your installation
    variables:
      host:
        default: lekalao.example.com
        description: The domain of your own Lekalao
security:
  - bearer: []
tags:
  - name: Lists
  - name: Subscribers
  - name: Tags
  - name: Segments
  - name: Imports
  - name: Templates
  - name: Campaigns
  - name: Automations
  - name: Transactional e-mails
  - name: Revenue
  - name: Platform
paths:
  /api/v1/campaigns:
    post:
      tags:
        - Campaigns
      summary: Create a campaign
      description: >-
        The campaign is born a draft. The finer settings (segment, sender, UTM,
        A/B test, spreading, time zone) are made in the interface.
      operationId: api.campaigns.store
      parameters:
        - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - list
                - editor
              properties:
                name:
                  type: string
                  maxLength: 255
                  description: Seen by the team only.
                subject:
                  type:
                    - string
                    - 'null'
                  maxLength: 255
                list:
                  type: string
                  format: uuid
                editor:
                  type: string
                  enum:
                    - blocks
                    - markdown
                    - html
                    - mjml
                content:
                  type:
                    - string
                    - 'null'
                  description: >-
                    500,000 characters at most. For "blocks", the editor's JSON
                    document.
                track_opens:
                  type: boolean
                  default: true
                track_clicks:
                  type: boolean
                  default: true
            example:
              name: Offre de Noël
              subject: Bonjour {{ subscriber.first_name }}, nos bûches sont là
              list: 9d5c2a1e-8f3b-4c7a-9e21-3b8f0c6d4a12
              editor: html
              content: >-
                <p>Bonjour {{ subscriber.first_name }},</p><p><a
                href="https://exemple.com/noel">Commander</a></p>
      responses:
        '201':
          description: The campaign that was created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Campaign'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      required: false
      schema:
        type: string
        maxLength: 255
      description: >-
        Replay a write safely: the same key gives back the first answer for 24
        hours (header Idempotent-Replay: true).
  schemas:
    Campaign:
      type: object
      properties:
        id:
          type: string
          format: uuid
        name:
          type: string
        subject:
          type:
            - string
            - 'null'
        status:
          type: string
          enum:
            - draft
            - scheduled
            - sending
            - paused
            - sent
            - cancelled
        list:
          type:
            - string
            - 'null'
          format: uuid
        scheduled_at:
          type:
            - string
            - 'null'
          format: date-time
        sent_at:
          type:
            - string
            - 'null'
          format: date-time
        statistics:
          $ref: '#/components/schemas/CampaignStatistics'
        created_at:
          type: string
          format: date-time
    CampaignStatistics:
      type: object
      properties:
        recipients:
          type:
            - integer
            - 'null'
        sent:
          type: integer
        delivered:
          type: integer
          description: Confirmed by the provider (its feedback webhook).
        opens:
          type: integer
        unique_opens:
          type: integer
        clicks:
          type: integer
        unique_clicks:
          type: integer
        bounces:
          type: integer
        complaints:
          type: integer
        unsubscribes:
          type: integer
    Message:
      type: object
      properties:
        message:
          type: string
    ValidationError:
      type: object
      properties:
        message:
          type: string
          example: The email field must be a valid email address.
        errors:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    Unauthenticated:
      description: No token, or an invalid or revoked one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
          example:
            message: Unauthenticated.
    Forbidden:
      description: The token lacks the ability needed, or the team is suspended.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Message'
    ValidationFailed:
      description: Invalid data.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    TooManyRequests:
      description: >-
        The token's limit is reached. Wait the number of seconds Retry-After
        gives.
      headers:
        X-RateLimit-Limit:
          schema:
            type: integer
          description: Calls allowed per minute for this token.
        X-RateLimit-Remaining:
          schema:
            type: integer
        Retry-After:
          schema:
            type: integer
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      description: >-
        An API token. The "read" ability: GET routes only. "read + write": every
        route.

````