DEVELOPER REFERENCE

PRNT RESTful API Documentation

Integrate screenshot capture into your apps in minutes. All requests are securely transmitted over HTTPS and accept JSON payloads.

1. Quickstart Guide

The PRNT capture endpoint accepts standard HTTP POST requests. Pass the destination website URL along with your secret API key to receive your image.

# Basic cURL Request
curl -X POST "https://prnt.tr/api/v1/capture.php" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d "target_url=https://example.com" \
  -d "format=png"

2. Authentication

Authenticate your requests by including your secret API key in the HTTP Authorization header as a Bearer token.

Method Header / Query Recommendation
HTTP Header Authorization: Bearer prnt_live_... Recommended (Secure)
URL Query Param ?api_key=prnt_live_... Testing / Staging Only

3. Request Parameters

Parameter Type Default Description
target_url String (URL) Required Valid HTTP/HTTPS web address to capture.
format String png Output format: png, jpeg, webp, pdf
viewport String 1920x1080 Browser screen dimension (e.g. 375x812, 1440x900)
full_page Boolean false Captures the full height of the page with auto-scrolling.
block_ads Boolean true Blocks advertising trackers and banners.
hide_cookie_banners Boolean true Automatically purges GDPR and CCPA consent popups.
custom_js String null JavaScript code to execute on the page before capturing.

4. Multi-Language Code Snippets

Node.js (Fetch)

const fetch = require('node-fetch'); async function captureWebsite() { const response = await fetch('https://prnt.tr/api/v1/capture.php', { method: 'POST', headers: { 'Authorization': 'Bearer YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ target_url: 'https://github.com', format: 'png', full_page: true }) }); const data = await response.json(); console.log('Screenshot URL:', data.data.image_url); } captureWebsite();

Python (Requests)

import requests headers = {"Authorization": "Bearer YOUR_API_KEY"} payload = { "target_url": "https://news.ycombinator.com", "format": "webp", "viewport": "1440x900" } response = requests.post("https://prnt.tr/api/v1/capture.php", json=payload, headers=headers) print(response.json())

PHP (cURL)

<?php $ch = curl_init("https://prnt.tr/api/v1/capture.php"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_POST, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ "Authorization: Bearer YOUR_API_KEY", "Content-Type: application/json" ]); curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([ "target_url" => "https://stripe.com", "format" => "png" ])); $response = curl_exec($ch); curl_close($ch); $result = json_decode($response, true);

5. HTTP Response & Error Codes

Code Status Description
200 OK Success Screenshot captured and rendered successfully.
400 Bad Request Invalid Request Missing parameters, invalid URL, or SSRF security check triggered.
401 Unauthorized Unauthorized Invalid, inactive, or missing API key.
429 Too Many Requests Quota Exceeded Monthly quota consumed or rate limit threshold exceeded.