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

# Create Campaign (v2)

> Create a campaign without requiring an agent ID upfront. Agent can be assigned later.

<Note>
  Create a campaign without specifying an agent ID. This allows you to use **different agents** for different calls within the same campaign.
</Note>

## Quick Example

```bash theme={null}
curl -X POST https://api.callkaro.ai/v2/call/campaign \
  -H "Content-Type: application/json" \
  -H "X-API-KEY: your_api_key_here" \
  -d '{
    "name": "Multi-Agent Campaign"
  }'
```

## Workflow

<Steps>
  <Step title="Create the campaign (no agent ID required)">
    ```bash theme={null}
    curl -X POST https://api.callkaro.ai/v2/call/campaign \
      -H "X-API-KEY: your_api_key_here" \
      -d '{
        "name": "Inspection Campaign"
      }'
    ```

    **Response:**

    ```json theme={null}
    {
      "batch_id": "68433b7b0dee98e59245ebab",
      "message": "Campaign created successfully",
      "status": "success"
    }
    ```
  </Step>

  <Step title="Add calls with any agent">
    Use different agents for each call:

    ```bash theme={null}
    # Call 1 - Agent A
    curl -X POST https://api.callkaro.ai/call/outbound \
      -H "X-API-KEY: your_api_key_here" \
      -d '{
        "to_number": "+919876543210",
        "batch_id": "68433b7b0dee98e59245ebab",
        "agent_id": "agent_sales_id",
        "metadata": {"name": "Customer 1"}
      }'

    # Call 2 - Agent B
    curl -X POST https://api.callkaro.ai/call/outbound \
      -H "X-API-KEY": your_api_key_here" \
      -d '{
        "to_number": "+919876543211",
        "batch_id": "68433b7b0dee98e59245ebab",
        "agent_id": "agent_support_id",
        "metadata": {"name": "Customer 2"}
      }'
    ```
  </Step>

  <Step title="Monitor in dashboard">
    Track campaign performance at `/dashboard/batch-calls/{batch_id}`
  </Step>
</Steps>

## When to Use v2

Use Campaign v2 when:

* ✅ You want to use **different agents** in the same campaign
* ✅ You don't have the agent ID ready when creating the campaign
* ✅ You need maximum flexibility

## v1 vs v2 Comparison

| Feature                  | v1 (POST /call/campaign) | v2 (POST /v2/call/campaign)       |
| ------------------------ | ------------------------ | --------------------------------- |
| Agent ID Required        | ✅ Yes                    | ❌ No                              |
| Same Agent for All Calls | ✅ Yes                    | ❌ No - Can vary                   |
| Flexibility              | Lower                    | Higher                            |
| Use Case                 | Single-agent campaigns   | Multi-agent or flexible campaigns |

<Info>
  **💡 Recommended**: Use v2 for new integrations unless you specifically need all calls to share the same agent.
</Info>

## Response

### Success (200 OK)

```json theme={null}
{
  "batch_id": "68433b7b0dee98e59245ebab",
  "message": "Campaign created successfully",
  "status": "success"
}
```

Save the `batch_id` - you'll need it to add calls to this campaign!

## Tips

<Tip>
  **Maximum flexibility**: v2 gives you the freedom to assign any agent to any call within the campaign, making it ideal for complex workflows.
</Tip>

<Tip>
  **No upfront planning**: Create campaigns first, assign agents later based on your business logic or customer needs.
</Tip>


## OpenAPI

````yaml POST /v2/call/campaign
openapi: 3.1.0
info:
  title: CallKaro AI API
  description: Campaign and outbound call management API for CallKaro AI voice agents
  version: 1.0.0
  contact:
    name: CallKaro AI Support
    email: support@callkaro.ai
    url: https://callkaro.ai
servers:
  - url: https://api.callkaro.ai
    description: Production server
security:
  - ApiKeyAuth: []
paths:
  /v2/call/campaign:
    post:
      tags:
        - Endpoints
      summary: Create Campaign (v2)
      description: >-
        Create a campaign without requiring an agent ID upfront. Agent can be
        assigned later.
      operationId: createCampaignV2
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CampaignV2Request'
            example:
              name: Inspection Campaign
      responses:
        '200':
          description: Campaign created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CampaignResponse'
              example:
                batch_id: 68433b7b0dee98e59245ebab
                message: Campaign created successfully
                status: success
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden - Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    CampaignV2Request:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: Campaign name for identification and organization
          example: Inspection Campaign
          minLength: 1
          maxLength: 200
    CampaignResponse:
      type: object
      properties:
        batch_id:
          type: string
          description: Unique identifier for the created campaign
          example: 68433b7b0dee98e59245ebab
        message:
          type: string
          example: Campaign created successfully
        status:
          type: string
          example: success
    ErrorResponse:
      type: object
      properties:
        status:
          type: string
          example: error
        message:
          type: string
          description: Error description
          example: 'Missing required field: to_number'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
      description: API key from https://callkaro.ai/dashboard/api-key

````