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:
| Status | Meaning |
|---|---|
| 200 | Success |
| 201 | Created (POST) |
| 400 | Bad request (missing/invalid parameters) |
| 401 | Unauthorized (missing or invalid Bearer token) |
| 404 | Not found (provider, zone, or record) |
| 405 | Method not allowed |
| 409 | Conflict (e.g. admin already initialized) |
| 422 | Unprocessable entity (e.g. credential verification failed) |
| 502 | Upstream 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/mePOST /api/auth/setup
API Endpoints Summary
Authentication
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| POST | /api/auth/setup | No | Create admin account (one-time) |
| POST | /api/auth/login | No | Login and obtain session token |
| GET | /api/auth/me | Optional | Check setup/auth status |
| POST | /api/auth/logout | No | Invalidate current session |
Providers
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/providers | Yes | List all providers |
| POST | /api/providers | Yes | Add a new provider |
| PATCH | /api/providers/:id | Yes | Update a provider |
| DELETE | /api/providers/:id | Yes | Delete a provider |
| POST | /api/providers/verify | Yes | Verify credentials without saving |
| GET | /api/providers/:id/zones | Yes | List zones for a provider |
Zones
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/zones | Yes | List all zones across providers |
Records
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/zones/:zoneId/records | Yes | List DNS records in a zone |
| POST | /api/zones/:zoneId/records | Yes | Create a DNS record |
| PATCH | /api/zones/:zoneId/records/:recordId | Yes | Update a DNS record |
| DELETE | /api/zones/:zoneId/records/:recordId | Yes | Delete a DNS record |
Lines (Huawei Cloud)
| Method | Endpoint | Auth | Description |
|---|---|---|---|
| GET | /api/zones/:zoneId/lines | Yes | List Huawei Cloud resolution lines |