RasterKit – One API for Screenshots, PDFs, and OG Images

TheVedrick1 pts0 comments

RasterKit — Screenshot, PDF & OG Image API">

Screenshots · PDFs · OG images — one engine Render the web to pixels you can ship

One API that turns any URL or HTML into a screenshot, a pixel-perfect PDF, or a templated<br>social image. Replace three subscriptions with one.

Get your free API key Read the docs<br>100 renders/month free · no credit card · first render in under 2 minutes

curlNode.jsPythonPHPRubyGoJavaC#<br>curl -X POST https://rasterkit.com/v1/screenshot \<br>-H "x-api-key: $RASTERKIT_API_KEY" \<br>-H "content-type: application/json" \<br>-d '{"url": "https://example.com", "full_page": true, "format": "png"}' \<br>-o screenshot.png<br>import { writeFile } from 'node:fs/promises'

const res = await fetch('https://rasterkit.com/v1/screenshot', {<br>method: 'POST',<br>headers: {<br>'x-api-key': process.env.RASTERKIT_API_KEY,<br>'content-type': 'application/json',<br>},<br>body: JSON.stringify({"url": "https://example.com", "full_page": true, "format": "png"}),<br>})<br>if (!res.ok) throw new Error(`Render failed: ${res.status} ${await res.text()}`)<br>await writeFile('screenshot.png', Buffer.from(await res.arrayBuffer()))<br>console.log('Saved screenshot.png')<br>import os<br>import requests

res = requests.post(<br>"https://rasterkit.com/v1/screenshot",<br>headers={"x-api-key": os.environ["RASTERKIT_API_KEY"]},<br>json={"url": "https://example.com", "full_page": True, "format": "png"},<br>timeout=60,<br>res.raise_for_status()<br>with open("screenshot.png", "wb") as f:<br>f.write(res.content)<br>print("Saved screenshot.png")<br>true,<br>CURLOPT_RETURNTRANSFER => true,<br>CURLOPT_TIMEOUT => 60,<br>CURLOPT_HTTPHEADER => [<br>'x-api-key: ' . getenv('RASTERKIT_API_KEY'),<br>'content-type: application/json',<br>],<br>CURLOPT_POSTFIELDS => '{"url": "https://example.com", "full_page": true, "format": "png"}',<br>]);<br>$body = curl_exec($ch);<br>$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);<br>curl_close($ch);<br>if ($status !== 200) {<br>throw new RuntimeException("Render failed: $status $body");<br>file_put_contents('screenshot.png', $body);<br>echo "Saved screenshot.png\n";<br>require "net/http"<br>require "json"

uri = URI("https://rasterkit.com/v1/screenshot")<br>req = Net::HTTP::Post.new(uri)<br>req["x-api-key"] = ENV.fetch("RASTERKIT_API_KEY")<br>req["content-type"] = "application/json"<br>req.body = '{"url": "https://example.com", "full_page": true, "format": "png"}'

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 60) { |http| http.request(req) }<br>raise "Render failed: #{res.code} #{res.body}" unless res.code == "200"<br>File.binwrite("screenshot.png", res.body)<br>puts "Saved screenshot.png"<br>package main

import (<br>"bytes"<br>"fmt"<br>"io"<br>"net/http"<br>"os"<br>"time"

func main() {<br>body := []byte(`{"url": "https://example.com", "full_page": true, "format": "png"}`)<br>req, _ := http.NewRequest("POST", "https://rasterkit.com/v1/screenshot", bytes.NewReader(body))<br>req.Header.Set("x-api-key", os.Getenv("RASTERKIT_API_KEY"))<br>req.Header.Set("content-type", "application/json")

client := &http.Client{Timeout: 60 * time.Second}<br>res, err := client.Do(req)<br>if err != nil {<br>panic(err)<br>defer res.Body.Close()

data, _ := io.ReadAll(res.Body)<br>if res.StatusCode != 200 {<br>panic(fmt.Sprintf("render failed: %d %s", res.StatusCode, data))<br>os.WriteFile("screenshot.png", data, 0644)<br>fmt.Println("Saved screenshot.png")<br>import java.net.URI;<br>import java.net.http.*;<br>import java.nio.file.*;<br>import java.time.Duration;

public class Render {<br>public static void main(String[] args) throws Exception {<br>String body = """<br>{"url": "https://example.com", "full_page": true, "format": "png"}""";<br>HttpRequest request = HttpRequest.newBuilder()<br>.uri(URI.create("https://rasterkit.com/v1/screenshot"))<br>.timeout(Duration.ofSeconds(60))<br>.header("x-api-key", System.getenv("RASTERKIT_API_KEY"))<br>.header("content-type", "application/json")<br>.POST(HttpRequest.BodyPublishers.ofString(body))<br>.build();

HttpResponse res = HttpClient.newHttpClient()<br>.send(request, HttpResponse.BodyHandlers.ofByteArray());<br>if (res.statusCode() != 200) {<br>throw new RuntimeException("Render failed: " + res.statusCode() + " " + new String(res.body()));<br>Files.write(Path.of("screenshot.png"), res.body());<br>System.out.println("Saved screenshot.png");<br>using System.Text;

var client = new HttpClient { Timeout = TimeSpan.FromSeconds(60) };<br>client.DefaultRequestHeaders.Add("x-api-key",<br>Environment.GetEnvironmentVariable("RASTERKIT_API_KEY"));

var body = new StringContent(<br>"""{"url": "https://example.com", "full_page": true, "format": "png"}""",<br>Encoding.UTF8, "application/json");

var res = await client.PostAsync("https://rasterkit.com/v1/screenshot", body);<br>var bytes = await res.Content.ReadAsByteArrayAsync();<br>if (!res.IsSuccessStatusCode)<br>throw new Exception($"Render failed: {(int)res.StatusCode} {Encoding.UTF8.GetString(bytes)}");

await File.WriteAllBytesAsync("screenshot.png", bytes);<br>Console.WriteLine("Saved screenshot.png");

📸 Screenshot API<br>POST /v1/screenshot<br>Full-page captures, mobile & tablet emulation, dark mode, ad and cookie-banner<br>blocking. PNG, JPEG, or WebP.<br>Screenshot docs →<br>📄 PDF API<br>POST...

screenshot body https true json rasterkit

Related Articles