Overview
Hostwares exposes a full REST API that lets you programmatically manage every aspect of your infrastructure. With an API key, you can deploy sites, manage databases, control services, configure domains, and monitor resources from any programming language, CI/CD pipeline, or automation tool.
Use cases include:
- Automated deployments from CI/CD (GitHub Actions, GitLab CI, Jenkins)
- Infrastructure-as-Code with Terraform
- Custom dashboards and monitoring
- Slack/Discord notifications on deploy events
- Integrating with existing project management tools
- Building custom deployment workflows with n8n or Zapier
API Key Setup
Before integrating, generate an API key from your dashboard:
- Navigate to Dashboard → API Keys
- Click Create New Key and give it a descriptive name (e.g., "GitHub Actions Production")
- Copy the key immediately — it starts with
sk_and won't be shown again - Store it as an environment secret in your CI/CD system
# Example: Store as GitHub Secret
# Settings → Secrets → Actions → New repository secret
# Name: HOSTWARES_API_KEY
# Value: sk_abc123def456...Security best practices:
- Never commit API keys to version control
- Use separate keys for development, staging, and production
- Rotate keys every 90 days
- Delete unused keys promptly
GitHub Actions Integration
Auto-deploy to Hostwares on every push to main:
# .github/workflows/deploy.yml
name: Deploy to Hostwares
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Trigger Deploy
run: |
curl -X PATCH \
https://hostwares.com/api/sites/${{ secrets.HOSTWARES_SITE_ID }} \
-H "Authorization: Bearer ${{ secrets.HOSTWARES_API_KEY }}" \
-H "Content-Type: application/json" \
-d '{"action": "deploy"}'
- name: Wait for deployment
run: |
sleep 10
STATUS=$(curl -s \
https://hostwares.com/api/sites/${{ secrets.HOSTWARES_SITE_ID }} \
-H "Authorization: Bearer ${{ secrets.HOSTWARES_API_KEY }}" \
| jq -r '.status')
echo "Deployment status: $STATUS"
if [ "$STATUS" = "FAILED" ]; then exit 1; fiGitLab CI Integration
# .gitlab-ci.yml
deploy:
stage: deploy
only:
- main
script:
- |
curl -X PATCH \
"https://hostwares.com/api/sites/$HOSTWARES_SITE_ID" \
-H "Authorization: Bearer $HOSTWARES_API_KEY" \
-H "Content-Type: application/json" \
-d '{"action": "deploy"}'Migrate from Vercel
Moving from Vercel to Hostwares is straightforward:
- Create a site on Hostwares with the same GitHub repo
- Copy your environment variables from Vercel to Hostwares
- Update your domain DNS to point to Hostwares
- Remove the Vercel integration from GitHub
# Bulk import environment variables via API
curl -X POST https://hostwares.com/api/sites/SITE_ID/env \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"variables": [
{"key": "DATABASE_URL", "value": "postgres://..."},
{"key": "NEXT_PUBLIC_API_URL", "value": "https://api.example.com"}
]
}'Terraform Provider
Not published yet.The shape below is what we're designing against — use the REST API directly (below) for infrastructure-as-code until this ships.
# main.tf (design preview — not yet available)
terraform {
required_providers {
hostwares = {
source = "hostwares/hostwares"
}
}
}
provider "hostwares" {
api_key = var.hostwares_api_key
}
resource "hostwares_site" "api" {
name = "my-api-backend"
repository = "github.com/myorg/api"
branch = "main"
port = 8080
environment = {
NODE_ENV = "production"
DATABASE_URL = var.database_url
}
}
resource "hostwares_database" "postgres" {
name = "production-db"
type = "postgresql"
}Node.js SDK
Not published yet — @hostwares/sdkisn't on npm. Until it ships, a thin wrapper around fetch gets you the same ergonomics:
const HOSTWARES_API = 'https://hostwares.com/api';
const apiKey = process.env.HOSTWARES_API_KEY;
async function hw(path: string, options: RequestInit = {}) {
const res = await fetch(`${HOSTWARES_API}${path}`, {
...options,
headers: { Authorization: `Bearer ${apiKey}`, 'Content-Type': 'application/json', ...options.headers },
});
if (!res.ok) throw new Error((await res.json()).error);
return res.json();
}
// List all sites
const sites = await hw('/sites');
// Trigger a redeploy
await hw(`/sites/${siteId}`, { method: 'PATCH', body: JSON.stringify({ action: 'deploy' }) });Python SDK
Not published yet — pip install hostwares isn't available. Call the REST API directly:
import requests
API_KEY = "sk_..."
BASE = "https://hostwares.com/api"
headers = {"Authorization": f"Bearer {API_KEY}"}
# List sites
sites = requests.get(f"{BASE}/sites", headers=headers).json()
# Trigger a redeploy
requests.patch(f"{BASE}/sites/{site_id}", headers=headers, json={"action": "deploy"})Zapier / n8n Automation
Use the REST API with any automation platform that has an HTTP action:
- Zapier: Use the Webhooks by Zapier module with our API endpoints
- n8n: Use the HTTP Request node to call the Hostwares API
- Make (Integromat): Create custom HTTP modules
Example workflow: redeploy when a Jira ticket moves to "Ready for Deploy"
// n8n HTTP Request Node
Method: PATCH
URL: https://hostwares.com/api/sites/{{siteId}}
Headers:
Authorization: Bearer {{$credentials.hostwaresApiKey}}
Body (JSON):
{ "action": "deploy" }Monitoring Tools Integration
There's no push-based metrics/webhook feed yet — poll the REST API on an interval, or ask the AI assistant directly:
- Grafana / Datadog: Poll
GET /api/sitesandGET /api/databaseson a schedule (JSON datasource) until native forwarding ships - PagerDuty: Have your uptime checker hit your site directly; Hostwares doesn't push downtime alerts to PagerDuty yet
- Uptime Kuma: Monitor your Hostwares sites the normal way — as external HTTP(S) monitors from your self-hosted instance
Slack & Discord Notifications
There's no built-in Slack/Discord push integration yet. Two ways to get notified today:
- Ask the AI — "notify me here if my-site goes down" works within a chat session
- Poll + relay — an n8n/Zapier workflow that polls
GET /api/sites/:idon a schedule and posts to your Slack/Discord webhook whenstatuschanges is the reliable stopgap until native push notifications ship