Skip to Content
CallMitraDocs
API referenceCampaigns

Create a campaign with its leads

The usual way to start: one request creates the campaign and adds or creates its leads. Start it with `POST /campaigns/{campaign_id}/start`, or send `campaignData.isActive: true` to start it right away (the same checks as start apply).

POST
/api/v1/campaigns/create-with-leads

The usual way to start: one request creates the campaign and adds or creates its leads. Start it with POST /campaigns/{campaign_id}/start, or send campaignData.isActive: true to start it right away (the same checks as start apply).

Authorization

headerX-API-Key<token>

Create in the console: Settings → API & webhooks.

Header Parameters

Idempotency-Key?string

Any unique string up to 255 characters. Retrying with the same key and body within 24 hours returns the first result instead of acting twice.

Lengthlength <= 255

Request Body

application/json
  1. body

A new campaign plus the leads to put on it.

campaignData?|

The campaign. name and agentId are required.

copySettingsFromCampaignId?Copysettingsfromcampaignid

Start from another campaign's settings and webhook; campaignData.settings overrides them.

Formatuuid
leadSourceType?Leadsourcetype

bulk_upload creates the leads in uploadedLeads; existing_leads adds leads you already have. Optional only for a catch-all inbound campaign.

Value in"bulk_upload""existing_leads"
selectedLeadIds?array<>

With existing_leads: IDs of leads to add.

selectedLeadSourceIds?array<>

With existing_leads: add every lead of these sources (used when no lead IDs are given).

uploadedLeads?array<>|

With bulk_upload: the leads to create. Repeated numbers are added once.

[key: string]?any

Response Body

OK

application/json
  1. response

The new campaign's ID and how many leads it holds.

campaignId?|

ID of the new campaign.

message?|

Human-readable confirmation.

processedLeads?|

Leads added to the campaign.

success?|

Always true.

[key: string]?any
Example Request
curl -X POST 'https://api.callmitra.ai/api/v1/campaigns/create-with-leads' \  -H 'Content-Type: application/json' \  -d '{  "campaignData": {    "agentId": "9a8b7c6d-5e4f-4a3b-2c1d-0e9f8a7b6c5d",    "name": "December renewals",    "settings": {      "maxCallsPerDay": 200    }  },  "leadSourceType": "bulk_upload",  "uploadedLeads": [    {      "attributes": {        "city": "Pune"      },      "name": "Asha Rao",      "phone": "+919876543210"    }  ]}'
Example Response
{  "campaignId": "3f6c1b2a-7d4e-4a1b-9c2d-5e6f7a8b9c0d",  "message": "Campaign created",  "processedLeads": 1,  "success": true}