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

# SDKs

> Use S2 SDKs for TypeScript, Python, Go, and Rust to create clients, work with basins and streams, and access higher-level APIs.

S2 provides SDKs across several languages to simplify working with our core APIs.

While the [REST API](/api) can be used directly from any HTTP client, the SDKs provide higher-level abstractions (like the [Producer API](/sdk/appending#producer)), retry and error handling logic, rich types, and more performant streaming sessions.

## SDKs

| Language   | Repo                                                                     | Docs                                                                      | API  |
| ---------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------- | ---- |
| TypeScript | [s2-sdk-typescript](https://github.com/s2-streamstore/s2-sdk-typescript) | [typedoc](https://s2-streamstore.github.io/s2-sdk-typescript/index.html)  | `v1` |
| Python     | [s2-sdk-python](https://github.com/s2-streamstore/s2-sdk-python)         | [readthedocs](https://s2-sdk.readthedocs.io/en/stable/api-reference.html) | `v1` |
| Go         | [s2-sdk-go](https://github.com/s2-streamstore/s2-sdk-go)                 | [pkg.go.dev](https://pkg.go.dev/github.com/s2-streamstore/s2-sdk-go/s2)   | `v1` |
| Rust       | [s2/sdk](https://github.com/s2-streamstore/s2/tree/main/sdk)             | [docs.rs](https://docs.rs/s2-sdk/latest/s2_sdk/)                          | `v1` |

Each repository also contains a variety of examples to demonstrate some common use cases.

## Getting Started

Every SDK follows the same pattern: create a client with an [access token](/concepts/access-tokens), then navigate to basins and streams hierarchically.

Every SDK operation has a simple single-request form. [Appends](/sdk/appending) and [reads](/sdk/reading) also support sessions, which keep a connection open for pipelined writes or streaming records.

<Tabs>
  <Tab title="TypeScript">
    ```typescript theme={null}
    import { S2 } from "@s2-dev/streamstore";

    const client = new S2({
    	accessToken: process.env.S2_ACCESS_TOKEN!,
    });

    const basin = client.basin("my-basin");
    const stream = basin.stream("my-stream");
    ```
  </Tab>

  <Tab title="Python">
    ```python theme={null}
    import os

    from s2_sdk import S2

    client = S2(os.environ["S2_ACCESS_TOKEN"])

    basin = client.basin("my-basin")
    stream = basin.stream("my-stream")
    ```
  </Tab>

  <Tab title="Go">
    ```go theme={null}
    package main

    import (
    	"os"

    	"github.com/s2-streamstore/s2-sdk-go/s2"
    )

    func main() {
    	client := s2.New(os.Getenv("S2_ACCESS_TOKEN"), nil)

    	basin := client.Basin("my-basin")
    	_ = basin.Stream("my-stream")
    }
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    use s2_sdk::{S2, types::S2Config};

    let client = S2::new(S2Config::new(std::env::var("S2_ACCESS_TOKEN")?))?;

    let basin = client.basin("my-basin".parse()?);
    let stream = basin.stream("my-stream".parse()?);
    ```
  </Tab>
</Tabs>

From here, operations fall into two categories: [basin](/sdk/basin-resources) and [stream](/sdk/stream-resources) operations for managing resources, and [appending](/sdk/appending) and [reading](/sdk/reading) for working with records. See [endpoints](/sdk/endpoints) and [retries + timeouts](/sdk/retries-timeouts) for configuration details.
