Examples
Recipes you can paste and run
Swap in your API key and a target URL. Everything else already works.
Recipe
Turn a product page into JSON
One crawl with an ai_query — the answer comes back in the data field.
import os, json, requests
res = requests.get(
"https://app.irmu.com/api/crawl",
params={
"url": "https://www.amazon.com/dp/B0CHX1W1XY",
"premium": "true",
"ai_query": "Return title, price, currency, rating and stock status as JSON",
},
headers={"Authorization": f"Bearer {os.environ['IRMU_API_KEY']}"},
)
body = res.json()
print(body["credits_charged"], json.loads(body["data"]))Recipe
Save a full-page screenshot
GET /screenshot returns the whole scroll height as base64 JPEG. 30 credits flat — premium, rendering, geotargeting and ai_query are all included.
import base64, os, requests
res = requests.get(
"https://app.irmu.com/api/screenshot",
params={
"url": "https://example.com",
"viewport": "1440x900",
"country": "us",
},
headers={"Authorization": f"Bearer {os.environ['IRMU_API_KEY']}"},
timeout=120,
)
body = res.json()
if body.get("screenshot"):
with open("shot.jpg", "wb") as f:
f.write(base64.b64decode(body["screenshot"]))
print("saved", body["credits_charged"], "credits")
else:
# 202: the picture is still being taken — collect it from /crawl/{job}
print(body["status"], body["job_id"])Recipe
Crawl a paginated listing
Walk pages until one comes back empty. Rendering is on by default.
import os, requests
key = os.environ["IRMU_API_KEY"]
pages, page = [], 1
while page <= 50:
res = requests.get(
"https://app.irmu.com/api/crawl",
params={"url": f"https://example.com/catalog?page={page}", "js": "true"},
headers={"Authorization": f"Bearer {key}"},
)
html = res.text
if "No results" in html:
break
pages.append(html)
page += 1
print(len(pages), "pages collected")Recipe
Crawl from another country
Geotargeting costs nothing extra. Combine it with premium residential IPs for defended targets.
curl -G https://app.irmu.com/api/crawl \
-H "Authorization: Bearer $IRMU_API_KEY" \
--data-urlencode "url=https://www.amazon.de/dp/B0CHX1W1XY" \
--data-urlencode "premium=true" \
--data-urlencode "country=de"Recipe
Collect a slow crawl
A crawl that needs more time answers 202 with a job id. Collecting the result is free.
import os, time, requests
key = os.environ["IRMU_API_KEY"]
auth = {"Authorization": f"Bearer {key}"}
res = requests.get(
"https://app.irmu.com/api/crawl",
params={"url": "https://example.com/heavy", "js": "true"},
headers=auth,
)
if res.status_code == 202:
job = res.json()["job_id"]
while True:
time.sleep(2)
res = requests.get(f"https://app.irmu.com/api/crawl/{job}", headers=auth)
if res.status_code != 202:
break
print(res.status_code, res.headers.get("content-type"))Recipe
Fetch a static page for 1 credit
Rendering is on by default. Turn it off when the markup you need is already in the HTML.
curl -G https://app.irmu.com/api/crawl \
-H "Authorization: Bearer $IRMU_API_KEY" \
--data-urlencode "url=https://docs.example.com/guide" \
--data-urlencode "js=false"Start building with Irmu today
200 free credits every month, no card required. Every API, every integration, one key.