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

# Create a draft campaign with its sequence

> The campaign starts as a draft and sends nothing until it is launched. Add its leads with `POST /campaigns/{id}/leads`. Send an `Idempotency-Key` header to make a retry safe: the same key returns the campaign it first created, and 422 if the request changed. Without one, a retry creates a second draft.



## OpenAPI

````yaml /openapi.json post /v1/campaigns
openapi: 3.1.0
info:
  title: Cluster API
  version: '1'
servers:
  - url: https://api.getcluster.ai
security: []
paths:
  /v1/campaigns:
    post:
      tags:
        - Campaigns
      summary: Create a draft campaign with its sequence
      description: >-
        The campaign starts as a draft and sends nothing until it is launched.
        Add its leads with `POST /campaigns/{id}/leads`. Send an
        `Idempotency-Key` header to make a retry safe: the same key returns the
        campaign it first created, and 422 if the request changed. Without one,
        a retry creates a second draft.
      operationId: create_campaign
      parameters:
        - name: idempotency-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
                minLength: 8
                maxLength: 200
              - type: 'null'
            title: Idempotency-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCampaignRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Campaign'
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Payment Required
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Not Found
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Entity
        '429':
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Too Many Requests
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
        '503':
          headers:
            Retry-After:
              description: Seconds to wait before retrying.
              schema:
                type: string
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Service Unavailable
      security:
        - ApiKey: []
components:
  schemas:
    CreateCampaignRequest:
      properties:
        name:
          type: string
          maxLength: 120
          minLength: 1
          title: Name
        sequence:
          $ref: '#/components/schemas/SequenceInput'
        linkedin_sender_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Linkedin Sender Ids
        email_sender_ids:
          items:
            type: string
            format: uuid
          type: array
          title: Email Sender Ids
      additionalProperties: false
      type: object
      required:
        - name
        - sequence
      title: CreateCampaignRequest
    Campaign:
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        status:
          type: string
          title: Status
        campaign_type:
          type: string
          title: Campaign Type
        delivery_mode:
          type: string
          title: Delivery Mode
        list_id:
          anyOf:
            - type: string
            - type: 'null'
          title: List Id
        contact_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Contact Count
        stats:
          $ref: '#/components/schemas/CampaignStats'
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        scheduled_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Scheduled At
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
        paused_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Paused At
        paused_reason:
          anyOf:
            - $ref: '#/components/schemas/CampaignPausedReason'
            - type: 'null'
        finished_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Finished At
        ends_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Ends At
      type: object
      required:
        - id
        - name
        - status
        - campaign_type
        - delivery_mode
        - stats
        - created_at
        - updated_at
      title: Campaign
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorBody'
      type: object
      required:
        - error
      title: ErrorResponse
    SequenceInput:
      properties:
        steps:
          items:
            $ref: '#/components/schemas/SequenceStepInput'
          type: array
          maxItems: 10
          minItems: 1
          title: Steps
      additionalProperties: false
      type: object
      required:
        - steps
      title: SequenceInput
      description: >-
        Steps run in the order given. A message after a connection request waits
        for the connection.
    CampaignStats:
      properties:
        active_contact_count:
          type: integer
          title: Active Contact Count
          default: 0
        completed_contact_count:
          type: integer
          title: Completed Contact Count
          default: 0
        failed_contact_count:
          type: integer
          title: Failed Contact Count
          default: 0
        excluded_contact_count:
          type: integer
          title: Excluded Contact Count
          default: 0
        connection_request_sent_count:
          type: integer
          title: Connection Request Sent Count
          default: 0
        message_sent_count:
          type: integer
          title: Message Sent Count
          default: 0
        email_sent_count:
          type: integer
          title: Email Sent Count
          default: 0
        profile_visit_sent_count:
          type: integer
          title: Profile Visit Sent Count
          default: 0
        like_post_sent_count:
          type: integer
          title: Like Post Sent Count
          default: 0
        reply_count:
          type: integer
          title: Reply Count
          default: 0
      type: object
      title: CampaignStats
    CampaignPausedReason:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
      type: object
      required:
        - code
        - message
      title: CampaignPausedReason
      description: Why the system paused the campaign. Absent when a person paused it.
    ErrorBody:
      properties:
        code:
          type: string
          title: Code
        message:
          type: string
          title: Message
        request_id:
          type: string
          title: Request Id
        details:
          anyOf:
            - items:
                $ref: '#/components/schemas/ErrorDetail'
              type: array
            - type: 'null'
          title: Details
      type: object
      required:
        - code
        - message
        - request_id
      title: ErrorBody
    SequenceStepInput:
      properties:
        type:
          type: string
          enum:
            - connection_request
            - message
            - email
            - profile_visit
            - like_post
          title: Type
        name:
          anyOf:
            - type: string
              maxLength: 120
              minLength: 1
            - type: 'null'
          title: Name
        subject:
          anyOf:
            - type: string
              maxLength: 255
            - type: 'null'
          title: Subject
        body:
          anyOf:
            - type: string
              maxLength: 8000
            - type: 'null'
          title: Body
        wait_days:
          type: integer
          maximum: 365
          minimum: 0
          title: Wait Days
          default: 0
      additionalProperties: false
      type: object
      required:
        - type
      title: SequenceStepInput
    ErrorDetail:
      properties:
        field:
          anyOf:
            - type: string
            - type: 'null'
          title: Field
        message:
          type: string
          title: Message
      type: object
      required:
        - message
      title: ErrorDetail
  securitySchemes:
    ApiKey:
      type: http
      description: A workspace API key, created under Settings, API keys.
      scheme: bearer

````

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