API Documentation

Build with Bavinhost — Account API for customers and Partner Gateway API for resellers & agencies.

Two REST APIs, both authenticated with API keys over HTTPS. Choose the API that matches how you use Bavinhost.

Overview

Bavinhost exposes programmatic access so you can manage services outside the control panel.

API Who it’s for Base URL Get keys
Account API End customers managing their own domains, hosting, billing, and support https://www.bavinhost.com/account/api/v1 Client area → API Keys
Partner Gateway Resellers & agencies provisioning sites, domains, wallet, and team access https://www.bavinhost.com/partner-gateway/api/v1 Partner dashboard → Settings

Account API

Customer-facing REST API for domains, hosting, orders, account profile, support tickets, and billing.

Authentication

Send your API key on every request using either:

  • Header: X-API-Key: YOUR_API_KEY
  • Query: ?api_key=YOUR_API_KEY

Create and revoke keys in the API Keys page after logging in.

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://www.bavinhost.com/account/api/v1/domains"

Endpoints

Domains
MethodPathDescription
GET/domainsList your domains
GET/domains/{id}Get a domain by ID
POST/domainsRegister a domain
POST/domains/{id}/renewRenew domain (charges account balance)
POST/domains/{id}/auto-renewEnable/disable auto-renew
PUT/domains/{id}Update domain (e.g. nameservers)

Register body example:

{
  "domain": "example.com",
  "years": 1,
  "contacts": { }
}

Renew body example:

{
  "years": 1
}

Auto-renew body example:

{
  "enabled": true
}
Hosting
MethodPathDescription
GET/hostingList hosting accounts
GET/hosting/{id}Get a hosting account
POST/hostingCreate a hosting account
POST/hosting/{id}/renewRenew hosting (charges account balance)
PUT/hosting/{id}Update / suspend / unsuspend
Orders
MethodPathDescription
GET/ordersList orders
GET/orders/{id}Get an order
Account
MethodPathDescription
GET/accountGet account profile
PUT/accountUpdate account profile
Support
MethodPathDescription
GET/supportList tickets
GET/support/{id}Get ticket + comments
POST/supportOpen a ticket

Create ticket body example:

{
  "title": "Issue title",
  "description": "Help needed",
  "department": "IT"
}
Billing
MethodPathDescription
GET/billing/balanceAccount balance
GET/billing/transactionsRecent transactions

Partner Gateway API

Reseller / agency API for site provisioning, domains, wallet billing, team, API keys, and webhooks.

Authentication

Partner requests require these headers:

X-Api-Key: your_api_key
X-Timestamp: unix_timestamp
X-Nonce: unique_nonce

Keys and webhook settings live in the partner dashboard. Logged-in dashboard sessions can also call the API without a key for interactive use.

Endpoints

Sites
MethodPathDescription
GET/sitesList partner sites
GET/sites/{id}Get a site
POST/sitesProvision a site
POST/sites/{id}/suspendSuspend site
POST/sites/{id}/reactivateReactivate site
POST/sites/{id}/terminateTerminate site
POST/sites/{id}/redeployRedeploy site
POST/sites/{id}/upgradeUpgrade plan
POST/sites/{id}/renewRenew site hosting (wallet charge)
POST/sites/{id}/auto-renewEnable/disable site auto-renew
POST/sites/{id}/attach-domainAttach domain
GET/sites/{id}/resourcesResource usage
GET / POST / PUT / DEL/sites/{id}/dnsManage DNS records
POST/sites/bulk/suspendBulk suspend
POST/sites/bulk/reactivateBulk reactivate
POST/sites/bulk/terminateBulk terminate

Provision body example:

