🛰️ Technical Reference

Hostinger VPS API
Full Resource Guide

Everything you need to manage VPS lifecycle, snapshots, and configurations via the Hostinger API — organized by topic, with plain-language explanations, SDKs, CLI, and automation recipes.

⏱️ 20-minute session 📚 developers.hostinger.com
1 Auth & Setup
2 Server Lifecycle
3 Snapshots
4 Config & Scripts
5 SDKs & CLI
6 Automation
7 Kodee (AI Assistant)
8 Checklist
9 Quiz
🔐
Authentication & Getting Started
Tokens, headers, and rate limits — 2 min
⏱ 2 min
🧠 What this is for
Think of the API token as a password that identifies your script or app to Hostinger instead of you logging in by hand. You generate it once in hPanel, then attach it to every request so Hostinger knows the request is authorized — without you typing a username and password each time.
🗝️ Where to Generate
hPanel → Account Settings → API
📄 Full Docs
⚠️ Rate Limiting
A 429 response means you've exceeded the limit — your IP may be temporarily blocked.
💻 Example — listing your VPS with curl
# Every request needs the token in the Authorization header curl -H "Authorization: Bearer YOUR_API_TOKEN" \ https://developers.hostinger.com/api/vps/v1/virtual-machines
ℹ️
New to the API? Start with "What is Hostinger API" for the token generation walkthrough: read the guide.
🖥️
Server Lifecycle — Key Endpoints
Base path: /api/vps/v1/virtual-machines/{id} — 3 min
⏱ 3 min
🧠 What this is for
These endpoints do the same things you'd do by clicking buttons in hPanel — see your servers, turn them on/off, restart them, or check how much CPU/RAM they're using — except you trigger them from code. That's what makes automation possible: a script can restart a hung server or check load without a human clicking anything.
MethodEndpointPurpose
GET/virtual-machinesList all VPS
GET/virtual-machines/{id}Get VPS details
POST/virtual-machinesCreate VPS
POST/virtual-machines/{id}/startPower on
POST/virtual-machines/{id}/stopGraceful shutdown
POST/virtual-machines/{id}/restartRestart
POST/virtual-machines/{id}/recreateRecreate
GET/virtual-machines/{id}/metricsCPU / RAM / traffic
💻 Example — restart a VPS that's stopped responding
curl -X POST -H "Authorization: Bearer YOUR_API_TOKEN" \ https://developers.hostinger.com/api/vps/v1/virtual-machines/12345/restart
💡
Tip Poll GET /virtual-machines/{id} to build your own uptime monitor — check the state field against running.
📸
Snapshot Management
Backups via API, and their limits — 3 min
⏱ 3 min
🧠 What this is for
A snapshot is a quick "save point" for your entire VPS — like a video game checkpoint. You take one right before doing something risky (a big config change, a package upgrade), and if it breaks something, you restore it and you're back to exactly how things were. It's not a full backup system though: only one snapshot exists at a time, and it disappears after a day — so it's for short-term safety nets, not long-term storage.
MethodEndpointPurpose
GET/virtual-machines/{id}/snapshotGet snapshot
POST/virtual-machines/{id}/snapshotCreate snapshot
DELETE/virtual-machines/{id}/snapshotDelete snapshot
POST/virtual-machines/{id}/snapshot/restoreRestore from snapshot
💻 Example — snapshot before a risky update, restore if it fails
# 1. Take a snapshot right before the change curl -X POST -H "Authorization: Bearer YOUR_API_TOKEN" \ https://developers.hostinger.com/api/vps/v1/virtual-machines/12345/snapshot # 2. Something broke? Roll it back curl -X POST -H "Authorization: Bearer YOUR_API_TOKEN" \ https://developers.hostinger.com/api/vps/v1/virtual-machines/12345/snapshot/restore
⚠️
Snapshot Limits Only 1 snapshot is stored at a time. It auto-deletes after 1 day. An OS reinstall wipes the existing snapshot.
📖 Source: Backup & Snapshot Guide
⚙️
Configuration & Post-Install Scripts
Set up the server, then automate provisioning — 3 min
⏱ 3 min
🧠 What this is for
Configuration endpoints change server-level settings you'd otherwise set manually in hPanel — the hostname, root password, nameservers, panel password, or SSH keys. Post-install scripts go a step further: you write a setup script once (e.g. "install nginx and lock down SSH") and Hostinger runs it automatically every time a matching VPS is provisioned — so you never configure a fresh server by hand twice.

