account control center

Roller Network Help - REST API

Account Control Center REST API

The REST API lets your own systems manage the valid user table, mail domains, the mail queue, hosted mail boxes and Secondary DNS. It is intended for advanced users. Requests and responses are JSON, and every request is recorded in the API log on the REST API Tokens page.

The REST API replaces the older Account Manager API (/api/api.php), which still works but will not be updated with new features and may be removed in the future. The older API keys and permissions do not work with the REST API.

Tokens

Create a token on the REST API Tokens page. The API requires a service level of Personal or higher; it is not available to free or Basic accounts. Each token has:

The token is shown once when it is created. We store only a hash of the token, so if it's lost it can't be recovered: delete it and create a new one.

Making Requests

Send the token in the Authorization header of every request. Never put it in the URL. Requests with a body send it as JSON with Content-Type: application/json. Values in the path, such as a mail box address, should be URL encoded. HTTPS is required.

List mail domains
curl -H "Authorization: Bearer $TOKEN" https://acc.rollernet.us/api/v1/mail/domains
Add a valid user
curl -X POST -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"entry": "sales"}' https://acc.rollernet.us/api/v1/mail/domains/example.com/usertable/entries
Disable a Secondary DNS zone
curl -X PATCH -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" -d '{"enabled": false}' https://acc.rollernet.us/api/v1/dns/secondary/zones/example.com

Responses

A successful response has its result in data, except a 204 response, which has no body. An error response has the HTTP status and a message in error:

Success
{"data": [{"domain": "example.com"}, {"domain": "example.net"}]}
Error
{"error": {"status": 404, "message": "Mail domain example.org not found for this account."}}
Status
Meaning
200
Success, with the result in data.
201
Created.
202
Accepted; the servers carry out the request shortly.
204
Success, with no response body.
400
The request body is not valid JSON, or a field is missing or unknown.
401
The token is missing or not valid.
403
The token does not have the permission, is used from an address it does not allow, or the account cannot use the API.
404
The domain, zone, mail box or entry does not exist on the account, or there is no such endpoint.
405
The endpoint does not accept this method. The Allow header lists the methods it does accept.
409
The request conflicts with the current state, such as deleting a suspended zone.
415
The request body is not sent as application/json.
422
The request was understood but could not be carried out, such as an invalid domain name or a duplicate entry.
500
An internal error. Try again later, and contact support if it continues.
502
A mail server could not be reached.

Endpoints

Paths are relative to https://acc.rollernet.us/api/v1.

Valid User Table

Needs the Valid User Table (usertable) permission.

Method
Path
Description
GET
/mail/domains/{domain}/usertable
The domain's mode (allow, deny, defer, auto, global or hosted) and its entries.
PUT
/mail/domains/{domain}/usertable/mode
Request body: {"mode": "deny"}
Set the mode: allow (Default Allow), deny (Default Deny), defer (Defer All) or global (Use Global Table).
POST
/mail/domains/{domain}/usertable/entries
Request body: {"entry": "user"}
Add an exact-match allow entry for user@domain.
DELETE
/mail/domains/{domain}/usertable/entries/{entry}
Remove an entry.

Mail Domains

Needs the Mail Domains (maildomains) permission.

Method
Path
Description
GET
/mail/domains
List the account's mail domains.
POST
/mail/domains
Request body: {"domain": "example.com"}
Add a domain in Secondary MX mode.
PATCH
/mail/domains/{domain}
Request body: {"mode": "redirect", "redirect": {"host": "mx.example.com", "port": 25}}
Change any of: mode (mx, hold or redirect, which needs redirect), slow_delivery (true or false) and enabled (true or false).
DELETE
/mail/domains/{domain}
Remove a domain.

Mail Queue

Needs the Mail Queue (mailqueue) permission.

Method
Path
Description
GET
/mail/queue
Queued message counts on each mail server, for every mail domain.
GET
/mail/domains/{domain}/queue
Queued message counts for one domain.
POST
/mail/domains/{domain}/queue/flush
Ask every mail server to deliver the domain's queued mail now (ETRN). Returns 202.

