JavaScript SDK: swarmhit.emailAccounts.connect(params)
Connect an existing mailbox with its logins: a Google app password (provider: google), or IMAP and SMTP servers (provider: imap). It is connected as the app's Connect form and CSV import connect one: both logins are tried first, a seat is taken, and an address the workspace removed before comes back with its campaigns. The password goes to our email gateway as the app sends it, and is never stored by Cadency, logged, or answered back. A Microsoft mailbox connects through a hosted link instead (POST /email-accounts/hosted-link). With startWarmup, warmup starts on the mailbox once it connects, with the same password: warmup says whether it started, or why not (a personal address such as Gmail never warms). The key's creator must still be a member of the workspace the key was made in (403 forbidden otherwise). Refusals: 400 invalid-row (a missing or invalid field, servers, port or password; message says which), sign-in-required (a Microsoft mailbox) or no-plan (no seat left); 409 already-connected (the workspace has this address: details.accountId) or in-progress; 422 invalid-credentials (a server refused the login) or connection-failed (a server could not be reached), each with details.leg (imap or smtp) and, when it said something, details.response (the mail server's own words); 429 rate-limited; 503 service-unavailable.
Authorization
bearerAuth An API key created on the Access tokens page.
In: header
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
curl -X POST "https://example.com/email-accounts/connect" \ -H "Content-Type: application/json" \ -d '{ "provider": "google", "email": "user@example.com" }'{ "data": { "email": "string", "status": "connected", "account": { "id": "string", "label": "string", "senderId": "string", "email": "string", "fromName": "string", "picture": "string", "provider": "google", "authType": "password", "connectedVia": "app", "hostedLinkId": "string", "status": "pending", "error": "string", "limits": {}, "usage": {}, "paused": true, "pausedReason": "user", "pausedAt": "2019-08-24T14:15:22Z", "trackOpens": true, "trackClicks": true, "dnsHealth": { "domain": "string", "managed": true, "spf": { "status": "ok", "reason": "string" }, "dkim": { "status": "ok", "reason": "string", "selector": "string" }, "dmarc": { "status": "ok", "reason": "string", "policy": "none" }, "checkedAt": "2019-08-24T14:15:22Z" }, "deliverabilityTest": { "status": "running", "startedAt": "2019-08-24T14:15:22Z", "finishedAt": "2019-08-24T14:15:22Z", "landing": "inbox", "spf": "string", "dkim": { "result": "string", "selector": "string" }, "dmarc": "string", "blocklists": { "ip": "clean", "domain": "clean" }, "failure": "send" }, "counters": {}, "createdAt": "2019-08-24T14:15:22Z", "updatedAt": "2019-08-24T14:15:22Z", "managed": { "provider": "string", "domain": "string", "status": "string", "renewsAt": "2019-08-24T14:15:22Z", "cancelAt": "2019-08-24T14:15:22Z", "isAdmin": true }, "warmup": { "provider": "string", "status": "pending", "statusLabel": "string", "strategy": { "preset": "conservative", "startingVolume": 1, "dailyIncrease": 1, "targetVolume": 1, "replyInbox": [ 0, 0 ], "replyPromotions": [ 0, 0 ], "replySpam": 0 }, "strategyApplied": true, "day": 0, "currentVolume": 0, "targetVolume": 0, "health": "excellent", "healthLabel": "string", "healthScore": 0, "inboxRate": 0, "startedAt": "2019-08-24T14:15:22Z", "holdUntil": "2019-08-24T14:15:22Z", "holdReason": "warming", "holdOverride": true, "syncedAt": "2019-08-24T14:15:22Z", "error": "string" }, "restoredFrom": "string" }, "restored": { "campaigns": 0, "leads": 0 }, "warmup": { "started": true, "status": "string", "code": "string", "message": "string" } }}