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

# Create Campaign

> Create a new outbound campaign.

Use this endpoint to **create a new campaign**.

## Endpoint

**POST** `/create-campaign`

**Content-Type:** `application/json`
**Authentication:** Required (workspace auth)

## Request Body

```json theme={null}
{
  "agent_id": 123,
  "campaign_name": "Winter Sale Campaign",
  "description": "Outbound calls to promote winter offers",
  "start_date": "2025-12-01",
  "end_date": "2025-12-31",
  "max_retry": 3,
  "max_delay": "{\"d\":1,\"h\":2,\"m\":30}"
}
```

### Notes

* All fields (`agent_id`, `campaign_name`, `description`, `start_date`, `end_date`, `max_retry`) are **required**.
* `campaign_name` **must be unique** within a workspace.
* `max_retry` cannot be greater than **50**.
* `max_delay` is **required** when `max_retry` is greater than **1**. It must be passed as a **JSON string** (not an object) with keys `d` (days), `h` (hours), and `m` (minutes) as numbers. Example: `"{\"d\":1,\"h\":2,\"m\":30}"`.
* `start_date` and `end_date` must be in **`YYYY-MM-DD`** format (e.g., `"2025-12-01"`).

## Example cURL

```bash theme={null}
curl -X POST https://www.tryunleashx.com/api/v1/global/create-campaign \
  -H "Content-Type: application/json" \
  -H "Authorization: <api_key>" \
  -d '{
    "agent_id": 123,
    "campaign_name": "Winter Sale Campaign",
    "description": "Outbound calls to promote winter offers",
    "start_date": "2025-12-01",
    "end_date": "2025-12-31",
    "max_retry": 3,
    "max_delay": "{\"d\":1,\"h\":2,\"m\":30}"
  }'
```


## OpenAPI

````yaml api-reference/openapi.json POST /create-campaign
openapi: 3.1.0
info:
  title: >-
    UnleashX - Build human like conversations | Voice Agents | Automations | AI
    Workforce
  version: 1.0.0
  description: UnleashX - Your home for human like conversations
servers:
  - url: https://www.tryunleashx.com/api/v1/global/
security:
  - bearerAuth: []
paths:
  /create-campaign:
    post:
      tags:
        - Campaigns
      summary: Create campaign
      description: Create a new outbound campaign.
      parameters:
        - name: token
          in: header
          required: true
          description: API token for authentication
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                agent_id:
                  type: integer
                  description: Voice agent to use for this campaign
                campaign_name:
                  type: string
                  description: Name of the campaign. Must be unique within a workspace.
                description:
                  type: string
                  description: Description of the campaign
                start_date:
                  type: string
                  format: date
                  description: Campaign start date in YYYY-MM-DD format (e.g. 2025-12-01)
                end_date:
                  type: string
                  format: date
                  description: Campaign end date in YYYY-MM-DD format (e.g. 2025-12-31)
                max_retry:
                  type: integer
                  minimum: 1
                  maximum: 50
                  description: Maximum number of retry attempts (cannot be greater than 50)
                max_delay:
                  type: string
                  description: >-
                    Delay between retries as a JSON string. Required when
                    max_retry > 1. Keys: d (days), h (hours), m (minutes) with
                    numeric values. Example: {"d":1,"h":2,"m":30}
              required:
                - agent_id
                - campaign_name
                - description
                - start_date
                - end_date
                - max_retry
              if:
                properties:
                  max_retry:
                    minimum: 2
                required:
                  - max_retry
              then:
                required:
                  - max_delay
      responses:
        '200':
          description: Campaign created successfully
        '400':
          description: >-
            Bad Request - validation failed or business rule violated (e.g.,
            max_retry > 50, missing required fields when publishing, duplicate
            campaign name in workspace)
      security: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````