Screenshots
POST /v1/screenshots cattura qualsiasi pagina web pubblica come immagine o PDF — nessun template richiesto.
# Request
curl https://api.mostlyrender.com/v1/screenshots \
-H "Authorization: Bearer mr_live_…" \
-H "Content-Type: application/json" \
-d '{
"url": "https://stripe.com",
"fullPage": true,
"output": "png"
}'
| Field | Type | Notes |
|---|---|---|
url |
string | Richiesto. Un URL pubblico http(s). |
width |
integer | Larghezza del viewport. Default 1200 (16–2400). |
height |
integer | Altezza del viewport. Default 630 (16–2400). |
fullPage |
boolean | Cattura l’intera altezza di scorrimento. Default false. |
scale |
number | Fattore di scala del dispositivo (retina). Fino a 3. |
output |
string | png (default), jpeg, webp, o pdf. |
paper |
string | Con output: "pdf", impagina in un documento di questa dimensione carta (A4, A3, A5, Letter, Legal, Tabloid, Ledger) con margini, invece di una singola cattura a altezza intera. |
async |
boolean | Accoda e restituisce 202. |
webhookUrl |
string | Callback firmato al completamento (implica async). |
notifyEmail |
string | Invia email a questo indirizzo quando il job termina (implica async). |
# Response
{
"id": "shot_abc123",
"url": "https://img.mostlyrender.com/mostlyrender/screenshots/shot_abc123.png",
"output": "png"
}
# URL safety
Screenshots accettano solo URL http(s) pubblici. Le richieste a intervalli privati, loopback, link-local, o host di metadati cloud sono rifiutate con 400 — e la guardia ri-controlla dopo qualsiasi redirect, quindi un URL pubblico non può rimbalzare a uno interno.
# SDK
shot = mr.screenshot("https://stripe.com", full_page=True)
print(shot["url"])
Le pagine grandi possono essere lente — per quelle, usa async + webhooks.