domains
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseHostinger Domains
Hostinger Domains
The Domains API provides full domain lifecycle management — from checking availability and purchasing to configuring nameservers, forwarding, WHOIS profiles, domain locks, and privacy protection.
Domains API 提供完整的域名生命周期管理——从检查可用性、购买,到配置 nameserver、转发、WHOIS 资料、域名锁和隐私保护。
Table of Contents
目录
Core Concepts
核心概念
Domain Portfolio
域名资产组合
Your domain portfolio contains all domains registered under your Hostinger account. Each domain has configuration for nameservers, WHOIS contacts, lock status, and privacy protection.
您的域名资产组合包含在 Hostinger 账户下注册的所有域名。每个域名均配置有 nameserver、WHOIS 联系人、锁定状态和隐私保护。
Domain Availability
域名可用性
Before purchasing, check if a domain name is available across one or more TLDs. The API also supports alternative domain suggestions.
购买前,检查某个域名是否在一个或多个 TLD 中可用。该 API 还支持备选域名建议。
Domain Forwarding
域名转发
Redirect a domain to another URL using 301 (permanent) or 302 (temporary) redirects.
使用 301(永久)或 302(临时)重定向,将域名重定向到另一个 URL。
WHOIS Profiles
WHOIS 资料
Contact information associated with domain registrations. Each TLD may require specific WHOIS details. Profiles can be reused across multiple domains.
与域名注册关联的联系信息。每个 TLD 可能要求提供特定的 WHOIS 详情。同一资料可在多个域之间复用。
Domain Lock
域名锁
Prevents unauthorized domain transfers. Must be disabled before transferring a domain to another registrar.
防止未经授权的域名转移。将域名转移给另一家注册商之前,必须先禁用域名锁。
Privacy Protection
隐私保护
Hides the domain owner's personal information from public WHOIS databases.
在公开 WHOIS 数据库中隐藏域名所有者的个人信息。
Domain Access Verification
域名访问验证
Some operations require proof that you control a domain. The Domain Access Verifier returns the pending and completed verifications for a set of domains, so you can check verification status before relying on a domain.
Note: This endpoint lives under a different base path —— not/api/v2/direct/verifications/active./api/domains/v1/
某些操作需要证明您控制某个域名。Domain Access Verifier 返回一组域名的待处理验证和已完成验证,因此您可以在依赖某个域名前检查其验证状态。
注意: 此端点位于不同的基础路径下,而不是/api/v2/direct/verifications/active下。/api/domains/v1/
Common Patterns
常见模式
Check Domain Availability
检查域名可用性
bash
curl -X POST "https://developers.hostinger.com/api/domains/v1/availability" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"domain": "myawesomesite",
"tlds": ["com", "net", "org"],
"with_alternatives": true
}'Python SDK:
python
from hostinger_api import Hostinger
client = Hostinger(api_token="YOUR_API_TOKEN")
result = client.domains.availability.check(
domain="myawesomesite",
tlds=["com", "net", "org"],
with_alternatives=True
)TypeScript SDK:
typescript
import { Hostinger } from "hostinger-api-sdk";
const client = new Hostinger({ apiToken: "YOUR_API_TOKEN" });
const result = await client.domains.availability.check({
domain: "myawesomesite",
tlds: ["com", "net", "org"],
withAlternatives: true,
});PHP SDK:
php
use Hostinger\Api\HostingerApi;
$client = new HostingerApi('YOUR_API_TOKEN');
$result = $client->domains->availability->check([
'domain' => 'myawesomesite',
'tlds' => ['com', 'net', 'org'],
'with_alternatives' => true,
]);Note: Rate limited to 10 requests per minute. TLDs should be without leading dot (e.g.,notcom). For alternatives, provide only one TLD..com
bash
curl -X POST "https://developers.hostinger.com/api/domains/v1/availability" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"domain": "myawesomesite",
"tlds": ["com", "net", "org"],
"with_alternatives": true
}'Python SDK:
python
from hostinger_api import Hostinger
client = Hostinger(api_token="YOUR_API_TOKEN")
result = client.domains.availability.check(
domain="myawesomesite",
tlds=["com", "net", "org"],
with_alternatives=True
)TypeScript SDK:
typescript
import { Hostinger } from "hostinger-api-sdk";
const client = new Hostinger({ apiToken: "YOUR_API_TOKEN" });
const result = await client.domains.availability.check({
domain: "myawesomesite",
tlds: ["com", "net", "org"],
withAlternatives: true,
});PHP SDK:
php
use Hostinger\Api\HostingerApi;
$client = new HostingerApi('YOUR_API_TOKEN');
$result = $client->domains->availability->check([
'domain' => 'myawesomesite',
'tlds' => ['com', 'net', 'org'],
'with_alternatives' => true,
]);注意: 限流为每分钟 10 个请求。TLD 不应带前导点(例如,而不是com)。请求备选建议时,只提供一个 TLD。.com
Purchase a Domain
购买域名
bash
curl -X POST "https://developers.hostinger.com/api/domains/v1/portfolio" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"domain": "my-new-domain.com",
"item_id": "hostingercom-domain-com-usd-1y",
"payment_method_id": 1327362,
"domain_contacts": {
"owner_id": 741288,
"admin_id": 741288,
"billing_id": 741288,
"tech_id": 741288
}
}'Getfrom the billing catalog. If no payment method is provided, your default is used. If no WHOIS info is provided, default contact information for that TLD is used.item_id
bash
curl -X POST "https://developers.hostinger.com/api/domains/v1/portfolio" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"domain": "my-new-domain.com",
"item_id": "hostingercom-domain-com-usd-1y",
"payment_method_id": 1327362,
"domain_contacts": {
"owner_id": 741288,
"admin_id": 741288,
"billing_id": 741288,
"tech_id": 741288
}
}'从账单目录获取。如果未提供付款方式,则使用默认付款方式。如果未提供 WHOIS 信息,则使用该 TLD 的默认联系信息。item_id
List and View Domains
列出和查看域名
bash
undefinedbash
undefinedList all domains
List all domains
curl -X GET "https://developers.hostinger.com/api/domains/v1/portfolio"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X GET "https://developers.hostinger.com/api/domains/v1/portfolio"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
Get domain details
Get domain details
curl -X GET "https://developers.hostinger.com/api/domains/v1/portfolio/example.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedcurl -X GET "https://developers.hostinger.com/api/domains/v1/portfolio/example.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedConfigure Nameservers
配置 Nameserver
bash
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/nameservers" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ns1": "ns1.custom-dns.com",
"ns2": "ns2.custom-dns.com"
}'bash
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/nameservers" \
-H "Authorization: Bearer $HOSTINGER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"ns1": "ns1.custom-dns.com",
"ns2": "ns2.custom-dns.com"
}'Domain Forwarding
域名转发
bash
undefinedbash
undefinedCreate forwarding (301 permanent redirect)
Create forwarding (301 permanent redirect)
curl -X POST "https://developers.hostinger.com/api/domains/v1/forwarding"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domain": "old-domain.com", "redirect_type": "301", "redirect_url": "https://new-domain.com" }'
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domain": "old-domain.com", "redirect_type": "301", "redirect_url": "https://new-domain.com" }'
curl -X POST "https://developers.hostinger.com/api/domains/v1/forwarding"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domain": "old-domain.com", "redirect_type": "301", "redirect_url": "https://new-domain.com" }'
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domain": "old-domain.com", "redirect_type": "301", "redirect_url": "https://new-domain.com" }'
Get forwarding config
Get forwarding config
curl -X GET "https://developers.hostinger.com/api/domains/v1/forwarding/old-domain.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X GET "https://developers.hostinger.com/api/domains/v1/forwarding/old-domain.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
Delete forwarding
Delete forwarding
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/forwarding/old-domain.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedcurl -X DELETE "https://developers.hostinger.com/api/domains/v1/forwarding/old-domain.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedDomain Lock & Privacy Protection
域名锁与隐私保护
bash
undefinedbash
undefinedEnable domain lock (prevent transfers)
Enable domain lock (prevent transfers)
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/domain-lock"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/domain-lock"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
Disable domain lock (before transfer)
Disable domain lock (before transfer)
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/domain-lock"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/domain-lock"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
Enable privacy protection
Enable privacy protection
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/privacy-protection"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/privacy-protection"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
Disable privacy protection
Disable privacy protection
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/privacy-protection"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedcurl -X DELETE "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/privacy-protection"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedWHOIS Profile Management
WHOIS 资料管理
bash
undefinedbash
undefinedList WHOIS profiles (optionally filter by TLD)
List WHOIS profiles (optionally filter by TLD)
curl -X GET "https://developers.hostinger.com/api/domains/v1/whois?tld=com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X GET "https://developers.hostinger.com/api/domains/v1/whois?tld=com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
Create a WHOIS profile
Create a WHOIS profile
curl -X POST "https://developers.hostinger.com/api/domains/v1/whois"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "tld": "com", "entity_type": "individual", "country": "US", "whois_details": { "first_name": "John", "last_name": "Doe", "email": "john@example.com", "phone": "+1.5551234567", "address": "123 Main St", "city": "New York", "state": "NY", "zip": "10001" } }'
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "tld": "com", "entity_type": "individual", "country": "US", "whois_details": { "first_name": "John", "last_name": "Doe", "email": "john@example.com", "phone": "+1.5551234567", "address": "123 Main St", "city": "New York", "state": "NY", "zip": "10001" } }'
curl -X POST "https://developers.hostinger.com/api/domains/v1/whois"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "tld": "com", "entity_type": "individual", "country": "US", "whois_details": { "first_name": "John", "last_name": "Doe", "email": "john@example.com", "phone": "+1.5551234567", "address": "123 Main St", "city": "New York", "state": "NY", "zip": "10001" } }'
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "tld": "com", "entity_type": "individual", "country": "US", "whois_details": { "first_name": "John", "last_name": "Doe", "email": "john@example.com", "phone": "+1.5551234567", "address": "123 Main St", "city": "New York", "state": "NY", "zip": "10001" } }'
Check which domains use a WHOIS profile
Check which domains use a WHOIS profile
curl -X GET "https://developers.hostinger.com/api/domains/v1/whois/741288/usage"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X GET "https://developers.hostinger.com/api/domains/v1/whois/741288/usage"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
Delete a WHOIS profile
Delete a WHOIS profile
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/whois/741288"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedcurl -X DELETE "https://developers.hostinger.com/api/domains/v1/whois/741288"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefinedCheck Domain Verifications
检查域名验证
bash
undefinedbash
undefinedGet pending and completed verifications for one or more domains
Get pending and completed verifications for one or more domains
curl -X GET "https://developers.hostinger.com/api/v2/direct/verifications/active"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domains": ["example.com", "example.net"] }'
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domains": ["example.com", "example.net"] }'
undefinedcurl -X GET "https://developers.hostinger.com/api/v2/direct/verifications/active"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domains": ["example.com", "example.net"] }'
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
-H "Content-Type: application/json"
-d '{ "domains": ["example.com", "example.net"] }'
undefinedAPI Reference
API 参考
Availability
可用性
| Method | Endpoint | Description |
|---|---|---|
| | Check domain availability (rate limit: 10/min) |
| 方法 | 端点 | 描述 |
|---|---|---|
| | 检查域名可用性(限流:10 次/分钟) |
Portfolio
域名资产组合
| Method | Endpoint | Description |
|---|---|---|
| | List all domains |
| | Purchase a new domain |
| | Get domain details |
| | Update nameservers |
| | Enable domain lock |
| | Disable domain lock |
| | Enable privacy protection |
| | Disable privacy protection |
| 方法 | 端点 | 描述 |
|---|---|---|
| | 列出所有域名 |
| | 购买新域名 |
| | 获取域名详情 |
| | 更新 nameserver |
| | 启用域名锁 |
| | 禁用域名锁 |
| | 启用隐私保护 |
| | 禁用隐私保护 |
Forwarding
转发
| Method | Endpoint | Description |
|---|---|---|
| | Create domain forwarding |
| | Get forwarding config |
| | Delete forwarding |
| 方法 | 端点 | 描述 |
|---|---|---|
| | 创建域名转发 |
| | 获取转发配置 |
| | 删除转发 |
WHOIS
WHOIS
| Method | Endpoint | Description |
|---|---|---|
| | List WHOIS profiles |
| | Create WHOIS profile |
| | Get WHOIS profile |
| | Delete WHOIS profile |
| | Get profile usage |
| 方法 | 端点 | 描述 |
|---|---|---|
| | 列出 WHOIS 资料 |
| | 创建 WHOIS 资料 |
| | 获取 WHOIS 资料 |
| | 删除 WHOIS 资料 |
| | 获取资料使用情况 |
Verifications
验证
| Method | Endpoint | Description |
|---|---|---|
| | Get pending and completed domain verifications (body: |
| 方法 | 端点 | 描述 |
|---|---|---|
| | 获取待处理和已完成的域名验证(请求体: |
Best Practices
最佳实践
Registration
注册
- Always check availability before attempting to purchase
- Ensure WHOIS profile exists for the target TLD before registering
- Some TLDs require — check requirements per TLD
additional_details - Keep domain lock enabled to prevent unauthorized transfers
- 尝试购买前,务必检查可用性
- 注册前,确保目标 TLD 已存在 WHOIS 资料
- 某些 TLD 要求提供 ——请按 TLD 检查具体要求
additional_details - 保持域名锁处于启用状态,防止未经授权的转移
Security
安全
- Enable privacy protection to hide personal information from public WHOIS
- Enable domain lock on all production domains
- Only disable domain lock immediately before an intended transfer
- 启用 隐私保护,在公开 WHOIS 中隐藏个人信息
- 对所有生产域名启用 域名锁
- 仅在计划转移且转移前才禁用域名锁
Nameservers
Nameserver
- Improper nameserver configuration makes the domain unresolvable
- Always have at least 2 nameservers configured
- Verify nameservers are responding before switching
- nameserver 配置不当会导致域名无法解析
- 始终至少配置 2 个 nameserver
- 切换前,验证 nameserver 正在正常响应
Forwarding
转发
- Use (permanent) for SEO-preserving redirects
301 - Use (temporary) for short-term redirects
302 - Remove forwarding before pointing the domain to hosting
- 对保留 SEO 的重定向使用 (永久)
301 - 对短期重定向使用 (临时)
302 - 将域名指向托管服务之前,移除转发配置
Troubleshooting
故障排查
Domain Not Resolving After Nameserver Change
更换 Nameserver 后域名无法解析
- Nameserver changes can take up to 48 hours to propagate
- Verify new nameservers are configured correctly:
dig NS example.com - Check that DNS records exist on the new nameserver
- nameserver 更改最多可能需要 48 小时才能传播
- 验证新 nameserver 配置正确:
dig NS example.com - 检查新 nameserver 上是否存在 DNS 记录
Domain Purchase Failed
域名购买失败
- Check registration status in hPanel
- Verify WHOIS profile is complete for the target TLD
- Ensure payment method has sufficient funds
- 在 hPanel 中检查注册状态
- 验证目标 TLD 的 WHOIS 资料是否完整
- 确保付款方式中有足够资金
Domain Lock Cannot Be Disabled
域名锁无法禁用
- Some TLDs have registrar-imposed lock periods after registration
- Contact support if the lock state doesn't change
- 某些 TLD 在注册后会有注册商规定的锁定期
- 如果锁定状态未发生变化,请联系支持团队
WHOIS Profile Deletion Fails
WHOIS 资料删除失败
- Profile may be in use by active domains
- Check usage with the endpoint first
/whois/{whoisId}/usage
- 该资料可能正被有效域名使用
- 先使用 端点检查使用情况
/whois/{whoisId}/usage
See Also
另请参阅
The following deep-dive guide is available in this skill directory:
- — Domain purchase workflow, nameserver configuration, transfer procedures, WHOIS management, and bulk operations (TypeScript/PHP examples)
transfer-guide.md
以下深入指南位于此 skill 目录中:
- — 域名购买工作流、nameserver 配置、转移流程、WHOIS 管理和批量操作(TypeScript/PHP 示例)
transfer-guide.md