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

# Add Leads to Campaign

> Add new leads to a campaign with validation and deduplication

<Note>
  Max 400 leads per request. Validates against block lists and duplicates. Returns added/skipped counts with reasons.
</Note>

## Path Parameters

<ParamField path="campaign_id" type="number" required>
  The ID of the campaign to add leads to
</ParamField>

## Query Parameters

<ParamField query="api_key" type="string" required>
  Your SmartLead API key
</ParamField>

## Request Body

<ParamField body="lead_list" type="array" required>
  Array of lead objects to add (maximum 400 leads per request)

  <Expandable title="Lead Object">
    <ParamField body="email" type="string" required>
      Lead's email address
    </ParamField>

    <ParamField body="first_name" type="string">
      Lead's first name
    </ParamField>

    <ParamField body="last_name" type="string">
      Lead's last name
    </ParamField>

    <ParamField body="phone_number" type="string">
      Lead's phone number
    </ParamField>

    <ParamField body="company_name" type="string">
      Company name
    </ParamField>

    <ParamField body="website" type="string">
      Company website
    </ParamField>

    <ParamField body="location" type="string">
      Lead's location
    </ParamField>

    <ParamField body="linkedin_profile" type="string">
      LinkedIn profile URL
    </ParamField>

    <ParamField body="company_url" type="string">
      Company URL
    </ParamField>

    <ParamField body="custom_fields" type="object">
      Custom fields for personalization (maximum 200 key-value pairs per lead)
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="settings" type="object">
  Lead import settings

  <Expandable title="Settings">
    <ParamField body="ignore_global_block_list" type="boolean" default="false">
      Skip global block list validation
    </ParamField>

    <ParamField body="ignore_unsubscribe_list" type="boolean" default="false">
      Include previously unsubscribed leads
    </ParamField>

    <ParamField body="ignore_duplicate_leads_in_other_campaign" type="boolean" default="false">
      Allow same lead in multiple campaigns
    </ParamField>

    <ParamField body="ignore_community_bounce_list" type="boolean" default="false">
      Skip community bounce list check
    </ParamField>
  </Expandable>
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://server.smartlead.ai/api/v1/campaigns/123/leads?api_key=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "lead_list": [
        {
          "email": "john@example.com",
          "first_name": "John",
          "last_name": "Doe",
          "company_name": "Acme Corp",
          "custom_fields": {
            "job_title": "CEO"
          }
        }
      ]
    }'
  ```

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

  API_KEY = "YOUR_API_KEY"
  campaign_id = 123

  payload = {
      "lead_list": [
          {
              "email": "john@example.com",
              "first_name": "John",
              "last_name": "Doe",
              "company_name": "Acme Corp",
              "custom_fields": {
                  "job_title": "CEO"
              }
          }
      ]
  }

  response = requests.post(
      f"https://server.smartlead.ai/api/v1/campaigns/{campaign_id}/leads",
      params={"api_key": API_KEY},
      json=payload
  )

  result = response.json()
  print(f"Added: {result.get('added_count', 0)}, Skipped: {result.get('skipped_count', 0)}")
  ```

  ```javascript JavaScript theme={null}
  const API_KEY = 'YOUR_API_KEY';
  const campaignId = 123;

  const payload = {
    lead_list: [
      {
        email: 'john@example.com',
        first_name: 'John',
        last_name: 'Doe',
        company_name: 'Acme Corp',
        custom_fields: {
          job_title: 'CEO'
        }
      }
    ]
  };

  const response = await fetch(
    `https://server.smartlead.ai/api/v1/campaigns/${campaignId}/leads?api_key=${API_KEY}`,
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload)
    }
  );

  const result = await response.json();
  console.log(`Added: ${result.added_count}, Skipped: ${result.skipped_count}`);
  ```
</RequestExample>

## Response Codes

<ResponseField name="200" type="Success">
  Leads added successfully
</ResponseField>

<ResponseField name="400" type="Bad Request">
  Invalid request parameters or malformed request body
</ResponseField>

<ResponseField name="401" type="Unauthorized">
  Invalid or missing API key
</ResponseField>

<ResponseField name="404" type="Not Found">
  Campaign not found or no access
</ResponseField>

<ResponseField name="422" type="Validation Error">
  Lead validation failed - check email format, required fields
</ResponseField>

<ResponseField name="429" type="Rate Limit Exceeded">
  Too many requests
</ResponseField>

<ResponseField name="500" type="Internal Server Error">
  Server error occurred
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "message": "Leads added successfully",
    "added_count": 1,
    "skipped_count": 0,
    "skipped_leads": []
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "message": "Invalid API Key"
  }
  ```

  ```json 422 - Validation Error theme={null}
  {
    "error": "Invalid email format for john@invalid"
  }
  ```
</ResponseExample>

## Related Endpoints

* [Get Campaign Leads](/api-reference/leads/get-by-campaign)
* [Update Lead](/api-reference/leads/update)
* [Delete Lead](/api-reference/leads/delete)
