OverviewProductsPlatformsAPI ReferenceResources
Email

Send an email

POSThttps://zernio.com/api/v1/email/messages

Sends from the connected mailbox and returns the stored sent copy.

The message is mirrored into the inbox (message.sent fires once) and counted against the mailbox's daily cap. The cap is reported in the X-Zernio-Send-Limit, X-Zernio-Send-Remaining and X-Zernio-Send-Reset response headers.

Authentication

AuthorizationBearer tokenRequired

API key authentication: send your Zernio API key in the Authorization header, prefixed with Bearer.

Body

application/json

What every request needs

accountIdstringRequired
toarray of EmailAddressRequired
emailstring (email)Required
subjectstring, max 998Required
Optional parameters18 fields
ccarray of EmailAddress
emailstring (email)Required
bccarray of EmailAddress
emailstring (email)Required
replyToarray of EmailAddress
emailstring (email)Required
fromNamestring, max 200
fromstring (email)

Send from another address listed by GET /v1/email/send-as; on Outlook, declare a shared mailbox there first. An address not on the list answers 400, and Outlook refusing it at send time answers 403. Omitted, the mail leaves from the mailbox address.

appendSignatureboolean

Appends the signature of the sending address: its Zernio default first, else its Gmail signature. 400 when it has neither.

signatureIdstring

Appends this Zernio signature instead. Wins over appendSignature.

textstring

Plain-text body. One of text or html is required.

htmlstring
attachmentsarray of object

25 MB in total on every provider. Send files over 4 MB by url: request bodies are capped at 4.5 MB.

filenamestringRequired
contentTypestringRequired
headersobject

Custom X- headers only. List-Unsubscribe is dropped on Microsoft and reported in metadata.droppedHeaders.

metadataobject
scheduledForstring (date-time)

Send later, between 1 minute and 30 days from now. The request answers 202 with the scheduled send; it leaves within a minute of this time through the same caps as an immediate send. List or cancel it under /v1/email/messages/scheduled.

holdAsDraftboolean

Needs scheduledFor. Saves the email as a draft in the mailbox now and sends that draft at scheduledFor, with any edits the user made in their mail app. A draft deleted or sent from the mailbox first fails the send (email.send_failed). Cancelling deletes the draft.

trackOpensboolean

Adds an open pixel to the html and fires email.opened. Needs html.

trackLinksboolean

Rewrites every http(s) link in the html through a Zernio redirect and fires email.link_clicked. Needs html.

trackRepliesboolean

Fires email.thread_replied when someone else writes in this message's thread. Works with text or html.

to[].namestring or null

Headers

Optional
Idempotency-Keystring, max 255

Optional client-generated unique key (e.g. a UUID) that makes retries safe.

  • Same key + same body: replays the original response.
  • Same key + different body: 422.
  • Key still processing: 409.

A request cut off mid-handler (e.g. by a function timeout) can leave its key in progress, answering 409 until the key expires after 24 hours.

On the Ads create, boost and duplicate endpoints, a same-body retry runs again once the cut-off request started more than 15 minutes ago.

Responses

Success· the request worked

Errors· the request failed

How it behaves

Sending limits

These mailboxes are for one-to-one mail, not bulk sends. Protection on every mailbox:

  • Daily cap: Microsoft 1,000; Google Workspace 500; Gmail consumer 200. Reaching it answers 429 email_send_cap_reached with details.cap.
  • The same body reaching more than 50 distinct recipients within an hour pauses the mailbox with an escalating cooldown (429 rate_limited, account.rate_limited webhook).

Scheduling

With scheduledFor the request answers 202 with a ScheduledEmail instead of sending. The account and payment method are checked now; the caps, cooldowns and the send itself run at scheduledFor. A send that fails then fires email.send_failed. List, read and cancel scheduled sends under /v1/email/messages/scheduled.

Tracking

  • trackOpens adds a 1x1 image to the html and fires email.opened.
  • trackLinks rewrites every http(s) link in the html through a Zernio redirect and fires email.link_clicked.
  • trackReplies fires email.thread_replied when someone else writes in the thread.

Tracking costs nothing extra. Opens are approximate: image proxies prefetch and image blocking hides them.

Other errors

  • 402: Gmail sends need a payment method on the workspace. Reading, calendar and files do not.
  • 400: holdAsDraft without scheduledFor; trackOpens or trackLinks without html; scheduledFor outside 1 minute to 30 days.
POST/v1/email/messages
import Zernio from '@zernio/node';const zernio = new Zernio({ apiKey: process.env.ZERNIO_API_KEY });const { data } = await zernio.email.sendEmailMessage({  body: {    accountId: 'account_abc123',    to: [      {        email: 'user@example.com',      },    ],    subject: 'string',  },});console.log(data);
{  "data": {    "id": "string",    "threadId": "string",    "accountId": "string",    "provider": "google",    "folders": [      "string"    ],    "from": {      "email": "user@example.com",      "name": "string"    },    "sender": {      "email": "user@example.com",      "name": "string"    },    "to": [      {        "email": "user@example.com",        "name": "string"      }    ],    "cc": [      {        "email": "user@example.com",        "name": "string"      }    ],    "bcc": [      {        "email": "user@example.com",        "name": "string"      }    ],    "replyTo": [      {        "email": "user@example.com",        "name": "string"      }    ],    "subject": "string",    "snippet": "string",    "text": "string",    "html": "string",    "attachments": [      {        "id": "string",        "filename": "string",        "contentType": "string",        "size": 0,        "isInline": true,        "contentId": "string"      }    ],    "headers": {      "property1": "string",      "property2": "string"    },    "raw": "string",    "date": "2019-08-24T14:15:22Z",    "unread": true,    "starred": true,    "labels": [      "string"    ],    "metadata": {      "property1": "string",      "property2": "string"    },    "trackingId": "string",    "clean": {      "text": "string",      "status": "stripped",      "removed": {        "quoted": true,        "forwardHeader": true,        "boilerplate": true      },      "signature": "string",      "forwarded": {        "from": "string",        "to": "string",        "date": "string",        "subject": "string"      }    },    "draftId": "string",    "forwardedFrom": "string"  }}
OpenAPI specification
Was this page helpful?