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

# SDKs

> Install the 0xArchive SDK for Python, TypeScript, or Rust and make a first typed call to the Hyperliquid order book.

Call 0xArchive from Python, TypeScript, or Rust with typed requests, pagination, [WebSocket helpers](/sdks/websocket-usage), and [order-book reconstruction](/sdks/reconstruction). All three SDKs are open source; these pages match version `1.12.0`.

Set your key once. Each example below reads it from the environment:

```bash theme={"theme":"github-dark"}
export OXARCHIVE_API_KEY="0xa_your_api_key"
```

<Tabs>
  <Tab title="Python">
    Python 3.9 or later:

    ```bash theme={"theme":"github-dark"}
    pip install oxarchive==1.12.0
    ```

    ```python first_call.py theme={"theme":"github-dark"}
    from oxarchive import Client

    client = Client()  # reads OXARCHIVE_API_KEY
    book = client.hyperliquid.orderbook.get("BTC", depth=1)
    print(book.coin, book.mid_price)
    ```

    ```bash theme={"theme":"github-dark"}
    python first_call.py
    ```

    For live streams and replay, install `pip install 'oxarchive[websocket]==1.12.0'`. Source: [0xArchiveIO/sdk-python](https://github.com/0xArchiveIO/sdk-python).
  </Tab>

  <Tab title="TypeScript">
    Node.js 18 or later. The example uses top-level `await`, so the project is an ES module:

    ```bash theme={"theme":"github-dark"}
    mkdir oxarchive-first-call && cd oxarchive-first-call
    npm init -y
    npm pkg set type=module
    npm install --save-exact @0xarchive/sdk@1.12.0
    ```

    ```typescript first-call.ts theme={"theme":"github-dark"}
    import { OxArchive } from "@0xarchive/sdk";

    const client = new OxArchive({ apiKey: process.env.OXARCHIVE_API_KEY! });
    const book = await client.hyperliquid.orderbook.get("BTC", { depth: 1 });
    console.log(book.coin, book.midPrice);
    ```

    ```bash theme={"theme":"github-dark"}
    npx tsx first-call.ts
    ```

    Responses use camelCase field names. Source: [0xArchiveIO/sdk-typescript](https://github.com/0xArchiveIO/sdk-typescript).
  </Tab>

  <Tab title="Rust">
    ```bash theme={"theme":"github-dark"}
    cargo new oxarchive-first-call && cd oxarchive-first-call
    cargo add oxarchive@=1.12.0
    cargo add tokio --features rt-multi-thread,macros
    ```

    Replace `src/main.rs` with:

    ```rust src/main.rs theme={"theme":"github-dark"}
    use oxarchive::resources::orderbook::GetOrderBookParams;
    use oxarchive::OxArchive;

    #[tokio::main]
    async fn main() -> oxarchive::Result<()> {
        let client = OxArchive::from_env()?; // reads OXARCHIVE_API_KEY
        let params = GetOrderBookParams { depth: Some(1), ..Default::default() };
        let book = client.hyperliquid.orderbook.get("BTC", Some(params)).await?;
        println!("{} {}", book.coin, book.mid_price.unwrap_or_default());
        Ok(())
    }
    ```

    ```bash theme={"theme":"github-dark"}
    cargo run
    ```

    For live streams and replay, enable the `websocket` feature: `cargo add oxarchive@=1.12.0 --features websocket`. Source: [0xArchiveIO/sdk-rust](https://github.com/0xArchiveIO/sdk-rust).
  </Tab>
</Tabs>

A successful run prints `BTC` and the current mid price, such as `BTC 85726.5`. A missing or invalid key fails with a `401` error instead. [Installation](/sdks/installation) covers the WebSocket extras and pinned installs.

## Venue clients

Each venue has its own client, so your code always names the market it reads:

* Hyperliquid perpetuals: `client.hyperliquid`, with HIP-3 under `client.hyperliquid.hip3` and HIP-4 under `client.hyperliquid.hip4`.
* Hyperliquid Spot: `client.spot` in Python and TypeScript, and `client.hyperliquid.spot` in Rust.
* Lighter: `client.lighter`. Lighter on Robinhood Chain: `client.rh_lighter` in Python and Rust, and `client.rhLighter` in TypeScript.

For another language, call the [REST API](/rest-api) directly or generate a client from [OpenAPI](/openapi).

## Errors

A failed request raises `OxArchiveError` in Python and TypeScript, and returns `Error::Api` in Rust. Each carries the HTTP status, a stable `error_code` to branch on, and the `request_id` to quote to support. The SDKs send API version `2026-10-01`, so a few codes are newer names than raw REST returns by default: a window older than your plan's history is `historical_depth_exceeded` rather than `history_window_exceeded`. [Errors](/errors) lists every code.

## Next step

<Card title="REST usage" icon="square-terminal" href="/sdks/rest-usage">
  Request options, pagination, response handling, and the full namespace map for each SDK.
</Card>


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.