---
title: "Create an Email activity"
method: POST
path: "/activity/email/"
tags: ["activities.emails"]
---

# Create an Email activity

`POST /activity/email/`

*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/`.

## Request body

- CreateEmailActivity
  - `activity_at` string, date-time, nullable
  - `attachments` object[], nullable
    - `content_id` string, nullable
    - `content_type` string, nullable
    - `filename` string, required
    - `inline_only` boolean
    - `size` integer, required
    - `url` string, uri, required
  - `bcc` string[], nullable
  - `body_html` string, nullable
  - `body_text` string, nullable
  - `cc` string[], nullable
  - `contact_id` string, nullable
  - `created_by` string, nullable
  - `date_created` string, date-time, nullable
  - `email_account_id` string, nullable
  - `followup_date` string, date-time, nullable
  - `followup_sequence_add_cc_bcc` boolean, nullable
  - `followup_sequence_delay` integer, nullable
  - `followup_sequence_id` string, nullable
  - `in_reply_to_id` string, nullable
  - `lead_id` string, required
  - `opens` object[], nullable
    - `opened_at` string, date-time, required
  - `organization_id` string, nullable
  - `sender` string, email, nullable
  - `status` 'inbox' | 'draft' | 'scheduled' | 'outbox' | 'sent' | 'error', required
  - `subject` string, nullable
  - `template_id` string, nullable
  - `to` string[], nullable
  - `user_id` string, nullable

## Response `200`

Successful response

- EmailActivity
  - `_type` string, required
  - `activity_at` string, date-time, nullable, required
  - `agent_action_reason` string, nullable
  - `agent_config_id` string, nullable
  - `attachments` Attachment[], nullable
    - `content_type` string, nullable, required
    - `filename` string, nullable, required
    - `size` integer, nullable, required
    - `thumbnail_url` string, nullable
    - `url` string, required
  - `bcc` string[], required
  - `body_html` string, nullable, required
  - `body_preview` string, nullable
  - `body_text` string, nullable, required
  - `bulk_email_action_id` string, nullable, required
  - `cc` string[], required
  - `contact_id` string, nullable, required
  - `created_by` string, nullable, required
  - `created_by_name` string, nullable
  - `date_created` string, date-time, required
  - `date_scheduled` string, date-time, nullable, required
  - `date_sent` string, date-time, nullable, required
  - `date_updated` string, date-time, required
  - `direction` 'incoming' | 'outgoing', required — Direction of communication. Outgoing means the communication flowing from the user to the lead/contact. Inbound means the opposite.
  - `email_account_id` string, nullable
  - `envelope` object, nullable
  - `followup_sequence_add_cc_bcc` boolean, required
  - `followup_sequence_delay` integer, nullable, required
  - `followup_sequence_id` string, nullable
  - `has_reply` boolean, required
  - `id` string, required
  - `in_reply_to_id` string, nullable, required
  - `lead_id` string, nullable, required
  - `message_ids` string[], required
  - `need_smtp_credentials` boolean, required
  - `opens` EmailOpen[], nullable
    - `ip_address` string, nullable, required
    - `opened_at` string, date-time, required
    - `opened_by` string, nullable, required
    - `user_agent` string, nullable, required
  - `opens_summary` string, nullable, required
  - `organization_id` string, required
  - `references` string[], required
  - `send_as_id` string, nullable, required
  - `send_attempts` object[], nullable
  - `sender` string, nullable, required
  - `sequence_id` string, nullable
  - `sequence_name` string, nullable
  - `sequence_subscription_id` string, nullable
  - `status` 'inbox' | 'draft' | 'scheduled' | 'outbox' | 'sent' | 'error', required — Status of a message, such as Email or SMS.
  - `subject` string, nullable, required
  - `template_id` string, nullable, required
  - `template_name` string, nullable
  - `thread_id` string, nullable, required
  - `to` string[], required
  - `updated_by` string, nullable, required
  - `updated_by_name` string, nullable
  - `user_id` string, nullable, required
  - `user_name` string, nullable
  - `users` string[], required

## Other responses

- `400` — Bad request
- `401` — Unauthorized
- `404` — Not found

---

[API](https://skmtc.net/close/apis/close-api.md) · [All operations](https://skmtc.net/close/apis/close-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/close/close-api/revisions/0dcf3303e9d7/schema)
