JavaScript SDK: swarmhit.emailAccounts.emails.send(emailAccountId, params)
Send one email from this mailbox to an address, outside any campaign. The body is plain text: the mailbox's signature is added, and its open and click tracking apply. The address is tracked as a lead (a lead that already has it is reused). A reply lands in the inbox, in the same thread, and fires email.received with source: direct; a bounce or spam report fires email.bounced. To follow up in the thread, reply in chatId with POST /inbox/chats/{id}/messages. Counts against the mailbox's daily email cap and the workspace's email allowance, like a campaign email. Fails with 409 code: mailbox_paused, mailbox_warming (warmup still holds the mailbox) or mailbox_not_connected, and with 409 code: email_opted_out or email_bounced for an address that unsubscribed, reported an email as spam or hard-bounced, or blocklisted for an address (or its domain) on the workspace blocklist: nothing is sent to it.
Authorization
bearerAuth An API key created on the Access tokens page.
In: header
Path Parameters
Header Parameters
Unique key per action (e.g. a UUID). Reusing it replays the first response instead of sending again, so a retry can't double-send. Read only by the endpoints that list it. A key is scoped to the endpoint and the account (or chat) it acts on, and kept for 24 hours. Only a successful response is stored and replayed: a 4xx frees the key, while a 5xx keeps it (the action may have gone out; retry with a new key). So does a 400 passing on a LinkedIn, WhatsApp or mail provider failure (code provider-unreachable, provider-408 for the provider's own timeout, or provider- and a 5xx status such as provider-502), unless the request provably never reached the provider (its connection never opened): the action may have gone out. A retry with the same key then gets 409 idempotency_failed. The request body is not compared, so a reused key replays the first response even if the body differs.
length <= 255Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://example.com/email-accounts/string/emails" \ -H "Content-Type: application/json" \ -d '{ "to": "user@example.com", "subject": "string", "text": "string" }'{ "data": { "id": "string", "accountId": "string", "status": "sent", "to": "string", "subject": "string", "messageId": "string", "chatId": "string", "leadId": "string", "error": "string", "sentAt": "2019-08-24T14:15:22Z", "createdAt": "2019-08-24T14:15:22Z" }}