> ## Documentation Index
> Fetch the complete documentation index at: https://docs.topk.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Rust SDK

> Rust library for the TopK API

The `topk-rs` crate provides async Rust bindings for TopK API.

Source code is on [GitHub](https://github.com/topk-io/topk/tree/main/topk-rs).

## Installation

The crate is not published on crates.io yet. Depend on it from the TopK repository:

```toml theme={null}
[dependencies]
topk-rs = { git = "https://github.com/topk-io/topk.git", subdirectory = "sdk/topk-rs" }
```

Or use a `path` dependency if you have the SDK checked out locally.

## Prerequisites

* **API key** — sign in to [console.topk.io](https://console.topk.io) and generate an API key.
* **Region** — available regions are listed at [Regions](/regions).

## Usage

```rust theme={null}
use topk_rs::{Client, ClientConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = ClientConfig::new(
        std::env::var("TOPK_API_KEY").expect("TOPK_API_KEY"),
        std::env::var("TOPK_REGION").unwrap_or_else(|_| "aws-us-east-1-elastica".into()),
    );
    let client = Client::new(config);

    client.datasets().create("my-dataset").await?;

    Ok(())
}
```
