Send a public webpage URL and receive that page back as a PNG or JPEG image, base64 encoded. Each successful render costs one file credit from your plan.
Every request needs your API secret key in theAuthorization header as a Bearer token. Your email must be verified and your plan must include this feature with credit remaining.
Authorization: Bearer pigdf_your_api_secret_keyThe body is JSON with a required link field holding the URL, and an optional options object. The link must be a public http or https address; private, local, and unreachable hosts are rejected.
curl -X POST https://pigdf.com/api/render/link-to-image/ \
-H "Authorization: Bearer pigdf_your_api_secret_key" \
-H "Content-Type: application/json" \
-d '{
"link": "https://pigdf.com/",
"options": {
"format": "png",
"image_size": { "width": 1280 }
}
}'Every option is optional. This example sends all of them at once, with each default noted. Leave options out entirely and you get a full-page JPEG at 1280 pixels wide.
{
"link": "https://pigdf.com/", // required: a public http or https URL (up to 2048 characters)
"options": {
"format": "png", // default: "jpeg". Either "png" or "jpeg". Safe to delete.
"image_size": { "width": 1280, "height": 720 }, // default: 1280 wide, full page. Both 1-20000 px. Width only = full page at that width. Safe to delete.
"transparent": true, // default: false. PNG only, ignored for jpeg. Safe to delete.
"quality": 80, // default: 80. JPEG only (1-100), ignored for png. Safe to delete.
"scale": 2 // default: 1. Device pixel ratio 1-3 for sharper output. Safe to delete.
}
}
// JSON does not allow comments. Remove the comments above before sending.| Option | Type | Required | Default | Example | Notes |
|---|---|---|---|---|---|
| format | string | No | "jpeg" | "png" | Either png or jpeg. Any other value falls back to jpeg. |
| image_size | object | No | 1280 wide, full page | { "width": 1280, "height": 720 } | width and height in pixels, each between 1 and 20000. Width only captures the full page at that width. Leave it out for a 1280 wide full-page capture. |
| quality | number | No | 80 | 60 | JPEG quality between 1 and 100. Applies to jpeg only, ignored for png. |
| transparent | boolean | No | false | true | Transparent background. Applies to png only, ignored for jpeg. |
| scale | number | No | 1 | 2 | Device pixel ratio between 1 and 3 for sharper, higher resolution output. |
Every response uses the same envelope: success, errors, and data. On success the image arrives base64 encoded in data.content; decode it and save it as a file.
{
"success": true,
"errors": [],
"data": {
"content": "iVBORw0KGgoAAAANSUhEUgAABAAAAAK8CAYAAA..."
}
}When something is wrong, success is false, data is empty, and errors holds one or more messages. The HTTP status tells you the category.
{
"success": false,
"errors": ["Your current plan does not include this feature."],
"data": {}
}| Status | When it happens | Message |
|---|---|---|
| 400 | The body is not valid JSON. | Invalid JSON. |
| 400 | The link field is missing or empty. | A non-empty "link" field is required. |
| 400 | The link is longer than 2048 characters. | The link exceeds the 2048 character limit. |
| 400 | The link is not a valid http or https URL. | Please provide a valid link that starts with http or https. |
| 400 | The link host is private, local, or unreachable. | The link points to a host that is private, local, or could not be resolved. |
| 401 | The API secret key is missing or wrong. | You are not authorized to use this API. |
| 403 | Your email is not verified. | Please verify your email address to use this API. |
| 403 | Your plan does not include this feature. | Your current plan does not include this feature. |
| 408 | The render took longer than 30 seconds. | Rendering took longer than 30 seconds. |
| 413 | The image produced is larger than 25 MB. | The generated image exceeds the 25 MB limit. |
| 429 | You have used all your credit for this feature. | You have used all your credit for this feature. |
| 502 | The webpage could not be rendered. | The linked webpage could not be rendered to an image. |
The link is limited to 2048 characters, and the image you receive is limited to 25 MB.
Only public http and https hosts are allowed; private, local, and unreachable hosts are rejected.
Rendering is limited to 30 seconds per request.
Failed requests never spend a credit. Only a successful render does.