Screenshot API SDKs

Official SnapAPI SDKs for JavaScript, Python, Go, PHP, Swift, and Kotlin. Install from your package manager and start capturing screenshots in minutes.

Get API Key Free

JavaScript Screenshot API SDK

The SnapAPI JavaScript SDK supports Node.js 16 and later and modern browser environments with native fetch support. Install it with npm install snapapi-js or yarn add snapapi-js. Import the SnapAPI class and initialize it with your API key from the environment: import SnapAPI from 'snapapi-js'; const client = new SnapAPI(process.env.SNAPAPI_KEY). The screenshot method returns a Promise that resolves to a Buffer containing the PNG image bytes. The scrape method returns a Promise that resolves to a plain object with title, description, text, and html fields. The extract method accepts a schema definition object and returns a Promise that resolves to a structured object with the extracted fields. All methods accept an options object that maps directly to the SnapAPI query parameters, with camelCase property names for readability: { fullPage: true, delay: 2000, width: 1280, format: 'webp' }. The SDK includes TypeScript type definitions for all methods, options, and return types with full IntelliSense support in VS Code and other TypeScript-aware editors.

The JavaScript SDK handles common integration concerns automatically. Retry logic retries failed requests up to three times with exponential backoff for 429 rate limit and 5xx server error responses. Error normalization wraps all API errors in a SnapAPIError class with machine-readable code, human-readable message, and the HTTP status code, making it straightforward to catch and handle specific error types without inspecting raw HTTP responses. Response parsing handles the three response formats — binary, base64, and url — transparently based on the response_type parameter value, returning the appropriate type from each method call. The SDK is open source at github.com/Sleywill/snapapi-js and accepts community contributions through GitHub pull requests.

Python Screenshot API SDK

The SnapAPI Python SDK supports Python 3.8 and later. Install it with pip install snapapi-python. Import the SnapAPI client and initialize it with your API key: from snapapi import SnapAPI; client = SnapAPI(os.environ["SNAPAPI_KEY"]). The screenshot method returns bytes containing the PNG image data in synchronous mode. An async variant is available through the AsyncSnapAPI class that uses httpx internally and provides the same interface with async/await syntax for integration into asyncio applications. The Python SDK includes type hints for all method signatures and return types, compatible with mypy and pyright for static type checking in typed Python codebases. Pydantic models for the response types enable automatic validation and IDE autocomplete for the JSON response fields returned by the scrape and extract endpoints.

The Python SDK integrates cleanly with the requests and httpx HTTP libraries for applications that need to mix SnapAPI calls with other HTTP requests in the same client session. Pass a custom httpx.Client or requests.Session instance to the SnapAPI constructor to share connection pools and proxy configuration with other HTTP calls in the application. The session sharing pattern is particularly useful in web scraping pipelines that call both SnapAPI for rendered screenshots and custom HTTP requests for raw HTML fetching, keeping all outbound HTTP through a single configured client with consistent timeout and proxy settings.

Go Screenshot API SDK

The SnapAPI Go SDK supports Go 1.18 and later with generics. Install it with go get github.com/Sleywill/snapapi-go. Import the package and create a client with snapapi.NewClient(os.Getenv("SNAPAPI_KEY")). The Screenshot method returns a byte slice containing the PNG image data and an error value following Go's standard error handling conventions. The Scrape method returns a ScrapeResult struct with Title, Description, Text, and HTML string fields. All methods accept a context.Context as the first argument for cancellation and deadline propagation, enabling proper timeout handling in server applications. The Go SDK uses net/http internally with connection keep-alive enabled by default, and accepts a custom *http.Client for integration with applications that configure their own transport settings for proxy support, custom TLS, or connection pool tuning.

PHP Screenshot API SDK

The SnapAPI PHP SDK requires PHP 8.0 or later and the Guzzle HTTP library. Install it with composer require snapapi/snapapi-php. Create a client instance with new SnapAPI\Client($_ENV["SNAPAPI_KEY"]) and call the screenshot method with a target URL and optional parameters array. The method returns a Psr\Http\Message\StreamInterface containing the PNG image data, compatible with the PSR-7 HTTP message interfaces used throughout the PHP ecosystem. The PHP SDK includes PHPDoc annotations for all methods, enabling IDE autocomplete in PhpStorm and VS Code with PHP Intelephense. A Laravel service provider is included that automatically registers the SnapAPI client as a singleton in the Laravel application container, bound to the SNAPAPI_KEY value from the .env configuration file.

Swift and Kotlin SDKs

