Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A Rails app can request a screenshot from a hosted API, then store or serve the returned image just like other application output. For a concrete Ruby SDK example, this guide uses ScreenshotOne’s documented screenshotone gem; it is a provider-specific integration, not a Rails feature. If you would rather use a language-neutral HTTP API, ScreenshotNeo is a Rails-friendly option: one GET request can return a PNG, JPEG, WebP, or PDF, and its screenshot API also removes common consent banners and popups before capture.

How a screenshot API fits into a Rails app

The basic flow is simple: your server sends a target URL and capture settings to a screenshot provider; the provider loads the page in a browser and returns either image bytes or a URL for the capture. Rails then decides where the result belongs—for example, in a temporary response, application storage, or a background-job workflow.

A hosted API moves browser operation to a remote service. Your Rails application still needs to validate inputs, handle network and provider errors, protect credentials, and decide how to retain the result. The exact SDK, authentication, options, return type, and defaults depend on the provider.

Quick start with ScreenshotOne’s Ruby SDK

The following example uses the ScreenshotOne Ruby SDK and its documented ScreenshotOne::Client and ScreenshotOne::TakeOptions classes. These names and methods are ScreenshotOne-specific; check its Ruby SDK documentation for current syntax and supported parameters.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Install the gem

Add the gem to your Gemfile:

gem 'screenshotone'

Then install dependencies:

bundle install

2. Store the key in Rails credentials

Open the encrypted credentials file with:

bin/rails credentials:edit

Add a namespaced value using a placeholder here—not a real key:

#1 Best Overall
Sale
Philips 24 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 241V8LB
  • CRISP CLARITY: This 23.8″ Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors
  • WORK SEAMLESSLY: This sleek monitor is virtually bezel-free on three sides, so the screen looks even bigger for the viewer. This minimalistic design also allows for seamless multi-monitor setups that enhance your workflow and boost productivity
  • A BETTER READING EXPERIENCE: For busy office workers, EasyRead mode provides a more paper-like experience for when viewing lengthy documents
screenshotone:
  access_key: YOUR_ACCESS_KEY
  secret_key: YOUR_SECRET_KEY

The secret key is optional in the vendor’s client example. Store it only if your chosen provider flow requires it. Read the values on the server through Rails.application.credentials; never put them in browser JavaScript, source control, or a URL. Rails encrypts config/credentials.yml.enc, and the deployment environment must have the corresponding master key available to decrypt it. Keep that master key protected. See the Rails Security Guide.

3. Request image bytes

This controller action illustrates the image-bytes approach documented by ScreenshotOne. It asks the client to capture a URL and returns the resulting bytes as a PNG response. Adapt the target URL and response handling to your application; do not accept arbitrary public URLs from untrusted users without validation.

class ScreenshotsController < ApplicationController
  def show
    target_url = params.require(:url)

    client = ScreenshotOne::Client.new(
      access_key: Rails.application.credentials.dig(:screenshotone, :access_key),
      secret_key: Rails.application.credentials.dig(:screenshotone, :secret_key)
    )

    options = ScreenshotOne::TakeOptions.new(url: target_url)
    options.full_page = true
    options.delay = 2

    unless options.valid?
      return render plain: "Invalid screenshot options", status: :unprocessable_entity
    end

    image_bytes = client.take(options)
    send_data image_bytes,
              type: "image/png",
              disposition: "inline",
              filename: "page.png"
  rescue ActionController::ParameterMissing
    render plain: "Missing url parameter", status: :bad_request
  rescue StandardError => e
    Rails.logger.error("Screenshot request failed: #{e.class}")
    render plain: "Screenshot could not be created", status: :bad_gateway
  end
end

The vendor documents constructing TakeOptions, validating the options, and calling client.take(options) to retrieve image data. Confirm the current initializer and option methods in its documentation before deploying. The broad rescue is a demonstration boundary, not a substitute for handling the provider’s documented exceptions: in production, rescue specific network and provider errors where available, and avoid logging request credentials or sensitive page contents.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

4. Choose bytes or a generated URL

ScreenshotOne also documents generating a capture URL. A URL-based flow can be useful when another server-side component retrieves the capture or a URL is the output your workflow needs. Treat such URLs according to the provider’s access and expiration behavior; do not assume they are permanent or public. The bytes flow above instead gives Rails the image content directly, so your app can return it or store it using its chosen storage layer.

Rank #2
Philips 22 Inch Computer Monitor FHD 100Hz VA VESA Flicker-Free, 221V8LB
  • CRISP CLARITY: This 22 inch class (21.5″ viewable) Philips V line monitor delivers crisp Full HD 1920x1080 visuals. Enjoy movies, shows and videos with remarkable detail
  • 100HZ FAST REFRESH RATE: 100Hz brings your favorite movies and video games to life. Stream, binge, and play effortlessly
  • SMOOTH ACTION WITH ADAPTIVE-SYNC: Adaptive-Sync technology ensures fluid action sequences and rapid response time. Every frame will be rendered smoothly with crystal clarity and without stutter
  • INCREDIBLE CONTRAST: The VA panel produces brighter whites and deeper blacks. You get true-to-life images and more gradients with 16.7 million colors
  • THE PERFECT VIEW: The 178/178 degree extra wide viewing angle prevents the shifting of colors when viewed from an offset angle, so you always get consistent colors

