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

# Create Campaign

> Record a campaign; the campaign worker starts dialling it.



## OpenAPI

````yaml /openapi.json post /v1/campaigns
openapi: 3.1.0
info:
  title: TurnCall
  description: Production voice agent platform API
  version: 2.0.0
servers: []
security: []
paths:
  /v1/campaigns:
    post:
      tags:
        - campaigns
      summary: Create Campaign
      description: Record a campaign; the campaign worker starts dialling it.
      operationId: create_campaign_v1_campaigns_post
      parameters:
        - name: authorization
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Authorization
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCampaignRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                title: Response Create Campaign V1 Campaigns Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CreateCampaignRequest:
      properties:
        name:
          type: string
          maxLength: 255
          minLength: 1
          title: Name
        agent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Agent Id
        agents:
          anyOf:
            - items:
                $ref: '#/components/schemas/RoutingWeightEntry'
              type: array
              maxItems: 10
              minItems: 2
            - type: 'null'
          title: Agents
        from_number_id:
          type: string
          format: uuid
          title: From Number Id
        timezone:
          anyOf:
            - type: string
            - type: 'null'
          title: Timezone
        calling_window:
          anyOf:
            - $ref: '#/components/schemas/CallingWindowRequest'
            - type: 'null'
        retry_policy:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/RetryRule'
              propertyNames:
                enum:
                  - customer_did_not_answer
                  - customer_busy
                  - voicemail
              type: object
            - type: 'null'
          title: Retry Policy
        targets:
          items:
            $ref: '#/components/schemas/CampaignTargetRequest'
          type: array
          maxItems: 10000
          minItems: 1
          title: Targets
      additionalProperties: false
      type: object
      required:
        - name
        - from_number_id
        - targets
      title: CreateCampaignRequest
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RoutingWeightEntry:
      properties:
        agent_id:
          type: string
          format: uuid
          title: Agent Id
        weight:
          type: integer
          maximum: 100
          minimum: 1
          title: Weight
      type: object
      required:
        - agent_id
        - weight
      title: RoutingWeightEntry
      description: A single entry in A/B routing weights.
    CallingWindowRequest:
      properties:
        start:
          type: string
          format: time
          title: Start
        end:
          type: string
          format: time
          title: End
        days:
          items:
            type: string
            enum:
              - mon
              - tue
              - wed
              - thu
              - fri
              - sat
              - sun
          type: array
          minItems: 1
          title: Days
      additionalProperties: false
      type: object
      required:
        - start
        - end
      title: CallingWindowRequest
      description: >-
        Local hours every target may be called in, read in the target's own
        zone.
    RetryRule:
      properties:
        max_attempts:
          type: integer
          maximum: 10
          minimum: 1
          title: Max Attempts
        spacing_seconds:
          type: integer
          maximum: 604800
          minimum: 60
          title: Spacing Seconds
      additionalProperties: false
      type: object
      required:
        - max_attempts
        - spacing_seconds
      title: RetryRule
    CampaignTargetRequest:
      properties:
        number:
          type: string
          pattern: ^\+[1-9]\d{1,14}$
          title: Number
        variables:
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: number
              - type: boolean
          type: object
          title: Variables
        timezone:
          anyOf:
            - type: string
            - type: 'null'
          title: Timezone
      additionalProperties: false
      type: object
      required:
        - number
      title: CampaignTargetRequest
    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

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.