SDKs
Official Node.js and Python clients with typed options, error codes and automatic retries.
Note
The packages go live on npm and PyPI with the public launch. Until then the install commands below won't work yet: call the API over HTTP as in the quick start.
Both clients have no dependencies, read the key from RENDERBOLT_KEY, and retry rate limits (429) and temporary overloads (502, 503) twice with backoff. Every option on the endpoint pages works as a parameter.
Node.js#
Node 18 or newer. ESM, CommonJS and TypeScript types are included.
npm install fast-pdf-screenshot-sdk
import { RenderClient, RenderError } from 'fast-pdf-screenshot-sdk';
import { writeFile } from 'node:fs/promises';
const client = new RenderClient({ apiKey: process.env.RENDERBOLT_KEY });
// screenshot -> Buffer
const png = await client.screenshot({ url: 'https://stripe.com', block_ads: true, block_cookie_banners: true });
await writeFile('stripe.png', png);
// PDF straight to a file
await client.toFile('pdf', { html: '<h1>Invoice #1042</h1>', format: 'A4', margin: '15mm' }, 'invoice.pdf');
// Markdown for an LLM
const { title, content } = await client.extract({ url: 'https://en.wikipedia.org/wiki/Headless_browser' });
// errors carry the API code
try {
await client.screenshot({ url: 'https://example.com', wait_for_selector: '#app' });
} catch (err) {
if (err instanceof RenderError && err.code === 'SELECTOR_NOT_FOUND') {
// the element never appeared
}
}
| Client option | Default |
|---|---|
apiKey |
RENDERBOLT_KEY environment variable |
baseUrl |
RENDERBOLT_BASE_URL, then https://rendersbolt.com |
timeoutMs |
60000 |
maxRetries |
2 |
Python#
Python 3.8 or newer.
pip install fast-pdf-screenshot-sdk
from fast_pdf_screenshot import Client, RenderError
client = Client() # reads RENDERBOLT_KEY, or pass api_key="sk_live_..."
png = client.screenshot(url="https://stripe.com", block_ads=True, block_cookie_banners=True)
open("stripe.png", "wb").write(png)
client.to_file("pdf", "invoice.pdf", html="<h1>Invoice #1042</h1>", format="A4", margin="15mm")
page = client.extract(url="https://en.wikipedia.org/wiki/Headless_browser")
print(page["title"], page["metadata"]["word_count"])
try:
client.screenshot(url="https://example.com", wait_for_selector="#app")
except RenderError as err:
print(err.status, err.code, err.message)
client.usage() returns your plan and this month's usage.
Other languages#
Any HTTP client works. The quick start has examples for PHP and Go, and the OpenAPI spec generates clients for most languages.
Stuck? Write to [email protected] with the request you sent and the error code you got back.