Ir al contenido
v2.7

Obtener captura de una página web

Use this endpoint to capture a screenshot of any website URL.

GET/avatars/screenshotsAlcance avatars.read

Use this endpoint to capture a screenshot of any website URL. This endpoint uses a headless browser to render the webpage and capture it as an image.

You can configure the browser viewport size, theme, user agent, geolocation, permissions, and more. Capture either just the viewport or the full page scroll.

When width and height are specified, the image is resized accordingly. If both dimensions are 0, the API provides an image at original size. If dimensions are not specified, the default viewport size is 1280x720px.

url string obligatorio

Website URL which you want to capture.

headers object

HTTP headers to send with the browser request. Only Accept and Accept-Language are allowed. Defaults to empty.

viewportWidth number

Browser viewport width. Pass an integer between 1 to 1920. Defaults to 1280.

viewportHeight number

Browser viewport height. Pass an integer between 1 to 1080. Defaults to 720.

scale number

Browser scale factor. Pass a number between 0.1 to 3. Defaults to 1.

theme BrowserTheme

Browser theme. Pass “light” or “dark”. Defaults to “light”. Valores: light, dark.

userAgent string

Custom user agent string. Defaults to browser default.

fullpage boolean

Capture full page scroll. Pass 0 for viewport only, or 1 for full page. Defaults to 0.

locale string

Browser locale (e.g., “en-US”, “fr-FR”). Defaults to browser default.

timezone Timezone

