PREVIEW - design review build. Changes are disabled here; the live panel is dns.moklav.com.
Moklav GlobalMoklav Global

MOKLAV API (DNS + Hosting) v1.1.0

One API for MOKLAV DNS (zones on ns1/ns2.moklav.com) and MOKLAV Hosting (websites, SSL, mail, databases, FTP, cron, SSH keys, backups, one-click apps). Auth: `Authorization: Bearer <key>`. Scopes: `dns` (zones chosen at key creation), `hosting:read`, `hosting:write`. Errors: `{"error":{"code","message","status","details","request_id"}}`. Slow operations return `202` with a job; poll `GET /jobs/{id}` or use webhooks. Guide for humans and AI agents: https://dns.moklav.com/docs/guide and https://dns.moklav.com/llms.txt

Base URL: https://dns.moklav.com/api/v1 · OpenAPI spec: openapi.json (import into Postman / Insomnia / Swagger)

curl -H "Authorization: Bearer mk_..." https://dns.moklav.com/api/v1/zones
curl -X POST -H "Authorization: Bearer mk_..." -H "Content-Type: application/json" \
  -d '{"name":"www","type":"A","content":"192.0.2.10","ttl":300}' https://dns.moklav.com/api/v1/zones/example.com/records

Endpoints

MethodPathDescription
GET/zonesList zones this key can access
GET/zones/{zone}Get zone details and records
GET/zones/{zone}/recordsList records (optionally filter by name/type)
POST/zones/{zone}/recordsAdd one record (appends to an existing RRset)
DELETE/zones/{zone}/recordsDelete a record value or a whole RRset
PUT/zones/{zone}/rrsetReplace a whole RRset (all values for name+type)
GET/zones/{zone}/dnssecDNSSEC status and DS records for the registrar
GET/zones/{zone}/exportExport zone as BIND zone file text
POST/acme/presentACME DNS-01: add a TXT challenge (acme.sh / certbot hook)
POST/acme/cleanupACME DNS-01: remove a TXT challenge
GET/hosting/plansList hosting plans and prices (no auth)
GET/hosting/appsOne-click apps available for install (no auth)
POST/hosting/ordersOrder a plan
GET/hosting/ordersList your orders
POST/hosting/orders/{oid}/cancelCancel one of your pending orders
GET/hosting/accountsList hosting accounts
GET/hosting/accounts/{aid}Account details, plan and live usage
DELETE/hosting/accounts/{aid}Permanently delete account with all sites/mail/DBs (async)
GET/hosting/accounts/{aid}/statsMonthly disk/bandwidth history (for graphs)
GET/hosting/accounts/{aid}/sitesList websites
POST/hosting/accounts/{aid}/sitesAdd website (async: web + DNS + Let's Encrypt)
GET/hosting/accounts/{aid}/sites/{domain}Website details, DNS records and SFTP path
DELETE/hosting/accounts/{aid}/sites/{domain}Delete website and its files (async)
POST/hosting/accounts/{aid}/sites/{domain}/sslIssue / re-issue Let's Encrypt SSL (async)
PUT/hosting/accounts/{aid}/sites/{domain}/phpSwitch PHP version (async)
POST/hosting/accounts/{aid}/sites/{domain}/wordpressOne-click WordPress (async; password in job result once)
POST/hosting/accounts/{aid}/sites/{domain}/appsOne-click install any supported app (async)
GET/hosting/accounts/{aid}/mail/domainsList mail domains (with client settings)
POST/hosting/accounts/{aid}/mail/domainsAdd mail domain (async; MX/SPF/DKIM/DMARC auto)
GET/hosting/accounts/{aid}/mail/domains/{domain}/dnsDNS records needed for mail (incl. DKIM)
DELETE/hosting/accounts/{aid}/mail/domains/{domain}Delete mail domain and ALL its mailboxes
GET/hosting/accounts/{aid}/mail/domains/{domain}/mailboxesList mailboxes
POST/hosting/accounts/{aid}/mail/domains/{domain}/mailboxesCreate mailbox
PUT/hosting/accounts/{aid}/mail/domains/{domain}/mailboxes/{local}/passwordChange mailbox password
DELETE/hosting/accounts/{aid}/mail/domains/{domain}/mailboxes/{local}Delete mailbox
GET/hosting/accounts/{aid}/databasesList MariaDB databases
POST/hosting/accounts/{aid}/databasesCreate database + user
PUT/hosting/accounts/{aid}/databases/{name}/passwordChange database password
DELETE/hosting/accounts/{aid}/databases/{name}Delete database
POST/hosting/accounts/{aid}/ftpCreate FTP user for a site
DELETE/hosting/accounts/{aid}/ftp/{domain}/{login}Delete FTP user
GET/hosting/accounts/{aid}/cronList cron jobs
POST/hosting/accounts/{aid}/cronAdd cron job
DELETE/hosting/accounts/{aid}/cron/{cid}Delete cron job
GET/hosting/accounts/{aid}/ssh-keysList SSH/SFTP keys
POST/hosting/accounts/{aid}/ssh-keysAdd SSH/SFTP key
DELETE/hosting/accounts/{aid}/ssh-keys/{kid}Remove SSH key
GET/hosting/accounts/{aid}/backupsList backups
POST/hosting/accounts/{aid}/backupsBack up now (async)
POST/hosting/accounts/{aid}/backups/restoreRestore from backup (async)
PUT/hosting/accounts/{aid}/planChange plan (async)
POST/hosting/accounts/{aid}/suspendSuspend account (staff)
POST/hosting/accounts/{aid}/unsuspendUnsuspend account (staff)
GET/admin/hosting/ordersAll orders (staff)
POST/admin/hosting/orders/{oid}/approveApprove order and provision (staff)
POST/admin/hosting/orders/{oid}/rejectReject order (staff)
GET/admin/hosting/accountsAll hosting accounts (staff)
GET/admin/hosting/nodesHosting nodes, load and API health (staff)
GET/jobs/{jid}Async job status (poll until succeeded/failed)
GET/jobsList your jobs (newest first)
GET/webhooksList webhooks
POST/webhooksCreate webhook (signing secret returned once)
DELETE/webhooks/{wid}Delete webhook
GET/auditYour activity log (newest first)
GET/meCurrent user, key scopes and rate limit

Let's Encrypt DNS-01 (wildcards)

acme.sh

Download the hook script into the acme.sh dnsapi folder, then run:

dns_moklav.sh

export MOKLAV_API_KEY="mk_..."
acme.sh --issue --dns dns_moklav -d example.com -d '*.example.com'

certbot

Download the hook script, then run:

certbot-moklav-hook.sh

export MOKLAV_API_KEY="mk_..."
certbot certonly --manual --preferred-challenges dns \
  --manual-auth-hook "./certbot-moklav-hook.sh auth" --manual-cleanup-hook "./certbot-moklav-hook.sh cleanup" \
  -d example.com -d '*.example.com'

Dynamic DNS (DynDNS2)

Create a token in your domain's Dynamic DNS tab. Works with routers (MikroTik, OpenWrt ddns-scripts, pfSense "Custom"), ddclient and curl:

https://dns.moklav.com/nic/update?hostname=home.example.com&myip=1.2.3.4   (HTTP basic auth: any username, password = token)
# ddclient: protocol=dyndns2, server=dns.moklav.com, login=ddns, password=TOKEN