Mail Logs

Needs the Mail Logs (maillogs) permission.

Method
Path
Description
GET
/mail/logs/{type}?start=...&end=...
Incoming or delivery log entries for every mail domain, or submission log entries. See Mail Logs below for the query parameters and CSV downloads.
GET
/mail/domains/{domain}/logs/{type}?start=...&end=...
Incoming or delivery log entries for one mail domain.

Hosted Mail Boxes

Needs the Hosted Mail Boxes (mailboxes) permission.

Method
Path
Description
POST
/mail/mailboxes
Request body: {"address": "user@example.com", "password": "...", "outbound": true}
Create a mail box. With outbound set to true, also create an Outbound Mail Account with the same name and password.
PUT
/mail/mailboxes/{address}/password
Request body: {"password": "...", "current_password": "..."}
Change the password. When current_password is given, it must match first.
DELETE
/mail/mailboxes/{address}?outbound=1
Remove a mail box. With outbound=1, also remove the Outbound Mail Account with the same name.

Secondary DNS

Needs the Secondary DNS (secondarydns) permission.

Method
Path
Description
GET
/dns/secondary/zones
List zones with their state and master server.
POST
/dns/secondary/zones
Request body: {"zone": "example.com", "master": "192.0.2.1"}
Add a zone.
PATCH
/dns/secondary/zones/{zone}
Request body: {"enabled": false}
Enable or disable a zone.
DELETE
/dns/secondary/zones/{zone}
Remove a zone and its zone files.
POST
/dns/secondary/zones/{zone}/retransfer
Ask every server to transfer the zone again. Returns 202.
DELETE
/dns/secondary/zones/{zone}/file
Delete the transferred zone file from every server. The zone stays configured.

Mail Logs

The mail log endpoints read the same logs as the mail log page, and need the Mail Logs (maillogs) permission. The type is incoming, delivery or submission (Outbound Mail Accounts).

Both take these query parameters:

Parameter
Meaning
start, end
Required. The time range, as YYYY-MM-DDTHH:MM with optional seconds and an optional Z or offset such as -08:00. Times without an offset are in the tz zone, or UTC; see Time Zones below. Log entries are kept for six months, so older times return no entries.
account
Submission log only: the outbound account address, or its IP address for an IP-only account. Leave it out for all accounts.
status
Only entries that were rejected (reject), accepted (allow) or deferred (defer).
cidr, from, to, message, instance
Search one field, with at least two characters. Use one of these at a time. In the delivery log, from searches the queue ID and instance is not available.
tz
A time zone name such as America/Los_Angeles, for start and end without an offset and for the times in the result. Leave it out for UTC. See Time Zones below.
dns
Set to 1 to look up host names for IP addresses. This makes large results slower.

The response is JSON by default, with every matching entry, newest first. Times are ISO 8601: UTC with a Z, or in the tz zone with its offset. Large results are sent as they are read. If reading fails partway through, the response still ends as valid JSON, with an error member after the entries sent so far, so check for error before treating the result as complete.

To download the entries as a CSV file instead, send Accept: text/csv. The file has the same columns as the download on the mail log page, with times written as in the JSON response. Errors are still returned as JSON, with a JSON content type, so check the status code before saving the file.

Rejected incoming mail for a domain, as JSON
curl -H "Authorization: Bearer $TOKEN" "https://acc.rollernet.us/api/v1/mail/domains/example.com/logs/incoming?status=reject&start=2026-11-19T00:00Z&end=2026-11-20T00:00Z"
A day of delivery logs for all domains, as CSV
curl -f -o delivery.csv -H "Authorization: Bearer $TOKEN" -H "Accept: text/csv" "https://acc.rollernet.us/api/v1/mail/logs/delivery?start=2026-11-19T00:00Z&end=2026-11-20T00:00Z"
JSON response
{"data": [{"time": "2026-11-19T08:12:03Z", "status": "rejected", "ip": "192.0.2.5", "host": null, "server": "mail.rollernet.us", "from": "sender@example.net", "to": "user@example.com", "instance": "...", "comment": "..."}]}

