Home / Developers / API documentation

API documentation

Manage domains, hosting, billing, and support — plus Partner Gateway provisioning. Copy-paste examples below. Paid actions charge account balance or partner wallet automatically.

Base URL

All Account API requests use HTTPS and JSON. Production base:

https://www.bavinhost.com/account/api/v1/

Partner Gateway base:

https://www.bavinhost.com/partner-gateway/api/v1/

Authentication

Create an API key in Client area → API Keys. Send it on every request using either:

X-API-Key: YOUR_API_KEY
Authorization: Bearer YOUR_API_KEY

API key only — you do not send the API secret on requests. The secret is shown once when you create a key (for your records). Query string ?api_key= also works, but headers are preferred. No browser login session is required for API calls.

Charging rules

Read-only endpoints never charge. Paid actions debit account balance (Account API) or partner wallet (Partner Gateway) before work runs. If provision/register fails after debit, the amount is refunded automatically.

  • Charges balance: POST /domains, POST /domains/{id}/renew, POST /hosting, POST /hosting/{id}/renew
  • No charge: list/get, support tickets, profile updates, nameservers, suspend/unsuspend, auto-renew toggles
  • Insufficient funds: HTTP 402 with message Insufficient account balance

Endpoint map

Account API routes under https://www.bavinhost.com/account/api/v1/. Items marked Bill charge balance.

GET/domainsCore
GET/domains/{id}Core
POST/domainsBill
POST/domains/{id}/renewBill
POST/domains/{id}/auto-renewCore
PUT/domains/{id}Core
GET/hostingCore
GET/hosting/{id}Core
POST/hostingBill
POST/hosting/{id}/renewBill
PUT/hosting/{id}Core
GET/ordersCore
GET/orders/{id}Core
GET/accountCore
PUT/accountCore
GET/supportCore
POST/supportCore
GET/billing/balanceCore
GET/billing/transactionsCore

Domains Live

POST https://www.bavinhost.com/account/api/v1/domains Charges

Body:

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

Renew:

POST https://www.bavinhost.com/account/api/v1/domains/{id}/renew

{ "years": 1 }

Auto-renew toggle (no charge):

{ "enabled": true }

Hosting Live

POST https://www.bavinhost.com/account/api/v1/hosting Charges

{
  "domain": "example.com",
  "package": "starter",
  "username": "exuser",
  "password": "strong-password",
  "years": 1
}

Renew:

POST https://www.bavinhost.com/account/api/v1/hosting/{id}/renew

{ "years": 1 }

Suspend / unsuspend with PUT /hosting/{id} and body {"status":"suspended"} or {"status":"active"}.

Billing

GET https://www.bavinhost.com/account/api/v1/billing/balance

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

Also available: GET /billing/transactions.

Support

POST https://www.bavinhost.com/account/api/v1/support

{
  "title": "Issue title",
  "description": "Help needed",
  "department": "IT"
}

Partner Gateway Live

For resellers and agencies. Auth headers:

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

Wallet is required for provisioning, domain register/transfer, and renewals.

Partner sites

GET/sitesCore
POST/sitesBill
POST/sites/{id}/renewBill
POST/sites/{id}/auto-renewCore
POST/sites/{id}/suspendCore

Partner domains

GET/domainsCore
POST/domainsBill
POST/domains/{id}/renewBill
POST/domains/{id}/auto-renewCore

Quick start & code examples

Replace YOUR_API_KEY with a real key from API Keys.

Check balance (cURL)

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

Renew a domain (cURL)

curl -X POST "https://www.bavinhost.com/account/api/v1/domains/DOM_SECRET_ID/renew" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: YOUR_API_KEY" \
  -d '{"years":1}'

Purchase hosting (PHP)

$ch = curl_init('https://www.bavinhost.com/account/api/v1/hosting');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'X-API-Key: YOUR_API_KEY',
    ],
    CURLOPT_POSTFIELDS => json_encode([
        'domain' => 'example.com',
        'package' => 'starter',
        'username' => 'exuser',
        'password' => 'strong-password',
        'years' => 1,
    ]),
    CURLOPT_RETURNTRANSFER => true,
]);
$response = json_decode(curl_exec($ch), true);

Register domain (JavaScript)

const res = await fetch('https://www.bavinhost.com/account/api/v1/domains', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-API-Key': 'YOUR_API_KEY',
  },
  body: JSON.stringify({
    domain: 'example.com',
    years: 1,
    contacts: {}
  }),
});
const data = await res.json();

List domains (Python)

import requests

r = requests.get(
    'https://www.bavinhost.com/account/api/v1/domains',
    headers={'X-API-Key': 'YOUR_API_KEY'},
    timeout=30,
)
print(r.status_code, r.json())

Success response shape

{
  "success": true,
  "message": "Hosting account created successfully",
  "timestamp": "2026-08-14T19:00:00+00:00",
  "code": 200,
  "data": {
    "secretid": "HOST_...",
    "domain": "example.com",
    "amount_charged": 48.00,
    "currency": "USD",
    "balance": 152.00,
    "new_expiry": "2027-08-14 19:00:00"
  }
}

HTTP status codes

  • 200 — Success
  • 401 — Missing/invalid API key
  • 402 — Insufficient account balance / wallet
  • 404 — Resource not found
  • 405 — Method not allowed
  • 429 — Rate limit (default 100 req/hour per key)
  • 500 — Server / provider error (purchase refunds if already charged)

Get API access

  1. Log in to your client area
  2. Open API Keys and create a key
  3. Fund account balance before purchase/renew calls
  4. Call https://www.bavinhost.com/account/api/v1/… with your key

Partners: use the partner dashboard for keys and wallet. Need help? Contact us.