Configuration endpoints:

MethodEndpointPurpose
PUT/virtual-machines/{id}/hostnameSet hostname
DELETE/virtual-machines/{id}/hostnameRemove hostname
PUT/virtual-machines/{id}/root-passwordReset root password
PUT/virtual-machines/{id}/nameserversUpdate nameservers
PUT/virtual-machines/{id}/panel-passwordSet panel password
GET/virtual-machines/{id}/public-keysList SSH keys
POST/virtual-machines/{id}/setupRun setup

Post-install scripts — automate configuration at provisioning time:

MethodEndpointPurpose
POST/post-install-scriptsCreate script
GET/post-install-scriptsList scripts
GET/post-install-scripts/{id}Get specific script
PUT/post-install-scripts/{id}Update script
DELETE/post-install-scripts/{id}Delete script
💻 Example — a post-install script that installs NGINX and hardens SSH
POST /api/vps/v1/post-install-scripts { "name": "Install NGINX + harden SSH", "content": "#!/bin/bash\napt update && apt install -y nginx\nsed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config\nsystemctl restart sshd" }
📖 Source: Post-Install Scripts Guide
🛠️
SDKs & CLI
Skip raw REST calls — 3 min
⏱ 3 min
🧠 What this is for
SDKs let you call the API using normal code in your language of choice — you call a function like list() instead of manually building an HTTP request, and you get typed, predictable responses back. The CLI (hapi) is for quick one-off actions straight from your terminal, no code required at all — handy for scripts, cron jobs, or just checking on a server fast.
🙋
In Everyday Terms Think of the raw API as reaching into a car's engine and connecting the wires yourself — it works, but it's fiddly and easy to get wrong. An SDK is like the car's dashboard: familiar buttons and dials that do the same job, just easier and safer to use. The CLI is like a remote control — you press one button (type one line) and the action happens, no engineering knowledge needed. None of these require understanding how the "engine" (the API) actually works underneath.

These are all different ways to control your VPS from outside hPanel — same actions (start, stop, snapshot, etc.), different tool depending on how you like to work. Tap a card to see what each one is actually for:

Tool
PHP SDK
Tool
Python SDK
Tool
TypeScript/Node SDK
Tool
CLI (hapi)
Tool
Ansible Collection
Tool
Terraform Provider
Tool
n8n Node
Tool
MCP Server
💻 Example — listing VPS with the Python SDK
# pip install hostinger-api-sdk from hostinger import Client client = Client(api_token="YOUR_API_TOKEN") vms = client.vps.virtual_machines.list() print(vms)
💻 Example — same thing with the CLI
# Install apt install golang-go git clone --depth 1 https://github.com/hostinger/api-cli /tmp/api-cli cd /tmp/api-cli && go build -o /usr/local/bin/hapi # Auth export HAPI_API_TOKEN=<your_token> # VPS commands hapi vps vm list # List all VPS hapi vps vm get <vm_id> # VPS details hapi vps vm start <vm_id> # Power on hapi vps vm stop <vm_id> # Shutdown hapi vps vm list --format json # Machine-readable output
📖 Source: API CLI Guide
🤖
AI & Workflow Automation
MCP, n8n, and practical recipes — 2 min
⏱ 2 min
🧠 What this is for
MCP (Model Context Protocol) is a standard that lets AI assistants like Claude or Cursor call real tools and APIs on your behalf. Instead of writing a script, you type a plain-English request — "restart my VPS named prod-01" — and the AI translates that into the correct API call. n8n does the no-code equivalent for scheduled or triggered workflows: drag together API calls, conditions, and alerts without writing code.
🙋
In Everyday Terms Instead of paying someone to sit and watch a server 24/7, these tools act like a smoke detector — they watch quietly in the background and only speak up the moment something's actually wrong. With MCP, you get to "talk" to your server the way you'd ask a helpful assistant to do something — no code, just a sentence. With n8n, you build a simple "if this happens, then do that" flow chart on screen, like a flowchart on a whiteboard, and it runs itself from then on.

Click a recipe to see how it's built:

