Update a Specific Draft

Purpose

This API is used to update a specific draft in an account using draftId.

OAuth Scope

Use the scope

MailApps.messages.ALL (or) MailApps.messages.UPDATE

ALL - Full access to the messages.

UPDATE - Update a draft.

To generate Authtoken, refer here.

Request URL

Method : PUT

https://mail360.zoho.com/api/accounts/{account_key}/drafts/{draftId}

Path Parameters

  • account_key* string
    • This is a unique key used to identify the account in which the data has to be updated. It is generated during account addition.
    • This parameter can be retrieved using the Get All Accounts API.
  • draftId* long
    • This is a unique key used to identify a specific draft within the account.
    • This parameter can be retrieved using the Get All Drafts API.

Request Body (JSON Object)

  • fromAddress string
    • This is the sender's email address.
  • toAddress string
    • This is the recipient's email address.
  • ccAddress string
    • This is the recipient's email address to which a Cc of the mail has to be sent.
  • bccAddress string
    • This is the recipient's email address to which a Bcc of the mail has to be sent.
  • labelId Json array of long
    • This is the ID associated with the label.
    • This parameter can be fetched using the Get All Labels API.
  • replyTo string
    • This is the email address to which reply mail is sent.
  • askReceipt string
    • Depending on whether the sender requests a Read receipt from the recipient, the value can be
      • yes
      • no
  • priority string
    • Depending on the priority of the draft, the values can be
      • high
      • medium
      • low
  • encoding string
    • This is the encoding type that should be used in the email content. The value can be
      • Big5 | EUC-JP | EUC-KR | GB2312 | ISO-2022-JP | ISO-8859-1 | KOI8-R | Shift_JIS | US-ASCII | UTF-8 | WINDOWS-1251 | WINDOWS-1250 | big5 |euc-jp | utf-8 | euc-kr | gb2312 | iso-2022-jp | iso-8859-1 | koi8-r | shift-jis | us-ascii | windows-1251 | windows-1250 | X-WINDOWS-ISO2022JP
    • The default value is UTF-8.
  • subject string
    • The subject of the email.
  • mailFormat string
    • This is the format in which the mail needs to be sent. The value can be
      • html
      • plaintext
    • The default value is html.
  • includeSignature boolean
    • Depending on whether the sender wants to include a signature in the draft, the value can be
      • true
      • false
  • attachments Array of JSON objects
    • This parameter is an array consisting of JSON objects.
    • Each object in this array contain a key-value pair formatted as: "fileId" : "sampleID". The key, fileId, is constant across all objects. The value associated with fileId signifies the ID of the file that has been uploaded as an attachment and is of the string data type. This value can be obtained from Upload attachment API.

 

* - Mandatory parameter

Sample Request

Copiedcurl "https://mail360.zoho.com/api/accounts/x7k**M05r/drafts/1674571211***1" \
-X PUT \
-H "Content-Type: application/json" \
-H "Authorization: Zoho-oauthtoken ***" \
-d '{
   "toAddress" : "rebecca@zylker.com,daviid@zylker.com",
   "ccAddress" : "paul@zylker.com",
   "bccAddress" : "paul@zylker.com",
   "fromAddress" : "<Rebecca>rebecca@zylker.com",
   "subject" : "new Mail testing"
}'

Sample Success Response

Copied{
  "status": {
    "code": 200,
    "description": "success"
  },
  "data": {
    "draftId": "1674571936262110001"
  }
}

Sample Failure Response

Copied{
  "status": {
    "code": 400,
    "description": "Invalid Input"
  },
  "data": {
    "moreInfo": "Authentication failed"
  }
}