Management API
Everything in the dashboard is also available over REST at https://webknx.com/api/v1. Both use the same rules, validation and permissions.
Authentication
Authenticate with an API key secret (hx_sk_…), sent as a bearer token. Create a key in Dashboard → API keys and give it a role with the management permissions it needs.
curl https://webknx.com/api/v1/workspace \
-H "Authorization: Bearer $WEBKNX_SECRET_KEY"
The key acts on its own:
- Workspace: every call applies to the workspace the key belongs to. To manage another workspace, use a key from that workspace.
- Permissions: the key can do exactly what its role allows. A call outside the role returns
403 forbidden. For example, the default Developer role can manage API keys and read usage, but cannot invite members or change billing. - Grants: like a person, a key can only grant what its role holds. It cannot create a key, assign a role or edit a role with permissions its own role lacks.
- Restrictions: the key's referrer restrictions apply to management calls too. Service restrictions only limit which service APIs the key can call.
Unknown, expired and revoked keys, and keys of a suspended or deleted workspace, return 401 unauthorized. During a rotation overlap both the old and new secret work.
Actions taken through the API are recorded in the workspace audit log under the API key's name.
A key with management permissions can change your workspace. Keep it on a server, give it the narrowest role that works, and use separate keys for automation and for calling services.
Conventions
- Successful responses:
{"data": ..., "meta": {"request_id": "..."}}. - Lists are paginated with
?page=and?per_page=(max 100);meta.paginationhas the totals. - Errors follow the error format. Resources outside your workspace return
404. - Billing mutations accept an
Idempotency-Keyheader; repeating a request with the same key returns the original result.
Endpoints
| Area | Endpoints |
|---|---|
| Workspace | GET/PATCH /workspace |
| Team | GET /members, GET/POST /members/invitations, POST /members/invitations/{id}/resend, DELETE /members/invitations/{id}, PATCH/DELETE /members/{id} |
| Roles | GET/POST /roles, GET/PATCH/DELETE /roles/{id}, PUT /roles/{id}/permissions, GET /permissions |
| API keys | GET/POST /api-keys, GET/PATCH /api-keys/{id}, POST /api-keys/{id}/rotate, POST /api-keys/{id}/revoke |
| Billing | GET /billing/balance, GET /billing/plans, GET /billing/subscription, POST /billing/checkout, POST /billing/subscription/change, POST /billing/subscription/cancel, POST /billing/credits/purchase, GET /billing/transactions |
| Usage | GET /usage, GET /usage/{request_id} |
| Invoices | GET /invoices, GET /invoices/{id}, GET /invoices/{id}/download |
| Services | GET /services, GET /services/{slug}, GET /services/{slug}/operations, GET /services/{slug}/openapi, GET /services/{slug}/pricing |
Deleting a workspace and transferring ownership are only available to the owner in the dashboard.
The full contract is in the management OpenAPI document.