If persisting captures, decide on retention, naming, content type, and access control before adding storage code. The documentation cited here does not establish a particular Active Storage integration, so storage wiring should follow the Rails storage configuration your application already uses.

Capture options: what to configure

Capture settings are provider-specific. ScreenshotOne’s Ruby examples include full-page capture, delay, and geolocation. A delay can give page scripts time to render, but waiting longer also makes the request take longer; use the narrowest setting that produces the required content. Confirm each option’s accepted values and semantics in the vendor documentation rather than assuming another API uses the same names or defaults.

Other screenshot systems expose different controls. Playwright’s Page API, for example, supports full-page output, clipping an area, image type, quality, scaling, and an output path. Those are Playwright API options, not evidence that a hosted screenshot provider offers matching settings.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Validate the target URL and protect your app

  • Restrict destinations. If a user can supply the URL, validate its scheme and host against your product’s requirements. Server-side capture can otherwise become a route to internal services or unintended destinations.
  • Keep credentials server-side. Read keys from Rails credentials or another protected server-side secret store. Do not expose them to a browser or include them in logs.
  • Set an operational boundary. A page may be slow, unavailable, or fail to render. Use an appropriate request timeout and handle provider/network failure without holding a web request open indefinitely; a background job is often a better fit for captures that do not need to appear immediately.
  • Specify output expectations. Confirm image format, viewport, full-page behavior, and whether your app expects bytes or a generated URL. Set the response content type to match the actual returned format.
  • Consider sensitive pages. A capture provider must be able to access the target page. Avoid sending private or authenticated content unless the provider’s security and authentication flow meets your requirements.

Hosted API or browser automation?

A hosted API and Playwright solve related but distinct operational problems. With a hosted API, Rails calls a remote capture service and receives the result. With Playwright, your application or supporting infrastructure operates browser automation directly. Choose based on whether your team prefers a managed capture service or wants to configure and operate the browser stack itself.

Rank #3
Sale
Dell 24 Monitor - SE2426H - 23.8-inch FHD (1920x1080) 144Hz 1ms Display, in-Plane Switching (IPS) Technology, AMD FreeSync™, TÜV 3-Star 2X HDMI, Tilt
  • Clear visuals. Fluid motion: A 144Hz refresh rate and 1ms MPRT deliver smooth, tear‑free motion across work, gaming, and streaming for clearer, more fluid viewing.
  • Eye comfort: TÜV Rheinland 3‑star* certification reduces harmful blue light while preserving stunning color quality without compromise. *TÜV Rheinland 3-star eye comfort certification.
  • Wide viewing angle: Get consistent views across a wide 178° /178° viewing angle.
  • In-Plane Switching (IPS): See excellent color accuracy and consistency across wide viewing angles with In-plane Switching (IPS) technology.
  • Ultra-thin bezels: Maximize your viewing experience with thin bezels.

Playwright’s documented page workflow navigates to a page and then calls page.screenshot({ path: 'screenshot.png' }); its API also documents full-page capture, clipping, image type, quality, and scaling. See the Playwright Page API. This is an automation-library approach, not a hosted screenshot API. The cited documentation does not provide a shared benchmark for performance, reliability, or cost between the approaches, so those should be evaluated against your own workload and deployment constraints.

Other Ruby integrations

ScreenshotOne is one concrete vendor SDK, not the only Ruby-compatible route. Screenshot API describes a REST API and lists Ruby installation guidance, while Screenshot Scout documents a screenshotscout gem and a Ruby 3.4-or-newer requirement. These examples show that integrations exist in different forms; they do not establish equivalent options, pricing, capture quality, or service terms. Consult each provider’s current documentation before choosing an implementation.

For Rails developers who want a language-neutral hosted API rather than a provider-specific Ruby gem, ScreenshotNeo offers a single-request capture API and an MCP server for AI agents. Its request pattern is ordinary HTTP, so Rails can call it from server-side Ruby without installing a browser automation stack.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Or skip the browser setup

ScreenshotNeo accepts a URL and returns an image or PDF. Its capture workflow accepts cookie/consent banners like a visitor and removes more than 60 known consent platforms, newsletter popups, and chat widgets; each of those steps can be disabled. Bot checks and CAPTCHAs, blank pages, timeouts, failed loads, and cache hits are not billed, and responses identify the page verdict and billing status in headers. An MCP server exposes take_screenshot, get_page_info, and capture_pdf for Claude, Cursor, and other MCP clients.

One-call cURL example, adapting the URL to your target:

