hostinger-cli


Namehostinger-cli JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/hostinger/hostinger-cli
SummaryA comprehensive command-line interface for Hostinger API
upload_time2025-08-13 22:25:53
maintainerNone
docs_urlNone
authorHostinger CLI Contributors
requires_python>=3.8
licenseMIT
keywords hostinger api cli cloud vps domains dns hosting web hosting server management domain management
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Hostinger CLI

A comprehensive command-line interface for managing your Hostinger services. Control your domains, VPS instances, DNS records, and billing from the terminal.

[![PyPI version](https://badge.fury.io/py/hostinger-cli.svg)](https://badge.fury.io/py/hostinger-cli)
[![Python Version](https://img.shields.io/pypi/pyversions/hostinger-cli.svg)](https://pypi.org/project/hostinger-cli/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## 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)

```bash
pip install hostinger-cli
```

### From Source

```bash
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](https://hpanel.hostinger.com/profile/api).

```bash
# 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

```bash
# List all domains
hostinger domains list

# List all VPS instances
hostinger vps list

# Show billing overview
hostinger billing overview
```

## Usage Examples

### Domain Management

```bash
# 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

```bash
# 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

```bash
# 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

```bash
# 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

```bash
# 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 key
- `HOSTINGER_CONFIG_FILE`: Custom config file location

### Configuration File Format

```json
{
  "api_key": "your_api_key_here"
}
```

## Output Formats

Most commands support multiple output formats:

```bash
# 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 domains
- `show <domain>` - Show domain details
- `check <domain> <tlds...>` - Check domain availability
- `purchase <domain> <item-id>` - Purchase domain
- `lock/unlock <domain>` - Enable/disable domain lock
- `enable-privacy/disable-privacy <domain>` - Control privacy protection
- `set-nameservers <domain> <ns1> <ns2>` - Update nameservers
- `forwarding` - Manage domain forwarding
- `whois` - Manage WHOIS profiles

#### `hostinger vps`
- `list` - List VPS instances
- `show <vm-id>` - Show VPS details
- `start/stop/restart <vm-id>` - Control VPS power state
- `recreate <vm-id> <template-id>` - Recreate VPS
- `actions <vm-id>` - List VPS actions
- `backups <vm-id>` - List VPS backups
- `metrics <vm-id>` - Show VPS metrics
- `templates` - Manage OS templates
- `ssh-keys` - Manage SSH keys
- `datacenters` - List data centers

#### `hostinger dns`
- `list <domain>` - List DNS records
- `add <domain> <name> <type> <content>` - Add DNS record
- `delete <domain> <name> <type>` - Delete DNS record
- `update <domain> <name> <type> <old> <new>` - Update DNS record
- `import-zone/export-zone <domain> <file>` - Import/export DNS zone
- `reset <domain>` - Reset DNS to defaults
- `snapshots` - Manage DNS snapshots

#### `hostinger billing`
- `overview` - Show billing overview
- `catalog` - Browse service catalog
- `subscriptions` - Manage subscriptions
- `payment-methods` - Manage payment methods

## Error Handling

The CLI provides detailed error messages and uses appropriate exit codes:

- `0`: Success
- `1`: General error
- `2`: Command usage error

## Development

### Setting up Development Environment

```bash
# 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

```bash
# 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:

```bash
# Format code
black hostinger_cli/

# Check linting
flake8 hostinger_cli/
```

## API Reference

This CLI uses the [Hostinger API](https://developers.hostinger.com). 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](CONTRIBUTING.md) for details.

### Reporting Issues

Please report issues on our [GitHub Issues](https://github.com/hostinger/hostinger-cli/issues) page.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Support

- 📖 [Documentation](https://developers.hostinger.com)
- 🐛 [Bug Reports](https://github.com/hostinger/hostinger-cli/issues)
- 💬 [Discussions](https://github.com/hostinger/hostinger-cli/discussions)
- 📧 [Email Support](mailto:support@hostinger.com)

## Changelog

See [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.

---

Made with ❤️ by the Hostinger team

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hostinger/hostinger-cli",
    "name": "hostinger-cli",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "Hostinger CLI Contributors <support@hostinger.com>",
    "keywords": "hostinger, api, cli, cloud, vps, domains, dns, hosting, web hosting, server management, domain management",
    "author": "Hostinger CLI Contributors",
    "author_email": "Hostinger CLI Contributors <support@hostinger.com>",
    "download_url": "https://files.pythonhosted.org/packages/f4/cd/a1aed4f5460869ee6ed911e0e56eef04c9f6c15771a098ac8835475d1fbc/hostinger_cli-1.0.0.tar.gz",
    "platform": null,
    "description": "# Hostinger CLI\r\n\r\nA comprehensive command-line interface for managing your Hostinger services. Control your domains, VPS instances, DNS records, and billing from the terminal.\r\n\r\n[![PyPI version](https://badge.fury.io/py/hostinger-cli.svg)](https://badge.fury.io/py/hostinger-cli)\r\n[![Python Version](https://img.shields.io/pypi/pyversions/hostinger-cli.svg)](https://pypi.org/project/hostinger-cli/)\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\r\n\r\n## Features\r\n\r\n- \ud83c\udf10 **Domain Management**: Check availability, purchase, configure nameservers, enable/disable locks and privacy protection\r\n- \ud83d\udda5\ufe0f **VPS Management**: Deploy, start, stop, restart, recreate, monitor metrics, manage backups\r\n- \ud83d\udd27 **DNS Management**: Manage DNS records, import/export zones, snapshots, validation\r\n- \ud83d\udcb3 **Billing**: View subscriptions, payment methods, catalog items, pricing\r\n- \ud83d\udd11 **SSH Key Management**: Add, remove, and attach SSH keys to VPS instances\r\n- \ud83d\udcca **Rich Output**: Table and JSON output formats with colorized status indicators\r\n- \u2699\ufe0f **Easy Configuration**: Secure API key storage and management\r\n\r\n## Installation\r\n\r\n### From PyPI (Recommended)\r\n\r\n```bash\r\npip install hostinger-cli\r\n```\r\n\r\n### From Source\r\n\r\n```bash\r\ngit clone https://github.com/hostinger/hostinger-cli.git\r\ncd hostinger-cli\r\npip install -e .\r\n```\r\n\r\n## Quick Start\r\n\r\n### 1. Configure your API key\r\n\r\nFirst, get your API key from the [Hostinger Panel](https://hpanel.hostinger.com/profile/api).\r\n\r\n```bash\r\n# Configure interactively\r\nhostinger configure\r\n\r\n# Or set as environment variable\r\nexport HOSTINGER_API_KEY=\"your_api_key_here\"\r\n\r\n# Or pass directly to commands\r\nhostinger --api-key \"your_api_key_here\" domains list\r\n```\r\n\r\n### 2. List your services\r\n\r\n```bash\r\n# List all domains\r\nhostinger domains list\r\n\r\n# List all VPS instances\r\nhostinger vps list\r\n\r\n# Show billing overview\r\nhostinger billing overview\r\n```\r\n\r\n## Usage Examples\r\n\r\n### Domain Management\r\n\r\n```bash\r\n# Check domain availability\r\nhostinger domains check example com net org\r\n\r\n# List all domains\r\nhostinger domains list\r\n\r\n# Show domain details\r\nhostinger domains show example.com\r\n\r\n# Purchase a domain\r\nhostinger domains purchase example.com hostingercom-domain-com-usd-1y\r\n\r\n# Enable domain lock\r\nhostinger domains lock example.com\r\n\r\n# Enable privacy protection\r\nhostinger domains enable-privacy example.com\r\n\r\n# Update nameservers\r\nhostinger domains set-nameservers example.com ns1.example.com ns2.example.com\r\n```\r\n\r\n### VPS Management\r\n\r\n```bash\r\n# List all VPS instances\r\nhostinger vps list\r\n\r\n# Show VPS details\r\nhostinger vps show 12345\r\n\r\n# Start/stop/restart VPS\r\nhostinger vps start 12345\r\nhostinger vps stop 12345\r\nhostinger vps restart 12345\r\n\r\n# Show VPS metrics for last 7 days\r\nhostinger vps metrics 12345 --days 7\r\n\r\n# List available OS templates\r\nhostinger vps templates list\r\n\r\n# List data centers\r\nhostinger vps datacenters\r\n\r\n# Recreate VPS (\u26a0\ufe0f destroys all data!)\r\nhostinger vps recreate 12345 1130 --password \"SecurePassword123\"\r\n```\r\n\r\n### DNS Management\r\n\r\n```bash\r\n# List DNS records\r\nhostinger dns list example.com\r\n\r\n# Add DNS record\r\nhostinger dns add example.com www A 192.168.1.1 --ttl 3600\r\n\r\n# Delete DNS record\r\nhostinger dns delete example.com www A\r\n\r\n# Import DNS zone from file\r\nhostinger dns import-zone example.com zone.json\r\n\r\n# Export DNS zone to file\r\nhostinger dns export-zone example.com zone.json\r\n\r\n# Reset DNS to defaults\r\nhostinger dns reset example.com\r\n\r\n# List DNS snapshots\r\nhostinger dns snapshots list example.com\r\n\r\n# Restore DNS snapshot\r\nhostinger dns snapshots restore example.com 12345\r\n```\r\n\r\n### SSH Key Management\r\n\r\n```bash\r\n# List SSH keys\r\nhostinger vps ssh-keys list\r\n\r\n# Add SSH key from file\r\nhostinger vps ssh-keys create \"My Key\" --key-file ~/.ssh/id_rsa.pub\r\n\r\n# Add SSH key directly\r\nhostinger vps ssh-keys create \"My Key\" --key \"ssh-rsa AAAAB3NzaC1yc2E...\"\r\n\r\n# Attach SSH keys to VPS\r\nhostinger vps ssh-keys attach 12345 101 102\r\n\r\n# List attached SSH keys\r\nhostinger vps ssh-keys attached 12345\r\n```\r\n\r\n### Billing and Subscriptions\r\n\r\n```bash\r\n# Show billing overview\r\nhostinger billing overview\r\n\r\n# List all subscriptions\r\nhostinger billing subscriptions list\r\n\r\n# List payment methods\r\nhostinger billing payment-methods list\r\n\r\n# Browse catalog\r\nhostinger billing catalog list --category VPS\r\n\r\n# Search catalog\r\nhostinger billing search \"domain\"\r\n\r\n# Show pricing\r\nhostinger billing pricing --category DOMAIN\r\n```\r\n\r\n## Configuration\r\n\r\nThe CLI stores configuration in `~/.hostinger-cli.json`. You can also use environment variables:\r\n\r\n- `HOSTINGER_API_KEY`: Your Hostinger API key\r\n- `HOSTINGER_CONFIG_FILE`: Custom config file location\r\n\r\n### Configuration File Format\r\n\r\n```json\r\n{\r\n  \"api_key\": \"your_api_key_here\"\r\n}\r\n```\r\n\r\n## Output Formats\r\n\r\nMost commands support multiple output formats:\r\n\r\n```bash\r\n# Table format (default)\r\nhostinger domains list\r\n\r\n# JSON format\r\nhostinger domains list --format json\r\n\r\n# Raw API response\r\nhostinger domains list --format json | jq .\r\n```\r\n\r\n## Command Reference\r\n\r\n### Global Options\r\n\r\n- `--api-key`: Specify API key\r\n- `--config-file`: Specify config file location\r\n- `--help`: Show help message\r\n\r\n### Commands\r\n\r\n#### `hostinger configure`\r\nConfigure API key interactively\r\n\r\n#### `hostinger domains`\r\n- `list` - List all domains\r\n- `show <domain>` - Show domain details\r\n- `check <domain> <tlds...>` - Check domain availability\r\n- `purchase <domain> <item-id>` - Purchase domain\r\n- `lock/unlock <domain>` - Enable/disable domain lock\r\n- `enable-privacy/disable-privacy <domain>` - Control privacy protection\r\n- `set-nameservers <domain> <ns1> <ns2>` - Update nameservers\r\n- `forwarding` - Manage domain forwarding\r\n- `whois` - Manage WHOIS profiles\r\n\r\n#### `hostinger vps`\r\n- `list` - List VPS instances\r\n- `show <vm-id>` - Show VPS details\r\n- `start/stop/restart <vm-id>` - Control VPS power state\r\n- `recreate <vm-id> <template-id>` - Recreate VPS\r\n- `actions <vm-id>` - List VPS actions\r\n- `backups <vm-id>` - List VPS backups\r\n- `metrics <vm-id>` - Show VPS metrics\r\n- `templates` - Manage OS templates\r\n- `ssh-keys` - Manage SSH keys\r\n- `datacenters` - List data centers\r\n\r\n#### `hostinger dns`\r\n- `list <domain>` - List DNS records\r\n- `add <domain> <name> <type> <content>` - Add DNS record\r\n- `delete <domain> <name> <type>` - Delete DNS record\r\n- `update <domain> <name> <type> <old> <new>` - Update DNS record\r\n- `import-zone/export-zone <domain> <file>` - Import/export DNS zone\r\n- `reset <domain>` - Reset DNS to defaults\r\n- `snapshots` - Manage DNS snapshots\r\n\r\n#### `hostinger billing`\r\n- `overview` - Show billing overview\r\n- `catalog` - Browse service catalog\r\n- `subscriptions` - Manage subscriptions\r\n- `payment-methods` - Manage payment methods\r\n\r\n## Error Handling\r\n\r\nThe CLI provides detailed error messages and uses appropriate exit codes:\r\n\r\n- `0`: Success\r\n- `1`: General error\r\n- `2`: Command usage error\r\n\r\n## Development\r\n\r\n### Setting up Development Environment\r\n\r\n```bash\r\n# Clone the repository\r\ngit clone https://github.com/hostinger/hostinger-cli.git\r\ncd hostinger-cli\r\n\r\n# Create virtual environment\r\npython -m venv venv\r\nsource venv/bin/activate  # On Windows: venv\\Scripts\\activate\r\n\r\n# Install in development mode\r\npip install -e .\r\n\r\n# Install development dependencies\r\npip install -r requirements-dev.txt\r\n```\r\n\r\n### Running Tests\r\n\r\n```bash\r\n# Run all tests\r\npython -m pytest\r\n\r\n# Run with coverage\r\npython -m pytest --cov=hostinger_cli\r\n```\r\n\r\n### Code Style\r\n\r\nThis project uses Black for code formatting and Flake8 for linting:\r\n\r\n```bash\r\n# Format code\r\nblack hostinger_cli/\r\n\r\n# Check linting\r\nflake8 hostinger_cli/\r\n```\r\n\r\n## API Reference\r\n\r\nThis CLI uses the [Hostinger API](https://developers.hostinger.com). All API endpoints are supported with full feature parity.\r\n\r\nFor detailed API documentation, visit: https://developers.hostinger.com\r\n\r\n## Contributing\r\n\r\nWe welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for details.\r\n\r\n### Reporting Issues\r\n\r\nPlease report issues on our [GitHub Issues](https://github.com/hostinger/hostinger-cli/issues) page.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n\r\n## Support\r\n\r\n- \ud83d\udcd6 [Documentation](https://developers.hostinger.com)\r\n- \ud83d\udc1b [Bug Reports](https://github.com/hostinger/hostinger-cli/issues)\r\n- \ud83d\udcac [Discussions](https://github.com/hostinger/hostinger-cli/discussions)\r\n- \ud83d\udce7 [Email Support](mailto:support@hostinger.com)\r\n\r\n## Changelog\r\n\r\nSee [CHANGELOG.md](CHANGELOG.md) for a list of changes and version history.\r\n\r\n---\r\n\r\nMade with \u2764\ufe0f by the Hostinger team\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A comprehensive command-line interface for Hostinger API",
    "version": "1.0.0",
    "project_urls": {
        "Bug Reports": "https://github.com/hostinger/hostinger-cli/issues",
        "Changelog": "https://github.com/hostinger/hostinger-cli/blob/main/CHANGELOG.md",
        "Documentation": "https://developers.hostinger.com",
        "Homepage": "https://github.com/hostinger/hostinger-cli",
        "Repository": "https://github.com/hostinger/hostinger-cli"
    },
    "split_keywords": [
        "hostinger",
        " api",
        " cli",
        " cloud",
        " vps",
        " domains",
        " dns",
        " hosting",
        " web hosting",
        " server management",
        " domain management"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "7fb67ff2b8cad44ffbb7efbbe30694e05be7e88aeb8479c0b638d6978a55e861",
                "md5": "3da268870538201d8f8f7db2a1613ff9",
                "sha256": "cbfbff11dba40021d69cb92d894eb0abf199d5603afbcd810827d423d09ed34e"
            },
            "downloads": -1,
            "filename": "hostinger_cli-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3da268870538201d8f8f7db2a1613ff9",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 22975,
            "upload_time": "2025-08-13T22:25:51",
            "upload_time_iso_8601": "2025-08-13T22:25:51.755024Z",
            "url": "https://files.pythonhosted.org/packages/7f/b6/7ff2b8cad44ffbb7efbbe30694e05be7e88aeb8479c0b638d6978a55e861/hostinger_cli-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "f4cda1aed4f5460869ee6ed911e0e56eef04c9f6c15771a098ac8835475d1fbc",
                "md5": "0fc6935c2cbcb55c1c7350736e460a0d",
                "sha256": "70cc714196bc2d201c56ec7cf062a7239c943b4b10a1ecfb9222370fe190eec7"
            },
            "downloads": -1,
            "filename": "hostinger_cli-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0fc6935c2cbcb55c1c7350736e460a0d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 26715,
            "upload_time": "2025-08-13T22:25:53",
            "upload_time_iso_8601": "2025-08-13T22:25:53.232160Z",
            "url": "https://files.pythonhosted.org/packages/f4/cd/a1aed4f5460869ee6ed911e0e56eef04c9f6c15771a098ac8835475d1fbc/hostinger_cli-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-13 22:25:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hostinger",
    "github_project": "hostinger-cli",
    "github_not_found": true,
    "lcname": "hostinger-cli"
}
        
Elapsed time: 1.00826s