Skip to content
PricingDocs
All Integrations
Rust

Device Intelligence for Rust

High-performance server-side verification with the Rust SDK. Add visitor identification, bot detection, and smart signals to your Rust application in minutes.

Quick Install

Add the SDK to your project with your preferred package manager.

npmnpm install tracio
yarnyarn add tracio
pnpmpnpm add tracio

Basic Usage

Get up and running with the minimal setup.

$rust
use tracio::Client;
#[tokio::main]
async fn main() {
let client = Client::new("your-secret-key");
let event = client.get_event(request_id).await.unwrap();
println!("Visitor: {}", event.visitor_id);
}

Advanced Patterns

Production-ready patterns with error handling, loading states, and advanced configuration.

Axum Middleware with Bot Detection — Click to expand
use axum::{extract::State, http::StatusCode, Json, Router};
use tracio::Client;
use serde_json::json;
async fn verify_visitor(
State(client): State<Client>,
Json(payload): Json<serde_json::Value>,
) -> Result<Json<serde_json::Value>, StatusCode> {
let request_id = payload["requestId"]
.as_str()
.ok_or(StatusCode::BAD_REQUEST)?;
let event = client
.get_event(request_id)
.await
.map_err(|_| StatusCode::BAD_GATEWAY)?;
if event.bot.result != "notDetected" {
return Err(StatusCode::FORBIDDEN);
}
Ok(Json(json!({
"visitorId": event.visitor_id,
"confidence": event.confidence,
})))
}
#[tokio::main]
async fn main() {
let client = Client::new("your-secret-key");
let app = Router::new()
.route("/verify", axum::routing::post(verify_visitor))
.with_state(client);
let listener = tokio::net::TcpListener::bind("0.0.0.0:3000")
.await.unwrap();
axum::serve(listener, app).await.unwrap();
}

Configuration Options

All available options for initializing and configuring the SDK.

apiKeystringYour API key from the dashboard
endpointstringCustom endpoint URL for proxy-routed deployments
regionstringData region (us, eu, ap)
timeoutnumberRequest timeout in milliseconds
extendedResultbooleanAdds bot detection, incognito mode flags, and smart signals
linkedIdstringCustom identifier to associate visits (e.g. user ID or session ID)