@honeyhive/control-plane-sdk is a type-safe TypeScript client for the HoneyHive Control Plane REST API. It provides a one-to-one mapping of methods to API endpoints, organized into namespaces: client.projects, client.alerts.
It is the control-plane sibling of the TypeScript API SDK (@honeyhive/api-client, the data plane SDK). Use this client for control-plane resources (projects and alerts), and the data plane SDK for trace, event, dataset, and evaluation work.
Built on openapi-fetch, the client handles response parsing, query serialization, and error handling automatically. All request and response types are generated from the OpenAPI specification, so your editor provides full autocompletion and type checking for every API call.
Installation
Quick start
Create a project in a workspace, rename it, and archive it when finished:project_creator grants the project-creator membership to the named user, who must already be a member of the workspace. Omit it and the project is created with no memberships, leaving it reachable only by users whose access is inherited (an org admin, for instance) or granted through an SSO group claim. That is the intended path for organizations that manage access that way, so omitting the field is a legitimate choice rather than an oversight. The field is only accepted on API-key-authenticated requests like the one above; a user-initiated create always makes the calling user the creator and rejects the field with a 400.Example: Reading alerts
Authorization
The HoneyHive Control Plane API authenticates requests using an API key sent as a Bearer token in theAuthorization header.
Which keys work
The control plane accepts only fine-grained control-plane API keys, whose values start withhh_fgcp_. Create one in the HoneyHive app under an organization’s or a workspace’s Settings → Fine-grained API keys, choosing the scope it roots at and the permissions it carries.
Coarse-grained project keys (a full project key, hh_, or a read-only project key, hh_ro_) are not accepted by any operation this SDK exposes. The client sends whatever key it is given, so supplying one surfaces as a 401 from the control plane on your first request rather than an error at construction.
Data plane keys belong to the TypeScript API SDK, which reads
HH_PROJECT_API_KEY. That is a separate variable, so both clients can be configured in the same process without collision.Environment variable (recommended)
Set theHH_CONTROL_PLANE_API_KEY environment variable. The client reads it automatically when no apiKey option is provided:
apiKey option
Prefer the environment variable above. Reach for this option only when the environment variable can’t carry the key, for example when one process talks to several control planes, or the key arrives from a secret manager at startup.Never hard-code the key or commit it to source control. Always read it from a secret store or environment variable.
Custom middleware
For advanced scenarios (rotating keys, fetching tokens at request time), supply custom middleware that sets theAuthorization header on each request. Middleware runs after the initial headers are set, so it will override any API key provided via apiKey or HH_CONTROL_PLANE_API_KEY.
When middleware is supplied, no API key is required, because the middleware is assumed to handle authentication. If both are provided, the API key sets the initial header and the middleware can override it per-request. A client that authenticates entirely through middleware should simply pass no key.
The required header format is Authorization: Bearer <api-key>.
Middleware interface.
Control plane URL
By default the client talks tohttps://api.cp.us.honeyhive.ai (HoneyHive’s managed control plane). To point at a self-hosted or per-customer deployment, set the HH_CONTROL_PLANE_URL environment variable or pass controlPlaneUrl:
This is deliberately not the URL the HoneyHive web app talks to. The app authenticates with a session cookie rather than an API key, so its endpoint is not usable by this client.
Verbose logging
Setverbose: true (or the HH_VERBOSE environment variable to true) to log the resolved control plane URL, a masked API key, and the SDK package + version when the client is constructed. Useful for confirming which environment and credential the client is configured with.
console.error (stderr in Node, devtools in the browser) and only fires once per client construction. An explicit verbose: false overrides HH_VERBOSE.
The masked key shows the key’s id and none of its secret, which makes it identical to the masked key value shown for that key in the app, so a log line can be matched directly to a key. Any value that isn’t a well-formed fine-grained key is replaced entirely with asterisks rather than partially echoed, and (none) is logged when no key resolved.
