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

# Create a new program



## OpenAPI

````yaml /openapi.json post /api/programs
openapi: 3.0.0
info:
  title: GoMobile Backend API
  description: >-
    API documentation for GoMobile telephony platform - automated calling
    campaigns, interactive voice flows, and call management
  version: '1.0'
  contact: {}
servers:
  - url: http://localhost:3000
    description: Local Development
security: []
tags:
  - name: Organizations
    description: Multi-tenant organization management
  - name: Teams
    description: Team structure and hierarchy
  - name: Contacts
    description: Customer contact management (CRM)
  - name: Entities
    description: Business entities management
  - name: Audiences
    description: Contact segmentation and groups
  - name: Programs
    description: Call campaign configuration
  - name: Call Flows
    description: Interactive call flow builder
paths:
  /api/programs:
    post:
      tags:
        - Programs
      summary: Create a new program
      operationId: ProgramController_createProgram
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProgramDto'
      responses:
        '201':
          description: Program created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProgramResponseDto'
        '400':
          description: Invalid request
      security:
        - bearer: []
components:
  schemas:
    CreateProgramDto:
      type: object
      properties:
        name:
          type: string
          description: Program name
        mode:
          type: string
          enum:
            - batch
            - live
          default: batch
          description: 'Program mode: batch (static audience) or live (trigger-based)'
        audienceId:
          type: string
          description: Audience ID to call (required for batch mode)
        triggerCondition:
          description: Trigger condition (required for live mode)
          allOf:
            - $ref: '#/components/schemas/DateTriggerConditionDto'
        flowId:
          type: string
          description: Flow ID to execute
        startAt:
          type: string
          description: Scheduled start time (ISO 8601)
          example: '2025-12-20T09:00:00Z'
        stopAt:
          type: string
          description: Scheduled stop time (ISO 8601)
          example: '2025-12-20T18:00:00Z'
        didPool:
          description: Pool of DID UUIDs to use for outbound calls (at least one)
          example:
            - 123e4567-e89b-12d3-a456-426614174000
            - 123e4567-e89b-12d3-a456-426614174001
          type: array
          items:
            type: string
        retryStrategy:
          type: object
          description: Retry strategy for failed calls
          properties:
            type:
              type: string
              enum:
                - none
                - fixed_delay
                - scheduled
              description: Strategy type
            delayMinutes:
              type: number
              description: Delay between retries in minutes (for fixed_delay)
            maxRetries:
              type: number
              description: Maximum retry attempts (for fixed_delay)
            retryDates:
              type: array
              items:
                type: string
              description: ISO 8601 dates for scheduled retries
          required:
            - type
        pauseWindows:
          $ref: '#/components/schemas/PauseWindowsDto'
        autoPauseRules:
          description: 'Auto-pause rules: pause execution when counters reach thresholds'
          type: array
          items:
            $ref: '#/components/schemas/AutoPauseRuleDto'
      required:
        - name
        - flowId
        - startAt
        - didPool
        - retryStrategy
    ProgramResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Program ID
        name:
          type: string
          description: Program name
        mode:
          type: string
          enum:
            - batch
            - live
          description: Program mode
        organizationId:
          type: string
          description: Organization ID
        audienceId:
          type: string
          description: Audience ID. Set at creation for batch, auto-created for live.
        flowId:
          type: string
          description: Flow ID
        status:
          type: string
          enum:
            - draft
            - active
            - archived
          description: Program lifecycle status. Operational status is on executions.
        triggerCondition:
          description: Trigger condition (live mode only)
          allOf:
            - $ref: '#/components/schemas/DateTriggerConditionDto'
        startAt:
          type: string
          description: Scheduled start time
        stopAt:
          type: string
          description: Scheduled stop time
          nullable: true
        didPool:
          description: Resolved DID pool
          type: array
          items:
            $ref: '#/components/schemas/DidPoolItemDto'
        retryStrategy:
          type: object
          description: Retry strategy
          nullable: true
          additionalProperties: true
        pauseWindows:
          type: object
          description: Pause windows
          nullable: true
          additionalProperties: true
        autoPauseRules:
          type: object
          description: Auto-pause rules
          nullable: true
          additionalProperties: true
        createdAt:
          type: string
          description: Created at
        updatedAt:
          type: string
          description: Updated at
      required:
        - id
        - name
        - mode
        - organizationId
        - audienceId
        - flowId
        - status
        - startAt
        - didPool
        - retryStrategy
        - createdAt
        - updatedAt
    DateTriggerConditionDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - date
          example: date
        attributeName:
          type: string
          description: Custom attribute name (slug)
          example: date_echeance
        direction:
          type: string
          enum:
            - before
            - after
          description: Trigger before or after the date attribute value
          example: before
        offset:
          $ref: '#/components/schemas/TriggerOffsetDto'
      required:
        - type
        - attributeName
        - direction
        - offset
    PauseWindowsDto:
      type: object
      properties:
        sunday:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowItemDto'
        monday:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowItemDto'
        tuesday:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowItemDto'
        wednesday:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowItemDto'
        thursday:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowItemDto'
        friday:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowItemDto'
        saturday:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowItemDto'
        advanced:
          type: array
          items:
            $ref: '#/components/schemas/PauseWindowAdvancedItemDto'
    AutoPauseRuleDto:
      type: object
      properties:
        nodeId:
          type: string
          description: Node ID to count executions for
          example: node_abc123
        threshold:
          type: number
          description: Threshold value that triggers pause
          example: 100
        resetOnResume:
          type: boolean
          description: Whether to reset this counter when execution is resumed
          example: true
      required:
        - nodeId
        - threshold
        - resetOnResume
    DidPoolItemDto:
      type: object
      properties:
        id:
          type: string
          description: DID UUID
        number:
          type: string
          description: Phone number
          example: '+212500000001'
        country:
          type: string
          description: Country code
          example: MA
      required:
        - id
        - number
        - country
    TriggerOffsetDto:
      type: object
      properties:
        days:
          type: number
          description: Days offset
          example: 2
        hours:
          type: number
          description: Hours offset (0-23)
          example: 15
        minutes:
          type: number
          description: Minutes offset (0-59)
          example: 0
      required:
        - days
        - hours
        - minutes
    PauseWindowItemDto:
      type: object
      properties:
        startAt:
          $ref: '#/components/schemas/PauseWindowTimeDto'
        endAt:
          $ref: '#/components/schemas/PauseWindowTimeDto'
      required:
        - startAt
        - endAt
    PauseWindowAdvancedItemDto:
      type: object
      properties:
        startAt:
          type: string
          example: '2025-12-25T00:00:00Z'
        endAt:
          type: string
          example: '2025-12-25T23:59:59Z'
      required:
        - startAt
        - endAt
    PauseWindowTimeDto:
      type: object
      properties:
        hour:
          type: number
          example: 12
          description: Hour (0-23)
        minute:
          type: number
          example: 0
          description: Minute (0-59)
      required:
        - hour
        - minute
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````