DNSHE Free Domain API User Guide (V2.0)
Basic Information
API Endpoint: `https://api005.dnshe.com/index.php?m=domain_hub`
Authentication Method: API Key + API Secret
Supported Format: JSON
Rate Limit: Default 30 requests/minute
Authentication:Obtain API Credentials
- Log in to the client area
- Navigate to the "Free Domain Management" page
- Find "API Management" in the left navigation bar
- Click "Create API Key"
Authentication Methods
Method 1: HTTP Header (Recommended)
|
bash |
Method 2: URL/Body Parameters (Disabled)
For security reasons, `api_key` / `api_secret` are no longer supported via URL Query or request body. Please use only the `X-API-Key` and `X-API-Secret` request headers for authentication.
API Endpoints
- Subdomain Management
1.1 List Subdomains
Endpoint: `subdomains`
Action: `list`
Method: `GET`
Query Parameters:
|
Parameter |
Type |
Required |
Default Value |
Description |
|
page |
integer |
No |
1 |
Page number (starting from 1) |
|
per_page |
integer |
No |
200 |
Items per page (1-500) |
|
include_total |
boolean |
No |
false |
Whether to return the total count (slower for large datasets) |
|
search |
string |
No |
- |
Search keyword (matches subdomain or rootdomain) |
|
rootdomain |
string |
No |
- |
Filter by root domain |
|
status |
string |
No |
- |
Filter by status (active/suspended/expired) |
|
created_from |
string |
No |
- |
Creation start date (YYYY-MM-DD) |
|
created_to |
string |
No |
- |
Creation end date (YYYY-MM-DD) |
|
sort_by |
string |
No |
id |
Sort field (id/created_at/updated_at/expires_at/subdomain) |
|
sort_dir |
string |
No |
desc |
Sort direction (asc/desc) |
|
fields |
string |
No |
all |
Return fields (comma-separated). Optional: id,subdomain,rootdomain,full_domain,status,created_at,updated_at,expires_at,never_expires,cloudflare_zone_id,provider_account_id; id will be automatically added when custom fields are specified |
Basic Request Example:
|
bash |
Pagination Request Example:
|
bash |
Search and Filter Example:
|
bash |
Basic Response Example:
|
json |
Pagination Response Example:
|
json |
Performance Optimization Suggestions:
- Default 200 items per page; it is recommended to adjust `per_page` according to needs (50-100 is recommended)
- `include_total=1` will execute a COUNT query, which may be slow for large datasets; use only when necessary
- Judging whether there is a next page through `pagination.has_more` is more efficient than relying on `total`
- Using the `fields` parameter can significantly reduce data transfer volume
- Maximum `per_page=500`; values exceeding this will be automatically limited to 500
- For 10,000+ domains, it is recommended to use search and filter functions to accurately locate target domains
1.2 Register Subdomain
Endpoint:`subdomains`
Action:`register`
Method:`POST`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
subdomain |
string |
Yes |
Subdomain prefix |
|
rootdomain |
string |
Yes |
Root domain |
Request Example:
|
bash |
Response Example:
|
json |
1.3 Get Subdomain Details
Endpoint:`subdomains`
Action:`get`
Method:`GET`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
subdomain_id |
integer |
Yes |
Subdomain ID |
Request Example:
|
bash |
Response Example:
|
json |
1.4 Delete Subdomain
Endpoint:`subdomains`
Action:`delete`
Method:`POST` or `DELETE`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
subdomain_id |
integer |
Yes |
Subdomain ID |
Request Example:
|
bash |
Response Example:
|
json |
1.5 Renew Subdomain
Endpoint:`subdomains`
Action:`renew`
Method:`POST` or `PUT`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
subdomain_id |
integer |
Yes |
Subdomain ID |
Request Example:
|
bash |
Response Example:
|
json |
Description:
- `charged_amount` indicates the amount deducted from the user's account balance for this renewal. If the renewal is free or the deduction amount is 0, this field will be `0`.
Possible Errors:
- `403 renewal disabled`: No valid registration period is configured in the backend.
- `422 renewal not yet available`: The free renewal window has not yet opened (returns `error_code=renewal_not_yet_available` and remaining time field).
- `403 redemption period requires administrator`: The domain is in the redemption period and the backend is configured for manual processing.
- `403 renewal window expired`: The renewal grace period has expired.
- `402 insufficient balance for redemption renewal`: The redemption period is set to automatic deduction, but the account balance is insufficient.
- `404 subdomain not found`: The corresponding subdomain cannot be found or does not belong to the current API Key.
- DNS Record Management
2.1 List DNS Records
Endpoint:`dns_records`
Action:`list`
Method:`GET`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
subdomain_id |
integer |
Yes |
Subdomain ID |
Request Example:
|
bash |
Response Example:
|
json |
|
Note: The list returns both the internal module `id` and the cloud DNS provider `record_id`. Either field can be used to locate the record for `update`/`delete` (using `id` is recommended). |
2.2 Create DNS Record
Endpoint:`dns_records`
Action:`create`
Method:`POST`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
subdomain_id |
integer |
Yes |
Subdomain ID |
|
type |
string |
Yes |
Record type (A/AAAA/CNAME/MX/TXT/NS/SRV/CAA) |
|
name |
string |
No |
Record name (`@` or empty = current subdomain itself; full domain is supported) |
|
content |
string |
Conditionally Required |
Record value (SRV/CAA can be automatically assembled from structured parameters) |
|
ttl |
integer |
No |
TTL value (default 600) |
|
priority |
integer |
No |
MX priority (default 10 for MX)/SRV priority (default 0 for SRV) |
|
line |
string |
No |
Resolution line (available for us.ci/cn.mt, automatically ignored by other providers) |
|
record_weight / weight |
integer |
No |
SRV weight |
|
record_port / port |
integer |
No |
SRV port (1-65535) |
|
record_target / target |
string |
No |
SRV target host |
|
caa_flag |
integer |
No |
CAA flag (default 0) |
|
caa_tag |
string |
No |
CAA tag (default issue) |
|
caa_value |
string |
No |
CAA value |
|
Note: If NS management is disabled in the backend (`disable_ns_management`), writing `NS` type records will be rejected. |
Request Example:
|
bash |
Response Example:
|
json |
2.3 Update DNS Record
Endpoint:`dns_records`
Action:`update`
Method:`POST` or `PUT` or `PATCH`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
record_id |
string |
No |
Record positioning ID (can pass module `id` or provider `record_id`) |
|
id |
integer |
No |
Internal module record ID (recommended) |
|
type |
string |
No |
New type (A/AAAA/CNAME/MX/TXT/NS/SRV/CAA) |
|
name |
string |
No |
New name (`@` or empty = current subdomain itself) |
|
content |
string |
No |
New record value |
|
ttl |
integer |
No |
New TTL value |
|
priority |
integer |
No |
MX/SRV priority |
|
line |
string |
No |
Resolution line |
|
record_weight / weight |
integer |
No |
SRV weight |
|
record_port / port |
integer |
No |
SRV port |
|
record_target / target |
string |
No |
SRV target host |
|
caa_flag / caa_tag / caa_value |
mixed |
No |
CAA structured parameters |
|
At least one of `record_id` or `id` must be provided. |
Request Example:
|
bash |
Response Example:
|
json |
2.4 Delete DNS Record
Endpoint:`dns_records`
Action:`delete`
Method:`POST` or `DELETE`
Request Parameters:
|
Parameter |
Type |
Required |
Description |
|
record_id |
string |
No |
Record ID returned by the cloud DNS provider. If provided, it will be matched first. |
|
id |
integer |
No |
Internal module record ID, which can directly use the `id` value returned by the `list` interface. |
|
At least one of `record_id` or `id` must be provided. |
Request Example:
|
bash |
|
bash |
Response Example:
|
json |
- API Key Management
3.1 List API Keys
Endpoint:`keys`
Action:`list`
Method:`GET`
Request Example:
|
bash |
Response Example:
|
json DNSHE Free Domain API Documentation 3.2 Create API Key Endpoint: `keys` Action: `create` Method: `POST` Request Parameters:
Request Example:
Response Example:
3.3 Delete API Key Endpoint: `keys` Action: `delete` Method: `POST` or `DELETE` Request Parameters:
Request Example:
Response Example:
3.4 Regenerate API Key Endpoint: `keys` Action: `regenerate` Method: `POST` Request Parameters:
Request Example:
Response Example:
4.1 Query Quota Endpoint: `quota` Method: `GET` Request Example:
Response Example:
Error Codes and Unified Error Structure Starting from the current version, all API error responses follow the unified structure below:
Field Description:
Common Error Codes:
Rate Limiting Default Limit: 60 requests/minute Response Headers: - Rate limiting information is included in the request response Rate Limit Exceeded Response Example:
SDK Examples PHP Example
Python Example
JavaScript Example
This API is used to query WHOIS information externally, supporting both subdomains within the system and external domains. API Key is not required by default; the system enforces rate limiting based on the access IP (default 2 queries/minute, adjustable in the background via "WHOIS Queries Per Minute Limit"). To force the use of API Key, enable the "WHOIS Query Requires API Key" switch in the background. - Endpoint: `whois` - Method: `GET` -Parameters:
Request Example (Public Mode):
Request Example (When API Key is Required):
Response Example (Registered):
Response Example (Unregistered):
8.1 Query My Permanent Upgrade Status Endpoint: `permanent_upgrade` Action: `list` Method: `GET` Parameters:
Request Example:
Response Example:
8.2 Create Permanent Upgrade Task Endpoint: `permanent_upgrade` Action: `create` Method: `POST` / `PUT` Parameters:
Request Example:
8.3 Assist with Invitation Code Endpoint: `permanent_upgrade` Action: `assist` Method: `POST` / `PUT` Parameters:
Request Example:
8.4 Cancel Permanent Upgrade Task Endpoint: `permanent_upgrade` Action: `cancel` Method: `POST` / `DELETE` Parameters:
Request Example:
Common Errors
Here is the English translation of your documentation, formatted for clarity and professional use: Security RecommendationsProtecting API Keys
IP Whitelisting
Principle of Least Privilege
Monitoring Usage
HTTPS
FAQQ1: What should I do if my API key is lost or compromised? A: You can use the "Regenerate" action to create a new key. Once regenerated, the old key will be immediately invalidated. Q2: How can I increase my rate limit? A: Please contact the administrator to adjust the "API Request Rate Limit" settings in the backend. Q3: Can I use API keys from sub-accounts? A: No. API keys can only be created and managed by the main account. Q4: Does the API support batch operations? A: Currently, batch operations are not supported. APIs must be called individually for each task. Q5: How can I view API usage statistics? A: You can view the usage count and "Last Used" timestamp for each key in the "API Management" card within the Client Area. Changelogv2.0 (2026-04-25)
v1.0 (2025-10-19)
Support: If you encounter any is
Related Articles |