Rank #4
Samsung 27" Essential S3 (S36GD) Series FHD 1800R Curved Computer Monitor
  • CURVED FOR ENHANCED ENGAGEMENT: An immersive viewing experience with a curved monitor that wraps more closely around your field of vision; It creates a wider view, enhancing depth perception and minimizing peripheral distraction
  • SMOOTH PERFORMANCE FOR SEAMLESS CONTENT: Stay in the action when playing games, watching videos, or working on creative projects; The 100Hz refresh rate reduces lag and motion blur so you don't miss a thing in fast-paced moments¹
  • MORE GAMING POWER: Gain the edge with optimizable game settings; Color and image contrast can be adjusted to see scenes more vividly and spot enemies hiding in the dark; Game Mode adjusts any game to fill the screen so you can view every detail²
  • KEEP IT EASY ON THE EYES: Care for your eyes and stay comfortable, even during long sessions; Advanced eye comfort technology certified by TÜV reduces eye strain by minimizing blue light and reducing irritating screen flicker²
  • INCREASED VERSATILITY: Connect to more; Plug devices straight into your monitor for increased flexibility, making your computing environment even more convenient
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp

Use the ScreenshotNeo API documentation for authentication and request options. The service also provides Python and Node.js examples:

import requests
r = requests.get("https://api.screenshotneo.com/v1/shot", params={"access_key": "YOUR_API_KEY", "url": "https://stripe.com"}, timeout=90)
open("shot.webp", "wb").write(r.content)
const q = new URLSearchParams({ access_key: 'YOUR_API_KEY', url: 'https://stripe.com' });
const res = await fetch(`https://api.screenshotneo.com/v1/shot?${q}`);

ScreenshotNeo’s plans include 1,000 screenshots a month free with no card; paid plans start at $5 for 3,000 captures. These features are available on every plan. For a Rails integration, keep the key on the server and call the endpoint from a service object or background job; use the returned content type and response headers to decide whether to store, serve, retry, or discard a result.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Sign up for ScreenshotNeo’s free plan to try 1,000 screenshots a month with no card.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Troubleshooting and production checks

Rails cannot decrypt credentials

If accessing credentials fails in deployment, confirm the environment has the master key needed for the encrypted credentials file. Keep that key in the deployment secret manager rather than committing it. The Rails security guide explains the encrypted credentials mechanism.

Best Value
Sceptre New 22-Inch Gaming Monitor, FHD 1080p, Up to 144Hz, HDMI, DisplayPort, Built-in Speakers, Machine Black (E225W-FW144 Series, 2026)
  • 【INTEGRATED SPEAKERS】Whether you're at work or in the midst of an intense gaming session, our built-in speakers provide rich and seamless audio, all while keeping your desk clutter-free.
  • 【EASY ON THE EYES】 Protect your eyes and enhance your comfort with Blue-Light Shift technology. This feature reduces harmful blue light emissions from your screen, helping to alleviate eye strain during long hours of use and promoting healthier viewing habits.
  • 【WIDEN YOUR PERSPECTIVE】Our sleek minimal bezel design ensures undivided attention. The nearly bezel-free display seamlessly connects in a dual monitor arrangement, delivering an unobstructed view that lets you focus on more at once, completely distraction-free.

The provider rejects the request

Check that the key belongs to the selected provider and that required options are valid. For ScreenshotOne, validate the TakeOptions object before calling take, and compare the option names with its current Ruby guide. Do not transplant parameter names from another provider.

The capture is blank or incomplete

Verify the target URL is reachable by the capture service and inspect the page’s rendering behavior. A JavaScript-heavy page may need an appropriate wait strategy; ScreenshotOne’s examples include a delay. Full-page capture, viewport, and geolocation can also affect what appears. Change one setting at a time so you can identify the cause.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The Rails request takes too long

Captures depend on page loading and remote API response time. Avoid tying long-running work to a user-facing controller request when a background job can process it. Ensure network timeouts are bounded, and give callers a clear pending or failure state rather than waiting without limit.

The returned file will not display

Match the response content type and filename extension to the actual format returned. Do not label WebP or JPEG data as PNG. If the API returns a capture URL instead of bytes, retrieve it according to provider instructions rather than passing the URL itself as image content.

The capture exposes information it should not

Review URL validation, authentication handling, storage permissions, and retention. Do not log secret keys or sensitive page content. Avoid allowing users to direct a server-side screenshot service to arbitrary network destinations.

Pre-deployment checklist

  • Provider and integration type are explicit: SDK, HTTP API, or browser automation.
  • Keys are stored server-side, and the deployment can decrypt Rails credentials.
  • User-controlled URLs are restricted to intended destinations.
  • Image format, viewport, full-page behavior, and output destination are confirmed.
  • Network/provider failures, timeouts, and invalid options have a defined response path.
  • Captures that may take time run asynchronously when appropriate.
  • Logs exclude API keys and sensitive page data.

Frequently Asked Questions

Is a screenshot API part of Ruby on Rails?

No. Rails can call a hosted screenshot service, but its SDK, API, and options belong to the provider.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Can I use Playwright instead of a hosted screenshot API?

Yes. Playwright is a browser automation library that your team operates; it is a different integration model from calling a remote capture service.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.