Complete API for domain registration, DNS management, and web hosting automation
Register, transfer, and manage 200+ TLDs with HostBay
Full Cloudflare DNS control with A, AAAA, CNAME, MX, TXT records
Provision and manage hosting with email, databases, and SSL
API keys with granular permissions and rate limiting
Track domain status, DNS propagation, and SSL certificates
Easy balance management with flexible payment options
Get started with HostBay API in minutes with code examples in multiple languages
Create an API key through the HostBay Telegram bot
# List your domains
curl -X GET "https://api.hostbay.io/api/v1/domains" \
-H "Authorization: Bearer YOUR_API_KEY"
# Register a new domain (using HostBay contacts - easiest method)
curl -X POST "https://api.hostbay.io/api/v1/domains/register" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain_name": "example.com",
"period": 1,
"use_hostbay_contacts": true
}'
pip install requests
import requests
# Configuration
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# List domains
response = requests.get(f"{BASE_URL}/domains", headers=headers)
domains = response.json()
print(f"Your domains: {domains}")
# Register a domain (using HostBay contacts - easiest method)
domain_data = {
"domain_name": "example.com",
"period": 1,
"use_hostbay_contacts": True
}
response = requests.post(
f"{BASE_URL}/domains/register",
headers=headers,
json=domain_data
)
result = response.json()
print(f"Registration result: {result}")
npm install axios
const axios = require('axios');
// Configuration
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// List domains
async function listDomains() {
const response = await axios.get(`${BASE_URL}/domains`, { headers });
console.log('Your domains:', response.data);
}
// Register a domain (using HostBay contacts - easiest method)
async function registerDomain() {
const domainData = {
domain_name: 'example.com',
period: 1,
use_hostbay_contacts: true
};
const response = await axios.post(
`${BASE_URL}/domains/register`,
domainData,
{ headers }
);
console.log('Registration result:', response.data);
}
// Run examples
listDomains();
registerDomain();
'example.com',
'period' => 1,
'use_hostbay_contacts' => true
];
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $BASE_URL . '/domains/register');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($domainData));
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$result = json_decode($response, true);
curl_close($ch);
echo "Registration result: ";
print_r($result);
?>
You can create API keys through the HostBay Telegram bot:
Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Domains: Register, transfer, renew, and manage domain names
DNS: Create, update, delete DNS records (A, AAAA, CNAME, MX, TXT)
Hosting: Provision hosting, manage cPanel accounts, SSL certificates
Wallet: View balance, make payments, transaction history
API Keys: Manage other API keys (admin permission)
⥠Default Limits
Rate Limit Headers:
X-RateLimit-Limit - Maximum requests allowedX-RateLimit-Remaining - Requests remaining in current windowX-RateLimit-Reset - Unix timestamp when limit resetsđĄ If you exceed rate limits, you'll receive HTTP 429 (Too Many Requests). Custom limits available for enterprise customers.
â ī¸ Insufficient Balance Protection
All financial operations (domain registration, hosting, renewals) check wallet balance before processing. You'll receive a clear error if balance is insufficient:
{
"error": {
"code": "BAD_REQUEST",
"message": "Insufficient wallet balance. Required: $35.58, Available: $15.00",
"details": {
"required": 35.58,
"available": 15.0,
"shortage": 20.58
}
},
"timestamp": 1761937123
}
Best Practices:
GET /api/v1/wallet/balance to verify available fundsHostBay API offers flexible domain registration with two approaches:
Best for: Quick integrations, resellers, and automated systems
How it works: Set use_hostbay_contacts: true - HostBay handles all contact information automatically, just like our Telegram bot does.
Advantage: Minimal API payload, fastest integration, no contact data management needed
Best for: Enterprise, end-user portals, custom WHOIS data
How it works: Provide complete contacts object with registrant details
Advantage: Full WHOIS control, custom contact information visible in domain registration
The easiest way to register - no contact information required:
curl -X POST "https://api.hostbay.io/api/v1/domains/register" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain_name": "example.com",
"period": 1,
"use_hostbay_contacts": true,
"auto_renew": true
}'
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
# Simple registration with HostBay contacts
domain_data = {
"domain_name": "example.com",
"period": 1,
"use_hostbay_contacts": True,
"auto_renew": True
}
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.post(
f"{BASE_URL}/domains/register",
headers=headers,
json=domain_data
)
result = response.json()
print(f"Domain registered: {result['data']['domain_name']}")
print(f"Final price (with 10% API discount): ${result['data']['pricing']['final_price']}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
async function registerDomain() {
const domainData = {
domain_name: 'example.com',
period: 1,
use_hostbay_contacts: true,
auto_renew: true
};
const response = await axios.post(
`${BASE_URL}/domains/register`,
domainData,
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
console.log(`Domain registered: ${response.data.data.domain_name}`);
console.log(`Price (10% API discount): $${response.data.data.pricing.final_price}`);
}
registerDomain();
Provide your own contact information for WHOIS registration:
curl -X POST "https://api.hostbay.io/api/v1/domains/register" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain_name": "example.com",
"period": 1,
"contacts": {
"registrant": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1.2025551234",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US",
"company": "Example Inc"
}
},
"auto_renew": true,
"privacy_protection": true
}'
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
# Domain registration data
domain_data = {
"domain_name": "example.com",
"period": 1,
"contacts": {
"registrant": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1.2025551234",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US",
"company": "Example Inc"
}
},
"auto_renew": True,
"privacy_protection": True
}
headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.post(
f"{BASE_URL}/domains/register",
headers=headers,
json=domain_data
)
result = response.json()
print(f"Domain registered: {result['data']['domain_name']}")
print(f"Privacy enabled: {result['data']['privacy_enabled']}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
async function registerDomain() {
const domainData = {
domain_name: 'example.com',
period: 1,
contacts: {
registrant: {
first_name: 'John',
last_name: 'Doe',
email: 'john@example.com',
phone: '+1.2025551234',
address: '123 Main St',
city: 'New York',
state: 'NY',
postal_code: '10001',
country: 'US',
company: 'Example Inc'
}
},
auto_renew: true,
privacy_protection: true
};
const response = await axios.post(
`${BASE_URL}/domains/register`,
domainData,
{ headers: { Authorization: `Bearer ${API_KEY}` } }
);
console.log(`Domain registered: ${response.data.data.domain_name}`);
console.log(`Privacy enabled: ${response.data.data.privacy_enabled}`);
}
registerDomain();
Transfer an existing domain to HostBay:
POST /api/v1/domains/transfer
{
"domain_name": "existing-domain.com",
"auth_code": "EPP-AUTH-CODE-HERE",
"period": 1
}
Renew before expiration to maintain ownership:
POST /api/v1/domains/{domain_name}/renew
{
"period": 1
}
Enable or disable automatic renewal:
PATCH /api/v1/domains/{domain_name}
{
"auto_renew": true
}
HostBay offers comprehensive WHOIS privacy protection to shield your personal information from public WHOIS lookups. Privacy protection works differently based on how your domain is registered:
HostBay-Managed Contacts:
use_hostbay_contacts: true use our shared privacy contact by defaultUser-Provided Contacts:
Privacy Guard Contact Details (WHOIS Replacement):
Name: Domain Privacy Guard
Company: Whois Privacy Service
Email: cloakhost@tutamail.com
Phone: +354.4212434
Address: P.O. Box 123, Privacy Dept.
City: Reykjavik, Capital Region
Postal Code: 101
Country: Iceland (IS)
Set privacy_protection: true when registering a domain:
POST /api/v1/domains/register
{
"domain_name": "example.com",
"period": 1,
"use_hostbay_contacts": false,
"privacy_protection": true,
"contacts": {
"registrant": {
"first_name": "John",
"last_name": "Doe",
"email": "john@example.com",
"phone": "+1.2025551234",
"address": "123 Main St",
"city": "New York",
"state": "NY",
"postal_code": "10001",
"country": "US"
}
}
}
# Result: Domain registered with Privacy Guard contact in WHOIS
# John Doe's real contact stored securely for later restoration
Enable or disable privacy protection anytime:
# Enable privacy protection
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/privacy/enable" \
-H "Authorization: Bearer YOUR_API_KEY"
# Disable privacy protection (restore original contact)
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/privacy/disable" \
-H "Authorization: Bearer YOUR_API_KEY"
# Check privacy status
curl -X GET "https://api.hostbay.io/api/v1/domains/example.com" \
-H "Authorization: Bearer YOUR_API_KEY"
# Returns: privacy_enabled: true/false, contact_type: "hostbay_managed" or "user_provided"
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Enable privacy
response = requests.post(
f"{BASE_URL}/domains/example.com/privacy/enable",
headers=headers
)
print(response.json())
# {"success": true, "message": "Privacy protection enabled"}
# Disable privacy
response = requests.post(
f"{BASE_URL}/domains/example.com/privacy/disable",
headers=headers
)
print(response.json())
# {"success": true, "message": "Privacy protection disabled"}
# Check status
response = requests.get(
f"{BASE_URL}/domains/example.com",
headers=headers
)
domain = response.json()["data"]
print(f"Privacy enabled: {domain['privacy_enabled']}")
print(f"Contact type: {domain['contact_type']}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Enable privacy
const enableResponse = await axios.post(
`${BASE_URL}/domains/example.com/privacy/enable`,
{},
{ headers }
);
console.log(enableResponse.data);
// {"success": true, "message": "Privacy protection enabled"}
// Disable privacy
const disableResponse = await axios.post(
`${BASE_URL}/domains/example.com/privacy/disable`,
{},
{ headers }
);
console.log(disableResponse.data);
// {"success": true, "message": "Privacy protection disabled"}
// Check status
const domain = await axios.get(
`${BASE_URL}/domains/example.com`,
{ headers }
);
console.log(`Privacy: ${domain.data.data.privacy_enabled}`);
console.log(`Contact type: ${domain.data.data.contact_type}`);
Auto-renewal prevents service interruptions by automatically renewing hosting before expiration using your wallet balance.
1. Enable auto-renewal during order creation:
POST /api/v1/hosting/order
{
"domain_name": "example.com",
"domain_type": "new", // "new", "existing", or "external"
"plan": "pro_30day",
"period": 1,
"auto_renew": true
}
2. Check auto-renewal status:
GET /api/v1/hosting/{subscription_id}/auto-renewal
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"auto_renew": true
}
}
3. Toggle auto-renewal on/off:
PUT /api/v1/hosting/{subscription_id}/auto-renewal
{
"auto_renew": true
}
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"auto_renew": true,
"updated_at": "2025-11-01T09:00:00Z"
},
"message": "Auto-renewal enabled successfully"
}
4. Update auto-renewal during manual renewal:
POST /api/v1/hosting/{subscription_id}/renew
{
"period": 3,
"auto_renew": true
}
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"renewed": true,
"period": 3,
"amount_charged": 13.50,
"auto_renew_updated": true
}
}
For detailed code examples in Python, JavaScript, and cURL, see the Hosting Management Tutorial section below.
Insufficient Wallet Balance (400 Bad Request)
{
"error": {
"code": "BAD_REQUEST",
"message": "Insufficient wallet balance. Required: $35.58, Available: $15.00",
"details": {
"required": 35.58,
"available": 15.0
}
},
"timestamp": 1761937123
}
Domain Not Available (400 Bad Request)
{
"error": {
"code": "BAD_REQUEST",
"message": "Domain example.com is not available for registration"
},
"timestamp": 1761937124
}
Rate Limit Exceeded (429 Too Many Requests)
{
"error": "Rate limit exceeded",
"retry_after": 3600,
"timestamp": 1761937125
}
# Response Headers:
# X-RateLimit-Limit: 1000
# X-RateLimit-Remaining: 0
# X-RateLimit-Reset: 1761940725
Unauthorized (401)
{
"error": "Invalid or expired API key",
"timestamp": 1761937126
}
Complete guide to securing your domains and managing transfers between registrars. Learn how to lock/unlock domains, manage authorization codes, and handle incoming/outgoing transfers.
Transfer Lock: Prevents unauthorized transfers by blocking EPP/auth code generation and transfer requests
EPP/Auth Code: Secret authorization code required to transfer domain to another registrar
Transfer Process: Typically takes 5-7 days; previous registrar has time to approve/reject
ICANN 60-Day Lock: Domains cannot be transferred within 60 days of registration or contact changes
Control whether your domain can be transferred:
# Lock domain (prevent transfers)
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/lock" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "locked": true
# },
# "message": "Domain locked successfully"
# }
# Unlock domain (allow transfers)
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/unlock" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "locked": false
# },
# "message": "Domain unlocked successfully"
# }
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Lock domain
response = requests.post(
f"{BASE_URL}/domains/example.com/lock",
headers=headers
)
print(f"Domain locked: {response.json()}")
# Unlock domain
response = requests.post(
f"{BASE_URL}/domains/example.com/unlock",
headers=headers
)
print(f"Domain unlocked: {response.json()}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Lock domain
const lockResponse = await axios.post(
`${BASE_URL}/domains/example.com/lock`,
{},
{ headers }
);
console.log('Domain locked:', lockResponse.data);
// Unlock domain
const unlockResponse = await axios.post(
`${BASE_URL}/domains/example.com/unlock`,
{},
{ headers }
);
console.log('Domain unlocked:', unlockResponse.data);
Retrieve the secret code needed to transfer your domain away from HostBay:
# Get auth code
curl -X GET "https://api.hostbay.io/api/v1/domains/example.com/auth-code" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "auth_code": "Ab7mN9pQr2tXvYz4"
# },
# "message": "Auth code retrieved successfully"
# }
# â ī¸ Important: Domain must be UNLOCKED to get auth code
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Get auth code
response = requests.get(
f"{BASE_URL}/domains/example.com/auth-code",
headers=headers
)
data = response.json()
auth_code = data["data"]["auth_code"]
print(f"Auth code: {auth_code}")
# Use this code at the new registrar to initiate transfer
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Get auth code
const response = await axios.get(
`${BASE_URL}/domains/example.com/auth-code`,
{ headers }
);
const authCode = response.data.data.auth_code;
console.log(`Auth code: ${authCode}`);
// Use this code at the new registrar to initiate transfer
Generate a new auth code if the previous one was compromised or lost:
# Reset auth code
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/auth-code/reset" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "auth_code": "Zk3pL8qTw5yXrUv2",
# "type": "internal"
# },
# "message": "Auth code reset successfully"
# }
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Reset auth code
response = requests.post(
f"{BASE_URL}/domains/example.com/auth-code/reset",
headers=headers
)
data = response.json()
new_auth_code = data["data"]["auth_code"]
print(f"New auth code: {new_auth_code}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Reset auth code
const response = await axios.post(
`${BASE_URL}/domains/example.com/auth-code/reset`,
{},
{ headers }
);
const newAuthCode = response.data.data.auth_code;
console.log(`New auth code: ${newAuthCode}`);
Transfer a domain from another registrar to HostBay:
# Initiate transfer to HostBay
curl -X POST "https://api.hostbay.io/api/v1/domains/transfer" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"domain_name": "example.com",
"auth_code": "Ab7mN9pQr2tXvYz4",
"period": 1
}'
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "status": "transfer_pending",
# "openprovider_id": 12345678,
# "period": 1,
# "message": "Transfer initiated - typically completes in 5-7 days"
# },
# "message": "Domain transfer initiated successfully"
# }
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Initiate transfer
transfer_data = {
"domain_name": "example.com",
"auth_code": "Ab7mN9pQr2tXvYz4",
"period": 1
}
response = requests.post(
f"{BASE_URL}/domains/transfer",
headers=headers,
json=transfer_data
)
result = response.json()
print(f"Transfer status: {result['data']['status']}")
print(f"Expected completion: 5-7 days")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Initiate transfer
const transferData = {
domain_name: 'example.com',
auth_code: 'Ab7mN9pQr2tXvYz4',
period: 1
};
const response = await axios.post(
`${BASE_URL}/domains/transfer`,
transferData,
{ headers }
);
console.log(`Transfer status: ${response.data.data.status}`);
console.log('Expected completion: 5-7 days');
Approve or reject transfer requests when someone initiates a transfer of your domain to another registrar:
Speed up transfer instead of waiting 5 days for auto-approval:
# Approve outgoing transfer
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/transfer/approve" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "approved": true,
# "message": "Transfer approved successfully"
# },
# "message": "Outgoing transfer approved"
# }
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Approve transfer
response = requests.post(
f"{BASE_URL}/domains/example.com/transfer/approve",
headers=headers
)
print(f"Transfer approved: {response.json()}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Approve transfer
const response = await axios.post(
`${BASE_URL}/domains/example.com/transfer/approve`,
{},
{ headers }
);
console.log('Transfer approved:', response.data);
Block unauthorized transfer attempts:
# Reject outgoing transfer
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/transfer/reject" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "rejected": true,
# "message": "Transfer rejected successfully"
# },
# "message": "Outgoing transfer rejected"
# }
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Reject transfer
response = requests.post(
f"{BASE_URL}/domains/example.com/transfer/reject",
headers=headers
)
print(f"Transfer rejected: {response.json()}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Reject transfer
const response = await axios.post(
`${BASE_URL}/domains/example.com/transfer/reject`,
{},
{ headers }
);
console.log('Transfer rejected:', response.data);
Retry a stuck or failed transfer operation:
# Restart failed transfer
curl -X POST "https://api.hostbay.io/api/v1/domains/example.com/transfer/restart" \
-H "Authorization: Bearer YOUR_API_KEY"
# Response:
# {
# "success": true,
# "data": {
# "domain": "example.com",
# "restarted": true,
# "message": "Transfer restarted successfully"
# },
# "message": "Transfer operation restarted"
# }
import requests
API_KEY = "YOUR_API_KEY"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Restart transfer
response = requests.post(
f"{BASE_URL}/domains/example.com/transfer/restart",
headers=headers
)
print(f"Transfer restarted: {response.json()}")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { Authorization: `Bearer ${API_KEY}` };
// Restart transfer
const response = await axios.post(
`${BASE_URL}/domains/example.com/transfer/restart`,
{},
{ headers }
);
console.log('Transfer restarted:', response.data);
A Record: Points domain to IPv4 address (e.g., 192.0.2.1). Supports custom subdomains.
AAAA Record: Points domain to IPv6 address
CNAME Record: Alias one domain to another (e.g., www â example.com). Supports custom subdomains.
MX Record: Mail server for email delivery
TXT Record: Text data for verification, SPF, DKIM, DMARC. Supports custom subdomains including underscores for RFC-compliant records (e.g., _dmarc, _domainkey).
Add an A record to point your domain to a server:
POST /api/v1/dns/{domain_name}/records
{
"type": "A",
"name": "@",
"content": "192.0.2.1",
"ttl": 3600,
"proxied": false
}
# Root domain
{
"type": "A",
"name": "@",
"content": "192.0.2.1"
}
# www subdomain
{
"type": "CNAME",
"name": "www",
"content": "example.com"
}
# MX records for email
{
"type": "MX",
"name": "@",
"content": "mail.example.com",
"priority": 10
}
# SPF record for email authentication
{
"type": "TXT",
"name": "@",
"content": "v=spf1 include:_spf.example.com ~all"
}
{
"type": "A",
"name": "blog",
"content": "192.0.2.2"
}
TXT records support underscores for RFC-compliant email authentication:
# DMARC policy record
{
"type": "TXT",
"name": "_dmarc",
"content": "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"
}
# DKIM selector record
{
"type": "TXT",
"name": "default._domainkey",
"content": "v=DKIM1; k=rsa; p=MIGfMA0GCSq..."
}
# Domain verification for services
{
"type": "TXT",
"name": "mail",
"content": "google-site-verification=abc123..."
}
# API subdomain
{
"type": "A",
"name": "api",
"content": "192.0.2.3"
}
# CDN subdomain
{
"type": "CNAME",
"name": "cdn",
"content": "cdn.example.cloudfront.net"
}
# Service verification TXT record
{
"type": "TXT",
"name": "api",
"content": "service-token=xyz789"
}
HostBay integrates with Cloudflare for advanced DNS management:
DNS changes can take time to propagate globally:
Update multiple records at once (supports custom subdomains including underscores for TXT records):
POST /api/v1/dns/{domain_name}/records/bulk
{
"records": [
{"type": "A", "name": "@", "content": "192.0.2.1"},
{"type": "A", "name": "www", "content": "192.0.2.1"},
{"type": "A", "name": "api", "content": "192.0.2.3"},
{"type": "CNAME", "name": "mail", "content": "example.com"},
{"type": "MX", "name": "@", "content": "mail.example.com", "priority": 10},
{"type": "TXT", "name": "@", "content": "v=spf1 include:_spf.example.com ~all"},
{"type": "TXT", "name": "_dmarc", "content": "v=DMARC1; p=quarantine; rua=mailto:dmarc@example.com"}
]
}
name field represents the subdomain portion only (e.g., "api" for api.example.com)Create a new hosting account with cPanel:
POST /api/v1/hosting/provision
{
"domain_name": "example.com",
"plan": "starter",
"username": "exampleuser",
"password": "SecurePassword123!",
"email": "admin@example.com",
"package_name": "Basic Hosting"
}
Get hosting subscription details with optional credentials and usage data in a single request:
GET /api/v1/hosting/{subscription_id}
GET /api/v1/hosting/{subscription_id}?include=credentials
GET /api/v1/hosting/{subscription_id}?include=usage
GET /api/v1/hosting/{subscription_id}?include=credentials,usage
Response (with include=credentials,usage):
{
"id": 123,
"domain_name": "example.com",
"plan": "Pro 30 Days",
"status": "active",
"cpanel_username": "exampleuser",
"server_ip": "185.xxx.xxx.xxx",
"auto_renew": true,
"created_at": "2025-01-15T10:30:00Z",
"expires_at": "2025-02-14T10:30:00Z",
"is_active": true,
"credentials": {
"cpanel_url": "https://185.xxx.xxx.xxx:2083",
"cpanel_username": "exampleuser",
"ftp_host": "185.xxx.xxx.xxx",
"ftp_port": 21
},
"usage": {
"disk_used_mb": 256,
"disk_limit_mb": 10240,
"bandwidth_used_mb": 1024,
"bandwidth_limit_mb": 102400,
"fetched_at": "2025-01-15T12:00:00Z"
}
}
credentials - cPanel/FTP login details (static data)usage - Disk and bandwidth statistics (fetched live from cPanel)?include=credentials,usageGET /hosting/{id}/credentials â Use ?include=credentialsGET /hosting/{id}/usage â Use ?include=usageCreate email accounts for your domain:
POST /api/v1/hosting/{domain_name}/email
{
"email": "info@example.com",
"password": "SecureEmailPass123!",
"quota": 1024
}
Install free Let's Encrypt SSL certificate:
POST /api/v1/hosting/{domain_name}/ssl
{
"type": "letsencrypt",
"auto_renew": true
}
Create MySQL database:
POST /api/v1/hosting/{domain_name}/databases
{
"database_name": "my_database",
"database_user": "db_user",
"database_password": "SecureDBPass123!"
}
Control automatic renewal for hosting subscriptions to prevent service interruptions:
How It Works: When auto-renewal is enabled, your hosting subscription automatically renews before expiration using your wallet balance.
Benefits: No service interruptions, automatic payment processing, peace of mind
Control: You can enable/disable auto-renewal at any time - during order creation, during renewal, or with dedicated endpoints
Set auto-renewal when ordering hosting:
POST /api/v1/hosting/order
{
"domain_name": "example.com",
"domain_type": "new", // "new", "existing", or "external"
"plan": "pro_30day",
"period": 1,
"auto_renew": true
}
Check if auto-renewal is enabled for a subscription:
GET /api/v1/hosting/{subscription_id}/auto-renewal
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"auto_renew": true
}
}
Enable or disable auto-renewal anytime:
# Enable auto-renewal
PUT /api/v1/hosting/{subscription_id}/auto-renewal
{
"auto_renew": true
}
# Disable auto-renewal
PUT /api/v1/hosting/{subscription_id}/auto-renewal
{
"auto_renew": false
}
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"auto_renew": true,
"updated_at": "2025-11-01T09:00:00Z"
},
"message": "Auto-renewal enabled successfully"
}
Renew hosting and update auto-renewal setting in one request:
POST /api/v1/hosting/{subscription_id}/renew
{
"period": 3,
"auto_renew": true
}
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"renewed": true,
"period": 3,
"pricing": {
"base_price_per_period": 5.00,
"periods": 3,
"price_before_discount": 15.00,
"api_discount": 1.50,
"final_price": 13.50
},
"amount_charged": 13.50,
"auto_renew_updated": true
},
"message": "Hosting renewed successfully with 10% API discount"
}
Upload files via FTP or use cPanel File Manager:
GET /api/v1/hosting/{domain_name}/ftp
Response:
{
"ftp_server": "ftp.example.com",
"ftp_username": "exampleuser",
"ftp_port": 21
}
Create full account backup:
POST /api/v1/hosting/{domain_name}/backup
{
"backup_type": "full",
"email_notification": true
}
Host multiple websites on a single hosting subscription using addon domains. Each addon domain gets its own document root directory.
GET /api/v1/hosting/{subscription_id}/addon-domains
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"primary_domain": "mysite.com",
"addon_domains": [
{
"domain": "example.com",
"subdomain": "example",
"document_root": "/home/user/example_com",
"status": "active"
}
],
"total_addon": 1,
"total_all": 2
}
}
Add an existing domain or register a new one as an addon:
POST /api/v1/hosting/{subscription_id}/addon-domains
// Add existing/external domain
{
"domain": "example.com",
"document_root": "/public_html/myfolder", // Optional custom path
"subdomain": "example" // Optional, defaults to domain name
}
// Register NEW domain as addon (charges wallet)
{
"domain": "newsite.com",
"register_new": true,
"period": 1,
"auto_renew_domain": true,
"document_root": "/public_html/newsite"
}
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"primary_domain": "mysite.com",
"addon_domain": "example.com",
"subdomain": "example",
"document_root": "/public_html/myfolder",
"nameserver_status": "updated" | "manual_update_required",
"dns_nameservers": ["ns1.cloudflare.com", "ns2.cloudflare.com"]
}
}
DELETE /api/v1/hosting/{subscription_id}/addon-domains/{addon_domain}
Response:
{
"success": true,
"data": {
"subscription_id": 123,
"deleted_domain": "example.com",
"deleted": true
}
}
/public_html/myfolderregister_new: truepower_status field to track server state changesDeploy and manage Windows Server instances with Remote Desktop Protocol (RDP) access. Perfect for development, testing, or production workloads requiring Windows environments.
Get all available RDP plans with pricing information:
GET /api/v1/rdp/plans
Response:
{
"success": true,
"data": {
"plans": [
{
"id": 1,
"name": "Basic RDP",
"vcpu": 1,
"ram_mb": 2048,
"ram_gb": 2,
"storage_gb": 55,
"bandwidth_tb": 2,
"monthly_price": 44.00,
"quarterly_price": 124.08,
"yearly_price": 470.88,
"is_active": true
},
{
"id": 2,
"name": "Standard RDP",
"vcpu": 1,
"ram_mb": 4096,
"ram_gb": 4,
"storage_gb": 80,
"bandwidth_tb": 3,
"monthly_price": 72.00,
"quarterly_price": 203.04,
"yearly_price": 770.88,
"is_active": true
}
]
}
}
List all available Windows Server versions:
GET /api/v1/rdp/templates
Response:
{
"success": true,
"data": {
"templates": [
{
"id": 1,
"windows_version": "2025",
"edition": "Standard",
"display_name": "Windows Server 2025 Standard",
"is_active": true
},
{
"id": 2,
"windows_version": "2022",
"edition": "Standard",
"display_name": "Windows Server 2022 Standard",
"is_active": true
},
{
"id": 3,
"windows_version": "2019",
"edition": "Standard",
"display_name": "Windows Server 2019 Standard",
"is_active": true
},
{
"id": 4,
"windows_version": "2016",
"edition": "Standard",
"display_name": "Windows Server 2016 Standard",
"is_active": true
}
]
}
}
Get all 32 global datacenter regions:
GET /api/v1/rdp/regions
Response:
{
"success": true,
"data": {
"regions": [
{
"id": "ewr",
"city": "New Jersey",
"country": "US",
"continent": "North America"
},
{
"id": "lhr",
"city": "London",
"country": "GB",
"continent": "Europe"
},
{
"id": "sgp",
"city": "Singapore",
"country": "SG",
"continent": "Asia"
}
]
}
}
Deploy a new Windows Server with RDP access:
POST /api/v1/rdp/servers
Authorization: Bearer YOUR_API_KEY
{
"template_id": 1,
"plan_id": 2,
"region": "ewr",
"billing_cycle": "monthly",
"hostname": "my-windows-server"
}
Billing Cycle Options:
"monthly" - Full monthly price
"quarterly" - 6% discount (3 months prepaid)
"yearly" - 11% discount (12 months prepaid)
Response:
{
"success": true,
"data": {
"message": "RDP server provisioning started",
"server_id": 123,
"hostname": "my-windows-server",
"status": "provisioning",
"power_status": "starting",
"estimated_ready_time": "2-3 minutes"
}
}
power_status field for current power stateThe power_status field indicates the current power state of your server:
Note: Servers in starting or reinstalling states will automatically transition to running when ready. Smart retry logic ensures reliable auto-start even during temporary infrastructure delays.
Get all your RDP servers:
GET /api/v1/rdp/servers
Authorization: Bearer YOUR_API_KEY
Response:
{
"success": true,
"data": {
"servers": [
{
"id": 123,
"hostname": "my-windows-server",
"public_ip": "192.0.2.10",
"status": "active",
"power_status": "running",
"os": "Windows Server 2022 Standard",
"plan": {
"name": "Standard RDP",
"vcpu": 1,
"ram_mb": 4096,
"storage_gb": 80
},
"region": "ewr",
"billing": {
"cycle": "monthly",
"monthly_price": 72.00,
"next_renewal": "2025-12-03T00:00:00Z",
"auto_renew": true
},
"created_at": "2025-11-03T10:00:00Z",
"activated_at": "2025-11-03T10:08:00Z"
}
],
"total": 1
}
}
Retrieve full server details including RDP credentials:
GET /api/v1/rdp/servers/123
Authorization: Bearer YOUR_API_KEY
Response:
{
"success": true,
"data": {
"id": 123,
"hostname": "my-windows-server",
"public_ip": "192.0.2.10",
"status": "active",
"power_status": "running",
"os": "Windows Server 2022 Standard",
"credentials": {
"username": "Administrator",
"password": "SecureP@ssw0rd123"
},
"plan": {
"name": "Standard RDP",
"vcpu": 1,
"ram_mb": 4096,
"storage_gb": 80
},
"region": "ewr",
"billing": {
"cycle": "monthly",
"monthly_price": 72.00,
"next_renewal": "2025-12-03T00:00:00Z",
"auto_renew": true
},
"created_at": "2025-11-03T10:00:00Z",
"activated_at": "2025-11-03T10:08:00Z"
}
}
Power on a stopped server:
POST /api/v1/rdp/servers/123/start
Authorization: Bearer YOUR_API_KEY
Response:
{
"success": true,
"data": {
"message": "Server is starting",
"server_id": 123
}
}
Power off a running server:
POST /api/v1/rdp/servers/123/stop
Authorization: Bearer YOUR_API_KEY
Response:
{
"success": true,
"data": {
"message": "Server is stopping",
"server_id": 123
}
}
Reboot a running server:
POST /api/v1/rdp/servers/123/restart
Authorization: Bearer YOUR_API_KEY
Response:
{
"success": true,
"data": {
"message": "Server is restarting",
"server_id": 123
}
}
Completely wipe and reinstall Windows (generates new password):
POST /api/v1/rdp/servers/123/reinstall
Authorization: Bearer YOUR_API_KEY
Response:
{
"success": true,
"data": {
"message": "OS reinstall started. Server will auto-start when ready.",
"server_id": 123,
"power_status": "reinstalling",
"estimated_time": "1-2 minutes"
}
}
Permanently delete a server and stop billing:
DELETE /api/v1/rdp/servers/123
Authorization: Bearer YOUR_API_KEY
Response:
{
"success": true,
"data": {
"message": "Server my-windows-server deleted successfully",
"server_id": 123
}
}
RDP servers have automatic renewal with a 72-hour grace period:
How It Works: When auto-renewal is enabled, your RDP server automatically renews before expiration using your wallet balance.
Grace Period: 72 hours after renewal due date before server is suspended
Warnings: You'll receive notifications 3 days before renewal
Suspension: If payment fails after grace period, server is stopped to prevent further charges
End-to-end example of deploying and managing a Windows RDP server:
import requests
import time
# Your API key
API_KEY = "YOUR_API_KEY_HERE"
BASE_URL = "https://api.hostbay.io/api/v1"
headers = {"Authorization": f"Bearer {API_KEY}"}
# Step 1: Get available plans
response = requests.get(f"{BASE_URL}/rdp/plans", headers=headers)
plans = response.json()["data"]["plans"]
print(f"Available plans: {len(plans)}")
# Step 2: Get available templates
response = requests.get(f"{BASE_URL}/rdp/templates", headers=headers)
templates = response.json()["data"]["templates"]
print(f"Available Windows versions: {len(templates)}")
# Step 3: Get regions
response = requests.get(f"{BASE_URL}/rdp/regions", headers=headers)
regions = response.json()["data"]["regions"]
print(f"Available regions: {len(regions)}")
# Step 4: Create RDP server
create_data = {
"template_id": 1, # Windows Server 2025
"plan_id": 2, # Standard RDP
"region": "ewr", # New Jersey
"billing_cycle": "monthly",
"hostname": "my-dev-server"
}
response = requests.post(f"{BASE_URL}/rdp/servers", json=create_data, headers=headers)
result = response.json()["data"]
server_id = result["server_id"]
print(f"Server provisioning started: {server_id}")
# Step 5: Wait for provisioning (check every 30 seconds)
while True:
response = requests.get(f"{BASE_URL}/rdp/servers/{server_id}", headers=headers)
server = response.json()["data"]
if server["status"] == "active":
print(f"Server ready!")
print(f"IP: {server['public_ip']}")
print(f"Username: {server['credentials']['username']}")
print(f"Password: {server['credentials']['password']}")
break
elif server["status"] == "failed":
print("Provisioning failed")
break
print(f"Status: {server['status']} - waiting...")
time.sleep(30)
# Step 6: Connect via RDP
print(f"Connect with: mstsc /v:{server['public_ip']}")
# Step 7: Manage server
# Restart server
requests.post(f"{BASE_URL}/rdp/servers/{server_id}/restart", headers=headers)
print("Server restarted")
# Step 8: Get all your servers
response = requests.get(f"{BASE_URL}/rdp/servers", headers=headers)
all_servers = response.json()["data"]["servers"]
print(f"You have {len(all_servers)} RDP server(s)")
const axios = require('axios');
const API_KEY = 'YOUR_API_KEY_HERE';
const BASE_URL = 'https://api.hostbay.io/api/v1';
const headers = { 'Authorization': `Bearer ${API_KEY}` };
async function deployRDPServer() {
try {
// Get available plans
const plansResponse = await axios.get(`${BASE_URL}/rdp/plans`, { headers });
console.log(`Available plans: ${plansResponse.data.data.plans.length}`);
// Create RDP server
const createData = {
template_id: 1,
plan_id: 2,
region: 'ewr',
billing_cycle: 'monthly',
hostname: 'my-dev-server'
};
const createResponse = await axios.post(
`${BASE_URL}/rdp/servers`,
createData,
{ headers }
);
const serverId = createResponse.data.data.server_id;
console.log(`Server provisioning started: ${serverId}`);
// Wait for server to be ready
while (true) {
const serverResponse = await axios.get(
`${BASE_URL}/rdp/servers/${serverId}`,
{ headers }
);
const server = serverResponse.data.data;
if (server.status === 'active') {
console.log('Server ready!');
console.log(`IP: ${server.public_ip}`);
console.log(`Username: ${server.credentials.username}`);
console.log(`Password: ${server.credentials.password}`);
break;
} else if (server.status === 'failed') {
console.log('Provisioning failed');
break;
}
console.log(`Status: ${server.status} - waiting...`);
await new Promise(resolve => setTimeout(resolve, 30000));
}
} catch (error) {
console.error('Error:', error.response?.data || error.message);
}
}
deployRDPServer();
# Set your API key
API_KEY="YOUR_API_KEY_HERE"
# Get available plans
curl -X GET "https://api.hostbay.io/api/v1/rdp/plans" \
-H "Authorization: Bearer $API_KEY"
# Get available Windows templates
curl -X GET "https://api.hostbay.io/api/v1/rdp/templates" \
-H "Authorization: Bearer $API_KEY"
# Create RDP server
curl -X POST "https://api.hostbay.io/api/v1/rdp/servers" \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template_id": 1,
"plan_id": 2,
"region": "ewr",
"billing_cycle": "yearly",
"hostname": "my-dev-server"
}'
# Billing options: "monthly", "quarterly" (6% off), "yearly" (11% off)
# Get server details (replace 123 with your server_id)
curl -X GET "https://api.hostbay.io/api/v1/rdp/servers/123" \
-H "Authorization: Bearer $API_KEY"
# Restart server
curl -X POST "https://api.hostbay.io/api/v1/rdp/servers/123/restart" \
-H "Authorization: Bearer $API_KEY"
# Delete server
curl -X DELETE "https://api.hostbay.io/api/v1/rdp/servers/123" \
-H "Authorization: Bearer $API_KEY"
mstscExplore all 88 endpoints with interactive testing