# POST /campaigns/send-to-list — Send Campaign to Lists

> Product: **Pabbly Email Marketing** (v2)
> Base URL: `https://emails.pabbly.com/api/v2`
> Auth: Bearer via `Authorization` header
> Canonical: `/email-marketing/campaigns/send-campaign-to-lists`

The token must be included in the Authorization header as a Bearer token. The campaign must exist, belong to your business, and have a status of "live". The specified lists/segments must exist in your account. Sends a campaign to all active subscribers in one or more subscriber lists or segments using the campaign's template. Supports advanced filtering with included lists (required) and excluded lists (optional). Subscribers must have status "subscribed", not be deleted, and not be suppressed. The endpoint processes emails asynchronously in the background and returns immediately. Emails are queued in batches to handle large lists efficiently. Supports both regular subscriber lists and segments. Duplicate email addresses across multiple lists are automatically deduplicated.

**Body parameters:**

| Name | Type | Required | Description |
|------|------|----------|-------------|
| campaignId | string | No |  |
| includedList | array | No |  |
| excludedList | array | No |  |
| deliveryServerId | string | No |  |
| senderEmail | string | No |  |
| fromName | string | No |  |
| subject | string | No |  |

**Example request body:**

```json
{
    "campaignId": "507f1f77bcf86cd799439011",
    "includedList": [
      { "listName": "All Subscribers" },
      { "listName": "VIP Customers" }
    ],
    "excludedList": [
      { "listName": "Unsubscribed" }
    ],
    "deliveryServerId": "server123",
    "senderEmail": "noreply@example.com",
    "fromName": "John Doe",
    "subject": "Special Offer for You"
}
```

**Response (200)** — Campaign Send to Lists:

```json
{
    "success": true,
    "status": "success",
    "message": "Email sending initiated successfully",
    "data": {
        "campaignId": "693a741cb1dd9aa1a3c770eb",
        "campaignName": "Sarah Mcgowan",
        "includedList": [
            "pem-dev"
        ],
        "excludedList": [],
        "totalSubscribers": 6,
        "message": "6 email(s) are being queued in the background. Processing may take a few minutes.",
        "note": "Emails are being processed asynchronously. Check campaign status for delivery updates."
    }
}
```

**Code examples:**

_cURL_

```curl
curl -X POST https://emails.pabbly.com/api/v2/campaigns/send-to-list \
  -H "Authorization: Bearer {{YOUR_API_KEY}}" \
  -H "Content-Type: application/json" \
  -d '{
    "campaignId": "507f1f77bcf86cd799439011",
    "includedList": [
      {
        "listName": "All Subscribers"
      },
      {
        "listName": "VIP Customers"
      }
    ],
    "excludedList": [
      {
        "listName": "Unsubscribed"
      }
    ],
    "deliveryServerId": "server123",
    "senderEmail": "noreply@example.com",
    "fromName": "John Doe",
    "subject": "Special Offer for You"
  }'
```

_Ruby_

```ruby
require 'net/http'
require 'json'

uri = URI('https://emails.pabbly.com/api/v2/campaigns/send-to-list')
request = Net::HTTP::Post.new(uri)
request['Authorization'] = 'Bearer {{YOUR_API_KEY}}'
request['Content-Type'] = 'application/json'
request.body = "{\"campaignId\":\"507f1f77bcf86cd799439011\",\"includedList\":[{\"listName\":\"All Subscribers\"},{\"listName\":\"VIP Customers\"}],\"excludedList\":[{\"listName\":\"Unsubscribed\"}],\"deliveryServerId\":\"server123\",\"senderEmail\":\"noreply@example.com\",\"fromName\":\"John Doe\",\"subject\":\"Special Offer for You\"}"

response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == 'https') do |http|
  http.request(request)
end

data = JSON.parse(response.body)
```

_Python_

```python
import requests

response = requests.post(
    'https://emails.pabbly.com/api/v2/campaigns/send-to-list',
    headers={'Authorization': 'Bearer {{YOUR_API_KEY}}'},
    json={
    'campaignId': '507f1f77bcf86cd799439011',
    'includedList': [
        {
            'listName': 'All Subscribers'
        },
        {
            'listName': 'VIP Customers'
        }
    ],
    'excludedList': [
        {
            'listName': 'Unsubscribed'
        }
    ],
    'deliveryServerId': 'server123',
    'senderEmail': 'noreply@example.com',
    'fromName': 'John Doe',
    'subject': 'Special Offer for You'
},
)

data = response.json()
```