IANA timezone identifier (e.g., “America/New_York”, “Europe/London”). Defaults to browser default. Valores: africa/abidjan, africa/accra, africa/addis_ababa, africa/algiers, africa/asmara, africa/bamako, africa/bangui, africa/banjul, africa/bissau, africa/blantyre, africa/brazzaville, africa/bujumbura, africa/cairo, africa/casablanca, africa/ceuta, africa/conakry, africa/dakar, africa/dar_es_salaam, africa/djibouti, africa/douala, africa/el_aaiun, africa/freetown, africa/gaborone, africa/harare, africa/johannesburg, africa/juba, africa/kampala, africa/khartoum, africa/kigali, africa/kinshasa, africa/lagos, africa/libreville, africa/lome, africa/luanda, africa/lubumbashi, africa/lusaka, africa/malabo, africa/maputo, africa/maseru, africa/mbabane, africa/mogadishu, africa/monrovia, africa/nairobi, africa/ndjamena, africa/niamey, africa/nouakchott, africa/ouagadougou, africa/porto-novo, africa/sao_tome, africa/tripoli, africa/tunis, africa/windhoek, america/adak, america/anchorage, america/anguilla, america/antigua, america/araguaina, america/argentina/buenos_aires, america/argentina/catamarca, america/argentina/cordoba, america/argentina/jujuy, america/argentina/la_rioja, america/argentina/mendoza, america/argentina/rio_gallegos, america/argentina/salta, america/argentina/san_juan, america/argentina/san_luis, america/argentina/tucuman, america/argentina/ushuaia, america/aruba, america/asuncion, america/atikokan, america/bahia, america/bahia_banderas, america/barbados, america/belem, america/belize, america/blanc-sablon, america/boa_vista, america/bogota, america/boise, america/cambridge_bay, america/campo_grande, america/cancun, america/caracas, america/cayenne, america/cayman, america/chicago, america/chihuahua, america/ciudad_juarez, america/costa_rica, america/coyhaique, america/creston, america/cuiaba, america/curacao, america/danmarkshavn, america/dawson, america/dawson_creek, america/denver, america/detroit, america/dominica, america/edmonton, america/eirunepe, america/el_salvador, america/fort_nelson, america/fortaleza, america/glace_bay, america/goose_bay, america/grand_turk, america/grenada, america/guadeloupe, america/guatemala, america/guayaquil, america/guyana, america/halifax, america/havana, america/hermosillo, america/indiana/indianapolis, america/indiana/knox, america/indiana/marengo, america/indiana/petersburg, america/indiana/tell_city, america/indiana/vevay, america/indiana/vincennes, america/indiana/winamac, america/inuvik, america/iqaluit, america/jamaica, america/juneau, america/kentucky/louisville, america/kentucky/monticello, america/kralendijk, america/la_paz, america/lima, america/los_angeles, america/lower_princes, america/maceio, america/managua, america/manaus, america/marigot, america/martinique, america/matamoros, america/mazatlan, america/menominee, america/merida, america/metlakatla, america/mexico_city, america/miquelon, america/moncton, america/monterrey, america/montevideo, america/montserrat, america/nassau, america/new_york, america/nome, america/noronha, america/north_dakota/beulah, america/north_dakota/center, america/north_dakota/new_salem, america/nuuk, america/ojinaga, america/panama, america/paramaribo, america/phoenix, america/port-au-prince, america/port_of_spain, america/porto_velho, america/puerto_rico, america/punta_arenas, america/rankin_inlet, america/recife, america/regina, america/resolute, america/rio_branco, america/santarem, america/santiago, america/santo_domingo, america/sao_paulo, america/scoresbysund, america/sitka, america/st_barthelemy, america/st_johns, america/st_kitts, america/st_lucia, america/st_thomas, america/st_vincent, america/swift_current, america/tegucigalpa, america/thule, america/tijuana, america/toronto, america/tortola, america/vancouver, america/whitehorse, america/winnipeg, america/yakutat, antarctica/casey, antarctica/davis, antarctica/dumontdurville, antarctica/macquarie, antarctica/mawson, antarctica/mcmurdo, antarctica/palmer, antarctica/rothera, antarctica/syowa, antarctica/troll, antarctica/vostok, arctic/longyearbyen, asia/aden, asia/almaty, asia/amman, asia/anadyr, asia/aqtau, asia/aqtobe, asia/ashgabat, asia/atyrau, asia/baghdad, asia/bahrain, asia/baku, asia/bangkok, asia/barnaul, asia/beirut, asia/bishkek, asia/brunei, asia/chita, asia/colombo, asia/damascus, asia/dhaka, asia/dili, asia/dubai, asia/dushanbe, asia/famagusta, asia/gaza, asia/hebron, asia/ho_chi_minh, asia/hong_kong, asia/hovd, asia/irkutsk, asia/jakarta, asia/jayapura, asia/jerusalem, asia/kabul, asia/kamchatka, asia/karachi, asia/kathmandu, asia/khandyga, asia/kolkata, asia/krasnoyarsk, asia/kuala_lumpur, asia/kuching, asia/kuwait, asia/macau, asia/magadan, asia/makassar, asia/manila, asia/muscat, asia/nicosia, asia/novokuznetsk, asia/novosibirsk, asia/omsk, asia/oral, asia/phnom_penh, asia/pontianak, asia/pyongyang, asia/qatar, asia/qostanay, asia/qyzylorda, asia/riyadh, asia/sakhalin, asia/samarkand, asia/seoul, asia/shanghai, asia/singapore, asia/srednekolymsk, asia/taipei, asia/tashkent, asia/tbilisi, asia/tehran, asia/thimphu, asia/tokyo, asia/tomsk, asia/ulaanbaatar, asia/urumqi, asia/ust-nera, asia/vientiane, asia/vladivostok, asia/yakutsk, asia/yangon, asia/yekaterinburg, asia/yerevan, atlantic/azores, atlantic/bermuda, atlantic/canary, atlantic/cape_verde, atlantic/faroe, atlantic/madeira, atlantic/reykjavik, atlantic/south_georgia, atlantic/st_helena, atlantic/stanley, australia/adelaide, australia/brisbane, australia/broken_hill, australia/darwin, australia/eucla, australia/hobart, australia/lindeman, australia/lord_howe, australia/melbourne, australia/perth, australia/sydney, europe/amsterdam, europe/andorra, europe/astrakhan, europe/athens, europe/belgrade, europe/berlin, europe/bratislava, europe/brussels, europe/bucharest, europe/budapest, europe/busingen, europe/chisinau, europe/copenhagen, europe/dublin, europe/gibraltar, europe/guernsey, europe/helsinki, europe/isle_of_man, europe/istanbul, europe/jersey, europe/kaliningrad, europe/kirov, europe/kyiv, europe/lisbon, europe/ljubljana, europe/london, europe/luxembourg, europe/madrid, europe/malta, europe/mariehamn, europe/minsk, europe/monaco, europe/moscow, europe/oslo, europe/paris, europe/podgorica, europe/prague, europe/riga, europe/rome, europe/samara, europe/san_marino, europe/sarajevo, europe/saratov, europe/simferopol, europe/skopje, europe/sofia, europe/stockholm, europe/tallinn, europe/tirane, europe/ulyanovsk, europe/vaduz, europe/vatican, europe/vienna, europe/vilnius, europe/volgograd, europe/warsaw, europe/zagreb, europe/zurich, indian/antananarivo, indian/chagos, indian/christmas, indian/cocos, indian/comoro, indian/kerguelen, indian/mahe, indian/maldives, indian/mauritius, indian/mayotte, indian/reunion, pacific/apia, pacific/auckland, pacific/bougainville, pacific/chatham, pacific/chuuk, pacific/easter, pacific/efate, pacific/fakaofo, pacific/fiji, pacific/funafuti, pacific/galapagos, pacific/gambier, pacific/guadalcanal, pacific/guam, pacific/honolulu, pacific/kanton, pacific/kiritimati, pacific/kosrae, pacific/kwajalein, pacific/majuro, pacific/marquesas, pacific/midway, pacific/nauru, pacific/niue, pacific/norfolk, pacific/noumea, pacific/pago_pago, pacific/palau, pacific/pitcairn, pacific/pohnpei, pacific/port_moresby, pacific/rarotonga, pacific/saipan, pacific/tahiti, pacific/tarawa, pacific/tongatapu, pacific/wake, pacific/wallis, utc.

