# Duplicate Single Send

## API Overview

A Single Send is a one-time, non-automated email message delivered to a list or segment of your audience. A Single Send may be sent immediately or scheduled for future delivery.

Single Sends can serve many use cases, including promotional offers, engagement campaigns, newsletters, announcements, legal notices, or policy updates.

The Single Sends API allows you to create, retrieve, update, delete, schedule, and deliver your Single Sends. There are also endpoints for searching and statistics to help you maintain and alter your Single Sends as you learn more and further develop your campaigns.

The Single Sends API changed on **May 6, 2020**. Please check the SendGrid Knowledge Center for updates and instructions here: [https://sendgrid.com/docs/for-developers/sending-email/single-sends-2020-update/](/docs/sendgrid/for-developers/sending-email/single-sends-2020-update/)

## Operation overview

```json
{"path":"https://api.sendgrid.com/v3/marketing/singlesends/{id}","method":"post","servers":[{"url":"https://api.sendgrid.com","description":"The Twilio SendGrid v3 API"}]}
```

**This endpoint allows you to duplicate an existing Single Send using its Single Send ID.**

Duplicating a Single Send is useful when you want to create a Single Send but don't want to start from scratch. Once duplicated, you can update or edit the Single Send by making a PATCH request to the `/marketing/singlesends/{id}` endpoint.

If you leave the `name` field blank, your duplicate will be assigned the name of the Single Send it was copied from with the text “Copy of ” prepended to it. The `name` field length is limited to 100 characters, so the end of the new Single Send name, including “Copy of ”, will be trimmed if the name exceeds this limit.

## Operation details

### Authentication

API Key

### Headers

```json
[{"in":"header","name":"Authorization","required":true,"default":"Bearer <<YOUR_API_KEY_HERE>>","schema":{"type":"string"}}]
```

### Path parameters

```json
[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}]
```

### Request body

```json
{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100,"description":"The name of the duplicate Single Send. If you choose to leave the name field blank, your duplicate will be assigned the name of the Single Send it was copied from with the text 'Copy of ' prepended to it. The end of the new Single Send name, including 'Copy of ', will be trimmed if the name exceeds the character limit."}}},"encodingType":"application/json"}
```

### Responses

```json
[{"responseCode":"201","schema":{"description":"","content":{"application/json":{"schema":{"title":"singlesend_response","type":"object","refName":"SinglesendResponse","modelName":"SinglesendResponse","properties":{"id":{"type":"string","description":"The unique ID for the Single Send.","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":100,"description":"The name of the Single Send."},"status":{"type":"string","description":"The current status of the Single Send. The status may be `draft`, `scheduled`, or `triggered`.","enum":["draft","scheduled","triggered"],"refName":"Status2","modelName":"Status2"},"categories":{"type":"array","uniqueItems":true,"maxItems":10,"description":"The categories associated with this Single Send.","items":{"type":"string"}},"send_at":{"type":"string","description":"An ISO 8601 formatted date-time when the Single Send is set to be sent. Please note that any `send_at` property value will have no effect while the Single Send `status` is `draft`. You must update the Single Send with the [**Schedule Single Send**](/docs/sendgrid/api-reference/single-sends/schedule-single-send) endpoint or SendGrid application UI to schedule it.","format":"date-time","nullable":true},"send_to":{"type":"object","properties":{"list_ids":{"type":"array","description":"The IDs of each contact list to which the Single Send will be sent.","maxItems":50,"items":{"type":"string","format":"uuid"}},"segment_ids":{"type":"array","description":"The IDs of each segment to which the Single Send will be sent.","maxItems":10,"items":{"type":"string","format":"uuid"}},"all":{"type":"boolean","description":"If this property is set to `true`, the Single Send will be sent to all of your contacts. If it's set to `false`, at least one `list_ids` or `segment_ids` value must be provided before the Single Send is scheduled to be sent.","default":false}}},"updated_at":{"type":"string","description":"the ISO 8601 time at which the Single Send was last updated.","format":"date-time"},"created_at":{"type":"string","description":"the ISO 8601 time at which the Single Send was created.","format":"date-time"},"email_config":{"type":"object","properties":{"subject":{"type":"string","description":"The subject line of the Single Send. This property is not used when a `design_id` value is set."},"html_content":{"type":"string","description":"The HTML content of the Single Send. This property is not used when a `design_id` value is set."},"plain_content":{"type":"string","description":"The plain text content of the Single Send. This property is not used when a `design_id` value is set."},"generate_plain_content":{"type":"boolean","description":"If this property is set to `true`, `plain_content` is always generated from `html_content`. If it's set to false, `plain_content` is not altered.","default":true},"design_id":{"type":"string","description":"A `design_id` can be used in place of `html_content`, `plain_content`, and/or `subject`. You can retrieve a design's ID from the [**List Designs** endpoint](/docs/sendgrid/api-reference/designs-api/list-designs) or by pulling it from the design's detail page URL in the Marketing Campaigns App."},"editor":{"type":"string","description":"The editor, `design` or `code`, used to modify the Single Send's design in the Marketing Campaigns application user interface.","default":"code","enum":["code","design"],"refName":"Editor1","modelName":"Editor1"},"suppression_group_id":{"description":"The ID of the Suppression Group to allow recipients to unsubscribe. You must provide a `suppression_group_id` or the `custom_unsubscribe_url` with your Single Send.","nullable":true,"type":"integer"},"custom_unsubscribe_url":{"description":"The URL allowing recipients to unsubscribe. You must provide a `custom_unsubscribe_url` or a `suppression_group_id` with your Single Send.","format":"uri","nullable":true,"type":"string"},"sender_id":{"description":"The ID of the verified sender from whom the Single Send will be sent. You can retrieve a verified sender's ID from the [**Get Verified Senders** endpoint](/docs/sendgrid/api-reference/sender-verification/get-all-verified-senders) or by pulling it from the sender's detail page URL in the SendGrid App.","nullable":true,"type":"integer"},"ip_pool":{"description":"The name of the IP Pool from which the Single Send emails are sent.","nullable":true,"type":"string"}}},"warnings":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"},"field":{"type":"string"},"warning_id":{"type":"string"}}}}}}}}}},{"responseCode":"404","schema":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"},"error_id":{"type":"string"}}}}}}}}}},{"responseCode":"500","schema":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"errors":{"type":"array","items":{"type":"object","properties":{"field":{"type":"string"},"message":{"type":"string"},"error_id":{"type":"string"}}}}}}}}}}]
```

Duplicate Single Send

```js
const client = require("@sendgrid/client");
client.setApiKey(process.env.SENDGRID_API_KEY);

const id = "id";

const request = {
  url: `/v3/marketing/singlesends/${id}`,
  method: "POST",
};

client
  .request(request)
  .then(([response, body]) => {
    console.log(response.statusCode);
    console.log(response.body);
  })
  .catch((error) => {
    console.error(error);
  });
```

```python
import os
from sendgrid import SendGridAPIClient


sg = SendGridAPIClient(os.environ.get("SENDGRID_API_KEY"))

id = "id"

response = sg.client.marketing.singlesends._(id).post()

print(response.status_code)
print(response.body)
print(response.headers)
```

```csharp
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using SendGrid;

public class Program {
    public static async Task Main() {
        string apiKey = Environment.GetEnvironmentVariable("SENDGRID_API_KEY");
        var client = new SendGridClient(apiKey);

        var id = "id";

        var response = await client.RequestAsync(
            method: SendGridClient.Method.POST, urlPath: $"marketing/singlesends/{id}");

        Console.WriteLine(response.StatusCode);
        Console.WriteLine(response.Body.ReadAsStringAsync().Result);
        Console.WriteLine(response.Headers.ToString());
    }
}
```

```java
import com.sendgrid.*;
import java.io.IOException;

public class Example {
    public static void main(String[] args) throws IOException {
        try {
            SendGrid sg = new SendGrid(System.getenv("SENDGRID_API_KEY"));
            Request request = new Request();
            request.setMethod(Method.POST);
            request.setEndpoint("/marketing/singlesends/id");
            Response response = sg.api(request);
            System.out.println(response.getStatusCode());
            System.out.println(response.getBody());
            System.out.println(response.getHeaders());
        } catch (IOException ex) {
            throw ex;
        }
    }
}
```

```go
package main

import (
	"fmt"
	"github.com/sendgrid/sendgrid-go"
	"os"
)

func main() {
	apiKey := os.Getenv("SENDGRID_API_KEY")
	host := "https://api.sendgrid.com"
	request := sendgrid.GetRequest(apiKey, "/v3/marketing/singlesends/id", host)
	request.Method = "POST"
	response, err := sendgrid.API(request)
	if err != nil {
		fmt.Println(err.Error())
		os.Exit(1)
	} else {
		fmt.Println(response.StatusCode)
		fmt.Println(response.Body)
		fmt.Println(response.Headers)
	}
}
```

```php
<?php
// Uncomment the next line if you're using a dependency loader (such as Composer) (recommended)
// require 'vendor/autoload.php';

// Uncomment next line if you're not using a dependency loader (such as Composer)
// require_once '<PATH TO>/sendgrid-php.php';

$apiKey = getenv("SENDGRID_API_KEY");
$sg = new \SendGrid($apiKey);
$id = "id";

try {
    $response = $sg->client
        ->marketing()
        ->singlesends()
        ->_($id)
        ->post();
    print $response->statusCode() . "\n";
    print_r($response->headers());
    print $response->body() . "\n";
} catch (Exception $ex) {
    echo "Caught exception: " . $ex->getMessage();
}
```

```ruby
require 'sendgrid-ruby'
include SendGrid

sg = SendGrid::API.new(api_key: ENV['SENDGRID_API_KEY'])
id = "id"

response = sg.client.marketing.singlesends._(id).post()
puts response.status_code
puts response.headers
puts response.body
```

```bash
curl -X POST "https://api.sendgrid.com/v3/marketing/singlesends/id" \
--header "Authorization: Bearer $SENDGRID_API_KEY"
```
