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

# Create a campaign



## OpenAPI

````yaml POST /v1/campaigns
openapi: 3.0.1
info:
  title: Volubile API
  version: v1
servers:
  - url: https://api.eu.volubile.ai
    description: Generated server url
security: []
paths:
  /v1/campaigns:
    post:
      tags:
        - Campaigns
      summary: Create a campaign
      operationId: create
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCampaignRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignResponse'
        '400':
          description: Bad Request
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >
            Unauthorized access. The request has not been applied because it
            lacks valid authentication credentials.

            Possible reasons include that the API key is missing from the
            request headers, the provided API key is disabled,

            or the API key is associated with a customer account that is
            disabled.
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Too Many Requests
          content:
            '*/*':
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - Api key: []
        - Bearer token: []
components:
  schemas:
    CreateCampaignRequest:
      required:
        - agentId
        - batchSize
        - days
        - name
        - startDate
        - timeSlots
      type: object
      properties:
        name:
          type: string
          description: Name of the campaign
        agentId:
          type: string
          description: Unique identifier of the OUTBOUND agent to perform the campaign with
          format: uuid
        startDate:
          type: string
          description: Start date of the campaign
          format: date
          example: '2024-07-30'
        timeSlots:
          type: array
          description: >-
            Calls will only be performed during the allowed time slots:
            10:00-13:00 and 14:00-20:00. 
                            If the specified time slots overlap partially with these intervals, only the overlapping portion will be used.
                            For example: if "11:00-15:00" is provided, calls will occur from 11:00 to 13:00 and 14:00 to 15:00.
                            Maximum of 2 time slots are allowed
          items:
            $ref: '#/components/schemas/TimeSlot'
        batchSize:
          maximum: 1000
          minimum: 1
          type: integer
          description: The number of calls per day, minimum 1, maximum 1000
          format: int32
        retry:
          $ref: '#/components/schemas/Retry'
        days:
          type: array
          description: Days of the campaign
          items:
            type: string
            description: Days of the campaign
            enum:
              - MONDAY
              - TUESDAY
              - WEDNESDAY
              - THURSDAY
              - FRIDAY
              - SATURDAY
              - SUNDAY
        recipients:
          type: array
          description: List of recipients to call, minimum 1, maximum 1000
          items:
            $ref: '#/components/schemas/CreateCampaignRecipientRequest'
        timezone:
          type: string
          description: The timezone of the campaign
          example: Europe/Paris
    CampaignResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the campaign
          format: uuid
        name:
          type: string
          description: Name of the campaign
        agentId:
          type: string
          description: Unique identifier of the agent to perform the campaign with
          format: uuid
        startDate:
          type: string
          description: Start date of the campaign
          format: date
          example: '2024-07-30'
        timeSlots:
          type: array
          description: >-
            Timeslots of the campaign (when the calls will be performed during
            the day). Max 2 timeslots
          items:
            $ref: '#/components/schemas/TimeSlot'
        batchSize:
          type: integer
          description: The number of calls per...
          format: int32
        retry:
          $ref: '#/components/schemas/Retry'
        days:
          type: array
          description: Days of the campaign
          items:
            type: string
            description: Days of the campaign
            enum:
              - MONDAY
              - TUESDAY
              - WEDNESDAY
              - THURSDAY
              - FRIDAY
              - SATURDAY
              - SUNDAY
        status:
          type: string
          description: Status of the campaign
          enum:
            - ACTIVE
            - PAUSED
            - CANCELLED
        timezone:
          type: string
          description: The timezone of the campaign
          example: Europe/Paris
    ErrorResponse:
      type: object
      properties:
        timestamp:
          type: string
          description: |
            Date and time when the error occurs.

            Format: UTC time - yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
          format: date-time
        status:
          type: integer
          description: Http status code
          format: int32
        message:
          type: string
          description: Information about the error
        errors:
          type: array
          description: List of specific validation errors
          items:
            $ref: '#/components/schemas/ValidationError'
    TimeSlot:
      required:
        - endTime
        - startTime
      type: object
      properties:
        startTime:
          type: string
          description: |
            Start of the time slot.

            Format: UTC time - 'HH:mm'
          example: '10:30'
        endTime:
          type: string
          description: |
            End of the time slot.

            Format: UTC time - 'HH:mm'
          example: '12:30'
    Retry:
      type: object
      properties:
        max:
          maximum: 3
          minimum: 0
          type: integer
          description: >-
            Maximum number of retries to reach the contact, minimum 0 (no
            retries), maximum 3
          format: int32
        delay:
          type: integer
          description: >-
            Minimum delay between retry attempts (in hours), minimum 1 (only
            considered when 'max' is greater than zero)
          format: int32
        retryOn:
          type: array
          description: >-
            Condition to trigger a retry (call status and qualifiers), must not
            be empty (only considered when 'max' is greater than zero)
          items:
            type: string
            description: >-
              Condition to trigger a retry (call status and qualifiers), must
              not be empty (only considered when 'max' is greater than zero)
      description: Retry parameters when the contact cannot be reached
    CreateCampaignRecipientRequest:
      required:
        - phone
      type: object
      properties:
        phone:
          type: string
          description: Phone number to call, in the E.164 international standard format
          example: '+33612345678'
        context:
          type: object
          additionalProperties:
            type: object
            description: >
              Custom object for dynamic content injection into the agent prompt.

              Keys in this map correspond to placeholders in the prompt
              template: e.g {{ firstName }}.

              At runtime, each placeholder will be replaced with its
              corresponding value.


              ⚠️ All sent variables not found in configured agent prompt will be
              ignored.
            example:
              firstName: firstname
              lastName: lastname
              orderNumber: 5HZ99FRT
          description: >
            Custom object for dynamic content injection into the agent prompt.

            Keys in this map correspond to placeholders in the prompt template:
            e.g {{ firstName }}.

            At runtime, each placeholder will be replaced with its corresponding
            value.


            ⚠️ All sent variables not found in configured agent prompt will be
            ignored.
          example:
            firstName: firstname
            lastName: lastname
            orderNumber: 5HZ99FRT
    ValidationError:
      type: object
      properties:
        field:
          type: string
          description: Field in error
        rejectedValue:
          type: object
          description: Value in error
        message:
          type: string
          description: Description of the failed validation
      description: List of specific validation errors
  securitySchemes:
    Api key:
      type: apiKey
      description: Your API key.
      name: X-Api-Key
      in: header
    Bearer token:
      type: http
      description: Short lived Bearer token issued by /v1/auth/token.
      scheme: bearer
      bearerFormat: JWT

````