# Duplicate Campaign

> POST /campaigns/:id/duplicate — copy a campaign into a new draft.

`POST /campaigns/:id/duplicate`

Copies any campaign, whatever its status, into a new **draft** named `<name> (copy)`. The copy keeps the content, sender, reply-to, audience, segment, topic, unsubscribe policy, A/B settings, daily batch size and follow-up rules.

It does not keep anything about when or whether the original went out: no schedule, no repeat cadence, no A/B result, no stats. A campaign that used a mailing-list To address gets its own new address on the same domain.

> **Note:** Needs a full-access API key. A sending-only key gets `401 restricted_api_key`.

**Path parameters**

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | Yes | The id of the campaign to copy. |

**Node.js**

```js
const res = await fetch('https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate', {
  method: 'POST',
  headers: { 'Authorization': 'Bearer mb_xxxxxxxxx' },
});
const data = await res.json();
console.log(data);
```

**Ruby**

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

uri = URI('https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
req = Net::HTTP::Post.new(uri)
req['Authorization'] = 'Bearer mb_xxxxxxxxx'
res = http.request(req)
puts res.body
```

**PHP**

```php
<?php
$ch = curl_init('https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer mb_xxxxxxxxx',
        'User-Agent: my-app/1.0',
    ],
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
```

**Python**

```python
import requests

res = requests.post(
    "https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate",
    headers={"Authorization": "Bearer mb_xxxxxxxxx"},
)
print(res.json())
```

**Go**

```go
package main

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

func main() {
    req, _ := http.NewRequest("POST", "https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate", nil)
    req.Header.Set("Authorization", "Bearer mb_xxxxxxxxx")
    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    out, _ := io.ReadAll(res.Body)
    fmt.Println(string(out))
}
```

**Rust**

```rust
use reqwest::Client;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let res = Client::new()
        .post("https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate")
        .header("Authorization", "Bearer mb_xxxxxxxxx")
        .header("User-Agent", "my-app/1.0")
        .send()
        .await?;
    println!("{}", res.text().await?);
    Ok(())
}
```

**Java**

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

var client = HttpClient.newHttpClient();
var request = HttpRequest.newBuilder()
    .uri(URI.create("https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate"))
    .header("Authorization", "Bearer mb_xxxxxxxxx")
    .header("User-Agent", "my-app/1.0")
    .method("POST", HttpRequest.BodyPublishers.noBody())
    .build();
var response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
```

**.NET**

```csharp
using System.Net.Http;
using System.Text;

var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate");
request.Headers.Add("Authorization", "Bearer mb_xxxxxxxxx");
request.Headers.Add("User-Agent", "my-app/1.0");
var response = await client.SendAsync(request);
Console.WriteLine(await response.Content.ReadAsStringAsync());
```

**cURL**

```bash
curl -X POST 'https://www.senddart.com/api/campaigns/0b7d3c52-4f1e-4a8b-9d26-7e5f1c3a9b04/duplicate' \
  -H 'Authorization: Bearer mb_xxxxxxxxx'
```

### Response (201)

```json
{
  "object": "campaign",
  "id": "5d2a8e71-36c4-4b09-a1f8-2c9e7b0d4f63",
  "name": "November product update (copy)"
}
```

Fetch the full draft with [Retrieve Campaign](https://www.senddart.com/docs/api/campaigns-get). An unknown id returns `404 not_found`.
