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

# Rust SDK

> Build a NodeMaven proxy configuration in Rust and send your first request with reqwest.

Install the Rust SDK and send your first request with `reqwest`.

The `nodemaven` crate builds validated proxy configurations for Rust. Use the resulting URL with your HTTP client, or get separate authentication fields for a browser driver. The crate also includes a synchronous account API client.

## Before you start

You need Rust 1.85 or newer, an active Residential/Mobile plan with available traffic, and your proxy credentials. This quickstart uses SDK version **0.2.2** and the blocking `reqwest` client.

## 1. Create a project

```bash theme={null}
cargo new nodemaven-quickstart
cd nodemaven-quickstart
cargo add nodemaven@0.2.2
cargo add reqwest@0.12 --no-default-features --features blocking,rustls-tls
```

The `blocking` feature lets this example run without an async runtime. The `rustls-tls` feature enables HTTPS requests.

The SDK's built-in account API transport is enabled by default. If you only build proxy configurations, you can disable default features for the `nodemaven` dependency. An account API client then needs a transport supplied by your application.

## 2. Set your proxy credentials

In the [NodeMaven dashboard](https://dashboard.nodemaven.com), open **Rotating Residential Proxy → Authenticated** and find your credentials under **Proxy generator**.

![Proxy Setup 2](https://mintcdn.com/node-maven/l_oWfdd8xhVH5Vk9/images/proxy-setup-2.png?fit=max\&auto=format\&n=l_oWfdd8xhVH5Vk9\&q=85\&s=fd8b67bedb3bde4fb1e32461dd8b03ba)

Use the base username for your main user or sub-user, without generated parameters such as `-country-us`. The SDK adds the parameters you set in code. Your dashboard sign-in credentials will not authenticate a proxy.

On macOS or Linux:

```bash theme={null}
export NODEMAVEN_LOGIN='YOUR_PROXY_USERNAME'
export NODEMAVEN_PASSWORD='YOUR_PROXY_PASSWORD'
```

On Windows PowerShell:

```powershell theme={null}
$env:NODEMAVEN_LOGIN = 'YOUR_PROXY_USERNAME'
$env:NODEMAVEN_PASSWORD = 'YOUR_PROXY_PASSWORD'
```

Run the program from this terminal so it inherits the variables. The SDK does not load `.env` files automatically.

## 3. Send your first request

Replace `src/main.rs` with:

```rust theme={null}
use std::net::IpAddr;
use std::time::Duration;

use nodemaven::Proxy;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let proxy = Proxy::builder()
        .param("country", "us")
        .param("filter", "medium")
        .build()?;

    let client = reqwest::blocking::Client::builder()
        .proxy(reqwest::Proxy::all(proxy.url())?)
        .timeout(Duration::from_secs(30))
        .build()?;

    let body = client
        .get("https://api.ipify.org")
        .send()?
        .error_for_status()?
        .text()?;
    let exit_ip: IpAddr = body.trim().parse()?;
    println!("Proxy exit IP: {exit_ip}");
    Ok(())
}
```

Run it:

```bash theme={null}
cargo run
```

The output contains the proxy's public exit IP. For example:

```text theme={null}
Proxy exit IP: 203.0.113.42
```

This is illustrative output. Your IP will be different, and the request uses proxy traffic.

The builder reads your proxy credentials from the environment. `filter="medium"` corresponds to the dashboard's **Quality** mode. Building the object alone makes no network request.

## Use the proxy with an async client

`proxy.url()` also works with `reqwest::Client`. Your application supplies the async runtime and HTTP client. Keep connection-check and account API calls in mind: those SDK methods are synchronous, so move them off the async executor's worker threads when necessary.

## Configure a browser driver

Use `proxy.browser()` to retrieve a `BrowserProxy` with separate `server`, `username`, and `password` fields:

```rust theme={null}
let browser_proxy = proxy.browser();
```

Map those fields to the authentication options required by your driver. The SDK does not launch a browser or manage its lifecycle. Browser libraries differ in how they accept proxy authentication, so use the driver's own documentation for that step.

## Choose the right output

| SDK output | What it returns |
| - | - |
| `proxy.url()` | An HTTP proxy URL with percent-encoded credentials |
| `proxy.browser()` | Separate, unencoded browser proxy fields |
| `proxy.username()` | The generated username, including parameters |
| `proxy.server()` | `host:port` without credentials |

Do not encode credentials returned by `browser()` again. Do not log the authenticated URL or password field.

## Next steps

* [Configure location, pool, and filters](https://docs.nodemaven.com/developer-sdks/configuration.md)
* [Manage sticky sessions and worker identities](https://docs.nodemaven.com/developer-sdks/sessions.md)
* [Check a connection and handle typed errors](https://docs.nodemaven.com/developer-sdks/connection-checks.md)
* [Call the account API](https://docs.nodemaven.com/developer-sdks/account-api.md)

Full method reference: [docs.rs](https://docs.rs/nodemaven/0.2.2/nodemaven/). Source and issues: [nodemaven-rust](https://github.com/nodemaven/nodemaven-rust).


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