写
Screenshots API
2 operationsscreenshots:writescreenshots:read
Render a page or raw HTML to PNG, JPEG, WebP or PDF, with full-page capture, browser actions, ad blocking and caching.
| POST | /screenshots | Capture a web page or HTML as PNG, JPEG, WebP or PDF, as JSON or the image bytes. |
| GET | /screenshots/{screenshotId} | Get a screenshot and its image URL. |
Capture a web page or HTML as PNG, JPEG, WebP or PDF, as JSON or the image bytes.
POST
/v1/screenshotsscope screenshots:write
Bills 10 units per successful capture, recorded by the screenshot service when the capture succeeds. Cache hits are free.
Parameters
responseTypestring | jsonbinarydefault json |
Request body
asyncboolean | |
cacheTtlinteger (int32) | |
idempotencyKeystring | |
optionsOptions | null required | |
actionsAction[] | |
authorizationBasicAuth | null | |
blockAdsboolean | null | |
blockChatsboolean | null | |
blockCookieBannersboolean | null | |
blockResourcesstring[] | |
clickstring | |
clipHeightinteger (int32) | |
clipWidthinteger (int32) | |
clipXinteger (int32) | |
clipYinteger (int32) | |
cookiesCookie[] | |
cssUrlsstring[] | |
darkModeboolean | |
delayMsinteger (int32) | |
deviceScaleFactornumber (double) | |
disableJavascriptboolean | |
failOnHttpErrorboolean | |
formatstring | |
fullPageboolean | |
fullPageMaxHeightinteger (int32) | |
fullPageScrollboolean | null | |
fullPageScrollByinteger (int32) | |
fullPageScrollDelayMsinteger (int32) | null | |
geolocationAccuracynumber (double) | null | |
geolocationLatitudenumber (double) | null | |
geolocationLongitudenumber (double) | null | |
headersmap | |
hideSelectorsstring[] | |
htmlstring | |
imageQualityinteger (int32) | |
imageWidthinteger (int32) | |
initScriptstring | |
localestring | |
mediaTypestring | |
omitBackgroundboolean | |
pdfLandscapeboolean | |
pdfMarginstring | |
pdfPaperFormatstring | |
pdfPrintBackgroundboolean | null | |
proxystring | |
reducedMotionboolean | |
scriptsstring | |
scrollToElementstring | |
selectorstring | |
stylesstring | |
timeZonestring | |
timeoutSecondsinteger (int32) | |
tunnelstring | |
urlstring | |
userAgentstring | |
viewportDevicestring | |
viewportHasTouchboolean | null | |
viewportHeightinteger (int32) | |
viewportLandscapeboolean | |
viewportMobileboolean | null | |
viewportWidthinteger (int32) | |
waitForSelectorstring | |
waitUntilstring |
Response
29 fields
async | boolean |
attempt | integer (int32) |
cached | boolean |
clientRef | string |
contentType | string |
createdAt | integer (int64) |
durationMs | integer (int32) |
errorCode | string |
errorMessage | string |
evaluateResults | any[] |
finalUrl | string |
finishedAt | integer (int64) | null |
height | integer (int32) |
httpStatus | integer (int32) |
idempotencyKey | string | null |
maxAttempts | integer (int32) |
nextAttemptAt | integer (int64) |
ogDescription | string |
ogImage | string |
ogTitle | string |
screenshotId | string |
sizeBytes | integer (int64) |
status | string |
title | string |
tokenId | string |
truncated | boolean |
ttl | integer (int64) |
url | string |
width | integer (int32) |
curl -X POST "https://api.hoshime.com/v1/screenshots" \ -H "Authorization: Bearer $HOSHIME_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "async": false, "cacheTtl": 0, "idempotencyKey": "…", "options": { "actions": [ { "height": 0, "key": "…", "maxLoops": 0, "ms": 0, "optional": null, "script": "…", "selector": "…", "text": "…", "type": "…", "url": "https://…", "urlPattern": "…", "values": [], "width": 0 } ], "authorization": { "password": "…", "username": "…" }, "blockAds": false, "blockChats": false, "blockCookieBanners": false, "blockResources": [ "…" ], "click": "…", "clipHeight": 0, "clipWidth": 0, "clipX": 0, "clipY": 0, "cookies": [ { "domain": "…", "name": "…", "path": "…", "value": "…" } ], "cssUrls": [ "…" ], "darkMode": false, "delayMs": 0, "deviceScaleFactor": 0, "disableJavascript": false, "failOnHttpError": false, "format": "…", "fullPage": false, "fullPageMaxHeight": 0, "fullPageScroll": false, "fullPageScrollBy": 0, "fullPageScrollDelayMs": 0, "geolocationAccuracy": 0, "geolocationLatitude": 0, "geolocationLongitude": 0, "headers": {}, "hideSelectors": [ "…" ], "html": "…", "imageQuality": 0, "imageWidth": 0, "initScript": "…", "locale": "…", "mediaType": "…", "omitBackground": false, "pdfLandscape": false, "pdfMargin": "…", "pdfPaperFormat": "…", "pdfPrintBackground": false, "proxy": "…", "reducedMotion": false, "scripts": "…", "scrollToElement": "…", "selector": "…", "styles": "…", "timeZone": "…", "timeoutSeconds": 0, "tunnel": "…", "url": "https://…", "userAgent": "…", "viewportDevice": "…", "viewportHasTouch": false, "viewportHeight": 0, "viewportLandscape": false, "viewportMobile": false, "viewportWidth": 0, "waitForSelector": "…", "waitUntil": "…" } }'
const res = await fetch("https://api.hoshime.com/v1/screenshots", { method: "POST", headers: { Authorization: `Bearer ${process.env.HOSHIME_TOKEN}`, "Content-Type": "application/json", }, body: JSON.stringify({ "async": false, "cacheTtl": 0, "idempotencyKey": "…", "options": { "actions": [ { "height": 0, "key": "…", "maxLoops": 0, "ms": 0, "optional": null, "script": "…", "selector": "…", "text": "…", "type": "…", "url": "https://…", "urlPattern": "…", "values": [], "width": 0 } ], "authorization": { "password": "…", "username": "…" }, "blockAds": false, "blockChats": false, "blockCookieBanners": false, "blockResources": [ "…" ], "click": "…", "clipHeight": 0, "clipWidth": 0, "clipX": 0, "clipY": 0, "cookies": [ { "domain": "…", "name": "…", "path": "…", "value": "…" } ], "cssUrls": [ "…" ], "darkMode": false, "delayMs": 0, "deviceScaleFactor": 0, "disableJavascript": false, "failOnHttpError": false, "format": "…", "fullPage": false, "fullPageMaxHeight": 0, "fullPageScroll": false, "fullPageScrollBy": 0, "fullPageScrollDelayMs": 0, "geolocationAccuracy": 0, "geolocationLatitude": 0, "geolocationLongitude": 0, "headers": {}, "hideSelectors": [ "…" ], "html": "…", "imageQuality": 0, "imageWidth": 0, "initScript": "…", "locale": "…", "mediaType": "…", "omitBackground": false, "pdfLandscape": false, "pdfMargin": "…", "pdfPaperFormat": "…", "pdfPrintBackground": false, "proxy": "…", "reducedMotion": false, "scripts": "…", "scrollToElement": "…", "selector": "…", "styles": "…", "timeZone": "…", "timeoutSeconds": 0, "tunnel": "…", "url": "https://…", "userAgent": "…", "viewportDevice": "…", "viewportHasTouch": false, "viewportHeight": 0, "viewportLandscape": false, "viewportMobile": false, "viewportWidth": 0, "waitForSelector": "…", "waitUntil": "…" } }), }); const { data, meta } = await res.json();
import os, requests res = requests.post( "https://api.hoshime.com/v1/screenshots", headers={"Authorization": f"Bearer {os.environ['HOSHIME_TOKEN']}"}, json={ "async": False, "cacheTtl": 0, "idempotencyKey": "…", "options": { "actions": [ { "height": 0, "key": "…", "maxLoops": 0, "ms": 0, "optional": None, "script": "…", "selector": "…", "text": "…", "type": "…", "url": "https://…", "urlPattern": "…", "values": [], "width": 0 } ], "authorization": { "password": "…", "username": "…" }, "blockAds": False, "blockChats": False, "blockCookieBanners": False, "blockResources": [ "…" ], "click": "…", "clipHeight": 0, "clipWidth": 0, "clipX": 0, "clipY": 0, "cookies": [ { "domain": "…", "name": "…", "path": "…", "value": "…" } ], "cssUrls": [ "…" ], "darkMode": False, "delayMs": 0, "deviceScaleFactor": 0, "disableJavascript": False, "failOnHttpError": False, "format": "…", "fullPage": False, "fullPageMaxHeight": 0, "fullPageScroll": False, "fullPageScrollBy": 0, "fullPageScrollDelayMs": 0, "geolocationAccuracy": 0, "geolocationLatitude": 0, "geolocationLongitude": 0, "headers": {}, "hideSelectors": [ "…" ], "html": "…", "imageQuality": 0, "imageWidth": 0, "initScript": "…", "locale": "…", "mediaType": "…", "omitBackground": False, "pdfLandscape": False, "pdfMargin": "…", "pdfPaperFormat": "…", "pdfPrintBackground": False, "proxy": "…", "reducedMotion": False, "scripts": "…", "scrollToElement": "…", "selector": "…", "styles": "…", "timeZone": "…", "timeoutSeconds": 0, "tunnel": "…", "url": "https://…", "userAgent": "…", "viewportDevice": "…", "viewportHasTouch": False, "viewportHeight": 0, "viewportLandscape": False, "viewportMobile": False, "viewportWidth": 0, "waitForSelector": "…", "waitUntil": "…" } }, ) body = res.json()
{ "async": false, "attempt": 0, "cached": false, "clientRef": "…", "contentType": "…", "createdAt": 0, "durationMs": 0, "errorCode": "…", "errorMessage": "…", "evaluateResults": [ null ], "finalUrl": "https://…", "finishedAt": 0, "height": 0, "httpStatus": 0, "idempotencyKey": "…", "maxAttempts": 0, "nextAttemptAt": 0, "ogDescription": "…", "ogImage": "…", "ogTitle": "…", "screenshotId": "abc123", "sizeBytes": 0, "status": "…", "title": "…", "tokenId": "abc123", "truncated": false, "ttl": 0, "url": "https://…", "width": 0 }
Get a screenshot and its image URL.
GET
/v1/screenshots/{screenshotId}scope screenshots:read
Parameters
screenshotIdstring · path required |
Response
29 fields
async | boolean |
attempt | integer (int32) |
cached | boolean |
clientRef | string |
contentType | string |
createdAt | integer (int64) |
durationMs | integer (int32) |
errorCode | string |
errorMessage | string |
evaluateResults | any[] |
finalUrl | string |
finishedAt | integer (int64) | null |
height | integer (int32) |
httpStatus | integer (int32) |
idempotencyKey | string | null |
maxAttempts | integer (int32) |
nextAttemptAt | integer (int64) |
ogDescription | string |
ogImage | string |
ogTitle | string |
screenshotId | string |
sizeBytes | integer (int64) |
status | string |
title | string |
tokenId | string |
truncated | boolean |
ttl | integer (int64) |
url | string |
width | integer (int32) |
curl "https://api.hoshime.com/v1/screenshots/{screenshotId}" \ -H "Authorization: Bearer $HOSHIME_TOKEN"
const res = await fetch("https://api.hoshime.com/v1/screenshots/{screenshotId}", { headers: { Authorization: `Bearer ${process.env.HOSHIME_TOKEN}`, }, }); const { data, meta } = await res.json();
import os, requests res = requests.get( "https://api.hoshime.com/v1/screenshots/{screenshotId}", headers={"Authorization": f"Bearer {os.environ['HOSHIME_TOKEN']}"}, ) body = res.json()
{ "async": false, "attempt": 0, "cached": false, "clientRef": "…", "contentType": "…", "createdAt": 0, "durationMs": 0, "errorCode": "…", "errorMessage": "…", "evaluateResults": [ null ], "finalUrl": "https://…", "finishedAt": 0, "height": 0, "httpStatus": 0, "idempotencyKey": "…", "maxAttempts": 0, "nextAttemptAt": 0, "ogDescription": "…", "ogImage": "…", "ogTitle": "…", "screenshotId": "abc123", "sizeBytes": 0, "status": "…", "title": "…", "tokenId": "abc123", "truncated": false, "ttl": 0, "url": "https://…", "width": 0 }