n8n Recipe
Server status monitoring with Slack alerts
How It Works
  • Poll GET /virtual-machines/{id} on a schedule
  • Check the returned state against running
  • If it doesn't match, trigger a Slack alert node
n8n Recipe
Usage spike detection → auto-created Jira ticket
How It Works
  • Fetch GET /virtual-machines/{id}/metrics
  • Run the result through an OpenAI analysis step
  • Auto-create a Jira ticket when a spike is confirmed
n8n Recipe
Pre-maintenance snapshots
How It Works
  • Auto-trigger POST /snapshot before a scheduled maintenance window
  • Remember: only 1 snapshot is retained, and it auto-deletes after 1 day
🔌
MCP Server Connects Claude, Cursor, JetBrains, Devin, and OpenAI Codex to your VPS via natural language — supports both API Token and OAuth. No-install option: Hostinger Connector.
📖 Full tutorial: Automate VPS with n8n
🧞
Meet Kodee — Hostinger's AI VPS Assistant
MCP in action, and how to build your own — 2 min
⏱ 2 min
🧠 What this is for
Kodee is Hostinger's built-in AI assistant, and it now runs on the same MCP foundation covered in the previous section. Instead of clicking through hPanel or calling the API yourself, you just chat with Kodee in plain language — in over 50 languages — and it carries out the request for you, 24/7.
🙋
In Everyday Terms Think of Kodee as an on-call system administrator who never sleeps. You don't need to know any commands — just describe the problem or the task in your own words, the same way you'd ask a coworker for help, and Kodee handles the technical part behind the scenes.
✅ What Kodee Can Do
Change the hostname, enable/manage a firewall, create a snapshot, reset a password, manage SSH access, enable the malware scanner, monitor resource usage, and control installed panels like cPanel or Plesk.
⚠️ Safety Net
For destructive actions — reinstalling the VPS, changing the OS template, restoring a backup — Kodee will always ask you to confirm first before making the change.
💬 Example — just ask, in plain language
"What's the uptime of my newest VPS?" "Check the hardware usage of my newest VPS." "Create a snapshot before I update the server."

Want to build your own version of this? The same MCP foundation is available to anyone via the Hostinger API. Click to see the setup at a glance:

DIY Setup
Run your own Hostinger API MCP server
How It Works
  • Install Node.js (v20+) and the MCP server CLI: npm install -g hostinger-api-mcp
  • Generate a Hostinger API token in hPanel → Account Information → API
  • Add the MCP server to your AI tool's config (e.g. Claude Desktop) with your token
  • Test it by asking your AI agent something like "What's the uptime of my newest VPS?"
No Advanced Skills Needed

Setting this up only requires installing Node.js and the CLI, then pointing your AI tool at your token — no coding required beyond following the setup steps.

📖 Manage your VPS by chatting with AI · How to run your own Hostinger API MCP server
☑️
Before You Ship an Integration
Pre-flight checklist — 1 min
⏱ 1 min

Click each item to check it off.

  • API token generated in hPanel → Account Settings → API
  • Every request sends Authorization: Bearer YOUR_API_TOKEN
  • Handling of 429 rate-limit responses is in place (backoff/retry)
  • Snapshot workflows account for the 1-snapshot, 1-day auto-delete limit
  • Post-install scripts tested against a non-production VPS first
  • Chosen an SDK/CLI/MCP path instead of hand-rolled REST calls where possible
  • Pagination handled for list endpoints (default 50 items/page)
0 / 7 items checked
🧠
Knowledge Check
5 questions, one per topic — 1 min
⏱ 1 min

Q1. What HTTP status code indicates you've hit the rate limit?

500
401
429

Q2. Which endpoint gives you CPU, RAM, and traffic data for a VPS?

GET /virtual-machines/{id}
GET /virtual-machines/{id}/metrics
POST /virtual-machines/{id}/restart

Q3. When does a snapshot auto-delete?

After 7 days
After 1 day
Never — it must be deleted manually

Q4. What are post-install scripts used for?

Automating server configuration during provisioning
Restoring a VPS from a snapshot
Rotating SSH keys automatically

Q5. What does the MCP Server enable?

Only Python-based automation
Natural-language VPS management from tools like Claude, Cursor, and Devin
Direct SSH access with no authentication
Score: 0 / 5
📚 Sources & References