Domains this workspace receives mail on, and the test subdomains its admins add, which take mail once their TXT and MX records are found. Adding, removing and checking are for admins only
GET /domains
List this workspace's domains
Every domain the workspace has, in any state, ordered by name: the ones the operator set up and the ones its admins added, with the records each added one needs and what its last check found. The list is bounded by domainLimit, so it isn't paged. Another workspace's domains never appear, not even one claiming the same name.
Responses
200 The domains.
domainsrequired array of DomainDomain
idrequired string (uuid)namerequired string — Lowercase, with no trailing dot.enabledrequired boolean — Whether Mayfly takes mail for it now. True for verified and failing, false otherwise.statusrequired string, one of: pending, verified, failing, lapsed, disabled — - pending: added, and not verified yet, so it takes no mail.
- verified: takes mail; its last check passed, or the operator set it up.
- failing: still takes mail, but its rechecks haven't passed. Since failingSince a record has been missing or wrong, and if no check passes within 72 hours of that, it stops. Since erroringSince the DNS has given no answer, and if no check passes within 7 days of that, it stops.
- lapsed: was verified, and stopped taking mail: its rechecks didn't pass for that long, or the domain moved to the workspace whose value is now in its TXT record. A check that passes turns it back on.
- disabled: set up by the operator, and turned off.verificationrequired string, one of: dns, operator — dns: added by this workspace, and checked by its records. operator: set up by Mayfly's operator, and never checked.recordsrequired array of DnsRecord — The records to set at the domain's DNS provider, each with what the last check found. Empty for an operator domain.DnsRecord
typerequired string, one of: TXT, MXnamerequired string — The record's full name. The TXT record is _mayfly. followed by the domain; the MX record is the domain itself.valuerequired string — What the record must hold. The TXT record's is mayfly-verify= and this domain's own random value; the MX record's is Mayfly's MX host.priorityrequired integer | null — The MX record's priority, 10. Null for the TXT record.statusrequired string, one of: pending, verified, failed, error — What the last check found: pending before the first check, verified when the record is right, failed when the DNS answered and the record is missing or wrong, error when the DNS gave no answer, which is tried again and changes nothing about the domain.reasonrequired string | null — Why, for anything but verified and pending, written for people. Null otherwise.
verifiedAtrequired string | null (date-time) — When it last started taking mail. Null for a domain that never has.failingSincerequired string | null (date-time) — When its rechecks started finding a record missing or wrong, while it takes mail. Null when they pass.erroringSincerequired string | null (date-time) — When its rechecks started getting no answer from the DNS, while it takes mail. Null when they pass.checkedAtrequired string | null (date-time) — When it was last checked. Null until the first check, and for an operator domain.nextCheckAtrequired string | null (date-time) — When its next check is due. With checkRequested, the asked-for check: when it was asked for, or 30 seconds after checkedAt, whichever is later. Otherwise the scheduled one: every 6 hours while it passes, hourly while it's failing, every 15 minutes in the first day after it's added, and every 6 hours after that, and sooner while its name is contested between workspaces. The check itself starts within a few seconds of this. Null for an operator domain.checkRequestedrequired boolean — A check was asked for, by adding the domain or by checkDomain, and hasn't finished yet.createdAtrequired string (date-time)
domainLimitrequired integer — The most domains this workspace may hold, counting every one it has, in any state. 10 unless Mayfly's operator has raised it, which is free on request.
401 The API key is missing, wrong or revoked, or there's no live session. The code is unauthorized.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
429 Too many requests. The code is rate_limited; the wait caps answer waits_full instead, so a client can tell the two apart.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
POST /domains
Add a test subdomain
Adds a subdomain made for testing as this workspace's own. It takes no mail until Mayfly has found both of its records at the domain's DNS provider: a TXT record holding this domain's own value, which proves the workspace's admin controls the domain's DNS, and an MX record pointing at Mayfly's MX host. The first check is asked for at once; set the records, then ask again with checkDomain.
Refused with 400: a name that isn't one (invalid_domain; letters, digits, hyphens and dots only, with an international name in its xn-- form); a registered domain's root or a public suffix, found with the Public Suffix List, because pointing a root's MX record here would send all of its real mail to Mayfly (root_domain); and Mayfly's own domains (reserved_domain). Refused with 409: a name this workspace already has (domain_exists), and a workspace that holds as many domains as its limit (domain_limit_reached), whose message says who to ask for more, at no charge.
Another workspace holding or claiming the same name doesn't stop this, and the answer says nothing about it: the value published in the TXT record is what decides which workspace gets a name. A claim that no check has proven reserves nothing, so whoever claims a name first can't keep it from the workspace that controls its DNS.
Request body
namerequired string — The subdomain. Case and a trailing dot don't matter; it's stored lowercase, with no trailing dot.
Responses
201 Added, as a claim no check has proven yet, with the records to set.
Domain
idrequired string (uuid)namerequired string — Lowercase, with no trailing dot.enabledrequired boolean — Whether Mayfly takes mail for it now. True for verified and failing, false otherwise.statusrequired string, one of: pending, verified, failing, lapsed, disabled — - pending: added, and not verified yet, so it takes no mail.
- verified: takes mail; its last check passed, or the operator set it up.
- failing: still takes mail, but its rechecks haven't passed. Since failingSince a record has been missing or wrong, and if no check passes within 72 hours of that, it stops. Since erroringSince the DNS has given no answer, and if no check passes within 7 days of that, it stops.
- lapsed: was verified, and stopped taking mail: its rechecks didn't pass for that long, or the domain moved to the workspace whose value is now in its TXT record. A check that passes turns it back on.
- disabled: set up by the operator, and turned off.verificationrequired string, one of: dns, operator — dns: added by this workspace, and checked by its records. operator: set up by Mayfly's operator, and never checked.recordsrequired array of DnsRecord — The records to set at the domain's DNS provider, each with what the last check found. Empty for an operator domain.DnsRecord
typerequired string, one of: TXT, MXnamerequired string — The record's full name. The TXT record is _mayfly. followed by the domain; the MX record is the domain itself.valuerequired string — What the record must hold. The TXT record's is mayfly-verify= and this domain's own random value; the MX record's is Mayfly's MX host.priorityrequired integer | null — The MX record's priority, 10. Null for the TXT record.statusrequired string, one of: pending, verified, failed, error — What the last check found: pending before the first check, verified when the record is right, failed when the DNS answered and the record is missing or wrong, error when the DNS gave no answer, which is tried again and changes nothing about the domain.reasonrequired string | null — Why, for anything but verified and pending, written for people. Null otherwise.
verifiedAtrequired string | null (date-time) — When it last started taking mail. Null for a domain that never has.failingSincerequired string | null (date-time) — When its rechecks started finding a record missing or wrong, while it takes mail. Null when they pass.erroringSincerequired string | null (date-time) — When its rechecks started getting no answer from the DNS, while it takes mail. Null when they pass.checkedAtrequired string | null (date-time) — When it was last checked. Null until the first check, and for an operator domain.nextCheckAtrequired string | null (date-time) — When its next check is due. With checkRequested, the asked-for check: when it was asked for, or 30 seconds after checkedAt, whichever is later. Otherwise the scheduled one: every 6 hours while it passes, hourly while it's failing, every 15 minutes in the first day after it's added, and every 6 hours after that, and sooner while its name is contested between workspaces. The check itself starts within a few seconds of this. Null for an operator domain.checkRequestedrequired boolean — A check was asked for, by adding the domain or by checkDomain, and hasn't finished yet.createdAtrequired string (date-time)
400 A parameter is missing or invalid.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
401 The API key is missing, wrong or revoked, or there's no live session. The code is unauthorized.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
403 A request that changes data with the session cookie, or sets it, didn't send an Origin header matching the site. The code is bad_origin.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
404 It doesn't exist, it's in another workspace, or you need to be an admin.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
409 This workspace already has the domain (domain_exists), or holds as many as its limit (domain_limit_reached).
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
DELETE /domains/{domainId}
Remove a domain
Mail for it stops at once: once this answers, nothing more for the domain is stored, even mail already arriving. Mail already stored stays until it expires. A domain the operator set up can be removed too, and adding it back then needs its records like any other. Another workspace's domain answers 404, the same as one that doesn't exist.
| Parameter | Type | Description |
|---|
domainId pathrequired | string (uuid) | |
Responses
401 The API key is missing, wrong or revoked, or there's no live session. The code is unauthorized.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
403 A request that changes data with the session cookie, or sets it, didn't send an Origin header matching the site. The code is bad_origin.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
404 It doesn't exist, it's in another workspace, or you need to be an admin.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
POST /domains/{domainId}/check
Check a domain's records now
Asks for the domain's TXT and MX records to be checked soon, rather than on its schedule. The check runs in Mayfly's mail service; this answers at once, with checkRequested true and nextCheckAt saying when the check will be taken, and the result appears on each record, and checkRequested turns false, when it's done. An asked-for check runs at most once every 30 seconds for a domain: one asked for sooner after the last check (checkedAt) waits until then, and nextCheckAt says so. A request is never dropped, and asking again while one is waiting asks for nothing more. A domain just added has its first check asked for already, and taken at once. A domain the operator set up is never checked.
| Parameter | Type | Description |
|---|
domainId pathrequired | string (uuid) | |
Responses
202 Asked for.
Domain
idrequired string (uuid)namerequired string — Lowercase, with no trailing dot.enabledrequired boolean — Whether Mayfly takes mail for it now. True for verified and failing, false otherwise.statusrequired string, one of: pending, verified, failing, lapsed, disabled — - pending: added, and not verified yet, so it takes no mail.
- verified: takes mail; its last check passed, or the operator set it up.
- failing: still takes mail, but its rechecks haven't passed. Since failingSince a record has been missing or wrong, and if no check passes within 72 hours of that, it stops. Since erroringSince the DNS has given no answer, and if no check passes within 7 days of that, it stops.
- lapsed: was verified, and stopped taking mail: its rechecks didn't pass for that long, or the domain moved to the workspace whose value is now in its TXT record. A check that passes turns it back on.
- disabled: set up by the operator, and turned off.verificationrequired string, one of: dns, operator — dns: added by this workspace, and checked by its records. operator: set up by Mayfly's operator, and never checked.recordsrequired array of DnsRecord — The records to set at the domain's DNS provider, each with what the last check found. Empty for an operator domain.DnsRecord
typerequired string, one of: TXT, MXnamerequired string — The record's full name. The TXT record is _mayfly. followed by the domain; the MX record is the domain itself.valuerequired string — What the record must hold. The TXT record's is mayfly-verify= and this domain's own random value; the MX record's is Mayfly's MX host.priorityrequired integer | null — The MX record's priority, 10. Null for the TXT record.statusrequired string, one of: pending, verified, failed, error — What the last check found: pending before the first check, verified when the record is right, failed when the DNS answered and the record is missing or wrong, error when the DNS gave no answer, which is tried again and changes nothing about the domain.reasonrequired string | null — Why, for anything but verified and pending, written for people. Null otherwise.
verifiedAtrequired string | null (date-time) — When it last started taking mail. Null for a domain that never has.failingSincerequired string | null (date-time) — When its rechecks started finding a record missing or wrong, while it takes mail. Null when they pass.erroringSincerequired string | null (date-time) — When its rechecks started getting no answer from the DNS, while it takes mail. Null when they pass.checkedAtrequired string | null (date-time) — When it was last checked. Null until the first check, and for an operator domain.nextCheckAtrequired string | null (date-time) — When its next check is due. With checkRequested, the asked-for check: when it was asked for, or 30 seconds after checkedAt, whichever is later. Otherwise the scheduled one: every 6 hours while it passes, hourly while it's failing, every 15 minutes in the first day after it's added, and every 6 hours after that, and sooner while its name is contested between workspaces. The check itself starts within a few seconds of this. Null for an operator domain.checkRequestedrequired boolean — A check was asked for, by adding the domain or by checkDomain, and hasn't finished yet.createdAtrequired string (date-time)
401 The API key is missing, wrong or revoked, or there's no live session. The code is unauthorized.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
403 A request that changes data with the session cookie, or sets it, didn't send an Origin header matching the site. The code is bad_origin.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
404 It doesn't exist, it's in another workspace, or you need to be an admin.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.
409 Mayfly's operator set this domain up, so it isn't checked. The code is operator_domain.
Error
errorrequired objectcoderequired string — Stable and machine-readable, such as not_found, wait_timeout, rate_limited or waits_full.messagerequired string — For people. May change.