Get Emails of a Record
Emails are available as a related list in Leads, Contacts, Deals, Accounts, Quotes, Invoices, Sales Orders, Purchase Orders and custom modules.
Purpose
Use this API to get the details of the emails sent from/received to a record in any of these modules. This API returns ten emails per API call. To view details of a specific email use the View Email API.
Request Details
Request URL
{api_domain}/crm/{version}/{module_api_name}/{record_id}/Emails
Supported modules
Leads, Accounts, Contacts, Deals, Quotes, Invoices, Sales Orders, Purchase Orders, and Custom
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
ZohoCRM.modules.READ
or
ZohoCRM.modules.{module_name}.READ
and
ZohoCRM.modules.emails.READ
Possible Module Names
leads, accounts, contacts, deals, quotes, invoices, salesorders, purchaseorders, and custom
Parameters
- typestring, optional
Note that when you do not specify any of these parameters, you will receive all emails from the users and the ones sent from CRM in the response.
If the user has not configured email, the response will only contain the scheduled and sent emails from CRM.- sent_from_crm - Emails sent from CRM and associated with given record.
- scheduled_in_crm - Emails scheduled to be sent from CRM.
- drafts - List of all emails that are in draft state.
- user_emails - To fetch your emails or the shared user's emails, which are synced via IMAP/POP protocol using email integration.
- For the Accounts module, when :
- all_contacts_sent_crm_emails - Emails sent from CRM to contacts.
- all_contacts_scheduled_crm_emails - Emails that are scheduled to be sent from CRM to contacts.
- all_contacts_draft_crm_emails - Draft mails of all contacts associated with an account.
- owner_idinteger, optional
The ID of the user whose emails you want to fetch. Note that you can use this parameter only with type=user_emails.
- indexstring, optional
Each API returns the first ten emails, and the response contains the key "next_index". Use this value for "index" in subsequent calls to fetch other emails.
Note
When you fetch a specific email, the content key in the response represents the body of the email. Please note that you can fetch the email body only when fetching the specific email, and not all the emails of the record.
Sample request
Copied
Possible Errors
- CANNOT_PROCESSHTTP 400
Reasons and resolutions:
- The search function that is used to get emails list is temporarily unavailable. Try the API after some time.
- The configured mailbox of the current user is deleted. Reconfigure the email.
- The POP user's mailbox is deleted and needs to be backed up. If the current user is an admin, they can initiate a backup.
- The user is deactivated in Zoho Mail. Remove the user.
- IMAP is configured for the mailbox and sync is in process or yet to be initiated. Wait for the sync to complete before fetching the emails related to the record.
- You have setup Gmail API and the authentication failed. Reconfigure the Gmail API.
Refer to the "details" key in the response for the exact error and rectify it accordingly.
- INVALID_DATAHTTP 400
The record ID is invalid.
Resolution: Specify a valid ID of the lead, deal, contact, or account in the request URL. - INVALID_DATAHTTP 400
The value for the "type" parameter is invalid.
Resolution: Specify a valid value for the parameters. Refer to the "Parameters" section for the possible values. - NO_PERMISSIONHTTP 403
You do not have permission to view emails for this record in this module.
Resolution: Contact your administrator.
Sample Response
Copied
Show full
Show less