Quickstart
URL in, pixels out. Here's the whole integration.
1. Get an API key
Sign up with your email — we send a magic link, no password. Your API key
(rk_live_…) is shown immediately after sign-in. It's shown once; store it
like a password.
2. Render something
Pass the key in the x-api-key header (or as a Bearer token). The response body is the file.
curl -X POST https://rasterkit.com/v1/screenshot \
-H "x-api-key: $RASTERKIT_API_KEY" \
-H "content-type: application/json" \
-d '{"url": "https://example.com", "full_page": true, "format": "png"}' \
-o screenshot.png import { writeFile } from 'node:fs/promises'
const res = await fetch('https://rasterkit.com/v1/screenshot', {
method: 'POST',
headers: {
'x-api-key': process.env.RASTERKIT_API_KEY,
'content-type': 'application/json',
},
body: JSON.stringify({"url": "https://example.com", "full_page": true, "format": "png"}),
})
if (!res.ok) throw new Error(`Render failed: ${res.status} ${await res.text()}`)
await writeFile('screenshot.png', Buffer.from(await res.arrayBuffer()))
console.log('Saved screenshot.png') import os
import requests
res = requests.post(
"https://rasterkit.com/v1/screenshot",
headers={"x-api-key": os.environ["RASTERKIT_API_KEY"]},
json={"url": "https://example.com", "full_page": True, "format": "png"},
timeout=60,
)
res.raise_for_status()
with open("screenshot.png", "wb") as f:
f.write(res.content)
print("Saved screenshot.png") <?php
$ch = curl_init('https://rasterkit.com/v1/screenshot');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_HTTPHEADER => [
'x-api-key: ' . getenv('RASTERKIT_API_KEY'),
'content-type: application/json',
],
CURLOPT_POSTFIELDS => '{"url": "https://example.com", "full_page": true, "format": "png"}',
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status !== 200) {
throw new RuntimeException("Render failed: $status $body");
}
file_put_contents('screenshot.png', $body);
echo "Saved screenshot.png\n"; require "net/http"
require "json"
uri = URI("https://rasterkit.com/v1/screenshot")
req = Net::HTTP::Post.new(uri)
req["x-api-key"] = ENV.fetch("RASTERKIT_API_KEY")
req["content-type"] = "application/json"
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) }
raise "Render failed: #{res.code} #{res.body}" unless res.code == "200"
File.binwrite("screenshot.png", res.body)
puts "Saved screenshot.png" package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
body := []byte(`{"url": "https://example.com", "full_page": true, "format": "png"}`)
req, _ := http.NewRequest("POST", "https://rasterkit.com/v1/screenshot", bytes.NewReader(body))
req.Header.Set("x-api-key", os.Getenv("RASTERKIT_API_KEY"))
req.Header.Set("content-type", "application/json")
client := &http.Client{Timeout: 60 * time.Second}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode != 200 {
panic(fmt.Sprintf("render failed: %d %s", res.StatusCode, data))
}
os.WriteFile("screenshot.png", data, 0644)
fmt.Println("Saved screenshot.png")
} import java.net.URI;
import java.net.http.*;
import java.nio.file.*;
import java.time.Duration;
public class Render {
public static void main(String[] args) throws Exception {
String body = """
{"url": "https://example.com", "full_page": true, "format": "png"}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://rasterkit.com/v1/screenshot"))
.timeout(Duration.ofSeconds(60))
.header("x-api-key", System.getenv("RASTERKIT_API_KEY"))
.header("content-type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<byte[]> res = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofByteArray());
if (res.statusCode() != 200) {
throw new RuntimeException("Render failed: " + res.statusCode() + " " + new String(res.body()));
}
Files.write(Path.of("screenshot.png"), res.body());
System.out.println("Saved screenshot.png");
}
} using System.Text;
var client = new HttpClient { Timeout = TimeSpan.FromSeconds(60) };
client.DefaultRequestHeaders.Add("x-api-key",
Environment.GetEnvironmentVariable("RASTERKIT_API_KEY"));
var body = new StringContent(
"""{"url": "https://example.com", "full_page": true, "format": "png"}""",
Encoding.UTF8, "application/json");
var res = await client.PostAsync("https://rasterkit.com/v1/screenshot", body);
var bytes = await res.Content.ReadAsByteArrayAsync();
if (!res.IsSuccessStatusCode)
throw new Exception($"Render failed: {(int)res.StatusCode} {Encoding.UTF8.GetString(bytes)}");
await File.WriteAllBytesAsync("screenshot.png", bytes);
Console.WriteLine("Saved screenshot.png"); 3. PDFs and OG images use the same shape
curl -X POST https://rasterkit.com/v1/pdf \
-H "x-api-key: $RASTERKIT_API_KEY" \
-H "content-type: application/json" \
-d '{"url": "https://example.com/invoice/42", "format": "A4", "print_background": true}' \
-o document.pdf import { writeFile } from 'node:fs/promises'
const res = await fetch('https://rasterkit.com/v1/pdf', {
method: 'POST',
headers: {
'x-api-key': process.env.RASTERKIT_API_KEY,
'content-type': 'application/json',
},
body: JSON.stringify({"url": "https://example.com/invoice/42", "format": "A4", "print_background": true}),
})
if (!res.ok) throw new Error(`Render failed: ${res.status} ${await res.text()}`)
await writeFile('document.pdf', Buffer.from(await res.arrayBuffer()))
console.log('Saved document.pdf') import os
import requests
res = requests.post(
"https://rasterkit.com/v1/pdf",
headers={"x-api-key": os.environ["RASTERKIT_API_KEY"]},
json={"url": "https://example.com/invoice/42", "format": "A4", "print_background": True},
timeout=60,
)
res.raise_for_status()
with open("document.pdf", "wb") as f:
f.write(res.content)
print("Saved document.pdf") <?php
$ch = curl_init('https://rasterkit.com/v1/pdf');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_HTTPHEADER => [
'x-api-key: ' . getenv('RASTERKIT_API_KEY'),
'content-type: application/json',
],
CURLOPT_POSTFIELDS => '{"url": "https://example.com/invoice/42", "format": "A4", "print_background": true}',
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status !== 200) {
throw new RuntimeException("Render failed: $status $body");
}
file_put_contents('document.pdf', $body);
echo "Saved document.pdf\n"; require "net/http"
require "json"
uri = URI("https://rasterkit.com/v1/pdf")
req = Net::HTTP::Post.new(uri)
req["x-api-key"] = ENV.fetch("RASTERKIT_API_KEY")
req["content-type"] = "application/json"
req.body = '{"url": "https://example.com/invoice/42", "format": "A4", "print_background": true}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 60) { |http| http.request(req) }
raise "Render failed: #{res.code} #{res.body}" unless res.code == "200"
File.binwrite("document.pdf", res.body)
puts "Saved document.pdf" package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
body := []byte(`{"url": "https://example.com/invoice/42", "format": "A4", "print_background": true}`)
req, _ := http.NewRequest("POST", "https://rasterkit.com/v1/pdf", bytes.NewReader(body))
req.Header.Set("x-api-key", os.Getenv("RASTERKIT_API_KEY"))
req.Header.Set("content-type", "application/json")
client := &http.Client{Timeout: 60 * time.Second}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode != 200 {
panic(fmt.Sprintf("render failed: %d %s", res.StatusCode, data))
}
os.WriteFile("document.pdf", data, 0644)
fmt.Println("Saved document.pdf")
} import java.net.URI;
import java.net.http.*;
import java.nio.file.*;
import java.time.Duration;
public class Render {
public static void main(String[] args) throws Exception {
String body = """
{"url": "https://example.com/invoice/42", "format": "A4", "print_background": true}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://rasterkit.com/v1/pdf"))
.timeout(Duration.ofSeconds(60))
.header("x-api-key", System.getenv("RASTERKIT_API_KEY"))
.header("content-type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<byte[]> res = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofByteArray());
if (res.statusCode() != 200) {
throw new RuntimeException("Render failed: " + res.statusCode() + " " + new String(res.body()));
}
Files.write(Path.of("document.pdf"), res.body());
System.out.println("Saved document.pdf");
}
} using System.Text;
var client = new HttpClient { Timeout = TimeSpan.FromSeconds(60) };
client.DefaultRequestHeaders.Add("x-api-key",
Environment.GetEnvironmentVariable("RASTERKIT_API_KEY"));
var body = new StringContent(
"""{"url": "https://example.com/invoice/42", "format": "A4", "print_background": true}""",
Encoding.UTF8, "application/json");
var res = await client.PostAsync("https://rasterkit.com/v1/pdf", body);
var bytes = await res.Content.ReadAsByteArrayAsync();
if (!res.IsSuccessStatusCode)
throw new Exception($"Render failed: {(int)res.StatusCode} {Encoding.UTF8.GetString(bytes)}");
await File.WriteAllBytesAsync("document.pdf", bytes);
Console.WriteLine("Saved document.pdf"); curl -X POST https://rasterkit.com/v1/image \
-H "x-api-key: $RASTERKIT_API_KEY" \
-H "content-type: application/json" \
-d '{"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}}' \
-o og-image.png import { writeFile } from 'node:fs/promises'
const res = await fetch('https://rasterkit.com/v1/image', {
method: 'POST',
headers: {
'x-api-key': process.env.RASTERKIT_API_KEY,
'content-type': 'application/json',
},
body: JSON.stringify({"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}}),
})
if (!res.ok) throw new Error(`Render failed: ${res.status} ${await res.text()}`)
await writeFile('og-image.png', Buffer.from(await res.arrayBuffer()))
console.log('Saved og-image.png') import os
import requests
res = requests.post(
"https://rasterkit.com/v1/image",
headers={"x-api-key": os.environ["RASTERKIT_API_KEY"]},
json={"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}},
timeout=60,
)
res.raise_for_status()
with open("og-image.png", "wb") as f:
f.write(res.content)
print("Saved og-image.png") <?php
$ch = curl_init('https://rasterkit.com/v1/image');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
CURLOPT_HTTPHEADER => [
'x-api-key: ' . getenv('RASTERKIT_API_KEY'),
'content-type: application/json',
],
CURLOPT_POSTFIELDS => '{"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}}',
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);
if ($status !== 200) {
throw new RuntimeException("Render failed: $status $body");
}
file_put_contents('og-image.png', $body);
echo "Saved og-image.png\n"; require "net/http"
require "json"
uri = URI("https://rasterkit.com/v1/image")
req = Net::HTTP::Post.new(uri)
req["x-api-key"] = ENV.fetch("RASTERKIT_API_KEY")
req["content-type"] = "application/json"
req.body = '{"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}}'
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true, read_timeout: 60) { |http| http.request(req) }
raise "Render failed: #{res.code} #{res.body}" unless res.code == "200"
File.binwrite("og-image.png", res.body)
puts "Saved og-image.png" package main
import (
"bytes"
"fmt"
"io"
"net/http"
"os"
"time"
)
func main() {
body := []byte(`{"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}}`)
req, _ := http.NewRequest("POST", "https://rasterkit.com/v1/image", bytes.NewReader(body))
req.Header.Set("x-api-key", os.Getenv("RASTERKIT_API_KEY"))
req.Header.Set("content-type", "application/json")
client := &http.Client{Timeout: 60 * time.Second}
res, err := client.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode != 200 {
panic(fmt.Sprintf("render failed: %d %s", res.StatusCode, data))
}
os.WriteFile("og-image.png", data, 0644)
fmt.Println("Saved og-image.png")
} import java.net.URI;
import java.net.http.*;
import java.nio.file.*;
import java.time.Duration;
public class Render {
public static void main(String[] args) throws Exception {
String body = """
{"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://rasterkit.com/v1/image"))
.timeout(Duration.ofSeconds(60))
.header("x-api-key", System.getenv("RASTERKIT_API_KEY"))
.header("content-type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
HttpResponse<byte[]> res = HttpClient.newHttpClient()
.send(request, HttpResponse.BodyHandlers.ofByteArray());
if (res.statusCode() != 200) {
throw new RuntimeException("Render failed: " + res.statusCode() + " " + new String(res.body()));
}
Files.write(Path.of("og-image.png"), res.body());
System.out.println("Saved og-image.png");
}
} using System.Text;
var client = new HttpClient { Timeout = TimeSpan.FromSeconds(60) };
client.DefaultRequestHeaders.Add("x-api-key",
Environment.GetEnvironmentVariable("RASTERKIT_API_KEY"));
var body = new StringContent(
"""{"template_id": "tpl_your_template", "variables": {"title": "Hello World", "author": "Paul"}}""",
Encoding.UTF8, "application/json");
var res = await client.PostAsync("https://rasterkit.com/v1/image", body);
var bytes = await res.Content.ReadAsByteArrayAsync();
if (!res.IsSuccessStatusCode)
throw new Exception($"Render failed: {(int)res.StatusCode} {Encoding.UTF8.GetString(bytes)}");
await File.WriteAllBytesAsync("og-image.png", bytes);
Console.WriteLine("Saved og-image.png"); 4. Check your usage
curl https://rasterkit.com/v1/usage -H "x-api-key: $RASTERKIT_API_KEY"
{
"plan": "free",
"month": "2026-06",
"renders_used": 3,
"renders_included": 100,
"renders_remaining": 97,
"cached_hits": 0
} Next steps
- Screenshot parameters — devices, dark mode, full-page, blocking
- PDF parameters — paper sizes, headers/footers, page numbers
- Image templates — design once, render thousands
- Signed URLs — embed renders in
<img>tags with no backend - Caching — make repeat renders instant and free
- Async jobs & webhooks — for batch workloads