verifex 0.2.0

Official Rust SDK for the Verifex sanctions screening API
Documentation

Verifex Rust SDK

Crates.io docs.rs MIT

Official Rust client for the Verifex sanctions screening API. Screen against OFAC, UN, EU, UK + 23 more lists and 878K+ PEPs in one API call.

Installation

[dependencies]
verifex = "0.2"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }

Quick Start

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

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

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

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

Method Description
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