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

# Create Campaign

> Creates a new outreach campaign

## Overview

Create a new LinkedIn outreach campaign with AI-powered automation. This endpoint sets up a complete campaign with specified products, prompts, and agents, ready to start prospecting.

## Use Cases

* **New Product Launch**: Create campaigns for new product introductions
* **Market Expansion**: Set up campaigns for new geographic markets
* **Seasonal Campaigns**: Launch time-sensitive promotional campaigns
* **A/B Testing**: Create multiple campaigns to test different approaches
* **Delayed Launch**: Create campaigns early (with `preventAutoStart: true`), upload leads, and launch later when ready

## Key Features

* **AI-Powered Messaging**: Automated message generation using specified prompts
* **Smart Qualification**: Automatic prospect qualification based on responses
* **Agent Assignment**: Dedicated LinkedIn agents for authentic outreach
* **Performance Tracking**: Built-in analytics and conversion tracking
* **Prevent Auto-Start**: Optionally keep campaigns paused through lead uploads until you manually resume

## Testing Example

```bash theme={null}
curl -X POST "https://api.kakiyo.com/v1/campaigns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Q4 Enterprise Outreach",
    "productId": "prod_123456789",
    "promptId": "prompt_987654321",
    "agentId": "agent_abcdef123456",
    "variables": {
      "company_name": "Your Company",
      "value_proposition": "20% increase in sales efficiency"
    }
  }'

# Create a campaign that stays paused until manually resumed
curl -X POST "https://api.kakiyo.com/v1/campaigns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Delayed Launch Campaign",
    "productId": "prod_123456789",
    "promptId": "prompt_987654321",
    "agentId": "agent_abcdef123456",
    "variables": {},
    "preventAutoStart": true
  }'
```

```javascript theme={null}
// JavaScript/Node.js
const createCampaign = async (campaignData) => {
  const response = await fetch('https://api.kakiyo.com/v1/campaigns', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify(campaignData)
  });

  return await response.json();
};

// Usage example
// Create campaign (starts active immediately)
const newCampaign = await createCampaign({
  name: 'Q4 Enterprise Outreach',
  productId: 'prod_123456789',
  promptId: 'prompt_987654321',
  agentId: 'agent_abcdef123456',
  variables: {
    company_name: 'Your Company',
    value_proposition: '20% increase in sales efficiency'
  }
});

// Create campaign that stays paused until manually resumed
const delayedCampaign = await createCampaign({
  name: 'Delayed Launch Campaign',
  productId: 'prod_123456789',
  promptId: 'prompt_987654321',
  agentId: 'agent_abcdef123456',
  variables: {},
  preventAutoStart: true
});

console.log('Campaign Created:', newCampaign);
```

```python theme={null}
# Python
import requests

def create_campaign(campaign_data):
    """Create a new LinkedIn outreach campaign"""
    response = requests.post(
        'https://api.kakiyo.com/v1/campaigns',
        json=campaign_data,
        headers={
            'Authorization': 'Bearer YOUR_API_KEY',
            'Content-Type': 'application/json'
        }
    )

    return response.json()

# Usage example
campaign_data = {
    'name': 'Q4 Enterprise Outreach',
    'productId': 'prod_123456789',
    'promptId': 'prompt_987654321',
    'agentId': 'agent_abcdef123456',
    'variables': {
        'company_name': 'Your Company',
        'value_proposition': '20% increase in sales efficiency'
    }
}

result = create_campaign(campaign_data)
print('Campaign Created:', result)

# Create campaign that stays paused until manually resumed
delayed_campaign = create_campaign({
    'name': 'Delayed Launch Campaign',
    'productId': 'prod_123456789',
    'promptId': 'prompt_987654321',
    'agentId': 'agent_abcdef123456',
    'variables': {},
    'preventAutoStart': True
})
print('Delayed Campaign:', delayed_campaign)
```

## Prevent Auto-Start

By default, campaigns become active immediately and start outreach as soon as leads are uploaded. If you need to build campaigns ahead of time and launch later:

1. Set `preventAutoStart: true` when creating the campaign
2. Upload your leads — the campaign stays paused
3. When ready, call `POST /campaigns/{id}/resume` to activate

Resuming also clears the `preventAutoStart` flag, so subsequent uploads behave normally.

## Best Practices

1. **Descriptive Names**: Use clear, descriptive campaign names
2. **Variable Planning**: Define all necessary variables before campaign creation
3. **Agent Capacity**: Ensure assigned agents have available capacity
4. **Testing**: Create test campaigns before launching to large prospect lists
5. **Delayed Launch**: Use `preventAutoStart: true` for campaigns you want to prepare in advance

## Next Steps

After creating a campaign:

1. **Add Prospects**: Use `/prospects` or `/prospects/batch` endpoints
2. **Monitor Performance**: Check campaign analytics regularly
3. **Optimize Settings**: Adjust qualification thresholds based on results
4. **Scale Gradually**: Start with smaller prospect lists and scale up


## OpenAPI

````yaml POST /campaigns
openapi: 3.1.0
info:
  title: Kakiyo API
  description: API for automating LinkedIn outreach campaigns with AI-powered conversations
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.kakiyo.com/v1
security:
  - bearerAuth: []
paths:
  /campaigns:
    post:
      summary: Create Campaign
      description: Creates a new outreach campaign
      operationId: createCampaign
      requestBody:
        description: Campaign to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateCampaignRequest'
        required: true
      responses:
        '201':
          description: Campaign created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: campaign_12345abcde
                  name:
                    type: string
                    example: Q2 Sales Outreach
                  status:
                    type: string
                    example: active
                  preventAutoStart:
                    type: boolean
                    example: false
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Authentication failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden - limit reached
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    CreateCampaignRequest:
      type: object
      required:
        - name
        - productId
        - promptId
        - agentId
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 100
          example: Q2 Sales Outreach
        productId:
          type: string
          example: prod_123456789
        promptId:
          type: string
          example: prompt_987654321
        agentId:
          type: string
          example: agent_abcdef123456
        qualificationAutomatic:
          type: integer
          minimum: 0
          maximum: 100
          default: 70
          example: 75
        qualificationVerification:
          type: integer
          minimum: 0
          maximum: 100
          default: 50
          example: 50
        variables:
          type: object
          example:
            companyValue: Our AI-powered sales enablement platform
            painPoint: low response rates on cold outreach
            benefit: 3x more qualified meetings
        preventAutoStart:
          type: boolean
          default: false
          description: >-
            If true, campaign starts paused and stays paused after lead uploads
            until manually resumed. Defaults to false (immediate
            auto-activation).
          example: false
    Error:
      type: object
      properties:
        error:
          type: string
          example: validation_error
        message:
          type: string
          example: The request parameters failed validation
        details:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                example: name
              message:
                type: string
                example: The name field is required
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````