JavaScript SDK: swarmhit.mailboxBilling.get()
Bought mailboxes and domains are billed apart from the plan, each purchase on its own date and monthly from then on. This returns the monthly total and next charge date, the card charged, each purchase (mailboxes, price, status, a payUrl when a payment failed, the last receipt) and each domain's renewal (date, price or an estimate, status, payUrl when declined). Same data as the Mailboxes & domains tab of Settings → Billing in Swarmhit. 403 with code: not-allowed unless the key's creator may manage billing. Not gated on the managed mailboxes feature.
Authorization
bearerAuth An API key created on the Access tokens page.
In: header
Response Body
application/json
application/json
application/json
curl -X GET "https://example.com/mailbox-billing"{ "data": { "currency": "string", "monthlyCents": 0, "nextChargeAt": "2019-08-24T14:15:22Z", "includedMailboxes": 0, "card": { "brand": "string", "last4": "string", "expMonth": 0, "expYear": 0 }, "orders": [ { "id": "string", "domains": [ "string" ], "mailboxes": 0, "unitCents": 0, "monthlyCents": 0, "status": "active", "nextChargeAt": "2019-08-24T14:15:22Z", "unpaidSince": "2019-08-24T14:15:22Z", "payUrl": "string", "receiptUrl": "string", "createdAt": "2019-08-24T14:15:22Z" } ], "renewals": [ { "domain": "string", "expiresAt": "2019-08-24T14:15:22Z", "priceCents": 0, "priceEstimated": true, "status": "scheduled", "payUrl": "string" } ], "prices": { "mailboxMonthlyCents": 0, "domainMarkupCents": 0, "domainFirstYearMaxCents": 0 } }}Buy domains and mailboxes POST
**JavaScript SDK:** [`swarmhit.mailboxOrders.create(params)`](/smart-api/sdk/methods#mailboxOrders) Buy the quoted order: charges the workspace's card on file for the quote's `dueNowCents`, then registers the domains and creates the mailboxes. They arrive connected (no sign-in, `connectedVia: managed`) and warming unless `warmup.enabled` is false, usually within hours; follow the order on GET /mailbox-orders/{id} or the `mailbox_order.completed` / `mailbox_order.failed` webhooks. Send the `quoteId`; the order fields are optional and, when sent, must be exactly what was quoted (`409`, `code: quote-mismatch`). Buying the same quote again returns the same order with no second charge, and an `Idempotency-Key` replays the first answer to a retry. `402` with `code: no-payment-method` or `payment-failed` when the card cannot be charged; `409` with `code: quote-expired`, `price-changed` or `domain-unavailable` when the quote no longer holds (quote again); `409` with `code: payment-pending` when the charge is still being confirmed (the order appears in GET /mailbox-orders within minutes if it went through, so do not buy again); `403` with `code: not-allowed` unless the key's creator may manage billing (owner or admin of the paying workspace). Quoting needs the same right. For `existing` domains: `409` with `code: mailbox-unavailable`, `domain-full`, `domain-admin-cancelled` or `domain-not-ready`, and `404` with `code: domain-not-owned`.
Get a mailbox order GET
**JavaScript SDK:** [`swarmhit.mailboxOrders.get(mailboxOrderId, params?)`](/smart-api/sdk/methods#mailboxOrders) One order with every domain and mailbox and its step. By default only an order of the acting workspace, as it always was. With `orgWide=true`, an organization's key acting as the organization also finds the orders of the workspaces inside it, and the order carries `workspaceId` and `workspaceName`.