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

# Create campaign

> Creates a campaign as a `draft`. Bind the agent per channel: `voice_agent_id` for `voice`, `whatsapp_agent_id` for `whatsapp`, both for `whatsapp_voice`. The bound agent must be **published**. Scope `campaigns:write`.



## OpenAPI

````yaml /api-reference/openapi.json post /campaigns
openapi: 3.1.0
info:
  title: Lehar API
  version: v0
  description: >-
    Customer-facing REST API for the Lehar voice-AI platform. Platform-admin
    endpoints are intentionally excluded from this reference. Regenerate with
    `npm run sync:openapi`.
servers:
  - url: https://api.lehar.ai/ca/api/v0
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /campaigns:
    post:
      tags:
        - Campaigns
      summary: Create campaign
      description: >-
        Creates a campaign as a `draft`. Bind the agent per channel:
        `voice_agent_id` for `voice`, `whatsapp_agent_id` for `whatsapp`, both
        for `whatsapp_voice`. The bound agent must be **published**. Scope
        `campaigns:write`.
      operationId: create_campaign_ca_api_v0_campaigns_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                campaign_type:
                  type: string
                  enum:
                    - voice
                    - whatsapp
                    - whatsapp_voice
                  default: voice
                voice_agent_id:
                  type: string
                  description: >-
                    Required for `voice` and `whatsapp_voice`. Must reference a
                    published voice agent.
                whatsapp_agent_id:
                  type: string
                  description: Required for `whatsapp` and `whatsapp_voice`.
                from_phone_number_id:
                  type: string
                whatsapp_sender_id:
                  type: string
                timezone:
                  type: string
                  default: UTC
                description:
                  type: string
                schedule:
                  type: object
                  description: Business hours and retry policy.
                  properties:
                    business_hours:
                      type: object
                      properties:
                        start:
                          type: string
                          example: '09:00'
                        end:
                          type: string
                          example: '18:00'
                        days:
                          type: array
                          items:
                            type: string
                          example:
                            - mon
                            - tue
                            - wed
                            - thu
                            - fri
                    max_attempts:
                      type: integer
                      minimum: 1
                      maximum: 10
                      default: 3
                    retry_delay_minutes:
                      type: integer
                      default: 120
                    call_timeout_seconds:
                      type: integer
                      minimum: 30
                      maximum: 3600
                      default: 600
                    max_recipients_per_campaign:
                      type: integer
                      maximum: 50000
                workflow:
                  type: object
                  description: >-
                    Channel-specific config (e.g. `workflow.whatsapp` for
                    WhatsApp campaigns).
                variables_schema:
                  type: object
                metadata:
                  type: object
            example:
              name: March renewals
              campaign_type: voice
              voice_agent_id: agent_sales_hi
              timezone: Asia/Kolkata
              schedule:
                business_hours:
                  start: '09:00'
                  end: '18:00'
                  days:
                    - mon
                    - tue
                    - wed
                    - thu
                    - fri
                max_attempts: 3
                retry_delay_minutes: 120
      responses:
        '201':
          description: Created campaign (status `draft`)
          content:
            application/json:
              example:
                id: campaign_01EXAMPLE
                customer_id: customer_01EXAMPLE
                created_by_user_id: user_01EXAMPLE
                voice_agent_id: agent_sales_hi
                whatsapp_agent_id: null
                from_phone_number_id: null
                whatsapp_sender_id: null
                name: March renewals
                description: null
                campaign_type: voice
                status: draft
                timezone: Asia/Kolkata
                schedule:
                  business_hours:
                    start: '09:00'
                    end: '18:00'
                    days:
                      - mon
                      - tue
                      - wed
                      - thu
                      - fri
                  max_attempts: 3
                  retry_delay_minutes: 120
                workflow: {}
                variables_schema: {}
                metadata: {}
                temporal_workflow_id: null
                temporal_run_id: null
                cloned_from_campaign_id: null
                started_at: null
                completed_at: null
                created_at: '2026-05-22T10:00:00Z'
                updated_at: '2026-05-22T10:00:00Z'
        '400':
          description: Invalid request (e.g. missing per-channel agent binding)
          content:
            application/json:
              example:
                error:
                  code: invalid_request
                  message: voice_agent_id is required for this campaign type
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    BearerAuth:
      type: http
      scheme: bearer

````