Add a Sync Account

Purpose 

This API is used to add an account as a sync account in Mail360. Sync accounts in Mail360 are email accounts from third-party providers that are synced via IMAP for access through Mail360 APIs.

OAuth Scope

Use the scope

MailApps.accounts.ALL (or) MailApps.accounts.CREATE

ALL - Full access to the accounts.

CREATE - Add a new account.

To generate Authtoken, refer here.

Request URL

Method: POST

https://mail360.zoho.com/api/accounts

Request Body (JSON object)

  • emailid* string
    • This is the email ID of the account to be added as a sync account.
  • accountType* integer
    • This refers to the type of account to be added.
    • Provide the value as 2 to create a sync account.
  • displayName string
    • This is the short name to be used to identify the account.
  • incomingUser* string
    • This is the username or email id of the sync account.
  • incomingPasswd* string
    • This is the password or app-specific password to access the sync account through IMAP.
  • incomingServer* string
    • This is the host name of the IMAP server.
  • incomingServerPort* integer
    • This is the port detail of the IMAP server.
  • sslEnabled boolean
    • This is an optional parameter that will be decided based on the given port number itself.
    • The possible value can be
      • true - to connect with SSL.
      • false - to not connect with SSL.
  • startTls boolean
    • The possible value can be
      • true - if you want to use TLS.
      • false - if you do not want to use TLS.
  • gmailTypeSync  boolean
    • This parameter is applicable for Gmail accounts when sync needs to be based on labels.
    • The possible value can be
      • true - if sync should be based on labels.
      • false - if sync doesn't need to be based on labels
  • syncFromDate string
    • This is the timestamp value of the date from which the mail should be synced.
  • outgoingServer* string
    • This is the SMTP hostname of the email server.
  • outgoingServerPort* integer
    • This is the SMTP port number.
  • smtpConnection* integer
    • This is the connection mode to add the account.
    • The possible value can be
      • 0 - PLAIN
      • 1 - SSL
      • 2 - TLS
  • outgoingUser* string
    • This is the username that should be used for the SMTP connection.
  • outgoingPasswd* string
    • This is the password to be used for the SMTP connection.
  • saveSentCopy integer
    • The value of this parameter determines whether to save a copy of sent mail in Mail360 storage or not.
    • The possible value can be
      • 0 - Do not save sent emails.
      • 1 - Save sent emails

 

* - Mandatory parameter

Sample Request

Copiedcurl "https://mail360.zoho.com/api/accounts" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization:Zoho-oauthtoken ***" \
-d '{
    "emailid":"rebecca@gmail.com",
    "accountType":"2",
    "incomingUser":"***@gmail.com",
    "incomingPasswd":"********",
    "incomingServer":"imap.gmail.com",
    "incomingServerPort":"993",
    "isCustomSmtp":"true",
    "outgoingServer":"smtp.gmail.com",
    "outgoingServerPort":"465",
    "smtpConnection":"1",
    "outgoingAuth":"true",
    "outgoingUser":"***@gmail.com",
    "outgoingPasswd":"*******",
    "gmailTypeSync": "true"
}'

Sample Response

Copied{
  "status": {
    "code": 200,
    "description": "success"
  },
  "data": {
    "account_key": "M0BS3O****"
  }
}