Hostinger CLI
A comprehensive command-line interface for managing your Hostinger services. Control your domains, VPS instances, DNS records, and billing from the terminal.
Features
- 🌐 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
Installation
From PyPI (Recommended)
pip install hostinger-cli
From Source
git clone https://github.com/hostinger/hostinger-cli.git
cd hostinger-cli
pip install -e .
Quick Start
1. Configure your API key
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
2. List your services
# List all domains
hostinger domains list
# List all VPS instances
hostinger vps list
# Show billing overview
hostinger billing overview
Usage Examples
Domain Management
# 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
VPS Management
# 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"
DNS Management
# 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
SSH Key Management
# 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
Billing and Subscriptions
# 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 DOMAIN
Configuration
The 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
Configuration File Format
{
"api_key": "your_api_key_here"
}
Output Formats
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 .
Command Reference
Global Options
--api-key: Specify API key--config-file: Specify config file location--help: Show help message
Commands
hostinger configure
Configure API key interactively
hostinger domains
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
hostinger vps
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
hostinger dns
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
hostinger billing
overview- Show billing overviewcatalog- Browse service catalogsubscriptions- Manage subscriptionspayment-methods- Manage payment methods
Error Handling
The CLI provides detailed error messages and uses appropriate exit codes:
0: Success1: General error2: Command usage error
Development
Setting up Development Environment
# 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
Running Tests
# Run all tests
python -m pytest
# Run with coverage
python -m pytest --cov=hostinger_cli
Code Style
This project uses Black for code formatting and Flake8 for linting:
# Format code
black hostinger_cli/
# Check linting
flake8 hostinger_cli/
API Reference
This CLI uses the Hostinger API. All API endpoints are supported with full feature parity.
For detailed API documentation, visit: https://developers.hostinger.com
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Reporting Issues
Please report issues on our GitHub Issues page.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
Changelog
See CHANGELOG.md for a list of changes and version history.
Made with ❤️ by the Hostinger team
Metadata
Release files for hostinger-cli 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hostinger_cli-1.0.0.tar.gz | 26.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hostinger_cli-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 49.7 kB
Release files / hostinger_cli-1.0.0.tar.gz
| Download URL | hostinger_cli-1.0.0.tar.gz |
|---|---|
| Size | 26.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
70cc714196bc2d201c56ec7cf062a7239c943b4b10a1ecfb9222370fe190eec7
|
|
BLAKE2b-256 checksum How to use checksums |
f4cda1aed4f5460869ee6ed911e0e56eef04c9f6c15771a098ac8835475d1fbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|
Release files / hostinger_cli-1.0.0-py3-none-any.whl
| Download URL | hostinger_cli-1.0.0-py3-none-any.whl |
|---|---|
| Size | 23.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbfbff11dba40021d69cb92d894eb0abf199d5603afbcd810827d423d09ed34e
|
|
BLAKE2b-256 checksum How to use checksums |
7fb67ff2b8cad44ffbb7efbbe30694e05be7e88aeb8479c0b638d6978a55e861
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.4
|