{
  "domain": "client-example.com",
  "subdomain": "",
  "plan_id": "starter",
  "partner_customer_id": "cust_12345",
  "partner_customer_email": "owner@client-example.com",
  "partner_customer_name": "Client Owner"
}
Jobs
MethodPathDescription
GET/jobsList provisioning jobs
GET/jobs/{id}Job status
POST/jobs/{id}/retryRetry failed job
Domains
MethodPathDescription
GET/domainsList domains
GET/domains/{id}Get domain
GET/domains/searchSearch availability
POST/domainsRegister or transfer
POST/domains/{id}/lockLock domain
POST/domains/{id}/unlockUnlock domain
POST/domains/{id}/renewRenew domain (wallet + registrar)
POST/domains/{id}/auto-renewEnable/disable auto-renew
POST/domains/{id}/whois-privacyUpdate WHOIS privacy
GET/domains/{id}/statusDomain status
Wallet & invoices
MethodPathDescription
GET/walletWallet summary
POST/wallet/topupStart a top-up
GET/wallet/transactionsWallet transactions
POST/wallet/auto-topupConfigure auto top-up
GET/invoicesList invoices
GET/invoices/{id}Get invoice
Team, keys & webhooks
MethodPathDescription
GET/teamList team members
POST/team/inviteInvite member
PUT/team/{id}/roleUpdate role
DEL/team/{id}Remove member
GET/keysList API keys
POST/keysCreate API key
PUT/keys/{id}/revokeRevoke key
DEL/keys/{id}Delete key
POST/webhooks/testTest webhook URL
GET/webhooks/logsDelivery logs
POST/webhooks/rotate-secretRotate secret
POST/webhooks/{id}/retryRetry delivery

Code examples

Account API — list domains (cURL)
curl -H "X-API-Key: YOUR_API_KEY" \
  "https://www.bavinhost.com/account/api/v1/domains"
Account API — open support ticket
curl -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"title":"Issue","description":"Help needed","department":"IT"}' \
  "https://www.bavinhost.com/account/api/v1/support"
Account API — renew domain
curl -X POST \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"years":1}' \
  "https://www.bavinhost.com/account/api/v1/domains/DOM_SECRET_ID/renew"
Partner Gateway — renew site
curl -X POST "https://www.bavinhost.com/partner-gateway/api/v1/sites/SITE_ID/renew" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Timestamp: $(date +%s)" \
  -H "X-Nonce: $(openssl rand -hex 16)" \
  -d '{"years":1}'
Partner Gateway — list sites
curl -X GET "https://www.bavinhost.com/partner-gateway/api/v1/sites?page=1&limit=20" \
  -H "Content-Type: application/json" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "X-Timestamp: $(date +%s)" \
  -H "X-Nonce: $(openssl rand -hex 16)"
Partner Gateway — Node.js provision
const baseUrl = "https://www.bavinhost.com/partner-gateway/api/v1";
const apiKey = "YOUR_API_KEY";

const res = await fetch(`${baseUrl}/sites`, {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "X-Api-Key": apiKey,
    "X-Timestamp": Math.floor(Date.now() / 1000).toString(),
    "X-Nonce": crypto.randomUUID().replace(/-/g, "")
  },
  body: JSON.stringify({
    domain: "client-example.com",
    plan_id: "starter",
    partner_customer_id: "cust_12345",
    partner_customer_email: "owner@client-example.com",
    partner_customer_name: "Client Owner"
  })
});
console.log(await res.json());

Errors & rate limits

Account API responses use a standard envelope:

{
  "success": false,
  "data": null,
  "message": "Unauthorized",
  "code": 401
}

Partner Gateway error shape:

{
  "success": false,
  "error": {
    "code": "AUTH_FAILED",
    "message": "Missing API key or session"
  }
}

Common partner codes: AUTH_FAILED, FORBIDDEN, NOT_FOUND, METHOD_NOT_ALLOWED, VALIDATION_ERROR, INTERNAL_ERROR. Account API defaults to about 100 requests per hour per key. Partner Gateway returns X-RateLimit-* headers.

Get API access

Customers
  1. Log in to your client area
  2. Open API Keys
  3. Create a key and call /account/api/v1/…
Partners & resellers
  1. Join via Partners / reseller program
  2. Open the partner dashboard
  3. Create keys under Settings, then use /partner-gateway/api/v1/…

Need help integrating? Contact us or open a ticket.