_PHP_

```php
<?php
$ch = curl_init('https://emails.pabbly.com/api/v2/campaigns/send-to-list');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer {{YOUR_API_KEY}}', 'Content-Type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, '{"campaignId":"507f1f77bcf86cd799439011","includedList":[{"listName":"All Subscribers"},{"listName":"VIP Customers"}],"excludedList":[{"listName":"Unsubscribed"}],"deliveryServerId":"server123","senderEmail":"noreply@example.com","fromName":"John Doe","subject":"Special Offer for You"}');

$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
```

_Java_

```java
import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

HttpClient client = HttpClient.newHttpClient();
HttpRequest.Builder builder = HttpRequest.newBuilder()
    .uri(URI.create("https://emails.pabbly.com/api/v2/campaigns/send-to-list"))
    .header("Authorization", "Bearer {{YOUR_API_KEY}}")
    .header("Content-Type", "application/json")
    .method("POST", HttpRequest.BodyPublishers.ofString("{\"campaignId\":\"507f1f77bcf86cd799439011\",\"includedList\":[{\"listName\":\"All Subscribers\"},{\"listName\":\"VIP Customers\"}],\"excludedList\":[{\"listName\":\"Unsubscribed\"}],\"deliveryServerId\":\"server123\",\"senderEmail\":\"noreply@example.com\",\"fromName\":\"John Doe\",\"subject\":\"Special Offer for You\"}"));

HttpRequest request = builder.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

_Node.js_

```node
const response = await fetch('https://emails.pabbly.com/api/v2/campaigns/send-to-list', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer {{YOUR_API_KEY}}',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "campaignId": "507f1f77bcf86cd799439011",
    "includedList": [
      {
        "listName": "All Subscribers"
      },
      {
        "listName": "VIP Customers"
      }
    ],
    "excludedList": [
      {
        "listName": "Unsubscribed"
      }
    ],
    "deliveryServerId": "server123",
    "senderEmail": "noreply@example.com",
    "fromName": "John Doe",
    "subject": "Special Offer for You"
  }),
});

const data = await response.json();
```

_Go_

```go
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    payload := strings.NewReader("{\"campaignId\":\"507f1f77bcf86cd799439011\",\"includedList\":[{\"listName\":\"All Subscribers\"},{\"listName\":\"VIP Customers\"}],\"excludedList\":[{\"listName\":\"Unsubscribed\"}],\"deliveryServerId\":\"server123\",\"senderEmail\":\"noreply@example.com\",\"fromName\":\"John Doe\",\"subject\":\"Special Offer for You\"}")
    req, _ := http.NewRequest("POST", "https://emails.pabbly.com/api/v2/campaigns/send-to-list", payload)
    req.Header.Set("Content-Type", "application/json")
    req.Header.Set("Authorization", "Bearer {{YOUR_API_KEY}}")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}
```

_.NET_

```dotnet
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://emails.pabbly.com/api/v2/campaigns/send-to-list");
request.Headers.TryAddWithoutValidation("Authorization", "Bearer {{YOUR_API_KEY}}");
request.Content = new StringContent("{\"campaignId\":\"507f1f77bcf86cd799439011\",\"includedList\":[{\"listName\":\"All Subscribers\"},{\"listName\":\"VIP Customers\"}],\"excludedList\":[{\"listName\":\"Unsubscribed\"}],\"deliveryServerId\":\"server123\",\"senderEmail\":\"noreply@example.com\",\"fromName\":\"John Doe\",\"subject\":\"Special Offer for You\"}");
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");

var response = await client.SendAsync(request);
var data = await response.Content.ReadAsStringAsync();
Console.WriteLine(data);
```

---

**Other endpoints in Campaigns:**

- [POST /campaigns — Create Campaign](/email-marketing/campaigns/create-campaign)
- [GET /campaigns — Get All Campaigns](/email-marketing/campaigns/get-all-campaigns)
- [GET /campaigns/{Campaign ID} — Get Campaign by ID](/email-marketing/campaigns/get-campaign-by-id)
- [POST /campaigns/send-to-individual — Send Campaign to Individual](/email-marketing/campaigns/send-campaign-to-individual)

