> For a complete page index, fetch https://developer.close.com/llms.txt

# Create an Email activity

POST https://api.close.com/api/v1/activity/email/
Content-Type: application/json

*status* must be one of the following:

* `inbox` to log an already received email.
* `draft` to create a draft email.
* `scheduled` to send an email at a scheduled date and time, which must be specified in the `date_scheduled` field.
* `outbox` to actually **send** an email. To delay email sending by a few seconds (to allow undo), specify `send_in` in seconds (must be less than 60).
* `sent` to log an already sent email.

Only drafts can be modified, and their status can be changed to `scheduled` (to send later) or `outbox` (to send immediately). Scheduled emails, or emails in outbox that weren't sent yet can be canceled by setting the status back to `draft`.

For scheduled, outbox, or sent emails, a `followup_date` may be posted, which will have Close create an email followup task if no response was received.

We'll render an Email Template server-side if you include a `template_id` *without* including `body_text` or `body_html` in your POST.

To specify both a sender name and a sender email address when posting an email, you can use the `sender` field with the format `"sender": ""John Smith" <emailaddress@example.com>"`

The `sender` field is **required** for emails with status `inbox`, `scheduled`, `outbox`, or `error`. It may be omitted for `draft` (since the sender can be specified later before sending) and `sent` (where it defaults to the email address of the `user` associated with the email or the owner of the API key).

