API referenceMailbox orders
POST
/email-accounts/{id}/cancel-managed

JavaScript SDK: swarmhit.emailAccounts.cancelManaged(emailAccountId, params?)

Cancel a mailbox bought through Swarmhit (connectedVia: managed). It keeps working until cancelAt (its renewal date), then it is removed and stops being billed; the last mailbox of a domain also stops the domain's renewal. Not gated on the managed mailboxes feature. 409 with code: not-managed for a mailbox the workspace connected itself; 403 with code: not-allowed unless the key's creator may manage billing.

The domain's admin mailbox (managed.isAdmin) is the one every other mailbox on the domain depends on: once it is cancelled, no mailbox can ever be added to that domain again. While other mailboxes still run on the domain, cancelling it needs confirmAdmin: true; without it the answer is 409 with code: admin-mailbox and the warning to show.

Authorization

bearerAuth
AuthorizationBearer <token>

An API key created on the Access tokens page.

In: header

Path Parameters

id*string

Request 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/string/cancel-managed" \  -H "Content-Type: application/json" \  -d '{}'
{  "data": {    "cancelAt": "2019-08-24T14:15:22Z",    "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"    }  }}

Use a domain you already own POST

**JavaScript SDK:** [`swarmhit.managedDomains.create(params)`](/smart-api/sdk/methods#managedDomains) Use a domain the workspace already owns for bought mailboxes, instead of buying one: nothing is charged for the domain, only its mailboxes. Its DNS moves to Swarmhit: set the two `connection.nameservers` at the domain's registrar, replacing `connection.currentNameservers` (empty for a minute when our mail supplier is slow to answer: read the domain again). Its website records (A/AAAA at the root, `www`) are copied to its new DNS (`connection.websiteRecords`), so the site keeps working; nothing else is copied, so subdomains, other records and any email it has today stop working. The domain then connects on its own (`connection.state`: `nameservers` → `setting_up` → `ready`). Set the nameservers within about 12 hours: a pair not seen by then is replaced by a new one (`connection.nameserversChangedAt`, webhook `managed_domain.action_required` with `reason: nameservers_changed`). Follow it with GET /managed-domains/{id} or the `managed_domain.*` webhooks. Once `canAdd` is true, add mailboxes with a domain entry `{ name, existing: true, mailboxes }` in POST /mailbox-orders/quote. Nameservers not changed within 7 days: `expired`, add it again later. A domain another account had live here before needs support (`domain-taken`). Needs the managed mailboxes feature, billing rights (the key's creator) and a payment method on file. At most 5 domains connect at once, and 5 adds a minute.

Check an own domain now POST

**JavaScript SDK:** [`swarmhit.managedDomains.check(managedDomainId)`](/smart-api/sdk/methods#managedDomains) Look at an own domain again now, e.g. right after changing its nameservers: the next check runs within a minute. Returns the domain as it is now. 409 `not-own-domain` for a domain bought here.