> For a complete page index, fetch https://developer.close.com/llms.txt # Update an Email activity PUT https://api.close.com/api/v1/activity/email/{id}/ Content-Type: application/json This can be used to modify a draft or send it once the draft is complete. When changing a draft's status to `scheduled` or `outbox`, the `sender` field is required if not already set on the email. Reference: https://developer.close.com/api/resources/activities/emails/update ## 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 `, where token is your auth token. ## Request ### Path parameters - `id` (string, required) ### Body (application/json) This endpoint expects an UpdateEmailActivity. - `activity_at` (datetime, optional, nullable) - `attachments` (list of UpdateEmailActivityAttachmentsItems, 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) - `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 UpdateEmailActivityOpensItems, optional, nullable) - `sender` (string, optional, nullable) - `status` (enum, optional) - Allowed values: `inbox`, `draft`, `scheduled`, `outbox`, `sent`, `error` - `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) - `agent_config_id` (string, optional, nullable) - `attachments` (list of Attachment, optional, nullable) - `body_preview` (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) ## Errors ### 400 Bad Request Error Bad request - `any` ### 401 Unauthorized Error Unauthorized - `any` ### 404 Not Found Error Not found - `any` ## Types ### UpdateEmailActivityAttachmentsItems - `filename` (string, required) - `size` (integer, required) - `url` (string, required) - `content_id` (string, optional, nullable) - `content_type` (string, optional, nullable) - `inline_only` (boolean, optional) ### UpdateEmailActivityOpensItems - `opened_at` (datetime, required) ### Attachment - `content_type` (string, required, nullable) - `filename` (string, required, nullable) - `size` (integer, required, nullable) - `url` (string, required) - `thumbnail_url` (string, optional, nullable) ### 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) ## Examples **Request** ```json { "subject": "Updated subject!" } ``` **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": "Updated subject!", "template_id": null, "thread_id": "acti_3VFfJMUKvwvQPXAbXAbs9b01usbFC5acL8MrmFcsmK5", "to": [ "phil+sample@gclose.com" ], "updated_by": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA", "user_id": "user_N6KhMpzHRCYQHdn4gRNIFNN5JExnsrprKA6ekxM63XA", "users": [], "attachments": [], "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": null, "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_update_example import requests url = "https://api.close.com/api/v1/activity/email/id/" payload = { "subject": "Updated subject!" } headers = { "Content-Type": "application/json" } response = requests.put(url, json=payload, headers=headers, auth=("", "")) print(response.json()) ``` ```javascript activities.emails_update_example const url = 'https://api.close.com/api/v1/activity/email/id/'; const credentials = btoa(":"); const options = { method: 'PUT', headers: {Authorization: `Basic ${credentials}`, 'Content-Type': 'application/json'}, body: '{"subject":"Updated subject!"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go activities.emails_update_example package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.close.com/api/v1/activity/email/id/" payload := strings.NewReader("{\n \"subject\": \"Updated subject!\"\n}") req, _ := http.NewRequest("PUT", url, payload) req.SetBasicAuth("", "") 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_update_example require 'uri' require 'net/http' url = URI("https://api.close.com/api/v1/activity/email/id/") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Put.new(url) request.basic_auth("", "") request["Content-Type"] = 'application/json' request.body = "{\n \"subject\": \"Updated subject!\"\n}" response = http.request(request) puts response.read_body ``` ```java activities.emails_update_example import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.put("https://api.close.com/api/v1/activity/email/id/") .basicAuth("", "") .header("Content-Type", "application/json") .body("{\n \"subject\": \"Updated subject!\"\n}") .asString(); ``` ```php activities.emails_update_example request('PUT', 'https://api.close.com/api/v1/activity/email/id/', [ 'body' => '{ "subject": "Updated subject!" }', 'headers' => [ 'Content-Type' => 'application/json', ], 'auth' => ['', ''], ]); echo $response->getBody(); ``` ```csharp activities.emails_update_example using RestSharp; using RestSharp.Authenticators; var client = new RestClient("https://api.close.com/api/v1/activity/email/id/"); client.Authenticator = new HttpBasicAuthenticator("", ""); var request = new RestRequest(Method.PUT); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"subject\": \"Updated subject!\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ```