A comprehensive command-line interface for managing your Hostinger services. Control your domains, VPS instances, DNS records, and billing from the terminal.
- 🌐 Domain Management: Check availability, purchase, configure nameservers, enable/disable locks and privacy protection
- 🖥️ VPS Management: Deploy, start, stop, restart, recreate, monitor metrics, manage backups
- 🔧 DNS Management: Manage DNS records, import/export zones, snapshots, validation
- 💳 Billing: View subscriptions, payment methods, catalog items, pricing
- 🔑 SSH Key Management: Add, remove, and attach SSH keys to VPS instances
- 📊 Rich Output: Table and JSON output formats with colorized status indicators
- ⚙️ Easy Configuration: Secure API key storage and management
pip install hostinger-cligit clone https://github.com/hostinger/hostinger-cli.git
cd hostinger-cli
pip install -e .First, get your API key from the Hostinger Panel.
# Configure interactively
hostinger configure
# Or set as environment variable
export HOSTINGER_API_KEY="your_api_key_here"
# Or pass directly to commands
hostinger --api-key "your_api_key_here" domains list# List all domains
hostinger domains list
# List all VPS instances
hostinger vps list
# Show billing overview
hostinger billing overview# Check domain availability
hostinger domains check example com net org
# List all domains
hostinger domains list
# Show domain details
hostinger domains show example.com
# Purchase a domain
hostinger domains purchase example.com hostingercom-domain-com-usd-1y
# Enable domain lock
hostinger domains lock example.com
# Enable privacy protection
hostinger domains enable-privacy example.com
# Update nameservers
hostinger domains set-nameservers example.com ns1.example.com ns2.example.com# List all VPS instances
hostinger vps list
# Show VPS details
hostinger vps show 12345
# Start/stop/restart VPS
hostinger vps start 12345
hostinger vps stop 12345
hostinger vps restart 12345
# Show VPS metrics for last 7 days
hostinger vps metrics 12345 --days 7
# List available OS templates
hostinger vps templates list
# List data centers
hostinger vps datacenters
# Recreate VPS (⚠️ destroys all data!)
hostinger vps recreate 12345 1130 --password "SecurePassword123"# List DNS records
hostinger dns list example.com
# Add DNS record
hostinger dns add example.com www A 192.168.1.1 --ttl 3600
# Delete DNS record
hostinger dns delete example.com www A
# Import DNS zone from file
hostinger dns import-zone example.com zone.json
# Export DNS zone to file
hostinger dns export-zone example.com zone.json
# Reset DNS to defaults
hostinger dns reset example.com
# List DNS snapshots
hostinger dns snapshots list example.com
# Restore DNS snapshot
hostinger dns snapshots restore example.com 12345# List SSH keys
hostinger vps ssh-keys list
# Add SSH key from file
hostinger vps ssh-keys create "My Key" --key-file ~/.ssh/id_rsa.pub
# Add SSH key directly
hostinger vps ssh-keys create "My Key" --key "ssh-rsa AAAAB3NzaC1yc2E..."
# Attach SSH keys to VPS
hostinger vps ssh-keys attach 12345 101 102
# List attached SSH keys
hostinger vps ssh-keys attached 12345# Show billing overview
hostinger billing overview
# List all subscriptions
hostinger billing subscriptions list
# List payment methods
hostinger billing payment-methods list
# Browse catalog
hostinger billing catalog list --category VPS
# Search catalog
hostinger billing search "domain"
# Show pricing
hostinger billing pricing --category DOMAINThe CLI stores configuration in ~/.hostinger-cli.json. You can also use environment variables:
HOSTINGER_API_KEY: Your Hostinger API keyHOSTINGER_CONFIG_FILE: Custom config file location
{
"api_key": "your_api_key_here"
}Most commands support multiple output formats:
# Table format (default)
hostinger domains list
# JSON format
hostinger domains list --format json
# Raw API response
hostinger domains list --format json | jq .--api-key: Specify API key--config-file: Specify config file location--help: Show help message
Configure API key interactively
list- List all domainsshow <domain>- Show domain detailscheck <domain> <tlds...>- Check domain availabilitypurchase <domain> <item-id>- Purchase domainlock/unlock <domain>- Enable/disable domain lockenable-privacy/disable-privacy <domain>- Control privacy protectionset-nameservers <domain> <ns1> <ns2>- Update nameserversforwarding- Manage domain forwardingwhois- Manage WHOIS profiles
list- List VPS instancesshow <vm-id>- Show VPS detailsstart/stop/restart <vm-id>- Control VPS power staterecreate <vm-id> <template-id>- Recreate VPSactions <vm-id>- List VPS actionsbackups <vm-id>- List VPS backupsmetrics <vm-id>- Show VPS metricstemplates- Manage OS templatesssh-keys- Manage SSH keysdatacenters- List data centers
list <domain>- List DNS recordsadd <domain> <name> <type> <content>- Add DNS recorddelete <domain> <name> <type>- Delete DNS recordupdate <domain> <name> <type> <old> <new>- Update DNS recordimport-zone/export-zone <domain> <file>- Import/export DNS zonereset <domain>- Reset DNS to defaultssnapshots- Manage DNS snapshots
overview- Show billing overviewcatalog- Browse service catalogsubscriptions- Manage subscriptionspayment-methods- Manage payment methods
The CLI provides detailed error messages and uses appropriate exit codes:
0: Success1: General error2: Command usage error
# Clone the repository
git clone https://github.com/hostinger/hostinger-cli.git
cd hostinger-cli
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
# Install development dependencies
pip install -r requirements-dev.txt# Run all tests
python -m pytest
# Run with coverage
python -m pytest --cov=hostinger_cliThis project uses Black for code formatting and Flake8 for linting:
# Format code
black hostinger_cli/
# Check linting
flake8 hostinger_cli/This CLI uses the Hostinger API. All API endpoints are supported with full feature parity.
For detailed API documentation, visit: https://developers.hostinger.com
We welcome contributions! Please see our Contributing Guide for details.
Please report issues on our GitHub Issues page.
This project is licensed under the MIT License - see the LICENSE file for details.
See CHANGELOG.md for a list of changes and version history.
Made with ❤️ by the Hostinger team