# Create Campaign

> Create a new outbound calling campaign

`POST /api/v1/campaign/create`

Before creating a campaign, [upload your contacts CSV](/api-reference/campaigns/upload-contacts) to get a `source_url`.

Set `telephony_configuration_id` to pin the campaign to a specific [telephony configuration](/api-reference/telephony-configs). If omitted, Menace Voice falls back to the organization's [default outbound configuration](/api-reference/telephony-configs/set-default-outbound) — supplying an id that doesn't exist in your organization returns `400 telephony_configuration_not_found`.

The `time_slots` field controls when Menace Voice is allowed to place calls. If omitted, calls can be placed at any time. The `timezone` field applies to all time slot windows.

```json
{
  "time_slots": [
    { "day": "monday", "start": "09:00", "end": "17:00" },
    { "day": "tuesday", "start": "09:00", "end": "17:00" }
  ]
}
```

Once created, the campaign is in `draft` status. Call [Start](/api-reference/campaigns/start) to begin dialing.

## OpenAPI

````yaml api-reference/openapi.json post /api/v1/campaign/create
openapi: 3.1.0
info:
  title: Menace Voice API
  description: API for Menace Voice agents
  version: 1.0.0
servers:
  - url: https://voice.menaceui.com
    description: Production
  - url: http://localhost:8000
    description: Local development