The SnapAPI Swift SDK targets iOS 15+, macOS 12+, and supports Swift Package Manager. Add the package URL https://github.com/Sleywill/snapapi-swift to Xcode or Package.swift and import SnapAPISwift. The async screenshot(url:options:) function returns Data containing the PNG image or throws a SnapAPIError. The SDK is compatible with both UIKit and SwiftUI applications and includes Combine publishers for applications using reactive patterns. The SnapAPI Kotlin SDK targets Android API level 21 and later, published to Maven Central as com.snapapi:snapapi-kotlin. The SDK uses Kotlin Coroutines with suspend functions for all API calls, integrates with OkHttp for HTTP client configuration, and includes Kotlin Flow variants of all methods for reactive stream integration in modern Android applications using Flow for data streams.

Screenshot API SDK Version Management

All SnapAPI SDKs follow semantic versioning with a major.minor.patch version scheme. Major version increments indicate breaking API changes that require code updates in consuming applications. Minor version increments add new features and parameters in a backward-compatible way. Patch version increments fix bugs without changing the API surface. SDK versions are published to the respective package registries — npm, PyPI, pkg.go.dev, Packagist, Swift Package Index, and Maven Central — simultaneously when new versions are released. Subscribe to the SnapAPI GitHub repository releases page or watch the changelog at docs.snapapi.pics to receive notifications when new SDK versions are published. All SDK minor and patch versions are backward compatible, so updating from 2.0.0 to 2.1.0 or 2.0.1 requires no code changes. Before upgrading to a new major version, review the migration guide in the SDK CHANGELOG.md that documents all breaking changes and the required code updates.

Screenshot API SDK Contributing and Community

All SnapAPI SDK repositories are open source under the MIT license and accept community contributions through GitHub pull requests. The contribution guide in each repository covers the development setup, testing requirements, code style conventions, and the pull request review process. Community contributors have added support for additional response formats, improved error message clarity, and added convenience methods for common use cases that were not in the original SDK scope. Feature requests for new SDK functionality can be submitted as GitHub issues in the respective repository — requests with clear use cases and upvotes from multiple users are prioritized for inclusion in upcoming minor versions. Bug reports should include a minimal reproducible example and the SDK version, runtime version, and operating system to enable efficient diagnosis and resolution. The SnapAPI team reviews all open issues weekly and responds with status updates, reproduction attempts, or fixes within the current sprint cycle.

Screenshot API SDK vs Direct REST API

Choosing between using an official SnapAPI SDK and calling the REST API directly depends on the language, the integration complexity, and the team's preference for dependencies. The SDKs reduce boilerplate by handling URL construction, response parsing, error normalization, and retry logic, which is valuable for teams that want to focus on integration logic rather than HTTP plumbing. Direct REST API calls are appropriate for languages without an official SDK, for teams with strict dependency policies, or for simple one-off integrations where the overhead of managing a dependency is not justified. For the SDK languages — JavaScript, Python, Go, PHP, Swift, and Kotlin — the SDK is recommended for production integrations because it incorporates patterns learned from supporting many integrations and will be updated when the underlying API changes without requiring manual code updates in each consuming application.

SnapAPI SDK Architecture and Design Decisions

All official SnapAPI SDKs follow a consistent architecture that abstracts HTTP transport, authentication, and error handling behind a clean language-native interface. Each SDK exposes a client class initialized with the API key, with instance methods for each SnapAPI endpoint: screenshot, scrape, extract, and pdf. Method parameters map directly to SnapAPI's query parameters using language-idiomatic naming conventions — camelCase in JavaScript and Swift, snake_case in Python, Go, PHP, and Kotlin. Response objects are typed structs or data classes rather than raw dictionaries, providing IDE autocomplete and compile-time type checking in strongly typed languages. Error handling follows each language's conventions: exceptions in Python and PHP, Result types in Swift and Kotlin, error return values in Go, and Promise rejections in JavaScript. Each SDK ships with a comprehensive test suite that mocks HTTP responses, enabling users to write unit tests for their integration code without making real API calls.

SnapAPI SDK Version Management and Upgrades

All SnapAPI SDKs are versioned at v2.0.0, following semantic versioning with a stable v2 API contract. The v2 SDK interface is backward compatible — new optional parameters added to SnapAPI endpoints are added as optional method parameters in the SDK, with no breaking changes to existing method signatures. To upgrade between minor SDK versions, update the package version in your dependency manager and review the changelog for new optional parameters that you may want to adopt. The SDKs are hosted on each language's standard package registry: npm for JavaScript, PyPI for Python, pkg.go.dev for Go, Packagist for PHP, the Swift Package Index for Swift, and Maven Central for Kotlin. Pin the SDK version in production dependencies to ensure deployment reproducibility, and use your dependency manager's lock file to track the exact SDK version deployed in each environment.