1
Create a key in the console
Open the Keenable console ↗ and create a key.Keys start with
keen_. Copy yours before you close the dialog.2
Set KEENABLE_API_KEY
This command puts the key in your shell’s environment, where the SDKs, the MCP server and the CLI look for it.The variable lasts for this terminal session. Add the line to your shell profile, or to your secrets manager, to keep it.
3
Re-run the same code
Run the code from the Quickstart again. Nothing else changes.With
KEENABLE_API_KEY set, the TypeScript, Python, Go and Rust SDKs send the key and call the keyed endpoints instead of the /public ones. Responses now report what each call cost in a usage object (see Balance and usage).Get a key from an agent or the CLI
An agent, a CLI or a CI job that can’t open the console gets a key through device login. The tool shows a person a link and a code, the person approves it in the console, and the tool receives a new API key. The person signs in to the console to approve, or creates a free account at app.keenable.ai/signup first. The Keenable CLI runs this flow for you:keenable configure-mcp. To get a key for the SDKs or raw HTTP from your own tool, run the same flow over HTTP. See Device login.
A person has to approve every device login. An agent that signs in with AgentID doesn’t need one: that sign-in creates the agent’s own organization, and the agent creates its own key with two calls. See Getting a key as an agent. An agent with neither path can still search and fetch keyless with the /public endpoints. It can’t use Monitors. It should stop, tell the person that a key is needed and share the approval link, not retry.
Pass the key over raw HTTP
Without an SDK, send the key in theX-API-Key header and drop /public from the path. The keyed endpoints need no X-Keenable-Title header.
This request runs the Quickstart search with your key:
usage object.
If your client only supports bearer tokens, send Authorization: Bearer keen_<your_key> instead. If you send both headers, the API uses X-API-Key.
Key lifetime and rotation
- Keys belong to your organization.
- Keys never expire on their own.
- You can rotate a key at any time in the console ↗. Create the new key, update
KEENABLE_API_KEYeverywhere it is set, then revoke the old one.
403. If the key isn’t in Keenable’s format, the API returns 401 with Malformed API key (see 401 Malformed key). If the key has the right format but Keenable has no key with that value, as with a typo, the API returns 401 with Invalid API key (see 401 Invalid key).
Related
- Authentication: the key for the MCP server and the CLI.
- Rate limits: keyed and keyless limits side by side.
- Errors: every status the API returns and how to fix it.