Admin API SDKs
Busbar publishes typed client libraries for the admin API in three languages. Each is generated from the same openapi.json that documents the API reference, so the types always match the running server — no hand-written models to drift.
You point a client at the admin plane (:8081 by default, loopback), authenticate with an admin token, and every response is a typed object: .version is a string, .topology is a struct, keys/hooks/pools are typed all the way down.
| Language | Package | Install |
|---|---|---|
| Python | busbar-admin | pip install busbar-admin |
| TypeScript | @busbar/busbar-admin | npm install @busbar/busbar-admin @hey-api/client-fetch |
| Go | github.com/GetBusbar/busbar-go | go get github.com/GetBusbar/busbar-go |
All three authenticate with an x-admin-token: <token> header (the admin API also accepts Authorization: Bearer <token>). The examples below call GET /api/v1/admin/info and read the typed .version off the response — the same round-trip the SDKs’ CI runs against a live gateway.
Python
Section titled “Python”busbar-admin (import name busbar_admin) is generated with openapi-python-client. sync(), asyncio(), and their _detailed variants are all available.
from busbar_admin import AuthenticatedClientfrom busbar_admin.api.default import get_api_v1_admin_infofrom busbar_admin.models import InfoView
client = AuthenticatedClient( base_url="http://localhost:8081", token="YOUR_ADMIN_TOKEN", # send the credential as `x-admin-token: <token>` auth_header_name="x-admin-token", prefix="",)
with client as client: info: InfoView = get_api_v1_admin_info.sync(client=client) print("busbar version:", info.version) # -> "1.4.0" print("models:", info.topology.models)Prefer
Authorization: Bearer? Drop theauth_header_name/prefixoverrides — the defaultAuthenticatedClientsendsAuthorization: Bearer <token>, which the admin API also accepts.
TypeScript
Section titled “TypeScript”@busbar/busbar-admin is generated with @hey-api/openapi-ts and uses the @hey-api/client-fetch runtime (a peer install). It ships TypeScript source, so bundler/TS consumers resolve it directly.
import { createClient, createConfig } from "@hey-api/client-fetch";import { getApiV1AdminInfo } from "@busbar/busbar-admin";import type { InfoView } from "@busbar/busbar-admin";
const client = createClient(createConfig({ baseUrl: "http://localhost:8081", headers: { "x-admin-token": "YOUR_ADMIN_TOKEN" },}));
const { data, error } = await getApiV1AdminInfo({ client });if (error) throw error;
const info: InfoView = data; // fully typedconsole.log("busbar version:", info.version); // -> "1.4.0"console.log("models:", info.topology.models);busbar-go is generated with oapi-codegen. It requires Go 1.25+. Go modules publish via git tags — there is no registry token; go get fetches straight from the tagged repo.
package main
import ( "context" "fmt" "log" "net/http"
busbar "github.com/GetBusbar/busbar-go")
func main() { client, err := busbar.NewClientWithResponses( "http://localhost:8081", busbar.WithRequestEditorFn(func(_ context.Context, req *http.Request) error { req.Header.Set("x-admin-token", "YOUR_ADMIN_TOKEN") return nil }), ) if err != nil { log.Fatal(err) }
resp, err := client.GetApiV1AdminInfoWithResponse(context.Background()) if err != nil { log.Fatal(err) } if resp.JSON200 == nil { log.Fatalf("status %d: %s", resp.StatusCode(), resp.Body) }
info := resp.JSON200 // *InfoView, typed fmt.Println("busbar version:", info.Version) // -> "1.4.0" fmt.Println("models:", info.Topology.Models)}busbar-admin CLI
Section titled “busbar-admin CLI”Prefer a terminal to code? busbar-admin is a small Rust CLI that speaks the same admin API — the human-facing complement to the SDKs above. It reads BUSBAR_ENDPOINT / BUSBAR_ADMIN_TOKEN (or --endpoint / --token), with the same --insecure / --ca-cert / mTLS flags as the Terraform provider, and a --json mode for scripting.
cargo install --git https://github.com/GetBusbar/busbar-admin
busbar-admin info # version, uptime, topology, build modulesbusbar-admin keys create --budget-cents 5000 --rpm 60 # mint a virtual key (secret shown once)busbar-admin keys listbusbar-admin keys revoke <id>busbar-admin hooks listbusbar-admin config version # the running config_versionPoint it at a gateway with busbar-admin --endpoint http://localhost:8081 --token "$TOKEN" info. It’s #![forbid(unsafe_code)] and ships prebuilt macOS + Linux binaries on each tagged release.
How they stay in sync
Section titled “How they stay in sync”Each SDK repo commits the openapi.json it was generated from and, on every push/PR, regenerates the client and fails if the committed code drifts (git diff --exit-code). A release is cut by tagging vX.Y.Z, which publishes to the language registry (Python → PyPI, TypeScript → npm; Go is the tag itself). The SDKs carry their own semantic version, independent of the Busbar server version they target.
Because they’re generated, adding an admin endpoint to Busbar and regenerating is the whole cost of keeping all three current — there are no hand-maintained models.