> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.heyreach.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.heyreach.io/_mcp/server.

# CreateCampaignFromTemplate

POST https://api//api/public/campaign/CreateCampaignFromTemplate
Content-Type: application/json

## Creates a new campaign by cloning the sequence and schedule of an existing campaign (the template).

The new campaign is created in DRAFT status. The sequence (workflow) and schedule are copied from the template campaign identified by `campaignIdForTemplate`; you supply the new name, lead list, sender accounts and exclude options. After creation, call **StartCampaign** (`POST /api/public/campaign/StartCampaign?campaignId=<id>`) to activate it.

### Body Parameters

* **campaignIdForTemplate** *(long, required)*: ID of the existing campaign to use as the template. Its sequence and schedule are copied to the new campaign.

* **name** *(string, required)*: The new campaign name. 1-50 characters.

* **linkedInUserListId** *(long, required)*: ID of the lead list for the new campaign. Must exist and be of type USER\_LIST.

* **linkedInAcccountIdsForCampaign** *(long\[], required)*: Sender LinkedIn account IDs. 1-100 items. All accounts must exist and have valid auth.

* **excludeContactedFromOtherCampaigns** *(bool, required)*: Skip leads already in any other campaign.

* **excludeHasOtherAccConversations** *(bool, required)*: Skip leads that already have conversations with other sender accounts.

* **excludeContactedFromSenderInOtherCampaign** *(bool, required)*: Skip leads the sender accounts have already contacted in other campaigns.

* **excludeListId** *(long, optional)*: A separate list of leads to always exclude. Must not equal `linkedInUserListId`.

Reference: https://docs.heyreach.io/hey-reach-api/campaigns/create-campaign-from-template

## Request

### Headers

- `X-API-KEY` (string, optional) — API key header using this scheme. Example: "X-API-KEY: \{API\_KEY}"

### Body (application/json)

This endpoint expects an object.

- `campaignIdForTemplate` (integer, required)
- `name` (string, required)
- `linkedInUserListId` (integer, required)
- `excludeContactedFromOtherCampaigns` (boolean, required)
- `excludeHasOtherAccConversations` (boolean, required)
- `excludeContactedFromSenderInOtherCampaign` (boolean, required)
- `linkedInAcccountIdsForCampaign` (list of integer, required)
- `excludeListId` (any, optional, nullable)

## Response

### 200

OK

- `campaignId` (integer, required)

## Examples

**Request**

```json
{
  "campaignIdForTemplate": 12345,
  "name": "My Campaign From Template",
  "linkedInUserListId": 123456,
  "excludeContactedFromOtherCampaigns": false,
  "excludeHasOtherAccConversations": false,
  "excludeContactedFromSenderInOtherCampaign": false,
  "linkedInAcccountIdsForCampaign": [
    11111,
    22222
  ]
}
```

**Response**

```json
{
  "campaignId": 12345
}
```

**SDK Code**

```python
import requests

url = "https://api//api/public/campaign/CreateCampaignFromTemplate"

payload = {
    "campaignIdForTemplate": 12345,
    "name": "My Campaign From Template",
    "linkedInUserListId": 123456,
    "excludeContactedFromOtherCampaigns": False,
    "excludeHasOtherAccConversations": False,
    "excludeContactedFromSenderInOtherCampaign": False,
    "linkedInAcccountIdsForCampaign": [11111, 22222]
}
headers = {
    "X-API-KEY": "{{HR_API_KEY}}",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api//api/public/campaign/CreateCampaignFromTemplate';
const options = {
  method: 'POST',
  headers: {'X-API-KEY': '{{HR_API_KEY}}', 'Content-Type': 'application/json'},
  body: '{"campaignIdForTemplate":12345,"name":"My Campaign From Template","linkedInUserListId":123456,"excludeContactedFromOtherCampaigns":false,"excludeHasOtherAccConversations":false,"excludeContactedFromSenderInOtherCampaign":false,"linkedInAcccountIdsForCampaign":[11111,22222]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

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

func main() {

	url := "https://api//api/public/campaign/CreateCampaignFromTemplate"

	payload := strings.NewReader("{\n  \"campaignIdForTemplate\": 12345,\n  \"name\": \"My Campaign From Template\",\n  \"linkedInUserListId\": 123456,\n  \"excludeContactedFromOtherCampaigns\": false,\n  \"excludeHasOtherAccConversations\": false,\n  \"excludeContactedFromSenderInOtherCampaign\": false,\n  \"linkedInAcccountIdsForCampaign\": [\n    11111,\n    22222\n  ]\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("X-API-KEY", "{{HR_API_KEY}}")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api//api/public/campaign/CreateCampaignFromTemplate")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '{{HR_API_KEY}}'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"campaignIdForTemplate\": 12345,\n  \"name\": \"My Campaign From Template\",\n  \"linkedInUserListId\": 123456,\n  \"excludeContactedFromOtherCampaigns\": false,\n  \"excludeHasOtherAccConversations\": false,\n  \"excludeContactedFromSenderInOtherCampaign\": false,\n  \"linkedInAcccountIdsForCampaign\": [\n    11111,\n    22222\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api//api/public/campaign/CreateCampaignFromTemplate")
  .header("X-API-KEY", "{{HR_API_KEY}}")
  .header("Content-Type", "application/json")
  .body("{\n  \"campaignIdForTemplate\": 12345,\n  \"name\": \"My Campaign From Template\",\n  \"linkedInUserListId\": 123456,\n  \"excludeContactedFromOtherCampaigns\": false,\n  \"excludeHasOtherAccConversations\": false,\n  \"excludeContactedFromSenderInOtherCampaign\": false,\n  \"linkedInAcccountIdsForCampaign\": [\n    11111,\n    22222\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api//api/public/campaign/CreateCampaignFromTemplate', [
  'body' => '{
  "campaignIdForTemplate": 12345,
  "name": "My Campaign From Template",
  "linkedInUserListId": 123456,
  "excludeContactedFromOtherCampaigns": false,
  "excludeHasOtherAccConversations": false,
  "excludeContactedFromSenderInOtherCampaign": false,
  "linkedInAcccountIdsForCampaign": [
    11111,
    22222
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '{{HR_API_KEY}}',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api//api/public/campaign/CreateCampaignFromTemplate");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-KEY", "{{HR_API_KEY}}");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"campaignIdForTemplate\": 12345,\n  \"name\": \"My Campaign From Template\",\n  \"linkedInUserListId\": 123456,\n  \"excludeContactedFromOtherCampaigns\": false,\n  \"excludeHasOtherAccConversations\": false,\n  \"excludeContactedFromSenderInOtherCampaign\": false,\n  \"linkedInAcccountIdsForCampaign\": [\n    11111,\n    22222\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "{{HR_API_KEY}}",
  "Content-Type": "application/json"
]
let parameters = [
  "campaignIdForTemplate": 12345,
  "name": "My Campaign From Template",
  "linkedInUserListId": 123456,
  "excludeContactedFromOtherCampaigns": false,
  "excludeHasOtherAccConversations": false,
  "excludeContactedFromSenderInOtherCampaign": false,
  "linkedInAcccountIdsForCampaign": [11111, 22222]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api//api/public/campaign/CreateCampaignFromTemplate")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```