← All Integrations

Screenshot API for Ruby

Capture website screenshots in Ruby without Ferrum/Watir or any browser dependency. One HTTP call. Get back an image.

Quick Start

require "net/http"
require "uri"

uri = URI("https://grabshot.dev/v1/screenshot")
uri.query = URI.encode_www_form(
  url: "https://stripe.com",
  format: "png",
  width: "1280",
  frame: "macbook",
  key: "YOUR_API_KEY"
)

response = Net::HTTP.get_response(uri)
File.binwrite("screenshot.png", response.body)
puts "Saved screenshot.png"

Rails Controller

class ScreenshotsController < ApplicationController
  def show
    uri = URI("https://grabshot.dev/v1/screenshot")
    uri.query = URI.encode_www_form(
      url: params[:url],
      format: "png",
      width: "1280",
      key: ENV["GRABSHOT_KEY"]
    )

    response = Net::HTTP.get_response(uri)
    send_data response.body,
      type: "image/png",
      disposition: "inline"
  end
end

Start capturing screenshots in Ruby

25 free screenshots per month. No credit card required.

Get Free API Key →