Hub Gateway API
Authentication
How Homei Hub authenticates against the /api/hub/* gateway.
Every request to the Hub Gateway must present the shared service key in the
x-hub-api-key header. It is matched against the HUB_API_KEY environment
variable using a constant-time comparison.
Header parameters
| Parameter | Data Type | Required | Description |
|---|---|---|---|
x-hub-api-key | string | true | The shared Hub service key (HUB_API_KEY). |
Content-Type | string | true for POST | application/json. |
Two layers of access control
- Service key — the
x-hub-api-keyheader authenticates the Hub service as a whole, not an individual distributor. - Per-distributor — endpoints take a
hubCustomerId(in the body or query), and product-level access is enforced against thehub_product_authorizationtable. A distributor may only order products it has been authorized for.
Provider credentials (GigaCloud / Doba / LingXing) never leave B2B.
Example request
curl https://<your-b2b-host>/api/hub/products \
-H "x-hub-api-key: $HUB_API_KEY"Failure responses
| Status | Body | When |
|---|---|---|
503 | { "error": "Hub gateway not configured" } | HUB_API_KEY is not set on the server. |
401 | { "error": "Unauthorized" } | Missing or incorrect x-hub-api-key. |
Configuration
| Env var | Purpose | Default |
|---|---|---|
HUB_API_KEY | Shared gateway service key (required to enable /api/hub/*). | — |
HUB_DELIVERY_FEE_FLAT_CENTS | Flat delivery fee for the quote endpoint. | 1500 |