screenshotbase-sdk

Crates.ioscreenshotbase-sdk
lib.rsscreenshotbase-sdk
version0.1.0
created_at2025-11-10 11:05:33.107951+00
updated_at2025-11-10 11:05:33.107951+00
descriptionRust client for the screenshotbase.com API (status and website rendering).
homepagehttps://screenshotbase.com
repositoryhttps://github.com/everapihq/screenshotbase-rust
max_upload_size
id1925158
size60,838
MarTechDev (martechdev)

documentation

https://screenshotbase.com/docs/

README

screenshotbase (Rust)

Rust client for the screenshotbase.com API to:

  • Retrieve API status and quota
  • Take a website screenshot to image/PDF bytes

API docs: https://screenshotbase.com/docs/ Register API key: https://screenshotbase.com

Features

  • Async client via reqwest
  • Optional blocking client behind blocking feature
  • Configurable base_url (defaults to https://api.screenshotbase.com)
  • Authentication via X-API-Key header and api_key query param

Install

[dependencies]
screenshotbase-sdk = "0.1.0"

Or from your own registry/workspace as desired.

Enable blocking client:

[dependencies]
screenshotbase-sdk = { version = "0.1.0", features = ["blocking"] }

Quickstart (async)

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let api_key = std::env::var("SCREENSHOTBASE_API_KEY")?;
    let client = screenshotbase_sdk::client::ScreenshotbaseClient::new(api_key)?;

    // Status
    let status = client.get_status().await?;
    println!("Plan: {:?}, Quota used: {:?}", status.plan, status.quota_used);

    // Take website screenshot
    let result = client
        .take_screenshot(
            "https://example.com",
            screenshotbase_sdk::types::RenderOptions {
                format: Some(screenshotbase_sdk::types::ImageFormat::Png),
                full_page: Some(true),
                width: Some(1280),
                height: Some(800),
                ..Default::default()
            },
        )
        .await?;
    println!("Content-Type: {:?}", result.content_type);
    println!("Received {} bytes", result.bytes.len());
    Ok(())
}

Blocking

fn main() -> Result<(), Box<dyn std::error::Error>> {
    #[cfg(feature = "blocking")]
    {
        let api_key = std::env::var("SCREENSHOTBASE_API_KEY")?;
        let client = screenshotbase_sdk::client::ScreenshotbaseBlockingClient::new(api_key)?;
        let status = client.get_status()?;
        println!("Plan: {:?}", status.plan);
        let _result = client.take_screenshot("https://example.com", screenshotbase_sdk::types::RenderOptions::default())?;
    }
    Ok(())
}

Notes

  • Endpoints implemented:
    • GET /v1/status
    • GET /v1/take?url=... with additional query parameters from RenderOptions
  • The default base URL is https://api.screenshotbase.com; override with .with_base_url(...) if necessary.
  • Authentication uses X-API-Key header and also appends api_key as a query parameter for compatibility.

Refer to the official docs for details and the latest parameters: https://screenshotbase.com/docs/

License

MIT

Commit count: 0

cargo fmt