Spaces:
Runtime error
Runtime error
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 statusGET /docs- Swagger API documentation
Accounts (/api/accounts)
GET /- List all accountsPOST /- Create a new accountGET /:id- Get account detailsPATCH /:id- Update accountDELETE /:id- Delete accountPOST /:id/refresh-token- Manually refresh account tokenPOST /refresh-all-tokens- Refresh tokens for all accounts
Domains (/api/domains)
GET /- List all domainsPOST /- Register a new domainGET /:id- Get domain detailsDELETE /:id- Delete domain
DNS Records (/api/dns)
GET /:domainId/records- List DNS recordsPOST /:domainId/records- Create DNS record (A/CNAME)PUT /:domainId/records/:recordId- Update recordDELETE /:domainId/records/:recordId- Delete recordPOST /: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"