Skip to main content
The Keenable Rust SDK gives your code web search, page fetch and Monitors. This page covers version 0.2.0, the version in the SDK repository. The latest release on crates.io is 0.1.0 (checked 2026-11-19), so the parts marked with a newer “Needs SDK” version aren’t in the package you install yet. For the other languages, see TypeScript, Python and Go. For what all four SDKs share, see SDKs.

Install

Install the package. The SDK needs Rust 1.80 or newer:
The SDK is async: the samples also need cargo add tokio --features macros,rt-multi-thread. TLS goes through rustls by default, so no system library is needed. To use the platform’s TLS library, turn off default features and turn on native-tls. To see which version you have, run cargo tree -p keenable --depth 0.

Authenticate

Search and fetch work without an API key. An API key raises your rate limit, and Monitors needs one. Set KEENABLE_API_KEY and create the client with Client::new(), which reads the variable. To pass the key in code, use Client::with_options(Options { api_key: Some(key), ..Default::default() }). api_key: None reads KEENABLE_API_KEY. Some(String::new()) forces the keyless endpoints even when the variable is set. The constructor takes these settings: SearchOptions and FetchOptions carry a request: RequestOptions field that sets timeout, max_retries and headers for one call. For Monitors, client.monitors().with_request(RequestOptions { .. }) does the same. Needs SDK 0.2.0 or later: client.monitors().with_request. This program runs one keyless search and prints the top 3 results as a citable block:
main.rs
Save it as src/main.rs and run cargo run. You see one [n] Title (url) header per result, followed by the page text. Search options are fields on keenable::SearchOptions: exclude_domains, published_after, published_before, acquired_after, acquired_before, snippet_max_length, max_results, query_time, objective, disable_cards, site and mode. Fill the ones you need and end with ..Default::default(). Each one is described under Search parameters. To change how much text the citable block holds, see Context size.

Fetch

This program fetches one page without a key and prints its title and the first 300 characters of its markdown:
main.rs
Pass the fetch options through fetch_with and the max_chars, live and prompt fields of keenable::FetchOptions. Each one is described under Fetch parameters.

Monitors

Needs SDK 0.2.0 or later. The latest release on crates.io is 0.1.0. Until a newer release is out, call the Monitors API over HTTP. A monitor watches the web for a topic and keeps every new page that matches. The Monitors API is under client.monitors(). It needs an API key: without one, a call fails with the SDK’s authentication error and sends no request. This program creates a monitor with a webhook, then prints its ID, status and webhook signing secret:
main.rs
Set KEENABLE_API_KEY before you run it. Keep the secret: the API returns it only here and in an update that adds the first webhook, and you need it to verify each delivery. Store it where your webhook handler can read it, and keep it out of logs. list_all returns a MonitorPager. In MonitorUpdateParams, Some(None) removes the name, schedule, webhook, output schema or metadata. create always sends an Idempotency-Key, so the SDK can retry it without creating a second monitor. For queries, schedules and result fields, see Monitors.

Verify webhooks

Needs SDK 0.2.0 or later. The latest release on crates.io is 0.1.0. Until a newer release is out, verify the signature without the SDK, as Verify a webhook describes. Check each webhook delivery’s signature before you act on it. Call keenable::verify_webhook(payload, &headers, secret), in crate keenable. It needs no client and no API key. Pass the raw body as &[u8] and the headers as a keenable::reqwest::header::HeaderMap. Answer a failed check with 400 and don’t act on the delivery. Drop repeated deliveries by the event’s ID, which stays the same across retries. For a complete handler, see Verify a webhook.

Errors

The Rust SDK returns typed errors. Before an error reaches your code, the SDK retries the request, by default up to 2 times, when the Retryable column says yes. If the API’s error body sets retryable, that value decides instead of the status code. The Monitors update, trigger and bulk calls are retried only on a 429, which the API sends before it changes anything, because repeating them after another error could apply the change twice. For what each status code means and how to fix it, see Errors. err.api_error() returns the ApiError behind Auth, RateLimit, InsufficientCredits and Api, so one branch reads every non-2xx response. An API error carries what the API said about the failure: status_code, code, error_type, fix, retryable, retry_after, request_id, param, value and reason. Branch on the code, not on the message. This program sends a search that the API rejects with 400 and prints what the error carries:
main.rs
You see the status, the code, the rejected parameter and value, and the fix:
Output

Async

The Rust client is async only. search, fetch, run_tool_call and every Monitors method are async fns, so you .await them inside a Tokio runtime, such as a #[tokio::main] function. Add Tokio with the macros and rt-multi-thread features, as in Install. verify_webhook is a plain function and needs no runtime.

Notes

  • To give a model web search as a tool, pass keenable::tools() to your chat completions client and run each call with client.run_tool_call(name, arguments).await. See Tool calling.
  • The crate re-exports reqwest, so you can build a HeaderMap or a ClientBuilder without adding it yourself.
  • Monitors and webhook verification arrived in version 0.2.0. To see what the version you installed includes, read the Rust changelog.
  • Source and package: README, crates.io.