# DELETE /domains/{name}/mail/accounts/{local}

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the mail group.

Delete a mailbox

- Who may call it: administrator, reseller, customer
- Token scope, any of: mail, all
- Answers: 200 OK

Removes the mailbox and its Roundcube contacts, contact groups and identities. By default, UrbeStack keeps the Maildir and its messages in the customer's home. Set purge=true to delete them as well.

The 200 response contains the mailbox's email address in address, sets deleted to true and reports whether the Maildir was deleted in purged. The API returns 404 if the mailbox does not exist on the domain.

Administrators, the domain's owner and the owner's reseller can call this operation with a token that has the mail scope.

## As a command

- [urbestack-mail-account-del](https://urbestack.com/docs/commands/urbestack-mail-account-del.md): Removes a mail account and clears its Roundcube contacts, contact groups and identities.

## Parameters

- `name` (path, DomainName, required)
- `local` (path, LocalPart, required)
- `purge` (query, boolean)

## Example

Set $API to the base URL and $TOKEN to the token, as the [API overview](https://urbestack.com/docs/api.md) shows.

```
curl -sS -X DELETE "$API/domains/example.com/mail/accounts/info?purge=1" \
  -H "Authorization: Bearer $TOKEN"
```

Response, 200 OK:

```
{
  "address": "info@example.com",
  "deleted": true,
  "purged": 1
}
```

## Errors

- 400: --address is required
- 400: <what> must be text without control characters, 1 to <max> characters
- 400: Domain name required
- 400: Domain name too long
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid boolean
- 400: Invalid domain name
- 400: Invalid mail address: local part over 64 characters
- 400: Invalid mail address: no local part
- 400: Invalid mail address: the local part may hold letters, digits, dots, _ + and -
- 400: Invalid port
- 400: Invalid setting key
- 401: Authentication required
- 404: No such mail account: <address>
- 404: Setting '<key>' not found
