{"id":12591,"date":"2026-07-17T09:21:48","date_gmt":"2026-07-17T09:21:48","guid":{"rendered":"https:\/\/www.hostinger.com\/support\/?p=12591"},"modified":"2026-07-17T09:21:48","modified_gmt":"2026-07-17T09:21:48","slug":"how-to-install-and-use-the-official-cli-for-the-hostinger-mail-api","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/how-to-install-and-use-the-official-cli-for-the-hostinger-mail-api\/","title":{"rendered":"How to install and use the official CLI for the Hostinger Mail API"},"content":{"rendered":"<p><span style=\"font-weight: 400\">You can manage your <strong>Hostinger email accounts<\/strong>, messages, folders, webhooks, and quotas directly from your system terminal using the <strong>official command-line interface (CLI)<\/strong> tool. This official tool eliminates the need for writing custom scripts or handling HTTP requests manually.<\/span><\/p><p><span style=\"font-weight: 400\">This guide covers how to install the <\/span><span style=\"font-weight: 400\">hostinger-mail<\/span><span style=\"font-weight: 400\"> CLI tool on <strong>macOS, Linux, and Windows<\/strong>, how to authenticate your account, and how to run basic commands.<\/span><\/p><h2 id=\"h-before-you-start\"><b>Before<\/b> you<b> start<\/b><\/h2><p><span style=\"font-weight: 400\">To use the <strong>Hostinger Mail API CLI<\/strong> tool, ensure you have the following:<\/span><\/p><ul>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">An active Hostinger email account.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">An API key generated from your Hostinger account panel.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">A terminal environment on a supported operating system (Linux, macOS, or Windows).<\/span><\/li>\n<\/ul><h2 id=\"h-step-1-install-the-hostinger-mail-cli\"><b>Step 1 &ndash; Install the Hostinger Mail CLI<\/b><\/h2><p><span style=\"font-weight: 400\">The installation method depends on the operating system you are using. Follow the instructions for your specific platform.<\/span><\/p><h3><b>Option A &ndash; macOS (Homebrew)<\/b><\/h3><p><span style=\"font-weight: 400\">If you are using <strong>macOS<\/strong>, you can install the tool using <strong>Homebrew<\/strong>.<\/span><\/p><ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Open your terminal.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Run the following command to tap the official repository and install the binary:<\/span><\/li>\n<\/ol><p><span style=\"font-weight: 400\">Bash<\/span><\/p><pre><span style=\"font-weight: 400\">brew install hostinger\/tap\/hostinger-mail<\/span><\/pre><h3><b>Option B &ndash; Linux and Windows<\/b><\/h3><p><span style=\"font-weight: 400\">For <strong>Linux and Windows<\/strong>, download the latest cross-platform binary directly from the official repository release page.<\/span><\/p><ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Download the executable file corresponding to your operating system architecture.<\/span><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Place the binary file into a directory included in your system execution path (PATH variable) to run it from anywhere.<\/span><\/li>\n<\/ol><h2 id=\"h-step-2-authenticate-with-your-api-key\"><b>Step 2 &ndash; Authenticate with your API key<\/b><\/h2><p><span style=\"font-weight: 400\">The tool requires <strong>API key authentication<\/strong> to safely connect to your mailbox services. You can configure your credentials using either a configuration file or environment variables.<\/span><\/p><h3><b>Option A &ndash; Use a configuration file (Persistent)<\/b><\/h3><ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Create a configuration file in your home directory named <\/span>\n<pre><span style=\"font-weight: 400\">.hostinger-mail.yaml<\/span><span style=\"font-weight: 400\">.<\/span><\/pre>\n<\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><span style=\"font-weight: 400\">Open the file in a text editor and paste your token using the following format:<br>\n<\/span><\/span><span style=\"font-weight: 400\">YAML<\/span>\n<pre><span style=\"font-weight: 400\">api_key: YOUR_API_KEY_HERE<\/span><\/pre>\n<\/li>\n<li><span style=\"font-weight: 400\">Save the file. The tool will automatically look for this file when executing operations.<\/span><\/li>\n<\/ol><h3><b>Option B &ndash; Use environment variables (Temporary)<\/b><\/h3><ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Set the variable directly in your terminal session.<\/span>\n<ol>\n<li style=\"font-weight: 400\">\n<pre><span style=\"font-weight: 400\">On Linux and macOS, run:\r\n<\/span><span style=\"font-weight: 400\">Bash\r\n<\/span>export HOSTINGER_MAIL_API_KEY=\"YOUR_API_KEY_HERE\"<\/pre>\n<\/li>\n<li style=\"font-weight: 400\">\n<pre><span style=\"font-weight: 400\">On Windows PowerShell, run:\r\n<\/span><span style=\"font-weight: 400\">PowerShell\r\n<\/span>$env:HOSTINGER_MAIL_API_KEY=\"YOUR_API_KEY_HERE\"<\/pre>\n<\/li>\n<\/ol>\n<\/li>\n<\/ol><div class=\"intercom-interblocks-callout\" style=\"background-color: #b2f2b280;border-color: #a0e4a033\">Environment variables are temporary and will clear automatically when you close your current terminal window. Use the configuration file method for a permanent setup.<\/div><h2 id=\"h-step-3-manage-your-emails-via-commands\"><b>Step 3 &ndash; Manage your emails via commands<\/b><\/h2><p><span style=\"font-weight: 400\">Once configured, each <strong>Mail API operation<\/strong> is accessible as a dedicated subcommand inside the terminal. The tool provides multiple output structures, including clean tables, raw JSON, and visual trees.<\/span><\/p><ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><span style=\"font-weight: 400\">To view a complete list of commands and global options, append the help flag to the tool:<br>\n<\/span><\/span><span style=\"font-weight: 400\">Bash<\/span>\n<pre><span style=\"font-weight: 400\">hostinger-mail --help<\/span><\/pre>\n<\/li>\n<li><span style=\"font-weight: 400\"><span style=\"font-weight: 400\">Run a specific subcommand to manage your mailbox resources. For example, to view your current usage limits:<br>\n<\/span><\/span><span style=\"font-weight: 400\">Bash<\/span>\n<pre><span style=\"font-weight: 400\">hostinger-mail quota get<\/span><\/pre>\n<\/li>\n<li><span style=\"font-weight: 400\"><span style=\"font-weight: 400\">To view folders or send a message, execute the respective operations:<br>\n<\/span><\/span><span style=\"font-weight: 400\">Bash<\/span>\n<pre><span style=\"font-weight: 400\">hostinger-mail folders list<\/span>\r\n\r\n<span style=\"font-weight: 400\">hostinger-mail messages send --to=\"recipient@example.com\" --subject=\"Terminal Test\" --body=\"Sent via CLI.\"<\/span><\/pre>\n<\/li>\n<\/ol><h2 id=\"h-step-4-enable-shell-autocompletion-optional\"><b>Step 4 &ndash; Enable shell autocompletion (Optional)<\/b><\/h2><p><span style=\"font-weight: 400\">You can enable shell auto-completion so that the command structure finishes automatically when you press the <\/span><b>TAB<\/b><span style=\"font-weight: 400\"> key.<\/span><\/p><ol>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\"><span style=\"font-weight: 400\">Generate the autocompletion script for your specific shell environment (such as Bash, Zsh, fish, or PowerShell) by running the completion command:<br>\n<\/span><\/span><span style=\"font-weight: 400\">Bash<\/span>\n<pre><span style=\"font-weight: 400\">hostinger-mail completion bash<\/span><\/pre>\n<\/li>\n<li><span style=\"font-weight: 400\">Follow the terminal instructions to append the generated script to your profile configuration file, then restart your terminal window.<\/span><span style=\"font-weight: 400\"><br>\n<\/span><\/li>\n<\/ol><p><span style=\"font-weight: 400\">You can now manage your Hostinger email settings, monitor webhooks, check data quotas, and process messages faster from your system command line.<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Install and use the official Hostinger Mail API command-line interface to manage your emails directly from your terminal.<\/p>\n","protected":false},"author":596,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[315],"tags":[],"class_list":["post-12591","post","type-post","status-publish","format-standard","hentry","category-hostinger-mail-api"],"hreflangs":[],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/12591","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=12591"}],"version-history":[{"count":3,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/12591\/revisions"}],"predecessor-version":[{"id":12604,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/12591\/revisions\/12604"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=12591"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=12591"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=12591"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}