# Verifex Rust SDK
[](https://crates.io/crates/verifex)
[](https://docs.rs/verifex)
[](LICENSE)
Official Rust client for the [Verifex](https://verifex.dev) sanctions screening API. Screen against OFAC, UN, EU, UK + 23 more lists and 878K+ PEPs in one API call.
## Installation
```toml
[dependencies]
verifex = "0.2"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
```
## Quick Start
```rust
use verifex::{Verifex, ScreenRequest};
#[tokio::main]
async fn main() -> Result<(), verifex::VerifexError> {
let client = Verifex::new("vfx_your_api_key");
let result = client.screen(ScreenRequest {
name: "Vladimir Putin".into(),
type_: Some("person".into()),
..Default::default()
}).await?;
if result.is_clear() {
println!("No sanctions match found");
} else {
println!("Risk: {} ({} matches)", result.risk_level, result.total_matches);
for m in &result.matches {
println!(" {} ({}) - {}% confidence", m.name, m.source, m.confidence);
}
}
Ok(())
}
```
## Batch Screening
```rust
let batch = client.batch_screen(vec![
ScreenRequest { name: "Vladimir Putin".into(), ..Default::default() },
ScreenRequest { name: "Sberbank".into(), type_: Some("entity".into()), ..Default::default() },
]).await?;
for r in &batch.results {
println!("{}: {}", r.query["name"], r.risk_level);
}
```
## Error Handling
```rust
match client.screen(req).await {
Ok(result) => println!("{}", result.risk_level),
Err(e) if e.is_auth() => eprintln!("Invalid API key"),
Err(e) if e.is_rate_limit() => eprintln!("Rate limited - slow down"),
Err(e) if e.is_quota_exceeded() => eprintln!("Monthly quota reached"),
Err(e) => eprintln!("Error: {e}"),
}
```
## Configuration
```rust
use std::time::Duration;
let client = Verifex::new("vfx_key")
.with_base_url("https://custom-api.example.com")
.with_timeout(Duration::from_secs(10));
```
## API Reference
| `screen(req)` | Screen a single entity |
| `batch_screen(entities)` | Screen multiple entities (Pro+) |
| `usage()` | Get monthly usage stats |
| `health()` | Check API health (no auth) |
| `list_keys()` | List API keys |
| `create_key(name)` | Create new API key |
| `revoke_key(id)` | Revoke an API key |
## Features
- Async/await with `reqwest` + `tokio`
- `rustls` TLS (no OpenSSL dependency)
- Zero `unsafe` code
- Full `serde` (de)serialization
- Typed errors with `thiserror`
- Builder pattern for configuration
## License
MIT