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

# Getting Started with Neynar Rust SDK

> Easily call Neynar APIs with our Rust SDK

<Info>
  This tutorial uses the [Neynar Rust SDK](https://github.com/neynarxyz/rust-sdk)
</Info>

<Warning>
  This SDK is in **beta** and may change in the future.
  Please let us know if you encounter any issues or have suggestions for improvement.
</Warning>

## Prerequisites

* Install [Rust](https://www.rust-lang.org/tools/install) (using [rustup](https://rustup.rs/))
* Get your Neynar API key from [neynar.com](https://neynar.com)

## Project Setup

**Initialize Project Directory**

<CodeGroup>
  ```bash Shell theme={"system"}
  cargo new get-started-with-neynar-sdk
  cd get-started-with-neynar-sdk
  ```
</CodeGroup>

**Add Neynar SDK as a dependency**

<CodeGroup>
  ```bash Shell theme={"system"}
  cargo add --git https://github.com/neynarxyz/rust-sdk api
  ```
</CodeGroup>

## Implementation: Look up a user by their verified address

Replace the contents of `src/main.rs` with the following code:

<CodeGroup>
  ```rust src/main.rs theme={"system"}
    use neynar_sdk::apis::configuration as api_config;
    use neynar_sdk::apis::configuration::Configuration as ApiConfig;
    use neynar_sdk::apis::user_api::{
        FetchBulkUsersByEthOrSolAddressParams, fetch_bulk_users_by_eth_or_sol_address,
    };
    use neynar_sdk::models::BulkUserAddressType::VerifiedAddress;
    use reqwest::Client;

  #[tokio::main]
  async fn main() -> {
    let configuration = ApiConfig {
        base_path: "https://api.neynar.com/v2".to_string(),
        client: Client::builder().connection_verbose(true).build().unwrap(),
        user_agent: Some("rust-sdk-demo".to_string()),
        api_key: Some(api_config::ApiKey {
            prefix: None,
            key: "NEYNAR_API_DOCS".to_string(),
        }),
        basic_auth: None,
        bearer_access_token: None,
        oauth_access_token: None,
    };

    let addresses = "0xBFc7CAE0Fad9B346270Ae8fde24827D2D779eF07".to_string();
    let params = FetchBulkUsersByEthOrSolAddressParams {
        addresses,
        address_types: Some(vec![VerifiedAddress]),
        viewer_fid: None,
        x_neynar_experimental: None,
    };

    let result = fetch_bulk_users_by_eth_or_sol_address(&configuration, params).await;

    match result {
        Ok(response) => {
            println!("Users: {:?}", response.additional_properties);
        }
        Err(err) => {
            eprintln!("Failed to fetch users: {:?}", err);
            panic!("User fetch failed");
        }
    }
  }
  ```
</CodeGroup>

## Running the project

<CodeGroup>
  ```bash Shell theme={"system"}
  cargo run
  ```
</CodeGroup>

## Result

You should see a response similar to this (formatted for readability):

<CodeGroup>
  ```json Shell theme={"system"}
  Users [{
      fid: 20603,
      username: "topocount.eth",
      display_name: "Topocount",
      // ...other fields...
  }]
  ```
</CodeGroup>

## Congratulations! You successfully set up the [Neynar Rust SDK](https://github.com/neynarxyz/rust-sdk) and used it to look up a user by their address!

<Info>
  ### Ready to start building?

  Get your subscription at [neynar.com](https://neynar.com) and reach out to us on [Slack](https://neynar.com/slack) with any questions!
</Info>
