Expand description
§screenshotfreeapi
Official Rust client for the ScreenshotFreeAPI — a production-grade Screenshot-as-a-Service platform.
§Quick start
Add to Cargo.toml:
[dependencies]
screenshotfreeapi = "1"
tokio = { version = "1", features = ["full"] }use screenshotfreeapi::ScreenshotFreeAPIClient;
#[tokio::main]
async fn main() -> screenshotfreeapi::Result<()> {
let client = ScreenshotFreeAPIClient::new("sfa_your_api_key");
let result = client.capture("https://stripe.com").await?;
println!("{}", result.screenshots[0].url);
Ok(())
}§Resources
Access each group of endpoints through the corresponding field on ScreenshotFreeAPIClient:
client.auth— account registration and JWT managementclient.screenshots— enqueue web, mobile, and HTML capturesclient.jobs— poll status, fetch resultsclient.billing— plans, usage, upgradesclient.workspaces— team workspaces and member managementclient.monitors— scheduled app-capture monitorsclient.integrations— Zapier REST Hooks
§Webhook verification
use screenshotfreeapi::verify_webhook_signature;
let body = br#"{"jobId":"abc","status":"completed"}"#;
let sig = "the-value-of-X-ScreenshotFree-Signature-header";
let secret = "your_webhook_secret";
if verify_webhook_signature(body, sig, secret).is_ok() {
// safe to process
}Re-exports§
pub use resources::screenshots::WaitOptions;
Modules§
Structs§
- AppMonitor
- A scheduled app-capture monitor.
- Billing
Usage - Daily usage history from
GET /billing/usage. - Cancel
Response - Response from
DELETE /billing/cancel. - Create
Monitor Request - Request body for
POST /monitors/app. - Create
Workspace Request - Request body for
POST /workspaces. - Current
Plan - Current subscription and quota summary from
GET /billing/plan. - Daily
Usage - Usage count for a single calendar day.
- Dimensions
- Viewport dimensions in pixels.
- Enqueue
Response - Response from any
POST /screenshots/*endpoint (HTTP 202). - Health
Response - Response from
GET /health. - Html
Screenshot Options - Options for
POST /screenshots/html. - Invite
Request - Request body for
POST /workspaces/:id/invite. - JobResult
- Full result returned by
GET /jobs/:id/resultonce a job is completed. - JobStatus
Response - Response from
GET /jobs/:id/status. - Metadata
- Processing metadata attached to every
JobResult. - Mobile
Screenshot Options - Options for
POST /screenshots/mobile. - Monitor
History - An individual run entry in a monitor’s history.
- Plan
- A subscription plan tier returned by
GET /billing/plans. - Refresh
Request - Request body for
POST /auth/refresh. - Refresh
Response - Response from
POST /auth/refresh. - Register
Request - Request body for
POST /auth/register. - Register
Response - Response from
POST /auth/register. - Screenshot
- A single captured screenshot within a
JobResult. - Screenshot
FreeAPI Client - The main entry point for the ScreenshotFreeAPI Rust client.
- Token
Request - Request body for
POST /auth/token(password grant). - Token
Response - Response from
POST /auth/token. - Update
Role Request - Request body for
PUT /workspaces/:id/members/:userId. - Upgrade
Request - Request body for
POST /billing/upgrade. - Upgrade
Response - Response from
POST /billing/upgrade. - Verify
Response - Response from
POST /billing/verify. - WebScreenshot
Options - Options for
POST /screenshots/web. - Workspace
- A team workspace.
- Workspace
Action Response - Generic success/message response for workspace mutations.
- Workspace
Detail - Response listing workspaces with their members.
- Workspace
Member - A member of a workspace.
- Zapier
Subscribe Request - Request body for
POST /integrations/zapier/subscribe. - Zapier
Subscribe Response - Response from
POST /integrations/zapier/subscribe. - Zapier
Trigger Sample - Sample trigger payload returned by
GET /integrations/zapier/triggers/:event. - Zapier
Unsubscribe Response - Response from
DELETE /integrations/zapier/unsubscribe/:id.
Enums§
- Screenshot
FreeAPI Error - All errors that can be returned by the ScreenshotFreeAPI client.
Functions§
- verify_
webhook_ signature - Verify the
X-ScreenshotFree-Signatureheader value against a raw request body.
Type Aliases§
- Result
- Convenience alias used throughout this crate.