API Documentation

DNS APIs (.fz.mk)

DNS APIs (.fz.mk)

Current DNS API support is for the .fz.mk zone only.

Authentication Requirements (As Implemented)

  • Every /api/dns/* endpoint requires cookie session auth.
  • POST JSON routes below also enforce Content-Type: application/json via requireJson.
  • Global secondary-session middleware does not allow /api/dns paths, so secondary/API-key sessions are blocked before DNS handlers.
Endpoint Auth Required (as implemented)
GET /api/dns/domains Cookie session auth
GET /api/dns/test Cookie session auth
GET /api/dns/subdomains Cookie session auth
POST /api/dns/subdomains Cookie session auth + application/json
DELETE /api/dns/subdomains/:id Cookie session auth
GET /api/dns/subdomains/:id/records Cookie session auth
POST /api/dns/subdomains/:id/records Cookie session auth + application/json
POST /api/dns/subdomains/:id/sync Cookie session auth + application/json
PATCH /api/dns/records/:recordId Cookie session auth
DELETE /api/dns/records/:recordId Cookie session auth

Request and Response Examples

GET /api/dns/domains

Success response (200):

{ "domains": ["fz.mk"] }

GET /api/dns/test

Success response (200):

{
  "success": true,
  "message": "API connection successful",
  "url": "https://dns-provider.example",
  "domain": "fz.mk"
}

GET /api/dns/subdomains

Success response (200):

{
  "subdomains": [
    { "id": 1, "subdomain": "demo", "domain": "fz.mk" }
  ]
}

POST /api/dns/subdomains

Request headers:

  • Content-Type: application/json (required)

Request body:

{
  "subdomain": "demo",
  "domain": "fz.mk"
}

Success response (200):

{
  "subdomain": {
    "id": 1,
    "subdomain": "demo",
    "domain": "fz.mk"
  }
}

Common failures:

  • 400: invalid domain/format/reserved name
  • 409: { "error": "Subdomain already claimed" }

DELETE /api/dns/subdomains/:id

Success response (200):

{ "success": true }

GET /api/dns/subdomains/:id/records

Success response (200):

{
  "records": [
    {
      "id": 10,
      "record_type": "A",
      "name": "@",
      "value": "1.2.3.4",
      "ttl": 3600,
      "priority": null
    }
  ]
}

POST /api/dns/subdomains/:id/records

Request headers:

  • Content-Type: application/json (required)

Request body:

{
  "name": "@",
  "type": "A",
  "value": "1.2.3.4",
  "ttl": 3600
}

Success response (200):

{
  "record": {
    "id": 10,
    "record_type": "A",
    "name": "@",
    "value": "1.2.3.4",
    "ttl": 3600,
    "priority": null
  }
}

POST /api/dns/subdomains/:id/sync

Request headers:

  • Content-Type: application/json (required)

Request body:

{ "clear": true }

Success response (200):

{
  "success": true,
  "deleted": 3,
  "dbDeleted": 1,
  "synced": 6,
  "total": 6
}

PATCH /api/dns/records/:recordId

Handler reads record_type from body.

Request body:

{ "record_type": "TXT" }

Success response (200):

{
  "success": true,
  "record": {
    "id": 10,
    "record_type": "TXT",
    "name": "@",
    "value": "1.2.3.4",
    "ttl": 3600,
    "priority": null
  }
}

DELETE /api/dns/records/:recordId

Success response (200):

{ "success": true }