latitude number

Geolocation latitude. Pass a number between -90 to 90. Defaults to 0.

longitude number

Geolocation longitude. Pass a number between -180 to 180. Defaults to 0.

accuracy number

Geolocation accuracy in meters. Pass a number between 0 to 100000. Defaults to 0.

touch boolean

Enable touch support. Pass 0 for no touch, or 1 for touch enabled. Defaults to 0.

permissions BrowserPermission[]

Browser permissions to grant. Pass an array of permission names like [“geolocation”, “camera”, “microphone”]. Defaults to empty. Valores: geolocation, camera, microphone, notifications, midi, push, clipboard-read, clipboard-write, payment-handler, usb, bluetooth, accelerometer, gyroscope, magnetometer, ambient-light-sensor, background-sync, persistent-storage, screen-wake-lock, web-share, xr-spatial-tracking.

sleep number

Wait time in seconds before taking the screenshot. Pass an integer between 0 to 10. Defaults to 0.

width number

Output image width. Pass 0 to use original width, or an integer between 1 to 2000. Defaults to 0 (original width).

height number

Output image height. Pass 0 to use original height, or an integer between 1 to 2000. Defaults to 0 (original height).

quality number

Screenshot quality. Pass an integer between 0 to 100. Defaults to keep existing image quality.

output ImageFormat

Output format type (jpeg, jpg, png, gif and webp). Valores: jpg, jpeg, png, webp, heic, avif, gif.

Acceso: clave de API con el alcance avatars.read o sin clave ni sesión: basta el ID del proyecto.

200Éxito
400Parámetro inválido o faltante
401Sin sesión, sin permiso en el recurso o clave sin el alcance
429Límite de peticiones

Todo error llega como JSON con code, type y message: consulta Errores.

import {
Client,
Avatars,
BrowserTheme,
Timezone,
BrowserPermission,
ImageFormat,
} from '@owbase/web';
const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1') // Your API Endpoint
.setProject('<YOUR_PROJECT_ID>'); // Your project ID
const avatars = new Avatars(client);
const result = avatars.getScreenshot({
url: 'https://example.com',
headers: {
'Accept-Language': 'en-US,en;q=0.9',
}, // optional
viewportWidth: 1920, // optional
viewportHeight: 1080, // optional
scale: 2, // optional
theme: BrowserTheme.Dark, // optional
userAgent:
'Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X) AppleWebKit/605.1.15', // optional
fullpage: true, // optional
locale: 'en-US', // optional
timezone: Timezone.AfricaAbidjan, // optional
latitude: 37.7749, // optional
longitude: -122.4194, // optional
accuracy: 100, // optional
touch: true, // optional
permissions: [
BrowserPermission.Geolocation,
BrowserPermission.Notifications,
], // optional
sleep: 3, // optional
width: 800, // optional
height: 600, // optional
quality: 85, // optional
output: ImageFormat.Jpeg, // optional
});
console.log(result);
Respuesta200 OK

Sin cuerpo en la respuesta.


Las descripciones de esta página vienen de la especificación de la API del servidor (licencia BSD-3-Clause), en inglés, y los ejemplos vienen del generador de SDKs (licencia MIT). Los avisos completos están en el archivo NOTICE de los paquetes @owbase/web y @owbase/node.

¿Te ayudó esta página?