# POST /domains/{name}/mail/lists/import

First published 19 Nov 2026 (release 0.2.30) · Unchanged since publication

UrbeStack release 0.2.35 API operation in the mail group.

Import entries into the domain's allow, block or nogreylist list

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

Set kind to allow, block or nogreylist and send an array of 1 to 10000 lines in entries, one sender entry per item. An invalid kind or an entries value outside these requirements returns 400. UrbeStack replaces control characters with spaces and keeps the first 400 characters of each line. It skips blank lines and lines whose first non-whitespace character is #. Import processing has a 400-second timeout.

For allow and block, use email addresses such as someone@example.net, domains such as example.net, or wildcard domains such as *.example.net. For nogreylist, use plain or wildcard domains. Wildcards match subdomains at any depth. GET /domains/{name}/mail/lists lists the entries in effect, and POST /domains/{name}/mail/lists describes how each list applies to incoming mail.

Each domain list holds up to 2000 entries. Entries already on the list and duplicates in the import count as already present. Invalid entries and entries that exceed the list's capacity are refused individually. The operation adds the remaining entries.

The 200 response identifies the list in kind and reports counts in total, added, already and refused. The already_entries field reports the first 200 entries counted as already present. The refused_lines field reports the first 200 refused lines and the reason for each refusal.

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

## As a command

- [urbestack-mail-list-add](https://urbestack.com/docs/commands/urbestack-mail-list-add.md): Adds entries to a domain's mail sender list or, with --server, to a server-wide list.

## Parameters

- `name` (path, DomainName, required)

## Request body

JSON, the type [MailListImport](https://urbestack.com/docs/api/types/MailListImport.md).

- `entries` (array of string, required): List lines as entered, with one entry per line. Empty lines and lines beginning with # are skipped.
- `kind` (string, one of allow, block, nogreylist, required)

## 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 POST "$API/domains/example.com/mail/lists/import" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "entries": [
      "text"
    ],
    "kind": "allow"
  }'
```

Response, 200 OK:

```
{
  "added": 1,
  "already": 1,
  "already_entries": [
    "text"
  ],
  "kind": "profile",
  "refused": 1,
  "refused_lines": [
    {
      "error": "Domain 'example.com' already exists",
      "line": 1,
      "text": "text"
    }
  ],
  "total": 1
}
```

## Errors

- 400: <what> must be text without control characters, 1 to <max> characters
- 400: At most 10000 lines at once; this one has 
- 400: At most <LIST_LINES_MAX> lines at once; this one has 
- 400: Domain name required
- 400: Domain name too long
- 400: Give --allow ENTRY, --block ENTRY or --nogreylist ENTRY, one of them
- 400: Give --domain DOMAIN or --server
- 400: Invalid IPv4 address
- 400: Invalid IPv6 address
- 400: Invalid domain name
- 400: Invalid port
- 400: Invalid setting key
- 400: List type must be allow, block, or nogreylist.
- 400: That list holds at most <max> entries
- 400: With --stdin, specify --kind allow, block, or nogreylist, and omit the entry argument.
- 400: entries must be a list of sender entries.
- 401: Authentication required
- 404: Setting '<key>' not found
- 409: <entry> is already on that <kind> list
