Update Email Draft

Purpose

To update email drafts associated with a record in Zoho CRM. You can update up to 100 email drafts in a single API call.

Endpoints

  • PUT /{module_API_name}/{record_ID}/__email_drafts

Request Details

Request URL

{api-domain}/crm/{version}/{module_API_name}/{record_ID}/__email_drafts

Supported modules

Leads, Contacts, Deals, Accounts, Sales Orders, Purchase Orders, Invoices, Quotes, Cases, and Custom.

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

ZohoCRM.Modules.ALL
(or)
ZohoCRM.Modules.{module_name}.{operation_type}

Possible Module Names

leads, accounts, contacts, deals, quotes, salesorders, purchaseorders, invoices, cases, and custom

Possible operation types

ALL - Full access to modules
UPDATE - Update access to the specified module

Note

You cannot update the inventory details of an email draft.

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v8/Leads/2309216000000488477/__email_drafts"
-X PUT
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
-d "@updatedrafts.json"

Input JSON

  • idstring, mandatory

    The unique ID of the email draft you want to update.

  • fromemail address, mandatory

    The email address from which you want to send the email.

  • rich_textBoolean, mandatory

    Mention whether the format of the email is rich text or plain text. The possible options are : 
    true : rich text
    false : plain text

  • reply_toemail address, optional

    The email address that you want the user to reply to after receiving the mail.

  • toJSON array, optional

    The user name and email address to which you want to send an email. Include multiple JSON objects if you want to create the email draft for multiple users.

  • ccJSON array, optional

    The user name and email address that you want to cc when you send an email. Include multiple JSON objects if you want to cc multiple users.

  • bccJSON array, optional

    The user name and email address that you want to bcc when you send an email. Include multiple JSON objects if you want to bcc multiple users.

  • subjectString, optional

    The subject of the email

  • contentString, optional

    The email content in plain text or rich text format.

  • schedule_detailsJSON object, optional

    The scheduling details for the email. Please note that this time should be set in the future.

    • timeDateTime, mandatory

      The schedule time for the draft.

  • attachmentsJSON array, optional

    The attachments for the email.

    • idString, mandatory

      The unique id of the attachment.

    • file_nameString, mandatory

      The file name of the attachment.

Sample input

Copied{
   "__email_drafts":[
      {
          "id": "4f8efdcbaf23fd33c939217d4e14222d66b4d6744c35f027f42b1f303016c181",
         "reply_to":"pat.boyle@zylker.com",
         "from":"patricia.boyle@zylker.com",
         "to":[
            {
               "user_name":"user1",
               "email":"user1@zylker.com"
            }
         ],
         "cc":[
            {
               "user_name":"user2",
               "email":"user2@zylker.com"
            }
         ],
         "bcc":[
            {
               "user_name":"user3",
               "email":"user3@zylker.com"
            }
         ],
         "subject":"Test Draft update",
         "content":"this is the updated content",
         "rich_text":true,
         "template":{
            "id":"2309216000000000083"
         },
         "schedule_details":{
            "time":"2023-03-25T14:00:54+05:30",
            "timezone":"ASIA/KOLKATA"
         }
      }
   ]
}

Possible Errors

  • INVALID_REQUEST_METHODHTTP 400

    The request method is incorrect.
    Resolution: Use the HTTP PUT method to make this API call. Any other request method will result in this error.

  • INVALID_DATAHTTP 400

    You have specified an invalid record ID in the request URL.
    Resolution: Specify a valid Record ID in the request URL.

  • MANDATORY_NOT_FOUNDHTTP 400

    Required field not found.
    Resolution: You have not specified one or more of the mandatory keys in the input body. Specify all the mandatory keys. Refer to the Input JSON section at the beginning of this page to know more.

  • INVALID_MODULEHTTP 400

    You have specified an invalid module API name.
    Resolution: Specify a valid module API name in the request URL.

  • NOT_ALLOWEDHTTP 403

    The inventory_details field is not allowed in update draft request.
    Resolution: You cannot update the inventory details of an email draft using the Update Drafts API. Create a new draft with the required inventory details.

  • OAUTH_SCOPE_MISMATCHHTTP 401

    The access token you have used to make this API call does not have the required scope.
    Resolution: Generate a new access token with the required scopes for this API. Refer to the Scope section at the beginning of this page for the list of required scopes.

  • INVALID_URL_PATTERNHTTP 404

    The request URL is incorrect.
    Resolution: Specify a valid request URL. Refer to the request URL section at the beginning of this page for more details.

  • INTERNAL_ERRORHTTP 500

    Unexpected and unhandled exception in the server. 
    Resolution: Contact the support team at support@zohocrm.com.

Sample response

Copied{
    "__email_drafts": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "4f8efdcbaf23fd33c939217d4e14222d66b4d6744c35f027f42b1f303016c181"
            },
            "message": "Draft updated Successfully",
            "status": "success"
        }
    ]
}