Build on HostAfrica with one API
Automate VPS provisioning, networking, security, backups, and monitoring through the public API, the HA CLI, or an MCP-compatible interface - all generated from the same OpenAPI contract.
Choose the interface that fits your workflow.
Use the same HostAfrica token across the public API, the HA CLI, MCP, and SDKs.
Public API
For teams integrating HostAfrica into products, portals, and backend workflows.
Use the REST API to provision services, manage networking, trigger backups, check service status, and connect HostAfrica to your own systems.
- Best for product integrations and backend services
- Generated from the OpenAPI contract
- Works with Postman, SDKs, and custom clients
HA CLI
For operators who live in shell scripts, jobs, and runbooks.
The HA CLI gives you the same platform capabilities from the terminal - ideal for quick checks, CI jobs, and repeatable operations.
- Best for scripting and CI/CD automation
- Uses the same API token
- Easy to audit, version, and run at scale
MCP Server
For AI agents that need structured access to HostAfrica.
The MCP server exposes approved HostAfrica actions to agent workflows, so assistants can inspect services, suggest changes, and run permitted operations.
- Best for AI-assisted operations
- No custom API wrapper required
- Scope access through the same token model
Start with the same token. Move through the interface that fits.
Generate one bearer token, then use it from curl, the CLI, MCP, or an SDK.
- 1
Generate a bearer token in the HostAfrica Client Area (opens in new tab).
- 2
Make a first authenticated request to https://api.hostafrica.com.
- 3
Switch to the CLI or MCP once you want reusable ops or agent workflows.
New to the API? Follow the full Getting Started guide.
export HA_TOKEN=<your-bearer-token>
curl https://api.hostafrica.com/vps/list-vps-services \
-H "Authorization: Bearer $HA_TOKEN" \
-H "Content-Type: application/json" \
-d '{"page":1,"page_size":10}'export HA_SERVER=https://api.hostafrica.com
export HA_TOKEN=<your-bearer-token>
./ha list-vps-services \
| jq .data.services{
"mcpServers": {
"hostafrica-api": {
"type": "http",
"url": "https://api.hostafrica.com/mcp",
"headers": {
"Authorization": "Bearer <your-token>"
}
}
}
}import {Configuration, VPSManagementApi} from "@hostafrica/ha-sdk-typescript";
const client = new VPSManagementApi(
new Configuration({
accessToken: "<your-bearer-token>",
}),
);
const vps = await client.listVpsServices();Infrastructure jobs you can automate today.
Everything below is a real endpoint you can call today.
VPS management
List services, inspect configs, mount ISOs, and reinstall operating systems.
Explore VPS docs (opens in new tab)Power management
Start, stop, reboot, shutdown, and schedule recurring power actions.
Explore power docs (opens in new tab)Backups and schedules
Create and manage backups without leaving your workflow.
Explore backup docs (opens in new tab)Firewall and security
Control inbound and outbound rules, rotate credentials, and manage SSH keys.
Explore security docs (opens in new tab)DNS and reverse DNS
Map allocated IPs back to hostnames and keep naming consistent across services.
Explore DNS docs (opens in new tab)Monitoring
Set alerts on critical metrics and respond before issues spread.
Explore monitoring docs (opens in new tab)One contract. Consistent docs, SDKs, and tooling.
Reference docs, a Postman collection, the HA CLI, and official SDKs.
MCP for agent workflows. CLI for repeatable operations.
Both reach the same platform - pick by how your agents and scripts run.
MCP
Best when you want the quickest route from plain-language intent to structured tool execution.
- No shell access required
- Tool schemas guide the agent
- Best starting point for Cursor-style workflows
- Tradeoff: larger responses land in model context more often
CLI
Best when you need filtered output, reusable shell scripts, or lower token usage in repeated agent runs.
- Great for scripts, jobs, and terminal-native ops
- Easy to pipe through
jqbefore output reaches an agent - More flexible when combining operations
- Tradeoff: requires shell access and command awareness
For a full breakdown of all three approaches - including direct HTTP and token-cost tradeoffs - read the Using Agents guide.
Frequently asked questions
Common questions about the HostAfrica API, CLI, and MCP surface.
Yes, you can register an account at HostAfrica. To enable API access and obtain your bearer token, use your HostAfrica credentials to log in to the HostAfrica Client Area.
Sign in to the HostAfrica Client Area with your HostAfrica credentials and generate a bearer token, then pass it as a Bearer header on your requests. The API itself is free - you only pay for the VPS services you run. Don't have an account yet? Register at HostAfrica first.
Yes. Access to the API itself is free, but to order a VPS service you need to have a verified payment method configured for automated payments.
You can call the REST API from any language. We publish official SDKs for TypeScript, Python, Go, and PHP, with more in progress, and the HA CLI wraps the same API for shell and scripting workflows.
Yes, AI agents enabled by Large Language Models (like Claude Opus, Google Gemini, etc.) can use the API in multiple ways, directly or by connecting via our MCP server. See the API reference documentation and the MCP guide for more information.
Yes. Our streamable MCP surface exposes the same platform as structured tool calls, so AI agents and assistants can operate your VPS - power, backups, firewall, DNS and more - without shell access. Follow the MCP guide to connect, or read the API reference for the underlying endpoints.
Visit our server hosting page to find out more about the virtual and dedicated server hosting options we provide.