paths:
  /api/v1/campaign/create:
    post:
      tags:
        - main
      summary: Create Campaign
      description: Create a new campaign
      operationId: create_campaign_api_v1_campaign_create_post
      parameters:
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: "null"
            title: Authorization
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: "null"
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCampaignRequest"
      responses:
        "200":
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CampaignResponse"
        "404":
          description: Not found
        "422":
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/HTTPValidationError"
components:
  schemas:
    CampaignLogEntryResponse:
      properties:
        ts:
          type: string
          title: Ts
        level:
          type: string
          title: Level
        event:
          type: string
          title: Event
        message:
          type: string
          title: Message
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: "null"
          title: Details
      type: object
      required:
        - ts
        - level
        - event
        - message
      title: CampaignLogEntryResponse
      description: |-
        A single timestamped entry from the campaign's append-only log.

        Surfaced in the UI so operators can see why a campaign moved to
        paused / failed without digging through server logs.
    CampaignResponse:
      properties:
        id:
          type: integer
          title: Id
        name:
          type: string
          title: Name
        workflow_id:
          type: integer
          title: Workflow Id
        workflow_name:
          type: string
          title: Workflow Name
        state:
          type: string
          title: State
        source_type:
          type: string
          title: Source Type
        source_id:
          type: string
          title: Source Id
        total_rows:
          anyOf:
            - type: integer
            - type: "null"
          title: Total Rows
        processed_rows:
          type: integer
          title: Processed Rows
        failed_rows:
          type: integer
          title: Failed Rows
        created_at:
          type: string
          format: date-time
          title: Created At
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: "null"
          title: Started At
        completed_at:
          anyOf:
            - type: string
              format: date-time
            - type: "null"
          title: Completed At
        retry_config:
          $ref: "#/components/schemas/RetryConfigResponse"
        max_concurrency:
          anyOf:
            - type: integer
            - type: "null"
          title: Max Concurrency
        schedule_config:
          anyOf:
            - $ref: "#/components/schemas/ScheduleConfigResponse"
            - type: "null"
        circuit_breaker:
          anyOf:
            - $ref: "#/components/schemas/CircuitBreakerConfigResponse"
            - type: "null"
        executed_count:
          type: integer
          title: Executed Count
          default: 0
        total_queued_count:
          type: integer
          title: Total Queued Count
          default: 0
        parent_campaign_id:
          anyOf:
            - type: integer
            - type: "null"
          title: Parent Campaign Id
        redialed_campaign_id:
          anyOf:
            - type: integer
            - type: "null"
          title: Redialed Campaign Id
        telephony_configuration_id:
          anyOf:
            - type: integer
            - type: "null"
          title: Telephony Configuration Id
        telephony_configuration_name:
          anyOf:
            - type: string
            - type: "null"
          title: Telephony Configuration Name
        logs:
          items:
            $ref: "#/components/schemas/CampaignLogEntryResponse"
          type: array
          title: Logs
      type: object
      required:
        - id
        - name
        - workflow_id
        - workflow_name
        - state
        - source_type
        - source_id
        - total_rows
        - processed_rows
        - failed_rows
        - created_at
        - started_at
        - completed_at
        - retry_config
      title: CampaignResponse
    CircuitBreakerConfigRequest:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        failure_threshold:
          type: number
          maximum: 1
          minimum: 0
          title: Failure Threshold
          default: 0.5
        window_seconds:
          type: integer
          maximum: 600
          minimum: 30
          title: Window Seconds
          default: 120
        min_calls_in_window:
          type: integer
          maximum: 100
          minimum: 1
          title: Min Calls In Window
          default: 5
      type: object
      title: CircuitBreakerConfigRequest
    CircuitBreakerConfigResponse:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: false
        failure_threshold:
          type: number
          title: Failure Threshold
          default: 0.5
        window_seconds:
          type: integer
          title: Window Seconds
          default: 120
        min_calls_in_window:
          type: integer
          title: Min Calls In Window
          default: 5
      type: object
      title: CircuitBreakerConfigResponse
    CreateCampaignRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        workflow_id:
          type: integer
          title: Workflow Id
        source_type:
          type: string
          pattern: ^csv$
          title: Source Type
        source_id:
          type: string
          title: Source Id
        telephony_configuration_id:
          anyOf:
            - type: integer
            - type: "null"
          title: Telephony Configuration Id
        retry_config:
          anyOf:
            - $ref: "#/components/schemas/RetryConfigRequest"
            - type: "null"
        max_concurrency:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 1
            - type: "null"
          title: Max Concurrency
        schedule_config:
          anyOf:
            - $ref: "#/components/schemas/ScheduleConfigRequest"
            - type: "null"
        circuit_breaker:
          anyOf:
            - $ref: "#/components/schemas/CircuitBreakerConfigRequest"
            - type: "null"
      type: object
      required:
        - name
        - workflow_id
        - source_type
        - source_id
      title: CreateCampaignRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: "#/components/schemas/ValidationError"
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RetryConfigRequest:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        max_retries:
          type: integer
          maximum: 10
          minimum: 0
          title: Max Retries
          default: 2
        retry_delay_seconds:
          type: integer
          maximum: 3600
          minimum: 30
          title: Retry Delay Seconds
          default: 120
        retry_on_busy:
          type: boolean
          title: Retry On Busy
          default: true
        retry_on_no_answer:
          type: boolean
          title: Retry On No Answer
          default: true
        retry_on_voicemail:
          type: boolean
          title: Retry On Voicemail
          default: true
      type: object
      title: RetryConfigRequest
    RetryConfigResponse:
      properties:
        enabled:
          type: boolean
          title: Enabled
        max_retries:
          type: integer
          title: Max Retries
        retry_delay_seconds:
          type: integer
          title: Retry Delay Seconds
        retry_on_busy:
          type: boolean
          title: Retry On Busy
        retry_on_no_answer:
          type: boolean
          title: Retry On No Answer
        retry_on_voicemail:
          type: boolean
          title: Retry On Voicemail
      type: object
      required:
        - enabled
        - max_retries
        - retry_delay_seconds
        - retry_on_busy
        - retry_on_no_answer
        - retry_on_voicemail
      title: RetryConfigResponse
    ScheduleConfigRequest:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        timezone:
          type: string
          title: Timezone
          default: UTC
        slots:
          items:
            $ref: "#/components/schemas/TimeSlotRequest"
          type: array
          maxItems: 50
          minItems: 1
          title: Slots
      type: object
      required:
        - slots
      title: ScheduleConfigRequest
    ScheduleConfigResponse:
      properties:
        enabled:
          type: boolean
          title: Enabled
        timezone:
          type: string
          title: Timezone
        slots:
          items:
            $ref: "#/components/schemas/TimeSlotResponse"
          type: array
          title: Slots
      type: object
      required:
        - enabled
        - timezone
        - slots
      title: ScheduleConfigResponse
    TimeSlotRequest:
      properties:
        day_of_week:
          type: integer
          maximum: 6
          minimum: 0
          title: Day Of Week
        start_time:
          type: string
          pattern: ^\d{2}:\d{2}$
          title: Start Time
        end_time:
          type: string
          pattern: ^\d{2}:\d{2}$
          title: End Time
      type: object
      required:
        - day_of_week
        - start_time
        - end_time
      title: TimeSlotRequest
    TimeSlotResponse:
      properties:
        day_of_week:
          type: integer
          title: Day Of Week
        start_time:
          type: string
          title: Start Time
        end_time:
          type: string
          title: End Time
      type: object
      required:
        - day_of_week
        - start_time
        - end_time
      title: TimeSlotResponse
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
````
