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

# Unipile: Create Email Draft

> Creates an email draft in the customer’s connected mailbox without sending it. File attachments are not supported through Deepline.

Creates an email draft in the customer’s connected mailbox without sending it.

> [!NOTE]
>
> Tool ID: `unipile_create_email_draft`

## Run this action

Use the TypeScript SDK for one call. Use `ctx.tools.execute(...)` inside a Play for durable calls, scheduled calls, or CSV processing.

```ts theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
import { Deepline } from 'deepline';

const deepline = await Deepline.connect();
const result = await deepline.tools.execute(
  'unipile_create_email_draft',
  {
    "account_id": "123456789",
    "to": [
      {
        "identifier": "example_123"
      }
    ],
    "body": "Example message"
  },
);

console.log(result.toolResponse.raw);
```

### CLI

```bash theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
deepline tools execute unipile_create_email_draft --input '{
  "account_id": "123456789",
  "to": [
    {
      "identifier": "example_123"
    }
  ],
  "body": "Example message"
}' --json
```

## Example response

The SDK returns this shape at `result.toolResponse.raw`. The example values illustrate the response.

```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
{
  "data": {
    "object": "DraftCreated",
    "draft_id": "draft_123"
  }
}
```

Use `deepline describe unipile_create_email_draft --json` for the latest machine-readable contract.

## Input reference

⚠️ Interactive documentation does not work on this route (child parameters not correctly applied in snippet), Create a new draft.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `payload.account_id` | `string` | Yes | — | A unique identifier. Minimum length: 1. |
| `payload.from` | `object` | No | — | — |
| `payload.to` | `array` | Yes | — | — |
| `payload.cc` | `array` | No | — | — |
| `payload.bcc` | `array` | No | — | — |
| `payload.subject` | `string` | No | — | — |
| `payload.body` | `string` | Yes | — | — |
| `payload.reply_to` | `string` | No | — | Either the Unipile ID or the provider ID of the email to reply to. |
| `payload.custom_headers` | `array` | No | — | An array of custom headers to be added to the email. |
| `payload.tracking_options` | `object` | No | — | — |

<details>
  <summary>Show raw input schema</summary>

  ### Input JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "⚠️ Interactive documentation does not work on this route (child parameters not correctly applied in snippet), Create a new draft.",
    "properties": {
      "account_id": {
        "type": "string",
        "description": "A unique identifier.",
        "minLength": 1
      },
      "from": {
        "type": "object",
        "properties": {
          "display_name": {
            "type": "string",
            "description": "The name of the attendee."
          },
          "identifier": {
            "type": "string",
            "description": "The email address of the attendee.",
            "format": "emailLike"
          }
        },
        "additionalProperties": false
      },
      "to": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "display_name": {
              "type": "string",
              "description": "The name of the attendee."
            },
            "identifier": {
              "type": "string",
              "description": "The email address of the attendee.",
              "format": "emailLike"
            }
          },
          "required": [
            "identifier"
          ],
          "additionalProperties": false
        }
      },
      "cc": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "display_name": {
              "type": "string",
              "description": "The name of the attendee."
            },
            "identifier": {
              "type": "string",
              "description": "The email address of the attendee.",
              "format": "emailLike"
            }
          },
          "required": [
            "identifier"
          ],
          "additionalProperties": false
        }
      },
      "bcc": {
        "type": "array",
        "items": {
          "type": "object",
          "properties": {
            "display_name": {
              "type": "string",
              "description": "The name of the attendee."
            },
            "identifier": {
              "type": "string",
              "description": "The email address of the attendee.",
              "format": "emailLike"
            }
          },
          "required": [
            "identifier"
          ],
          "additionalProperties": false
        }
      },
      "subject": {
        "type": "string"
      },
      "body": {
        "type": "string"
      },
      "reply_to": {
        "type": "string",
        "description": "Either the Unipile ID or the provider ID of the email to reply to."
      },
      "custom_headers": {
        "type": "array",
        "description": "An array of custom headers to be added to the email.",
        "items": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string",
              "description": "The header name. Must start with 'X-' or 'x-' or be in this list: (List-Unsubscribe, List-Unsubscribe-Post, Reply-To, Content-Type)."
            },
            "value": {
              "type": "string"
            }
          },
          "required": [
            "name",
            "value"
          ],
          "additionalProperties": false
        }
      },
      "tracking_options": {
        "type": "object",
        "properties": {
          "opens": {
            "type": "boolean"
          },
          "links": {
            "type": "boolean",
            "description": "You can disable link tracking for specific links by adding the attribute `'data-disable-tracking'` to the anchor tag."
          },
          "label": {
            "type": "string"
          },
          "custom_domain": {
            "type": "string"
          }
        },
        "additionalProperties": false
      }
    },
    "required": [
      "account_id",
      "to",
      "body"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Output reference

Standard tool result payload.

| Name | Type | Required | Default | Details |
| - | - | - | - | - |
| `result.data` | `object` | Yes | — | @todo Draft created with draft id. |
| `result.data.object` | `"DraftCreated"` | Yes | — | Allowed: `DraftCreated`. |
| `result.data.draft_id` | `string` | Yes | — | A unique identifier. Minimum length: 1. |
| `result.meta` | `object` | No | — | Additional response metadata (status, paging). |

<details>
  <summary>Show raw output schema</summary>

  ### Output JSON Schema

  ```json theme={"languages":{"custom":["/languages/deepline-prompt.json"]}}
  {
    "type": "object",
    "description": "Standard tool result payload.",
    "properties": {
      "data": {
        "type": "object",
        "description": "@todo Draft created with draft id.",
        "properties": {
          "object": {
            "type": "string",
            "enum": [
              "DraftCreated"
            ]
          },
          "draft_id": {
            "type": "string",
            "description": "A unique identifier.",
            "minLength": 1
          }
        },
        "required": [
          "object",
          "draft_id"
        ],
        "additionalProperties": false
      },
      "meta": {
        "type": "object",
        "description": "Additional response metadata (status, paging).",
        "additionalProperties": true
      }
    },
    "required": [
      "data"
    ],
    "additionalProperties": false
  }
  ```
</details>

## Deepline cost

* Pricing model: `fixed` (per call).
* Estimated Deepline credits: `0` per pricing unit.
* Provider-native pricing may still exist outside Deepline credit billing.

## Related documentation

* [Unipile provider guide](https://deepline.com/docs/providers/unipile/guide.md)
* [SDK V2 quickstart](https://deepline.com/docs/sdk-v2/quickstart.md)
* [SDK reference](https://deepline.com/docs/sdk-v2/sdk-reference.md)
* [Run tools across a CSV](https://deepline.com/docs/sdk-v2/batch-csv.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.