Skip to content

API Overview

Dotnify's backend is a set of Vercel Serverless Functions under /api/. All endpoints accept and return JSON. The API follows REST conventions with a consistent response envelope.

Base URL

The API is served from the same origin as the frontend:

https://your-dotnify-domain.vercel.app/api/

Response Format

All responses use a consistent JSON envelope:

Success

json
{
  "ok": true,
  "data": { ... }
}

Error

json
{
  "ok": false,
  "error": "Description of what went wrong"
}

Common HTTP status codes:

StatusMeaning
200Success
201Created (POST)
400Bad request (missing/invalid parameters)
401Unauthorized (missing or invalid Bearer token)
404Not found (provider, zone, or record)
405Method not allowed
409Conflict (e.g. admin already initialized)
422Unprocessable entity (e.g. credential verification failed)
502Upstream error (DNS provider API call failed)

Authentication

Most endpoints require a Bearer token in the Authorization header:

Authorization: Bearer <token>

Tokens are obtained via POST /api/auth/login and are valid for 7 days. See Authentication for details.

The following endpoints do not require authentication:

  • GET /api/auth/me
  • POST /api/auth/setup

API Endpoints Summary

Authentication

MethodEndpointAuthDescription
POST/api/auth/setupNoCreate admin account (one-time)
POST/api/auth/loginNoLogin and obtain session token
GET/api/auth/meOptionalCheck setup/auth status
POST/api/auth/logoutNoInvalidate current session

Providers

MethodEndpointAuthDescription
GET/api/providersYesList all providers
POST/api/providersYesAdd a new provider
PATCH/api/providers/:idYesUpdate a provider
DELETE/api/providers/:idYesDelete a provider
POST/api/providers/verifyYesVerify credentials without saving
GET/api/providers/:id/zonesYesList zones for a provider

Zones

MethodEndpointAuthDescription
GET/api/zonesYesList all zones across providers

Records

MethodEndpointAuthDescription
GET/api/zones/:zoneId/recordsYesList DNS records in a zone
POST/api/zones/:zoneId/recordsYesCreate a DNS record
PATCH/api/zones/:zoneId/records/:recordIdYesUpdate a DNS record
DELETE/api/zones/:zoneId/records/:recordIdYesDelete a DNS record

Lines (Huawei Cloud)

MethodEndpointAuthDescription
GET/api/zones/:zoneId/linesYesList Huawei Cloud resolution lines