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

# Create a Campaign

> Create a new campaign from scratch

### Headers

<ParamField header="Authorization" type="string" required>
  Your API key for authentication. Prefix with `Bearer `.
</ParamField>

<ParamField header="x-access-token" type="string" required>
  Your access token for authentication.
</ParamField>

### Body

<ParamField body="campaign_name" type="string" required>
  The name of the campaign to be created (e.g., "Demo Campaign").
</ParamField>

<ParamField body="agent_id" type="string" required>
  The ID of the agent associated with the campaign (e.g., "25e57eca-5582-4ba7-849c-xxxx").
</ParamField>

<ParamField body="workflow_id" type="string" required>
  The workflow ID linked to the campaign (e.g., "291069c3-d653-479c-97f9-xxxx").
</ParamField>

<ParamField body="max_duration" type="number" required>
  Maximum duration in seconds for each interaction in the campaign (e.g., 300).
</ParamField>

<ParamField body="schema_analysis" type="string[]" optional>
  A list of schema analysis items to evaluate during the campaign (e.g., \["did the human answer?"]).
</ParamField>

<ParamField body="model" type="string" required>
  The AI model used in the campaign (e.g., "Claude 3 Haiku").
</ParamField>

<ParamField body="transfer_numbers" type="object" optional>
  Key-value pairs of labels and phone numbers for call transfers.
</ParamField>

<ParamField body="is_draft" type="boolean" optional>
  Indicates whether the campaign is in draft state (e.g., true).
</ParamField>

<ParamField body="voice_mail" type="string" optional>
  Voicemail message or reference; null if not set.
</ParamField>

<ParamField body="dynamic_data" type="object" optional>
  Dynamic key-value pairs used within the campaign; null if not set.
</ParamField>

<ParamField body="webhooks" type="object" optional>
  Webhook configurations for the campaign; null if not set.
</ParamField>

### Request Example

```json theme={null}
{
    "campaign_name": "demo_campaign",
    "agent_id": "AGENT_ID_HERE",
    "workflow_id": "WORKFLOW_ID_HERE",
    "max_duration": 300,
    "schema_analysis": [
        "did the human answer?"
    ],
    "model": "Claude 3 Haiku",
    "transfer_numbers": {
        "test": "PHONE_NUMBER_HERE"
    },
    "webhooks": [],
    "contacts": [
        "CONTACT_ID_HERE"
    ],
    "dialers": [
        "DIALER_ID_HERE"
    ]
}
```

### Response

<ResponseField name="message" type="string">
  Status of the request in the form of a short message.
</ResponseField>

<ResponseField name="data" type="object[]">
  List of the created campaign objects, each including a unique `id`.
</ResponseField>

<ResponseExample>
  ```json Response theme={null}
  {
      "responseCode": 2000,
      "message": "Compaign created successfully",
      "data": {
          "campaign_name": "demo_campaign",
          "agent_id": "AGENT_ID_HERE",
          "workflow_id": "WORKFLOW_ID_HERE",
          "max_duration": 300,
          "schema_analysis": [
              "did the human answer?"
          ],
          "model": "Claude 3 Haiku",
          "transfer_numbers": {
              "test": "PHONE_NUMBER_HERE"
          },
          "user_id": "USER_ID_HERE",
          "is_draft": true,
          "voice_mail": null,
          "dynamic_data": null,
          "webhooks": null,
          "ml_campaign_id": null,
          "status": null,
          "state": null,
          "id": "CAMPAIGN_ID_HERE",
          "created_at": "2025-08-05T07:29:59.422Z",
          "updated_at": "2025-08-05T07:29:59.422Z"
      }
  }
  ```
</ResponseExample>
