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

# Adding Leads to a Campaign

## Adding Leads

<Tabs>
  <Tab title="API" icon="binary">
    <Info>
      Adding leads to an active campaign will take up to 5 minutes for the leads to get synced.

      This ensures that there is no interruption to the campaigns sending.
    </Info>

    ### Adding leads from existing list

    Send a `POST` request to the [following endpoint](https://dedi.emailbison.com/api/reference#tag/campaigns/post/api/campaigns/\{campaign_id}/leads/attach-lead-list).

    ```bash theme={null}
    /api/campaigns/{campaign_id}/leads/attach-lead-list
    ```

    The request takes 1 required body parameter:

    <ParamField body="lead_list_id" type="integer" required>
      The ID of the lead list to add
    </ParamField>

    An example of this request:

    <CodeGroup>
      ```bash curl theme={null}
      curl 'https://dedi.emailbison.com/api/campaigns/6/leads/attach-lead-list' \
        --request POST \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
        --data '{
        "lead_list_id": 1
      }'
      ```

      ```JavaScript JavaScript theme={null}
      fetch('https://dedi.emailbison.com/api/campaigns/6/leads/attach-lead-list', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer YOUR_SECRET_TOKEN'
        },
        body: JSON.stringify({
          lead_list_id: 1
        })
      })
      ```

      ```Python Python theme={null}
      headers = {
          'Content-Type': 'application/json',
          'Authorization': 'Bearer YOUR_SECRET_TOKEN',
      }

      json_data = {
          'lead_list_id': 1,
      }

      response = requests.post(
          'https://dedi.emailbison.com/api/campaigns/6/leads/attach-lead-list',
          headers=headers,
          json=json_data,
      )
      ```
    </CodeGroup>

    ### Adding leads by their IDs

    You can also add individual leads to a campiagn using the lead IDs.

    Send a `POST` request to the [following endpoint](https://dedi.emailbison.com/api/reference#tag/campaigns/post/api/campaigns/\{campaign_id}/leads/attach-leads).

    ```bash theme={null}
    /api/campaigns/{campaign_id}/leads/attach-leads
    ```

    The request takes 1 required body parameter:

    <ParamField body="lead_ids" type="array" required>
      An array containing the IDs of the leads to add
    </ParamField>

    An example of this request:

    <CodeGroup>
      ```bash curl theme={null}
      curl 'https://dedi.emailbison.com/api/campaigns/6/leads/attach-leads' \
        --request POST \
        --header 'Content-Type: application/json' \
        --header 'Authorization: Bearer YOUR_SECRET_TOKEN' \
        --data '{
        "lead_ids": [1,2,3]
      }'
      ```

      ```JavaScript JavaScript theme={null}
      fetch('https://dedi.emailbison.com/api/campaigns/6/leads/attach-leads', {
        method: 'POST',
        headers: {
          'Content-Type': 'application/json',
          Authorization: 'Bearer YOUR_SECRET_TOKEN'
        },
        body: JSON.stringify({
          lead_ids: [1, 2, 3]
        })
      })
      ```

      ```Python Python theme={null}
      headers = {
          'Content-Type': 'application/json',
          'Authorization': 'Bearer YOUR_SECRET_TOKEN',
      }

      json_data = {
          'lead_ids': [1,2,3,],
      }

      response = requests.post('https://dedi.emailbison.com/api/campaigns/6/leads/attach-leads', headers=headers, json=json_data)
      ```
    </CodeGroup>
  </Tab>

  <Tab title="UI" icon="browser">
    Navigate to `Campaigns`.

    Click on the campaign you want to add leads to.

    Click the `Actions` dropdown and click `Add more contacts`.
  </Tab>
</Tabs>