Time Zones

Times are UTC unless you choose a time zone with tz, using its name from the IANA time zone database, such as America/Los_Angeles, America/New_York or Europe/Berlin. With tz, a start or end without an offset is in that zone, and the times in the result, in JSON or CSV, are in that zone with its offset, such as 2026-11-19T00:12:03-08:00. A zone name follows daylight saving time, so a range that crosses a change is still correct, and the hour that repeats when daylight saving time ends is told apart by its offset. An end time without seconds runs to the end of that minute, so 23:59 includes the whole last minute of the day.

A start or end can also end with its own offset, such as -08:00, which is used instead of tz for that value. Use the offset in effect on that date: -08:00 is Pacific Standard Time and -07:00 is Pacific Daylight Time. In a URL, a + offset must be written as %2B; otherwise it arrives as a space and the request is rejected. curl encodes the values for you with -G and --data-urlencode, and the example scripts encode them too.

One day in Pacific time, with times shown in Pacific time
curl -H "Authorization: Bearer $TOKEN" "https://acc.rollernet.us/api/v1/mail/domains/example.com/logs/incoming?tz=America/Los_Angeles&start=2026-11-19T00:00&end=2026-11-19T23:59"
JSON response with tz=America/Los_Angeles
{"data": [{"time": "2026-11-19T00:12:03-08:00", "status": "rejected", ...}]}
With an example script
RNACC_TZ=America/Los_Angeles python3 rest-api-example.py logs incoming 2026-11-19T00:00 2026-11-19T23:59 example.com
One day in Central European Time by offset, with + written as %2B (times shown in UTC)
curl -H "Authorization: Bearer $TOKEN" "https://acc.rollernet.us/api/v1/mail/domains/example.com/logs/incoming?start=2026-11-19T00:00%2B01:00&end=2026-11-19T23:59%2B01:00"
The same, with curl encoding the values
curl -G -H "Authorization: Bearer $TOKEN" --data-urlencode "start=2026-11-19T00:00+01:00" --data-urlencode "end=2026-11-19T23:59+01:00" https://acc.rollernet.us/api/v1/mail/domains/example.com/logs/incoming
Your computer's time zone name (Linux with systemd)
timedatectl show -p Timezone --value
Your computer's time zone name (macOS)
readlink /etc/localtime

On macOS, the name is the end of the path that readlink prints, such as America/Los_Angeles in /var/db/timezone/zoneinfo/America/Los_Angeles.

Example Scripts

These example command line clients show how to send the token, read responses and errors, and download a mail log as CSV. Each one does the same thing in a different language, and can be used as a starting point for your own scripts. They read the token from the RNACC_TOKEN environment variable, because command line arguments can be seen by other users of the system. Set RNACC_TZ to a time zone name, such as America/Los_Angeles, to give mail log times in that zone.

Perl
rest-api-example.pl. Perl 5 with HTTP::Tiny, JSON::PP, and IO::Socket::SSL for HTTPS.
Python
rest-api-example.py. Python 3.8 or later with the Requests package (pip install requests).
PHP
rest-api-example.php. PHP 8.0 or later with the Requests library (composer require rmccue/requests).

Run a script with no arguments to list its commands:

Commands
domains list mail domains queue [DOMAIN] queued message counts, for all domains or one flush DOMAIN deliver a domain's queued mail now (ETRN) usertable DOMAIN show a domain's valid user table adduser DOMAIN ENTRY add an entry to the valid user table deluser DOMAIN ENTRY remove an entry from the valid user table zones list Secondary DNS zones retransfer ZONE transfer a Secondary DNS zone again logs TYPE START END [DOMAIN] mail log entries as JSON, for all domains or one logs-csv TYPE START END FILE [DOMAIN] mail log entries saved as a CSV file
Example
export RNACC_TOKEN='rnacc_...' python3 rest-api-example.py logs-csv delivery 2026-11-19T00:00Z 2026-11-20T00:00Z delivery.csv