domain-reg / README.md
cz4ehs
Deploy Zone.ID Domain API 2025-12-07
03cdf80
metadata
title: Zone.ID Domain Registration API
emoji: 🌐
colorFrom: blue
colorTo: purple
sdk: docker
app_port: 7860
pinned: false

Zone.ID Domain Registration API

A REST API for automating zone.id and nett.to domain registration with automatic account management.

Features

  • Domain Registration: Create subdomains on zone.id and nett.to
  • DNS Management: Create, update, and delete A and CNAME records
  • Auto-Account Creation: Automatically creates new accounts when domain limits are reached
  • Token Auto-Refresh: Automatically refreshes tokens every 6 hours to prevent expiration

API Endpoints

All endpoints require X-API-Key header for authentication.

Health Check

  • GET /health - Check API status
  • GET /docs - Swagger API documentation

Accounts (/api/accounts)

  • GET / - List all accounts
  • POST / - Create a new account
  • GET /:id - Get account details
  • PATCH /:id - Update account
  • DELETE /:id - Delete account
  • POST /:id/refresh-token - Manually refresh account token
  • POST /refresh-all-tokens - Refresh tokens for all accounts

Domains (/api/domains)

  • GET / - List all domains
  • POST / - Register a new domain
  • GET /:id - Get domain details
  • DELETE /:id - Delete domain

DNS Records (/api/dns)

  • GET /:domainId/records - List DNS records
  • POST /:domainId/records - Create DNS record (A/CNAME)
  • PUT /:domainId/records/:recordId - Update record
  • DELETE /:domainId/records/:recordId - Delete record
  • POST /:domainId/sync - Sync records from Zone.ID

Environment Variables

Required:

  • DATABASE_URL - PostgreSQL connection string

Optional:

  • PORT - Server port (default: 7860)
  • HOST - Server host (default: 0.0.0.0)

Usage Example

# Create a domain
curl -X POST https://your-space.hf.space/api/domains \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"subdomain": "myapp", "suffix": "zone.id"}'

# Create an A record
curl -X POST https://your-space.hf.space/api/dns/{domainId}/records \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"type": "A", "hostname": "@", "content": "1.2.3.4"}'

# Create a CNAME record
curl -X POST https://your-space.hf.space/api/dns/{domainId}/records \
  -H "X-API-Key: your-api-key" \
  -H "Content-Type: application/json" \
  -d '{"type": "CNAME", "hostname": "www", "content": "example.com"}'

Token Auto-Refresh

The API automatically refreshes Zone.ID tokens every 6 hours to prevent the 3-day expiration. You can also manually trigger a refresh:

# Refresh specific account token
curl -X POST https://your-space.hf.space/api/accounts/{accountId}/refresh-token \
  -H "X-API-Key: your-api-key"

# Refresh all account tokens
curl -X POST https://your-space.hf.space/api/accounts/refresh-all-tokens \
  -H "X-API-Key: your-api-key"