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

# Create a campaign

> Create a marketing campaign (blast, drip, or journey) targeting a list/segment/CSV/all-contacts audience. The campaign is created as a draft until POST /campaigns/{id}/send. message_template is optional at creation but mandatory at send-time. For drip campaigns, the `steps` array defines the sequence; smart_send spreads delivery across 24h using best-time-to-send predictions.



## OpenAPI

````yaml /openapi.yaml post /api/v1/campaigns/
openapi: 3.1.0
info:
  title: Devotel CPaaS API
  description: Orbit by Devotel — Communications Platform as a Service API
  version: 1.0.0
  contact:
    name: Devotel
    url: https://devotel.io
    email: support@devotel.io
  license:
    name: Proprietary
servers:
  - url: https://api.orbit.devotel.io
    description: Production
security:
  - Bearer: []
  - ApiKey: []
tags:
  - name: Messages
    description: >-
      Send and manage messages across all channels (SMS, WhatsApp, RCS, Email,
      Viber, etc.)
  - name: Fax
    description: >-
      List and track fax (MMS/T.38) transmissions on Telnyx-backed fax numbers
      (sending flows through the Messaging API)
  - name: Agents
    description: AI agent creation, configuration, and execution
  - name: Voice
    description: Voice calls, IVR, conferencing, and SIP trunking
  - name: OnCall
    description: On-call rotations and escalation policy planning for incident alerting
  - name: Webhooks
    description: Webhook endpoint management and delivery logs
  - name: Numbers
    description: Phone number search, provisioning, and configuration
  - name: Brand Identity
    description: >-
      Unified cross-channel brand trust posture (10DLC, toll-free, WhatsApp,
      RCS, branded calling, number KYC)
  - name: Contacts
    description: Contact management, segmentation, and lifecycle tracking
  - name: Campaigns
    description: Marketing campaign orchestration and analytics
  - name: Flows
    description: Automation flow builder and execution engine
  - name: Templates
    description: Message template management and approval workflows
  - name: Settings
    description: Organization, channel, and user preference settings
  - name: Verify
    description: OTP generation and verification across channels
  - name: Push
    description: Push notification delivery via FCM and APNs
  - name: Integrations
    description: Third-party service connections and OAuth management
  - name: CDP
    description: >-
      Customer Data Platform — activation surface (CRM object sync, streaming
      destinations, ad-audience activation)
  - name: Files
    description: >-
      Server-to-server media upload, listing, retrieval, and deletion
      (signed-URL backed)
  - name: Commerce
    description: >-
      Omnichannel conversational-commerce — persistent cart + checkout state
      machine, channel-agnostic hosted pay-by-link, native WhatsApp checkout,
      and AP2-style agent payment mandates.
  - name: Sync
    description: >-
      Real-time shared-state primitive (Twilio Sync parity) — Documents, Maps,
      Lists, and ephemeral Streams, with change events relayed over the
      /api/v1/ws/sync WebSocket gateway
