API documentation
Manage your domains and DNS records from scripts, routers, certificate tools and AI assistants with the MathiWay REST API.
Getting started
- Sign in and open Control panel › API keys for the account whose domains you want to manage.
- Add an API key and copy it. It is shown only once.
- Send it with every call, as below. The base address is:
https://mathiway.com/api/v1
Authentication
An API key belongs to the account it was made in and reaches only that account's domains, with the rights of the member who made it. Treat it like a password; revoke it under API keys and it stops working at once.
Send the key as a Bearer token:
Authorization: Bearer mwk_…
Clients that only speak HTTP Basic, such as routers, may send any username and the key as the password.
Rate limits
Limits: 60 requests a minute and 1000 an hour per user (all your tokens together), 120 a minute per address, and 20 AI assistant tool calls a minute and 300 an hour. Over a limit the API answers 429 with a Retry-After header.
Answers carry RateLimit-Limit and RateLimit-Remaining. Over a limit the answer is HTTP 429 with Retry-After (seconds). Wait that long; never retry in a tight loop.
Endpoints
| Method | Path | What it does |
|---|---|---|
| GET | /api/v1/domains | The account's domains |
| GET | /api/v1/domains/{domain}/dns | A domain's DNS records |
| POST | /api/v1/domains/{domain}/dns | Add a DNS record |
| DELETE | /api/v1/domains/{domain}/dns | Delete a DNS record |
| GET | /api/v1/availability | Whether a name can be registered |
| GET | /api/v1/dyndns/update | Dynamic DNS (dyndns2) |
| POST | /api/v1/acme/present | Publish an ACME DNS-01 challenge |
| POST | /api/v1/acme/cleanup | Remove an ACME DNS-01 challenge |
List domains
curl -H 'Authorization: Bearer $TOKEN' https://mathiway.com/api/v1/domains
# {"domains":["example.se"]}
List DNS records
curl -H 'Authorization: Bearer $TOKEN' https://mathiway.com/api/v1/domains/example.se/dns
# {"records":[{"type":"A","host":"@","value":"203.0.113.5","ttl":"3600","priority":null}]}
Add a DNS record
Types A, AAAA, CNAME, MX, TXT, NS and SRV. Host @ is the domain itself; priority is for MX and SRV.
curl -X POST -H 'Authorization: Bearer $TOKEN' -H 'Content-Type: application/json' \
-d '{"type":"TXT","host":"@","value":"hello","ttl":"3600"}' \
https://mathiway.com/api/v1/domains/example.se/dns
# {"ok":true,"message":"..."}
Delete a DNS record
curl -X DELETE -H 'Authorization: Bearer $TOKEN' \
'https://mathiway.com/api/v1/domains/example.se/dns?type=TXT&host=@&value=hello'
Check availability
curl -H 'Authorization: Bearer $TOKEN' 'https://mathiway.com/api/v1/availability?name=mybrand.se'
# {"name":"mybrand.se","status":"available"}
available can be registered, regthroughothers is taken, reserved is held by the registry.
Dynamic DNS
Keeps a host pointed at a changing home IP. Works with any router or client that speaks dyndns2 (ddclient, inadyn, most routers). Use any username and the token as the password; leave out myip to use the caller's address.
https://mathiway.com/api/v1/dyndns/update?hostname=home.example.se&myip=203.0.113.5
Answers one line per hostname: good <ip>, nochg <ip>, nohost, notfqdn, dnserr.
Let's Encrypt
For wildcard or internal certificates. lego's httpreq provider talks to this API directly; it may only write _acme-challenge TXT records.
HTTPREQ_ENDPOINT=https://mathiway.com/api/v1/acme HTTPREQ_USERNAME=token HTTPREQ_PASSWORD=$TOKEN \
lego --email [email protected] --dns httpreq -d '*.example.se' -d example.se run
AI assistant
The same API is available to AI assistants as an MCP server at https://mathiway.com/api/mcp.
Errors
Failed calls answer JSON {"error": "…"}.
400 | The input was not valid. |
401 | No API key, or one that is unknown or revoked. |
403 | Not a domain of the API key's account. |
429 | Rate limited; wait the seconds in Retry-After. |
502 | The registry or DNS service refused the change or did not answer. |