Ironfang Render uses a standard HTTPS API, so Python can call it with requests and does not require an SDK. A successful request returns the image bytes directly, ready to write to a file.
Get a key
Create an API key in the portal. The secret is displayed once and stored as a hash. Keep it in an environment variable named IRONFANG_API_KEY rather than in the source file; the example below reads it from there.
export IRONFANG_API_KEY="if_live_..."Install
pip install requestsTake a screenshot
import os
import sys
import requests
key = os.environ.get("IRONFANG_API_KEY")
if not key:
sys.exit("Set IRONFANG_API_KEY to your Ironfang API key.")
resp = requests.post(
"https://api.ironfang.com/render/v1/screenshot",
headers={"Authorization": f"Bearer {key}"},
json={"url": "https://example.com", "width": 1280},
timeout=60,
)
if resp.status_code != 200:
# Errors are JSON even though success is binary.
err = resp.json()["error"]
sys.exit(f"{resp.status_code} {err['code']}: {err['message']}")
with open("shot.png", "wb") as f:
f.write(resp.content)Run it, and the screenshot is saved as shot.png in the current directory:
python shot.pyHandling errors
Successful render responses are binary. Errors use JSON in the form {"error": {"code", "message"}}. A missing or unrecognised key returns 401 invalid_api_key. A key without the render:render scope returns 403 insufficient_scope.
# The status check comes before the file is written: a failed
# render returns JSON, which must not be saved as shot.png.PDFs and templates
The same call shape works for PDFs at /render/v1/pdf, and for templated images at /render/v1/image/{id}. Only the path and the body change.
Next
- Screenshot API: viewport sizes, formats, clean captures and pricing
- Full-page screenshots: capture the whole scrolling page in one image
- Website screenshots in Node.js
- Website screenshots in PHP
- Full API reference

