Skip to the documentation
API

Remove a domain

Removes the domain from the workspace. Its addresses stop receiving, mail from it can no longer be sent, its tracking and files domains stop answering, and `domain.deleted` fires. Mail already received stays in the mailbox, unless this is the last domain of the workspace.

DELETE/domains/{id}

Runs the real call on your workspace.

DELETE /domains/{id}

Removes the domain from the workspace. Its addresses stop receiving, mail from it can no longer be sent, its tracking and files domains stop answering, and domain.deleted fires. Mail already received stays in the mailbox, unless this is the last domain of the workspace.

Example

Needs domains:write. A key limited to particular addresses or domains needs to hold the whole domain.

curl
curl -X DELETE "$API/domains/b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f" -H "$AUTH"
Response
{  "object": "domain",  "id": "b3e1f0a4-6c2d-4e8a-9f17-2d5c8a0b4e6f",  "domain": "acme.com",  "deleted": true,  "mailboxPurged": false,  "leftBehind": []}

Records Nextmail wrote for you through a connected DNS account are withdrawn. Anything it could not withdraw is listed in leftBehind, and records you published by hand stay where they are until you remove them.

Removing the last domain of a workspace deletes the whole mailbox with it, as it does in the app, so it needs confirm, the name of the domain, the way the app asks the person to type it: DELETE /domains/{id}?confirm=acme.com. Without it the call answers 409 last_domain and nothing is removed, and mailboxPurged in the answer says whether the mailbox went. A key limited to particular addresses or domains, or an app limited to some when it was connected, cannot remove the last domain.

An OAuth access token of a member also needs workspace:manage in that member’s role, the permission the app asks for to remove a domain. It is console-only, so without it the call is insufficient_authority, a 403, whatever the app was given.

An OAuth access token needs a verification code for this call. Until the app has verified one in the last 60 minutes, the call answers 403 step_up_required and changes nothing. An API key is never asked. The Authentication page shows how to ask for a code and verify it.

Reference