@keenable/client
v0.1.1
Published
Official TypeScript client for the Keenable API
Readme
@keenable/client
Official TypeScript client for the Keenable API.
Requires Node.js 18+ (native fetch).
Install
npm install @keenable/clientQuick start
import { KeenableClient } from "@keenable/client";
// API key: constructor arg → KEENABLE_API_KEY env var → public mode
const client = new KeenableClient({ apiKey: "your-api-key" });
// Or let it read from the environment / run in public mode
const client = new KeenableClient();
const results = await client.search({ query: "rust async", mode: "pro" });
console.log(results.results[0]?.title);
const page = await client.fetch({ url: results.results[0]!.url });
console.log(page.content.slice(0, 200));
const me = await client.getUser(); // requires API key
console.log(me.email);Authentication
The API key is resolved in order:
apiKeyconstructor optionKEENABLE_API_KEYenvironment variable- Public mode —
search,fetch, andfeedbackuse public endpoints with reduced rate limits.getUser()throwsKeenableApiError. A warning is logged to console.
API
| Method | Description |
|--------|-------------|
| search(params) | Web search (SearchRequest → SearchResponse) |
| fetch({ url }) | Fetch page content as markdown |
| feedback(params) | Submit search feedback |
| getUser() | Get API key identity (requires API key) |
Types (SearchRequest, SearchMode, FetchResponse, …) are exported from the package for autocomplete and validation.
Errors
Failed requests throw KeenableApiError with status and parsed ApiError body.
