Skip to content

Zoho: Create Email Drafts for a Record

Zoho emailDrafts.createEmailDrafts: arguments, response, policy and SDK examples.

← Email drafts operations · Get started

Operation zoho.createemaildrafts

Provider route: POST /crm/v8/{module}/{record}/__email_drafts. Alter supplies the connection’s credentials and routing.

Install @alter-ai/sdk @alter-ai/zoho with npm, or alter-sdk-zoho with pip. Supply your connected customer’s grant ID and the arguments described below.

import { App } from "@alter-ai/sdk";
import { ZohoIntegration } from "@alter-ai/zoho";
async function execute(input: Parameters<ZohoIntegration["emailDrafts"]["createEmailDrafts"]>[0]) {
const app = new App({ apiKey: process.env.ALTER_API_KEY! });
try {
const provider = new ZohoIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! });
const call = await provider.emailDrafts.createEmailDrafts(input);
const result = await call.wait();
return result.bodyJson();
} finally {
await app.close();
}
}
import os
from alter_sdk import App
from alter_sdk_zoho import ZohoIntegration
async def execute(arguments):
async with App(api_key=os.environ["ALTER_API_KEY"]) as app:
provider = ZohoIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]})
call = await provider.email_drafts.create_email_drafts(arguments)
result = await call.wait()
return result.body_json()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
pathobjectRequired within parentAdditional keys: not allowed
path.modulestringRequired within parentMaximum length: 100
path.recordstringRequired within parentMaximum length: 100
Pattern: ^[0-9]+$
bodyobjectRequired within parentRequest body for creating email drafts.
Additional keys: not allowed
body.__email_draftsarrayRequired within parentList of email drafts to create.
Maximum items: 100
body.__email_drafts[]objectEach itemEmail draft object.
Additional keys: not allowed
body.__email_drafts[].attachmentsarrayOptionalAttachments to add to the draft.
Maximum items: 50
body.__email_drafts[].attachments[]objectEach itemAttachment reference.
Additional keys: not allowed
body.__email_drafts[].attachments[].file_namestringOptionalFile name.
Maximum length: 512
body.__email_drafts[].attachments[].file_sizestringOptionalFile size in bytes as a numeric string.
Maximum length: 20
body.__email_drafts[].attachments[].idstringRequired within parentAttachment/file identifier. Use the [Files API](files.yaml#$.paths./files.get) to retrieve file IDs.

Maximum length: 256
body.__email_drafts[].attachments[].service_namestringRequired within parentStorage service name (e.g., Desktop, ZFSAttached).
Maximum length: 100
body.__email_drafts[].bccarrayOptionalList of BCC recipients.
Maximum items: 100
body.__email_drafts[].bcc[]objectEach itemBCC recipient object.
Additional keys: not allowed
body.__email_drafts[].bcc[].emailstringRequired within parentBCC recipient email address.
Maximum length: 256
body.__email_drafts[].bcc[].user_namestring or nullOptionalBCC recipient display name; null if not available.
Maximum length: 256
body.__email_drafts[].ccarrayOptionalList of CC recipients.
Maximum items: 100
body.__email_drafts[].cc[]objectEach itemCC recipient object.
Additional keys: not allowed
body.__email_drafts[].cc[].emailstringRequired within parentCC recipient email address.
Maximum length: 256
body.__email_drafts[].cc[].user_namestring or nullOptionalCC recipient display name; null if not available.
Maximum length: 256
body.__email_drafts[].contentstring or nullOptionalHTML body when rich_text is true; null to clear.
Maximum length: 200000
body.__email_drafts[].fromstringRequired within parentSpecifies the sender email address. Must be a configured outgoing address for the user. Use the [From Addresses API](from_addresses.yaml#$.paths./settings/emails/actions/from_addresses.get) to retrieve valid from addresses.

Maximum length: 254
Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}
body.__email_drafts[].inventory_detailsobject or nullOptionalInventory email details; null if not an inventory draft.
Additional keys: not allowed
body.__email_drafts[].inventory_details.inventory_templateobjectRequired within parentInventory template to use.
Additional keys: not allowed
body.__email_drafts[].inventory_details.inventory_template.idstringRequired within parentInventory template identifier.
Maximum length: 64
body.__email_drafts[].inventory_details.paper_typestringRequired within parentPaper type.
One of: A4, USLetter
body.__email_drafts[].inventory_details.view_typestringRequired within parentView type.
One of: portrait, landscape
body.__email_drafts[].linked_recordobject or nullOptionalCRM record to link this draft to (Contacts module only); null to clear.
Additional keys: not allowed
body.__email_drafts[].linked_record.idstringRequired within parentCRM record identifier to link.
Maximum length: 64
body.__email_drafts[].linked_record.moduleobjectRequired within parentModule to which the record belongs. Specify at least one of api_name” or “id”. If both are specified, they must refer to the same module.
Minimum fields: 1
Additional keys: not allowed
body.__email_drafts[].linked_record.module.api_namestringOptionalAPI name of the module.
Maximum length: 100
body.__email_drafts[].linked_record.module.idstringOptionalTab identifier of the module.
Maximum length: 20
body.__email_drafts[].plainTextContentstring or nullOptionalPlain text body when rich_text is false; null to clear.
Maximum length: 200000
body.__email_drafts[].reply_tostring or nullOptionalReply-to email address; null to clear.
Maximum length: 256
body.__email_drafts[].rich_textbooleanRequired within parenttrue for HTML editor mode; false for plain text mode.
body.__email_drafts[].schedule_detailsModelOptionalExpand Update an Email Draft — request body — body email drafts item schedule details
body.__email_drafts[].sourcestringOptionalSource identifier string stored at draft creation time (e.g., campaign name or integration identifier).
Maximum length: 256
body.__email_drafts[].subjectstring or nullOptionalEmail subject; null to clear.
Maximum length: 512
body.__email_drafts[].toarrayOptionalList of primary recipients.
Maximum items: 100
body.__email_drafts[].to[]objectEach itemRecipient object.
Additional keys: not allowed
body.__email_drafts[].to[].emailstringRequired within parentRecipient email address.
Maximum length: 256
body.__email_drafts[].to[].user_namestring or nullOptionalRecipient display name; null if not available.
Maximum length: 256

Referenced models: Update an Email Draft — request body — body email drafts item schedule details

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$JSONRoot
$ (anyOf 1)objectAlternativeResponse object containing the result of created email drafts.
Additional keys: not allowed
$ (anyOf 1).__email_draftsarrayRequired within parentList of created email draft results.
Maximum items: 100
$ (anyOf 1).__email_drafts[]objectEach itemResult of a single created email draft.
Additional keys: not allowed
$ (anyOf 1).__email_drafts[].codestringRequired within parentStatus code for the operation.
Known values: SUCCESS
$ (anyOf 1).__email_drafts[].detailsobjectRequired within parentDetails of the created draft.
Additional keys: not allowed
$ (anyOf 1).__email_drafts[].details.idstringRequired within parentEncrypted identifier of the created draft. Use this ID to update or delete the draft.
Maximum length: 256
$ (anyOf 1).__email_drafts[].messagestringRequired within parentOperation message.
Maximum length: 512
$ (anyOf 1).__email_drafts[].statusstringRequired within parentStatus of the operation.
Known values: success
$ (anyOf 2)ModelAlternativeExpand Create Email Drafts for a Record — response body — email drafts

Referenced models: Create Email Drafts for a Record — response body — email drafts

Create Email Drafts for a Record — response body — email drafts
FieldTypePresenceDescription and constraints
$objectRootResponse containing per-draft status for mixed batch processing results.
Additional keys: not allowed
__email_draftsarrayRequired within parentPer-draft status results for the submitted batch.
Maximum items: 100
__email_drafts[]JSONEach item
__email_drafts[] (anyOf 1)ModelAlternativeExpand Create Email Drafts for a Record — response body — __email_drafts / __email_drafts / item / code: SUCCESS, status: success
__email_drafts[] (anyOf 2)ModelAlternativeExpand Create Email Drafts for a Record — response body — __email_drafts / __email_drafts / item / status: error

Referenced models: Create Email Drafts for a Record — response body — __email_drafts / __email_drafts / item / code: SUCCESS, status: success, Create Email Drafts for a Record — response body — __email_drafts / __email_drafts / item / status: error

Update an Email Draft — request body — body email drafts item schedule details
FieldTypePresenceDescription and constraints
$object or nullRootScheduling details; null to remove schedule.
Additional keys: not allowed
sourcestringOptionalSource of the schedule decision.
One of: ecOneHourAhead, upTime, ecSchduleBestTime, ecUpComing, ecSchduleTime
timestringRequired within parentScheduled send time (ISO 8601 format).
Format: date-time
timezonestring or nullOptionalJava TimeZone ID string; null uses organization default.
Maximum length: 100
Create Email Drafts for a Record — response body — __email_drafts / __email_drafts / item / code: SUCCESS, status: success
FieldTypePresenceDescription and constraints
$objectRootPer-item success result.
Additional keys: not allowed
codestringRequired within parentOperation result code.
Known values: SUCCESS
detailsobjectRequired within parentDetails for successful draft operation.
Additional keys: not allowed
details.idstringRequired within parentUpdated or created draft identifier.
Maximum length: 64
messagestringRequired within parentHuman-readable result message.
Maximum length: 512
statusstringRequired within parentPer-item outcome status.
Known values: success
Create Email Drafts for a Record — response body — __email_drafts / __email_drafts / item / status: error
FieldTypePresenceDescription and constraints
$objectRootPer-item validation or processing error result.
Additional keys: not allowed
codestringRequired within parentOperation error code.

**Possible values:**
- **MANDATORY_NOT_FOUND** - A required field is missing.
- **INVALID_DATA** - The field contains invalid data.
- **NOT_ALLOWED** - The field is not allowed in this operation.
- **DUPLICATE_DATA** - A duplicate value was found (e.g. a duplicate attachment).
- **EXPECTED_FIELD_MISSING** - At least one of a set of expected fields must be specified.
- **AMBIGUITY_DURING_PROCESSING** - The given field values are ambiguous or conflicting.
- **NOT_SUPPORTED** - The given field or value is not supported for this module.
- **DEPENDENT_MISMATCH** - A field value does not match its dependent field.

Known values: MANDATORY_NOT_FOUND, INVALID_DATA, NOT_ALLOWED, DUPLICATE_DATA, EXPECTED_FIELD_MISSING, AMBIGUITY_DURING_PROCESSING, NOT_SUPPORTED, DEPENDENT_MISMATCH
Maximum length: 128
detailsobjectRequired within parentDetails for failed draft operation.
Additional keys: allowed
details.api_namestringOptionalField or API name that caused the error.
Maximum length: 128
details.json_pathstringOptionalJSON path for the invalid or missing field.
Maximum length: 256
messagestringRequired within parentHuman-readable error message.
Maximum length: 512
statusstringRequired within parentPer-item outcome status.
Known values: error

SDK function policy ID: zoho.createemaildrafts. Catalog operation: createEmailDrafts. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.

Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.