domains

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Hostinger 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 —
/api/v2/direct/verifications/active
— not
/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.,
com
not
.com
). For alternatives, provide only one TLD.
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
而不是
.com
)。请求备选建议时,只提供一个 TLD。

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
    }
  }'
Get
item_id
from 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.
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
    }
  }'
从账单目录获取
item_id
。如果未提供付款方式,则使用默认付款方式。如果未提供 WHOIS 信息,则使用该 TLD 的默认联系信息。

List and View Domains

列出和查看域名

bash
undefined
bash
undefined

List all domains

List all domains

curl -X GET "https://developers.hostinger.com/api/domains/v1/portfolio"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
curl -X GET "https://developers.hostinger.com/api/domains/v1/portfolio"
-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"
undefined
curl -X GET "https://developers.hostinger.com/api/domains/v1/portfolio/example.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefined

Configure 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
undefined
bash
undefined

Create 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" }'
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" }'

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"
curl -X GET "https://developers.hostinger.com/api/domains/v1/forwarding/old-domain.com"
-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"
undefined
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/forwarding/old-domain.com"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefined

Domain Lock & Privacy Protection

域名锁与隐私保护

bash
undefined
bash
undefined

Enable 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"
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/domain-lock"
-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"
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/domain-lock"
-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"
curl -X PUT "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/privacy-protection"
-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"
undefined
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/portfolio/example.com/privacy-protection"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefined

WHOIS Profile Management

WHOIS 资料管理

bash
undefined
bash
undefined

List 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"
curl -X GET "https://developers.hostinger.com/api/domains/v1/whois?tld=com"
-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" } }'
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" } }'

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"
curl -X GET "https://developers.hostinger.com/api/domains/v1/whois/741288/usage"
-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"
undefined
curl -X DELETE "https://developers.hostinger.com/api/domains/v1/whois/741288"
-H "Authorization: Bearer $HOSTINGER_API_TOKEN"
undefined

Check Domain Verifications

检查域名验证

bash
undefined
bash
undefined

Get 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"] }'
undefined
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"] }'
undefined

API Reference

API 参考

Availability

可用性

MethodEndpointDescription
POST
/api/domains/v1/availability
Check domain availability (rate limit: 10/min)
方法端点描述
POST
/api/domains/v1/availability
检查域名可用性(限流:10 次/分钟)

Portfolio

域名资产组合

MethodEndpointDescription
GET
/api/domains/v1/portfolio
List all domains
POST
/api/domains/v1/portfolio
Purchase a new domain
GET
/api/domains/v1/portfolio/{domain}
Get domain details
PUT
/api/domains/v1/portfolio/{domain}/nameservers
Update nameservers
PUT
/api/domains/v1/portfolio/{domain}/domain-lock
Enable domain lock
DELETE
/api/domains/v1/portfolio/{domain}/domain-lock
Disable domain lock
PUT
/api/domains/v1/portfolio/{domain}/privacy-protection
Enable privacy protection
DELETE
/api/domains/v1/portfolio/{domain}/privacy-protection
Disable privacy protection
方法端点描述
GET
/api/domains/v1/portfolio
列出所有域名
POST
/api/domains/v1/portfolio
购买新域名
GET
/api/domains/v1/portfolio/{domain}
获取域名详情
PUT
/api/domains/v1/portfolio/{domain}/nameservers
更新 nameserver
PUT
/api/domains/v1/portfolio/{domain}/domain-lock
启用域名锁
DELETE
/api/domains/v1/portfolio/{domain}/domain-lock
禁用域名锁
PUT
/api/domains/v1/portfolio/{domain}/privacy-protection
启用隐私保护
DELETE
/api/domains/v1/portfolio/{domain}/privacy-protection
禁用隐私保护

Forwarding

转发

MethodEndpointDescription
POST
/api/domains/v1/forwarding
Create domain forwarding
GET
/api/domains/v1/forwarding/{domain}
Get forwarding config
DELETE
/api/domains/v1/forwarding/{domain}
Delete forwarding
方法端点描述
POST
/api/domains/v1/forwarding
创建域名转发
GET
/api/domains/v1/forwarding/{domain}
获取转发配置
DELETE
/api/domains/v1/forwarding/{domain}
删除转发

WHOIS

WHOIS

MethodEndpointDescription
GET
/api/domains/v1/whois
List WHOIS profiles
POST
/api/domains/v1/whois
Create WHOIS profile
GET
/api/domains/v1/whois/{whoisId}
Get WHOIS profile
DELETE
/api/domains/v1/whois/{whoisId}
Delete WHOIS profile
GET
/api/domains/v1/whois/{whoisId}/usage
Get profile usage
方法端点描述
GET
/api/domains/v1/whois
列出 WHOIS 资料
POST
/api/domains/v1/whois
创建 WHOIS 资料
GET
/api/domains/v1/whois/{whoisId}
获取 WHOIS 资料
DELETE
/api/domains/v1/whois/{whoisId}
删除 WHOIS 资料
GET
/api/domains/v1/whois/{whoisId}/usage
获取资料使用情况

Verifications

验证

MethodEndpointDescription
GET
/api/v2/direct/verifications/active
Get pending and completed domain verifications (body:
domains
string array)
方法端点描述
GET
/api/v2/direct/verifications/active
获取待处理和已完成的域名验证(请求体:
domains
字符串数组)

Best Practices

最佳实践

Registration

注册

  • Always check availability before attempting to purchase
  • Ensure WHOIS profile exists for the target TLD before registering
  • Some TLDs require
    additional_details
    — check requirements per TLD
  • Keep domain lock enabled to prevent unauthorized transfers
  • 尝试购买前,务必检查可用性
  • 注册前,确保目标 TLD 已存在 WHOIS 资料
  • 某些 TLD 要求提供
    additional_details
    ——请按 TLD 检查具体要求
  • 保持域名锁处于启用状态,防止未经授权的转移

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
    301
    (permanent) for SEO-preserving redirects
  • Use
    302
    (temporary) for short-term redirects
  • 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
    /whois/{whoisId}/usage
    endpoint first
  • 该资料可能正被有效域名使用
  • 先使用
    /whois/{whoisId}/usage
    端点检查使用情况

See Also

另请参阅

The following deep-dive guide is available in this skill directory:
  • transfer-guide.md
    — Domain purchase workflow, nameserver configuration, transfer procedures, WHOIS management, and bulk operations (TypeScript/PHP examples)
以下深入指南位于此 skill 目录中:
  • transfer-guide.md
    — 域名购买工作流、nameserver 配置、转移流程、WHOIS 管理和批量操作(TypeScript/PHP 示例)

References

参考资料