paths:
  /api/v1/campaigns/:
    post:
      tags:
        - Campaigns
      summary: Create a campaign
      description: >-
        Create a marketing campaign (blast, drip, or journey) targeting a
        list/segment/CSV/all-contacts audience. The campaign is created as a
        draft until POST /campaigns/{id}/send. message_template is optional at
        creation but mandatory at send-time. For drip campaigns, the `steps`
        array defines the sequence; smart_send spreads delivery across 24h using
        best-time-to-send predictions.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - channel
              properties:
                name:
                  type: string
                  minLength: 1
                  maxLength: 200
                description:
                  type: string
                  maxLength: 1000
                type:
                  type: string
                  enum:
                    - blast
                    - drip
                    - journey
                channel:
                  type: string
                  enum:
                    - sms
                    - mms
                    - whatsapp
                    - email
                    - rcs
                    - viber
                    - voice
                    - instagram
                    - messenger
                    - line
                    - push
                    - telegram
                    - fax
                audience_type:
                  type: string
                  enum:
                    - all
                    - list
                    - segment
                    - csv
                audience_id:
                  type: string
                message_template:
                  type: string
                  maxLength: 10000
                variables:
                  type: object
                  additionalProperties: true
                scheduled_at:
                  type: string
                  format: date-time
                throttle_rate:
                  type: integer
                  minimum: 0
                  maximum: 1000
                recurrence:
                  type: object
                  additionalProperties: true
                  description: >-
                    Recurrence config. Accepts either canonical keys (type,
                    end_type, end_date, end_count, days, date, cron) or
                    UI-prefixed keys (recurrence_type, recurrence_end_type,
                    recurrence_end_date, etc.). When end_type === 'on_date' the
                    end_date MUST be in the future; past dates are rejected with
                    HTTP 400.
                  properties:
                    type:
                      type: string
                      enum:
                        - once
                        - daily
                        - weekly
                        - monthly
                        - custom
                      description: >-
                        Recurrence cadence. `custom` reads `cron`. Mirror:
                        `recurrence_type`.
                    recurrence_type:
                      type: string
                      enum:
                        - once
                        - daily
                        - weekly
                        - monthly
                        - custom
                      description: UI-prefixed alias of `type`.
                    end_type:
                      type: string
                      enum:
                        - never
                        - after_count
                        - on_date
                      description: >-
                        Termination policy. `on_date` requires a future
                        `end_date`; `after_count` requires `end_count`. Mirror:
                        `recurrence_end_type`.
                    recurrence_end_type:
                      type: string
                      enum:
                        - never
                        - after_count
                        - on_date
                      description: UI-prefixed alias of `end_type`.
                    end_date:
                      type: string
                      description: >-
                        ISO 8601 / YYYY-MM-DD. MUST be in the future when
                        end_type === 'on_date'; past dates rejected with HTTP
                        400. Mirror: `recurrence_end_date`.
                    recurrence_end_date:
                      type: string
                      description: UI-prefixed alias of `end_date`.
                    end_count:
                      type: integer
                      minimum: 1
                      maximum: 999
                      description: >-
                        Number of occurrences before auto-stop when end_type ===
                        'after_count'. Mirror: `recurrence_end_count`.
                    recurrence_end_count:
                      type: integer
                      minimum: 1
                      maximum: 999
                      description: UI-prefixed alias of `end_count`.
                    days:
                      type: array
                      items:
                        type: string
                      description: >-
                        Day-of-week selectors for weekly cadence (e.g.
                        ['mon','wed','fri']). Mirror: `recurrence_days`.
                    recurrence_days:
                      type: array
                      items:
                        type: string
                      description: UI-prefixed alias of `days`.
                    date:
                      type: integer
                      minimum: 1
                      maximum: 31
                      description: >-
                        Day-of-month selector for monthly cadence (1-31).
                        Mirror: `recurrence_date`.
                    recurrence_date:
                      type: integer
                      minimum: 1
                      maximum: 31
                      description: UI-prefixed alias of `date`.
                    cron:
                      type: string
                      maxLength: 100
                      description: >-
                        Cron expression for `type === 'custom'`. Mirror:
                        `recurrence_cron`.
                    recurrence_cron:
                      type: string
                      maxLength: 100
                      description: UI-prefixed alias of `cron`.
                    recurrence_interval:
                      type: integer
                      minimum: 1
                      maximum: 365
                      description: >-
                        Step interval (e.g. every 2 weeks → 2). Applies to
                        custom and daily/weekly/monthly cadences.
                    tz:
                      type: string
                      maxLength: 64
                      description: >-
                        IANA timezone for cron + day-of-week evaluation.
                        Defaults to org timezone.
                business_hours_only:
                  type: boolean
                steps:
                  type: array
                  maxItems: 50
                  items:
                    type: object
                    required:
                      - order
                      - delay_minutes
                      - channel
                      - template
                    properties:
                      id:
                        type: string
                      order:
                        type: integer
                        minimum: 0
                      delay_minutes:
                        type: integer
                        minimum: 0
                        maximum: 525600
                      channel:
                        type: string
                        enum:
                          - sms
                          - mms
                          - whatsapp
                          - email
                          - rcs
                          - viber
                          - voice
                          - instagram
                          - messenger
                          - line
                          - push
                          - telegram
                          - fax
                      template:
                        type: string
                        minLength: 1
                        maxLength: 10000
                      subject:
                        type: string
                        maxLength: 500
                      condition:
                        type: object
                        required:
                          - type
                        properties:
                          type:
                            type: string
                            enum:
                              - delivered
                              - read
                              - clicked
                              - not_delivered
                              - not_read
                              - always
                          timeout_minutes:
                            type: integer
                            minimum: 0
                smart_send:
                  type: boolean
                  default: false
      responses:
        '201':
          description: Campaign created (draft state)
          content:
            application/json:
              schema:
                type: object
                description: Campaign created (draft state)
                properties:
                  data:
                    type: object
                    additionalProperties: true
                    properties:
                      id:
                        type: string
                      name:
                        type: string
                      status:
                        type: string
                      type:
                        type: string
                      channel:
                        type: string
                      audience_type:
                        type: string
                      audience_id:
                        type:
                          - 'null'
                          - string
                      message_template:
                        type:
                          - 'null'
                          - string
                      scheduled_at:
                        type:
                          - 'null'
                          - string
                        format: date-time
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type:
                          - 'null'
                          - string
                        format: date-time
                  meta:
                    type: object
                    properties:
                      request_id:
                        type: string
                        description: >-
                          Unique request identifier (also returned in
                          X-Request-Id header)
                      timestamp:
                        type: string
                        format: date-time
                        description: ISO 8601 UTC timestamp of the response
        '422':
          description: Default Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    required:
                      - code
                      - message
                      - status
                    properties:
                      code:
                        type: string
                        description: >-
                          Machine-readable error code (e.g.
                          INVALID_PHONE_NUMBER)
                      message:
                        type: string
                        description: Human-readable error description
                      status:
                        type: integer
                        description: HTTP status code
                      details:
                        type: object
                        additionalProperties: true
                        description: Additional context about the error
                  meta:
                    type: object
                    properties:
                      request_id:
                        type: string
                      timestamp:
                        type: string
                        format: date-time
                      docs_url:
                        type: string
                        format: uri
                        description: Link to relevant error documentation
components:
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Dashboard JWT token from Clerk
    ApiKey:
      type: apiKey
      name: X-API-Key
      in: header
      description: Server-to-server API key (dv_live_sk_*)

````