To include an attachment, you must first upload the file to Close using the [Files API](https://developer.close.com/api/resources/files). Then, add an object to the `attachments` array with the following fields: `url`, `filename`, `content_type`, and `size`. The `url` should be the URL provided in the `download.url` field of the response from the [Files API](https://developer.close.com/api/resources/files). It must begin `https://app.close.com/go/file/`.

Reference: https://developer.close.com/api/resources/activities/emails/create

## Authentication

- `Authorization` header (basic auth, required) — Use your API key as the username and leave the password empty.
- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Body (application/json)

This endpoint expects a CreateEmailActivity.

- `lead_id` (string, required)
- `status` (enum, required)
  - Allowed values: `inbox`, `draft`, `scheduled`, `outbox`, `sent`, `error`
- `activity_at` (datetime, optional, nullable)
- `attachments` (list of CreateEmailActivityAttachmentsItems, optional, nullable)
- `bcc` (list of string, optional, nullable)
- `body_html` (string, optional, nullable)
- `body_text` (string, optional, nullable)
- `cc` (list of string, optional, nullable)
- `contact_id` (string, optional, nullable)
- `created_by` (string, optional, nullable)
- `date_created` (datetime, optional, nullable)
- `date_scheduled` (datetime, optional) — When to send the message. Required when `status` is `scheduled`, and ignored otherwise.
- `email_account_id` (string, optional, nullable)
- `followup_date` (datetime, optional, nullable)
- `followup_sequence_add_cc_bcc` (boolean, optional, nullable)
- `followup_sequence_delay` (integer, optional, nullable)
- `followup_sequence_id` (string, optional, nullable)
- `in_reply_to_id` (string, optional, nullable)
- `opens` (list of CreateEmailActivityOpensItems, optional, nullable)
- `organization_id` (string, optional, nullable)
- `send_in` (integer, optional) — Seconds to delay sending, to allow undo. Only used when `status` is `outbox`.
- `sender` (string, optional, nullable)
- `subject` (string, optional, nullable)
- `template_id` (string, optional, nullable)
- `to` (list of string, optional, nullable)
- `user_id` (string, optional, nullable)

## Response

### 200

Successful response

- `_type` (string, required)
- `activity_at` (datetime, required, nullable)
- `bcc` (list of string, required)
- `body_html` (string, required, nullable)
- `body_text` (string, required, nullable)
- `bulk_email_action_id` (string, required, nullable)
- `cc` (list of string, required)
- `contact_id` (string, required, nullable)
- `created_by` (string, required, nullable)
- `date_created` (datetime, required)
- `date_scheduled` (datetime, required, nullable)
- `date_sent` (datetime, required, nullable)
- `date_updated` (datetime, required)
- `direction` (enum, required, nullable) — Direction of communication. Outgoing means the communication flowing from the user to the lead/contact. Inbound means the opposite.
  - Allowed values: `incoming`, `outgoing`
- `followup_sequence_add_cc_bcc` (boolean, required)
- `followup_sequence_delay` (integer, required, nullable)
- `has_reply` (boolean, required)
- `id` (string, required)
- `in_reply_to_id` (string, required, nullable)
- `lead_id` (string, required, nullable)
- `message_ids` (list of string, required)
- `need_smtp_credentials` (boolean, required)
- `opens_summary` (string, required, nullable)
- `organization_id` (string, required)
- `references` (list of string, required)
- `send_as_id` (string, required, nullable)
- `sender` (string, required, nullable)
- `status` (enum, required) — Status of a message, such as Email or SMS.
  - Allowed values: `inbox`, `draft`, `scheduled`, `outbox`, `sent`, `error`
- `subject` (string, required, nullable)
- `template_id` (string, required, nullable)
- `thread_id` (string, required, nullable)
- `to` (list of string, required)
- `updated_by` (string, required, nullable)
- `user_id` (string, required, nullable)
- `users` (list of string, required)
- `agent_action_reason` (string, optional, nullable)
- `attachments` (list of Attachment, optional, nullable)
- `body_preview` (string, optional, nullable)
- `created_by_agent_id` (string, optional, nullable)
- `created_by_name` (string, optional, nullable)
- `email_account_id` (string, optional, nullable)
- `envelope` (map from string to any, optional, nullable)
- `followup_sequence_id` (string, optional, nullable)
- `opens` (list of EmailOpen, optional, nullable)
- `send_attempts` (list of SendAttempt, optional, nullable)
- `sequence_id` (string, optional, nullable)
- `sequence_name` (string, optional, nullable)
- `sequence_subscription_id` (string, optional, nullable)
- `template_name` (string, optional, nullable)
- `updated_by_name` (string, optional, nullable)
- `user_name` (string, optional, nullable)
- `agent_config_id` (string, optional, nullable, deprecated) — Deprecated. Use `created_by_agent_id` instead.

## Errors

### 400 Bad Request Error

Bad request, such as a validation error.

- `Activities.emails_createRequestBadRequestError`
  - ErrorMessage: ErrorMessage
  - ValidationErrors: ValidationErrors
  - NestedValidationErrors: NestedValidationErrors

### 401 Unauthorized Error

Authentication is missing or invalid.

- `error` (string, required) — Error message.

### 403 Forbidden Error

Forbidden. Also returned when the API key lacks the required scope (`error_code` is `insufficient_scope`) or is inactive (`error_code` is `inactive_api_key`).

- `Activities.emails_createRequestForbiddenError`
  - ErrorMessage: ErrorMessage
  - ApiKeyError: ApiKeyError

### 429 Too Many Requests Error

Too many requests. The global API rate limiter returns an empty body. Other rate and operation limits return a `RateLimitError` body. Wait for the number of seconds in the `retry-after` header before retrying.

- `error` (RateLimitErrorError, required)

## Types

### CreateEmailActivityAttachmentsItems

- `filename` (string, required)
- `size` (integer, required)
- `url` (string, required)
- `content_id` (string, optional, nullable)
- `content_type` (string, optional, nullable)
- `inline_only` (boolean, optional)

### CreateEmailActivityOpensItems

- `opened_at` (datetime, required)

### Attachment

- `content_type` (string, required, nullable) — MIME type of the file, e.g. `application/pdf`
- `filename` (string, required, nullable) — Name of the file, e.g. `contract.pdf`
- `size` (integer, required, nullable) — Size of the file in bytes
- `url` (string, required) — URL to download the file from Close
- `content_id` (string, optional, nullable) — MIME Content-ID field, referenced from the body HTML as a `cid:` link
- `inline_only` (boolean, optional) — Whether the attachment is embedded in the body HTML (e.g. a signature logo) rather than being standalone
- `thumbnail_url` (string, optional, nullable) — URL to download a thumbnail of the file. Only available for GIF, JPEG and PNG images.

### EmailOpen

- `ip_address` (string, required, nullable)
- `opened_at` (datetime, required)
- `opened_by` (string, required, nullable)
- `user_agent` (string, required, nullable)

### SendAttempt

- `date` (string, required)
- `error_class` (string, required, nullable)
- `error_message` (string, required)

### ErrorMessage

Error with a message.

- `error` (string, required) — Error message.

### ValidationErrors

Validation errors with the path of each invalid field.

- `errors` (list of ValidationErrorsErrorsItems, required)

### NestedValidationErrors

Validation errors nested by field. Some endpoints return only `errors` or only `field-errors`.

- `errors` (list of string, optional) — Errors that don't apply to a single field.
- `field-errors` (map from string to any, optional) — Errors keyed by field name. Each value is a message, a list of messages, or a nested object of the same shape for nested fields.

### ApiKeyError

The API key lacks the scope the request requires, or is inactive.

- `error` (string, required)
- `error_code` (enum, required)
  - Allowed values: `insufficient_scope`, `inactive_api_key`
- `required_scope` (string, optional) — API key scope the request requires. Present when `error_code` is `insufficient_scope`.

### RateLimitErrorError

- `message` (string, required, nullable)
- `rate_reset` (string, required) — Number of seconds until the rate limit resets.
- `allowed_limit` (integer, optional) — Maximum number of bulk actions allowed. Present when the bulk action limit was hit.
- `bulk_action_count` (integer, optional) — Number of bulk actions running. Present when the bulk action limit was hit.

### ValidationErrorsErrorsItems

- `field` (list of ValidationErrorsErrorsItemsFieldItems, required) — Path of the invalid field. Empty for errors that don't apply to a field.
- `msg` (string, required)

### ValidationErrorsErrorsItemsFieldItems

- integer
- string

## Examples

**Request**

```json
{
  "lead_id": "lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h",
  "status": "draft",
  "attachments": [
    {
      "filename": "image.jpg",
      "size": 1108447,
      "url": "https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/",
      "content_type": "image/jpeg"
    }
  ],
  "bcc": [],
  "body_html": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!",
  "body_text": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!",
  "cc": [],
  "contact_id": "cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t",
  "created_by": null,
  "date_created": "2013-02-01T00:54:51.274000+00:00",
  "email_account_id": "emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt",
  "sender": "karan@close.com",
  "subject": "Welcome to Close!",
  "template_id": null,
  "to": [
    "phil+sample@close.com"
  ],
  "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
}
```

**Response**

```json
{
  "_type": "Email",
  "activity_at": "2015-06-26T02:01:43.059265",
  "bcc": [],
  "body_html": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!",
  "body_text": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!",
  "bulk_email_action_id": null,
  "cc": [],
  "contact_id": "cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t",
  "created_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "date_created": "2015-06-26T02:01:43.059265",
  "date_scheduled": null,
  "date_sent": null,
  "date_updated": "2015-06-26T02:01:43.101910",
  "direction": "outgoing",
  "followup_sequence_add_cc_bcc": false,
  "followup_sequence_delay": null,
  "has_reply": false,
  "id": "acti_EdpqkmtlQHIDWE2CixJo606BapX34SpYV3fzHryGPc3",
  "in_reply_to_id": null,
  "lead_id": "lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h",
  "message_ids": [],
  "need_smtp_credentials": false,
  "opens_summary": null,
  "organization_id": "orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH",
  "references": [],
  "send_as_id": null,
  "sender": "karan@close.com",
  "status": "draft",
  "subject": "Welcome to Close!",
  "template_id": null,
  "thread_id": "acti_3VFfJMUKvwvQPXAbXAbs9b01usbFC5acL8MrmFcsmK5",
  "to": [
    "phil+sample@gclose.com"
  ],
  "updated_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA",
  "users": [],
  "attachments": [
    {
      "content_type": "image/jpeg",
      "filename": "image.jpg",
      "size": 1108447,
      "url": "https://app.close.com/go/file/persisted/orga_RbREgmiiwcr1w2b4cOnCMQaQPSIFxMqAD2Dh243uxcH/activity.email/acti_EdpqkmtlQHIDWE2CixJo606BapX34SpYV3fzHryGPc3/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/",
      "content_id": null,
      "inline_only": false
    }
  ],
  "body_preview": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any ",
  "created_by_name": "Steve Wiseman",
  "email_account_id": "emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt",
  "envelope": {},
  "opens": [],
  "send_attempts": [],
  "sequence_id": null,
  "sequence_name": null,
  "sequence_subscription_id": null,
  "template_name": null,
  "updated_by_name": "Steve Wiseman",
  "user_name": "Steve Wiseman",
  "body_html_quoted": {
    "expand": true,
    "html": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!"
  },
  "body_text_quoted": null
}
```

**SDK Code**

```python activities.emails_create_example
import requests

url = "https://api.close.com/api/v1/activity/email/"

payload = {
    "lead_id": "lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h",
    "status": "draft",
    "attachments": [
        {
            "filename": "image.jpg",
            "size": 1108447,
            "url": "https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/",
            "content_type": "image/jpeg"
        }
    ],
    "bcc": [],
    "body_html": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!",
    "body_text": "Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!",
    "cc": [],
    "contact_id": "cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t",
    "created_by": None,
    "date_created": "2013-02-01T00:54:51.274000+00:00",
    "email_account_id": "emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt",
    "sender": "karan@close.com",
    "subject": "Welcome to Close!",
    "template_id": None,
    "to": ["phil+sample@close.com"],
    "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
}
headers = {
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers, auth=("<CLOSE_API_KEY>", ""))

print(response.json())
```

```javascript activities.emails_create_example
const url = 'https://api.close.com/api/v1/activity/email/';
const credentials = btoa("<CLOSE_API_KEY>:");

const options = {
  method: 'POST',
  headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'},
  body: '{"lead_id":"lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h","status":"draft","attachments":[{"filename":"image.jpg","size":1108447,"url":"https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/","content_type":"image/jpeg"}],"bcc":[],"body_html":"Hi! My name is Karan and I\'m your Account Manager. I\'m here to get your team set up and help with anything you may need as you evaluate our platform. Please don\'t hesitate to reach out to me with any questions!","body_text":"Hi! My name is Karan and I\'m your Account Manager. I\'m here to get your team set up and help with anything you may need as you evaluate our platform. Please don\'t hesitate to reach out to me with any questions!","cc":[],"contact_id":"cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t","created_by":null,"date_created":"2013-02-01T00:54:51.274000+00:00","email_account_id":"emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt","sender":"karan@close.com","subject":"Welcome to Close!","template_id":null,"to":["phil+sample@close.com"],"user_id":"user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"}'
};

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

```go activities.emails_create_example
package main

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

func main() {

	url := "https://api.close.com/api/v1/activity/email/"

	payload := strings.NewReader("{\n  \"lead_id\": \"lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h\",\n  \"status\": \"draft\",\n  \"attachments\": [\n    {\n      \"filename\": \"image.jpg\",\n      \"size\": 1108447,\n      \"url\": \"https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/\",\n      \"content_type\": \"image/jpeg\"\n    }\n  ],\n  \"bcc\": [],\n  \"body_html\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"body_text\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"cc\": [],\n  \"contact_id\": \"cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t\",\n  \"created_by\": null,\n  \"date_created\": \"2013-02-01T00:54:51.274000+00:00\",\n  \"email_account_id\": \"emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt\",\n  \"sender\": \"karan@close.com\",\n  \"subject\": \"Welcome to Close!\",\n  \"template_id\": null,\n  \"to\": [\n    \"phil+sample@close.com\"\n  ],\n  \"user_id\": \"user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA\"\n}")

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

	req.SetBasicAuth("<CLOSE_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 activities.emails_create_example
require 'uri'
require 'net/http'

url = URI("https://api.close.com/api/v1/activity/email/")

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

request = Net::HTTP::Post.new(url)
request.basic_auth("<CLOSE_API_KEY>", "")
request["Content-Type"] = 'application/json'
request.body = "{\n  \"lead_id\": \"lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h\",\n  \"status\": \"draft\",\n  \"attachments\": [\n    {\n      \"filename\": \"image.jpg\",\n      \"size\": 1108447,\n      \"url\": \"https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/\",\n      \"content_type\": \"image/jpeg\"\n    }\n  ],\n  \"bcc\": [],\n  \"body_html\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"body_text\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"cc\": [],\n  \"contact_id\": \"cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t\",\n  \"created_by\": null,\n  \"date_created\": \"2013-02-01T00:54:51.274000+00:00\",\n  \"email_account_id\": \"emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt\",\n  \"sender\": \"karan@close.com\",\n  \"subject\": \"Welcome to Close!\",\n  \"template_id\": null,\n  \"to\": [\n    \"phil+sample@close.com\"\n  ],\n  \"user_id\": \"user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA\"\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.close.com/api/v1/activity/email/")
  .basicAuth("<CLOSE_API_KEY>", "")
  .header("Content-Type", "application/json")
  .body("{\n  \"lead_id\": \"lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h\",\n  \"status\": \"draft\",\n  \"attachments\": [\n    {\n      \"filename\": \"image.jpg\",\n      \"size\": 1108447,\n      \"url\": \"https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/\",\n      \"content_type\": \"image/jpeg\"\n    }\n  ],\n  \"bcc\": [],\n  \"body_html\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"body_text\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"cc\": [],\n  \"contact_id\": \"cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t\",\n  \"created_by\": null,\n  \"date_created\": \"2013-02-01T00:54:51.274000+00:00\",\n  \"email_account_id\": \"emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt\",\n  \"sender\": \"karan@close.com\",\n  \"subject\": \"Welcome to Close!\",\n  \"template_id\": null,\n  \"to\": [\n    \"phil+sample@close.com\"\n  ],\n  \"user_id\": \"user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.close.com/api/v1/activity/email/', [
  'body' => '{
  "lead_id": "lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h",
  "status": "draft",
  "attachments": [
    {
      "filename": "image.jpg",
      "size": 1108447,
      "url": "https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/",
      "content_type": "image/jpeg"
    }
  ],
  "bcc": [],
  "body_html": "Hi! My name is Karan and I\'m your Account Manager. I\'m here to get your team set up and help with anything you may need as you evaluate our platform. Please don\'t hesitate to reach out to me with any questions!",
  "body_text": "Hi! My name is Karan and I\'m your Account Manager. I\'m here to get your team set up and help with anything you may need as you evaluate our platform. Please don\'t hesitate to reach out to me with any questions!",
  "cc": [],
  "contact_id": "cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t",
  "created_by": null,
  "date_created": "2013-02-01T00:54:51.274000+00:00",
  "email_account_id": "emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt",
  "sender": "karan@close.com",
  "subject": "Welcome to Close!",
  "template_id": null,
  "to": [
    "phil+sample@close.com"
  ],
  "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
    'auth' => ['<CLOSE_API_KEY>', ''],
]);

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

```csharp activities.emails_create_example
using RestSharp;
using RestSharp.Authenticators;

var client = new RestClient("https://api.close.com/api/v1/activity/email/");
client.Authenticator = new HttpBasicAuthenticator("<CLOSE_API_KEY>", "");
var request = new RestRequest(Method.POST);

request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"lead_id\": \"lead_KwD00BYbXCHiPWj68LxFkxaeWuULpZ7awzm6LqeFs0h\",\n  \"status\": \"draft\",\n  \"attachments\": [\n    {\n      \"filename\": \"image.jpg\",\n      \"size\": 1108447,\n      \"url\": \"https://app.close.com/go/file/temporary/user_Ova4RGFG7pztSeJiiMFdN7O2MFl71nD0uGO3bIOo4Wk/1Zx0AlY1DwBXzKKrVwpAoj/image.jpg/\",\n      \"content_type\": \"image/jpeg\"\n    }\n  ],\n  \"bcc\": [],\n  \"body_html\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"body_text\": \"Hi! My name is Karan and I'm your Account Manager. I'm here to get your team set up and help with anything you may need as you evaluate our platform. Please don't hesitate to reach out to me with any questions!\",\n  \"cc\": [],\n  \"contact_id\": \"cont_8NNOJnVwmHQEYuVOgJ4B4zU7g9RUxYH4JnPjza5Vr6t\",\n  \"created_by\": null,\n  \"date_created\": \"2013-02-01T00:54:51.274000+00:00\",\n  \"email_account_id\": \"emailacct_nuALjWGi09rlr36zXp0ygjja9De0mzPqyqPPVsriTzt\",\n  \"sender\": \"karan@close.com\",\n  \"subject\": \"Welcome to Close!\",\n  \"template_id\": null,\n  \"to\": [\n    \"phil+sample@close.com\"\n  ],\n  \"user_id\": \"user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```