LOCALHOST
All pages
Tools

Partners

Act for clients, bulk tools and signed webhooks.

An approved partner runs every client from one account and one key: the clients' names, sites and wallets, the whole book at once, and webhooks that tell your own systems what happened. Partner prices apply to what you buy for clients; referred clients earn you a commission instead. The programme itself (tiers, applying, hand-off) is explained at https://localhost.co.zw/partners/.

Acting for a client

Add X-Client-Account: <client slug> to any call and it runs inside that client's account, with a key that has the clients permission. GET /resellers/clients lists your clients with their slugs; lh clients prints the same.

curl "$API/domains/" \
  -H "Authorization: Bearer $LH_API_KEY" \
  -H "X-Client-Account: mukoko-hardware"

lh --client mukoko-hardware register mukokohardware.com

Who pays. A client's wallet pays by default. Calls that register or renew names take pay_from: partner to pay from yours instead, at your partner price. POST /resellers/clients/{id}/fund moves money from your wallet to a client's.

Your own endpoints under /resellers/ always work on your account and refuse the header. Closing an account is the one thing never done for a client.

The book

GET /resellers/domains is every name across your clients, filterable by client and by expiring_within days; GET /resellers/sites every site, with POST /resellers/sites/{id}/{action} to start or stop one. POST /resellers/domains/bulk does one thing to many names and reports each success or failure on its own:

ActionDoes
renewRenew a year, paid by you or the client (pay_from).
auto_renew_on · auto_renew_offWhether each name renews by itself.
lock · unlockThe transfer lock.
nameserversPoint the names at the given nameservers.

From the terminal: lh book --expiring 30 and lh bulk renew mukoko.co.zw chidos.co.zw --pay-from client.

Prices and commissions

GET /resellers/prices shows what you pay against the list price for names and plans. GET /resellers/pricing and PUT /resellers/pricing turn your own prices to clients on, with a markup per group; turning them on needs agree: true once, because you present them as your own. GET /resellers/commissions lists what referrals and your margin have earned.

Webhooks

Up to 10 endpoints, each subscribed to the events it cares about; domain.* subscribes to a whole group. POST /resellers/webhooks answers with the signing secret once; POST /resellers/webhooks/{id}/rotate-secret makes a new one, …/test sends a ping now, …/deliveries shows every attempt and …/redeliver sends one again.

EventWhen
domain.createdA name was ordered or a move started
domain.registeredA name is registered and live
domain.transferredA name finished moving in
domain.renewedA name's expiry moved on
domain.expiredA name expired
domain.failedA registration or move was refused
domain.nameservers_changedThe registry confirmed new nameservers
site.state_changedA website started, stopped or failed
invoice.paidAn invoice was paid from a wallet
client.createdA client account was added
client.referredSomeone joined through the referral link
client.handed_offA client took over their account
commission.earnedA referral commission, or your margin on your own prices, was credited

A delivery

A JSON POST to your address with three headers of ours:

User-Agent: LOCALHOST-Webhooks/1
X-LH-Event: domain.registered
X-LH-Delivery: <unique id, the same on every retry>
X-LH-Signature: t=1731072000,v1=<hex HMAC-SHA256>

The signature is HMAC-SHA256 of "<t>." + raw body with your secret. Reject a t more than five minutes old, compare in constant time, and use X-LH-Delivery to ignore a repeat.

Checking it

import hmac, hashlib, time

def verify(secret, body: bytes, header: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(","))
    at = int(parts["t"])
    if abs(time.time() - at) > 300:
        return False
    mac = hmac.new(secret.encode(), f"{at}.".encode() + body, hashlib.sha256).hexdigest()
    return hmac.compare_digest(f"t={at},v1={mac}", header)

Answer with any 2xx quickly and do the work afterwards. Anything else is retried after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours; after 50 deliveries in a row have given up, the endpoint is switched off until you turn it back on.