API Documentation

Custom Domain APIs

Custom Domain APIs

The DNS page manages two domain types:

  • External domains: user enters any valid FQDN and proves control with a TXT record.
  • Free subdomains: user claims a subdomain under a configured free-domain namespace.

External domains are inactive until the TXT record is confirmed. File hosting and mail forwarding are enabled independently based on the A/MX/TXT records that resolve during refresh.

Authentication

Every /api/dns/* endpoint requires a primary cookie session. JSON write routes require Content-Type: application/json.

Endpoint Notes
GET /api/dns/config Returns free-subdomain bases and placeholder required records.
GET /api/dns/domains Lists the current user’s custom domains and required records.
POST /api/dns/domains Creates an external domain or free subdomain.
POST /api/dns/domains/:id/refresh Rechecks DNS and updates domain status/features.
POST /api/dns/domains/:id/ssl Rechecks file DNS and requests SSL provisioning for the domain.
PATCH /api/dns/domains/:id Toggles file/mail features for free subdomains.
POST /api/dns/domains/:id/records Creates a custom DNS record for an owned free subdomain.
DELETE /api/dns/domains/:id/records/:recordId Deletes a custom DNS record from an owned free subdomain.
DELETE /api/dns/domains/:id Deletes a domain and moves owned paths to the HTML-safe shared host.

External Domain Create

{
  "type": "external",
  "domain": "files.example.com"
}

Response includes a required TXT record:

{
  "domain": {
    "domain": "files.example.com",
    "domain_type": "external",
    "active": false,
    "requiredRecords": {
      "verification": {
        "type": "TXT",
        "host": "@",
        "value": "axfile-verification-key xxxxxxxxxx"
      }
    }
  }
}

Free Subdomain Create

{
  "type": "free_subdomain",
  "subdomain": "demo",
  "baseDomain": "kt.ci"
}

Free subdomains do not require TXT verification.

Free subdomains can also keep custom DNS records. Managed file/mail records are controlled by the service toggles; custom records are created and deleted separately.

SSL Generation

POST /api/dns/domains/:id/ssl is available after the domain is active and file-hosting DNS is ready. The route refreshes DNS before provisioning. If the A record is missing or ownership is no longer valid, it returns 400 and stores ssl_status: "dns_not_ready".

When DNS is ready, the server requests certificate provisioning and updates the saved SSL status.