Quick start
Get a key, take your first screenshot and handle errors, in curl, Node.js, Python, PHP or Go.
1. Get a key#
Enter your email and the key appears right away. It starts with sk_live_ and is shown only once, so store it now. Put it in an environment variable rather than in your code:
export API_KEY=sk_live_...
2. Take a screenshot#
Pick your language. Each example saves example.png.
curl https://rendersbolt.com/v1/screenshot \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"url":"https://example.com","block_cookie_banners":true}' \
-o example.png
import { writeFile } from 'node:fs/promises';
const res = await fetch('https://rendersbolt.com/v1/screenshot', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({ url: 'https://example.com', block_cookie_banners: true }),
});
if (!res.ok) throw new Error(JSON.stringify(await res.json()));
await writeFile('example.png', Buffer.from(await res.arrayBuffer()));
import os, requests
r = requests.post(
"https://rendersbolt.com/v1/screenshot",
headers={"Authorization": f"Bearer {os.environ['API_KEY']}"},
json={"url": "https://example.com", "block_cookie_banners": True},
timeout=60,
)
r.raise_for_status()
open("example.png", "wb").write(r.content)
<?php
$ch = curl_init('https://rendersbolt.com/v1/screenshot');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('API_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['url' => 'https://example.com', 'block_cookie_banners' => true]),
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 60,
]);
$body = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($status !== 200) {
throw new RuntimeException($body);
}
file_put_contents('example.png', $body);
package main
import (
"bytes"
"encoding/json"
"io"
"net/http"
"os"
)
func main() {
body, _ := json.Marshal(map[string]any{"url": "https://example.com", "block_cookie_banners": true})
req, _ := http.NewRequest("POST", "https://rendersbolt.com/v1/screenshot", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer "+os.Getenv("API_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode != http.StatusOK {
panic(string(data))
}
os.WriteFile("example.png", data, 0o644)
}
3. Read the response headers#
Every successful response tells you how it went:
| Header | Example | Meaning |
|---|---|---|
X-Render-Time |
412 |
Milliseconds the browser spent on your page |
X-Quota-Remaining |
99 |
Renders left this month |
X-Target-Status |
200 |
The HTTP status the site answered with |
X-Cache |
MISS |
HIT when a cached result was returned |
A 404 page is still rendered. Check X-Target-Status if that matters to you.
4. Handle errors#
Errors come back as JSON with a status code and a stable code:
{ "error": { "code": "INVALID_PARAMETER", "message": "format must be one of: png, jpeg, jpg, webp" } }
Retry 429 and 503 after a short wait. Fix the request for 400 and 422. The full list is in Errors.
Next steps#
- Make a PDF from your own HTML: PDF
- Turn a page into Markdown: Extract
- Try options without writing code: Playground
Stuck? Write to [email protected] with the request you sent and the error code you got back.