API Documentation

This documentation provides details about the available endpoints for the Screenshot API.

Screenshot Endpoint

This endpoint captures a screenshot of a given web page and returns it as a file.

Request

POST /

Headers

Header Required Description Example
Authorization * Yes A Bearer token for authentication. The token is defined in the server's .env file as API_SECRET_KEY. Bearer your_super_secret_key_here
Content-Type * Yes Specifies the content type of the request body. application/json

Body Parameters

Parameter Type Required Description
url String * Yes The full URL of the web page to capture. Must include http:// or https://.
width Integer * Yes The width of the browser viewport in pixels.
height Integer * Yes The height of the browser viewport in pixels.
type String No The desired output file type. Can be jpeg or pdf. Defaults to jpeg.
filename String No The desired name for the downloaded file (without extension). Defaults to screenshot.

Example Request (cURL)

curl --location --request POST 'http://browsershot.istoria.app' \
--header 'Authorization: Bearer your_super_secret_key_here' \
--header 'Content-Type: application/json' \
--data-raw '{
    "url": "https://google.com",
    "width": 1920,
    "height": 1080,
    "type": "jpeg",
    "filename": "google-screenshot"
}' --output google-screenshot.jpeg

Success Response

On success, the server responds with a status code of 200 OK and provides the requested file for download.

Error Responses

Status Code Reason
400 Bad Request A required parameter is missing or a parameter has an invalid value.
401 Unauthorized The Authorization header is missing.
403 Forbidden The provided bearer token is invalid.
500 Internal Server Error An unexpected error occurred on the server while trying to capture the screenshot.