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

# Create Campaign

Create a new campaign for automated outreach. The campaign starts in `draft` status and must be started separately.

### Request Body

| Field                       | Type    | Required | Description                           |
| --------------------------- | ------- | -------- | ------------------------------------- |
| `name`                      | string  | Yes      | Campaign name (1-200 characters)      |
| `description`               | string  | No       | Campaign description                  |
| `campaign_type`             | string  | Yes      | Type: `call`, `sms`, or `mixed`       |
| `assistant_id`              | integer | Yes      | ID of the assistant to use            |
| `welcome_message_template`  | string  | No       | Template for welcome message          |
| `agenda_template`           | string  | No       | Template for call agenda              |
| `end_call_message_template` | string  | No       | Template for end call message         |
| `sms_message_template`      | string  | No       | Template for SMS content              |
| `fallback_values`           | object  | No       | Fallback values for missing variables |
| `max_attempts`              | integer | No       | Max retry attempts (default: 3)       |
| `retry_delay_minutes`       | integer | No       | Delay between retries (default: 30)   |

### Template Variables

Templates support Jinja2-style variables:

* `{{name}}` - Contact's name
* `{{company}}` - Contact's company
* `{{assistant_name}}` - Your assistant's name
* Any custom field from imported contacts

### Example Request

```json Request Body theme={null}
{
  "name": "February Appointment Reminders",
  "description": "Reminder calls for February appointments",
  "campaign_type": "call",
  "assistant_id": 123,
  "welcome_message_template": "Hi {{name|title_case}}, this is {{assistant_name}} calling from {{company}}.",
  "agenda_template": "I'm calling to remind you about your appointment on {{appointment_date}}.",
  "end_call_message_template": "Thank you for your time, {{name}}. Have a great day!",
  "fallback_values": {
    "name": "there",
    "company": "our office"
  },
  "max_attempts": 3,
  "retry_delay_minutes": 60
}
```

### Response

```json Response theme={null}
{
  "id": 42,
  "name": "February Appointment Reminders",
  "description": "Reminder calls for February appointments",
  "campaign_type": "call",
  "status": "draft",
  "assistant_id": 123,
  "welcome_message_template": "Hi {{name|title_case}}, this is {{assistant_name}} calling from {{company}}.",
  "agenda_template": "I'm calling to remind you about your appointment on {{appointment_date}}.",
  "end_call_message_template": "Thank you for your time, {{name}}. Have a great day!",
  "sms_message_template": null,
  "fallback_values": {
    "name": "there",
    "company": "our office"
  },
  "variable_mappings": {},
  "available_variables": [],
  "max_attempts": 3,
  "retry_delay_minutes": 60,
  "total_contacts": 0,
  "completed_contacts": 0,
  "failed_contacts": 0,
  "created_at": "2024-02-01T10:00:00Z",
  "updated_at": "2024-02-01T10:00:00Z"
}
```

### Example Code

```bash cURL theme={null}
curl -X POST "https://api.burki.dev/api/v1/campaigns" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "February Appointment Reminders",
    "campaign_type": "call",
    "assistant_id": 123,
    "welcome_message_template": "Hi {{name}}, this is {{assistant_name}}."
  }'
```

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

response = requests.post(
    "https://api.burki.dev/api/v1/campaigns",
    headers={"Authorization": "Bearer YOUR_API_KEY"},
    json={
        "name": "February Appointment Reminders",
        "campaign_type": "call",
        "assistant_id": 123,
        "welcome_message_template": "Hi {{name}}, this is {{assistant_name}}."
    }
)

campaign = response.json()
print(f"Created campaign ID: {campaign['id']}")
```

```javascript JavaScript theme={null}
const response = await fetch("https://api.burki.dev/api/v1/campaigns", {
  method: "POST",
  headers: {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
  },
  body: JSON.stringify({
    name: "February Appointment Reminders",
    campaign_type: "call",
    assistant_id: 123,
    welcome_message_template: "Hi {{name}}, this is {{assistant_name}}."
  })
});

const campaign = await response.json();
console.log(`Created campaign ID: ${campaign.id}`);
```

### Next Steps

After creating a campaign:

1. **Import contacts** using the import-data endpoint
2. **Configure scheduling** using the schedule endpoint
3. **Start the campaign** using the start endpoint
