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

# Create Campaign

> Creates a new outbound campaign with specified recipients, voice agent, and scheduling configuration.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/voice-agents/campaigns
openapi: 3.0.1
info:
  title: Hamsa API
  description: Trying out our transcription and media-to-text APIs
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v1/voice-agents/campaigns:
    post:
      summary: Create an outbound campaign
      description: >-
        Creates a new outbound campaign with specified recipients, voice agent,
        and scheduling configuration.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCampaignRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateCampaignResponse'
        '400':
          description: Validation/Bad request error response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '404':
          description: Resource not found (voice agent or phone number)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    CreateCampaignRequest:
      type: object
      required:
        - name
        - phoneNumber
        - voiceAgentId
        - recipients
        - sendType
        - timeRange
        - projectId
      properties:
        name:
          type: string
          description: Campaign name (1-100 characters).
          example: Q1 Customer Outreach
          maxLength: 100
          minLength: 1
        phoneNumber:
          type: string
          description: Phone number to use for the campaign in E.164 format.
          example: '+14155551212'
        voiceAgentId:
          type: string
          format: uuid
          description: Voice agent ID to use for the campaign.
          example: 68f7656f-098b-4c43-b165-7cfd2cc8ac40
        recipients:
          type: array
          description: List of recipients for the campaign (minimum 1 recipient).
          minItems: 1
          items:
            type: object
            required:
              - phoneNumber
            properties:
              phoneNumber:
                type: string
                description: Recipient phone number.
                example: '+1234567890'
              ignoreE164Validation:
                type: boolean
                description: Whether to skip E.164 format validation for this recipient.
                example: false
              name:
                type: string
                description: Recipient name (optional).
                example: John Doe
                nullable: true
            additionalProperties: true
        sendType:
          type: string
          enum:
            - NOW
            - SCHEDULED
          description: >-
            When to send the campaign. Use 'NOW' for immediate sending or
            'SCHEDULED' for scheduled sending.
          example: NOW
        timeRange:
          type: object
          description: Time range for making calls.
          required:
            - days
            - startCallingTime
            - endCallingTime
          properties:
            days:
              type: array
              description: Days of the week when calls can be made.
              items:
                type: string
                enum:
                  - MONDAY
                  - TUESDAY
                  - WEDNESDAY
                  - THURSDAY
                  - FRIDAY
                  - SATURDAY
                  - SUNDAY
              example:
                - MONDAY
                - TUESDAY
                - WEDNESDAY
              minItems: 1
            startCallingTime:
              type: string
              pattern: ^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$
              description: Start time in HH:MM format (24-hour).
              example: '09:00'
            endCallingTime:
              type: string
              pattern: ^([0-1]?[0-9]|2[0-3]):[0-5][0-9]$
              description: >-
                End time in HH:MM format (24-hour). Must be after
                startCallingTime.
              example: '17:00'
        scheduledDate:
          type: string
          format: date-time
          description: >-
            Scheduled date/time in ISO 8601 format (required when sendType is
            SCHEDULED).
          example: '2025-12-01T09:00:00Z'
        scheduledTimezone:
          type: string
          description: >-
            Timezone for scheduled campaign (required when sendType is
            SCHEDULED).
          example: America/New_York
        reservedConcurrency:
          type: integer
          description: >-
            Number of concurrent calls reserved for this campaign (must be
            positive). Defaults to 1 when omitted.
          minimum: 1
          default: 1
          example: 10
    CreateCampaignResponse:
      type: object
      properties:
        success:
          type: boolean
          example: true
        message:
          type: string
          example: Campaign created successfully
        messageKey:
          type: string
          example: CAMPAIGN_CREATED_SUCCESSFULLY
        data:
          type: object
          properties:
            id:
              type: string
              format: uuid
              example: a8f7656f-098b-4c43-b165-7cfd2cc8ac50
            name:
              type: string
              example: Q1 Customer Outreach
            status:
              type: string
              enum:
                - SCHEDULED
                - RUNNING
                - PAUSED
                - COMPLETED
                - CANCELLED
              example: SCHEDULED
            sendType:
              type: string
              enum:
                - NOW
                - SCHEDULED
              example: NOW
            scheduledDate:
              type: string
              format: date-time
              example: '2025-12-01T09:00:00Z'
              nullable: true
            scheduledTimezone:
              type: string
              example: America/New_York
              nullable: true
            timeRange:
              type: object
              nullable: true
              properties:
                days:
                  type: array
                  items:
                    type: string
                    enum:
                      - MONDAY
                      - TUESDAY
                      - WEDNESDAY
                      - THURSDAY
                      - FRIDAY
                      - SATURDAY
                      - SUNDAY
                  example:
                    - MONDAY
                    - TUESDAY
                    - WEDNESDAY
                startCallingTime:
                  type: string
                  example: '09:00'
                endCallingTime:
                  type: string
                  example: '17:00'
            reservedConcurrency:
              type: integer
              example: 10
            webhookUrl:
              type: string
              example: https://example.com/webhook
              nullable: true
            projectId:
              type: string
              format: uuid
              example: 48f7656f-098b-4c43-b165-7cfd2cc8ac30
            userId:
              type: string
              format: uuid
              example: 48f7656f-098b-4c43-b165-7cfd2cc8ac30
            voiceAgentId:
              type: string
              format: uuid
              example: 68f7656f-098b-4c43-b165-7cfd2cc8ac40
            phoneNumberId:
              type: string
              format: uuid
              example: 48f7656f-098b-4c43-b165-7cfd2cc8ac30
            createdAt:
              type: string
              format: date-time
              example: '2025-12-06T10:00:00.000Z'
            updatedAt:
              type: string
              format: date-time
              example: '2025-12-06T10:00:00.000Z'
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````