Skip to content

Create a draft email

email.draft(EmailDraftParams**kwargs) -> EmailDraftResponse
POST/v1/emails/draft

Creates a draft in the connected email account that owns the from address. Mirrors native email-client behavior: only from is required — to, cc, bcc, subject, messageBody, and attachments are all optional. At least one of those optional fields must be populated; sending only from returns a 400.

Supports idempotency via the Idempotency-Key header.

Required scope: emails:create

Rate limit category: Write

ParametersExpand Collapse
from_: str

Bare email address (no display name). Must match a connected email account owned by the API key user. Compared case-insensitively. Mailbox where the draft is created.

attachments: Optional[Sequence[str]]

Optional list of file IDs (uploaded via the Files API) to attach to the draft. Maximum 5 attachments per draft, each ≤ 3MB.

bcc: Optional[Sequence[str]]

Bcc recipients (same shape as to).

cc: Optional[Sequence[str]]

Cc recipients (same shape as to).

message_body: Optional[MessageBody]

Email message body (HTML or plain text).

content: str

Email body content.

content_type: Optional[Literal["HTML", "TEXT"]]

Defaults to HTML.

One of the following:
"HTML"
"TEXT"
subject: Optional[str]

Email subject.

to: Optional[Sequence[str]]

Recipient email addresses (bare, no display names). Up to 500.

ReturnsExpand Collapse
class EmailDraftResponse:
drafted_at: str

ISO 8601 timestamp of when the draft was created.

Create a draft email

from lightfield import Lightfield

client = Lightfield(
    api_key="My API Key",
)
email_draft_response = client.email.draft(
    from_="sales@acme.com",
)
print(email_draft_response.drafted_at)
{
  "draftedAt": "draftedAt"
}
Returns Examples
{
  "draftedAt": "draftedAt"
}