Capzy Web Scraper API. Get useful content.
Fetch a page through one HTTP request. Start with HTML, enable JavaScript when the page needs a browser, and add selectors when you want structured fields.
Select an example request
{
"clientKey": "YOUR_CAPZY_API_KEY",
"url": "https://example.com"
}The smallest request fetches the page content. Rendering and extraction are optional.
Start small, then add what the page needs
Use your Capzy API key as clientKey. These previews only change the sample code; run a real request from the dashboard playground or your application.
Get an API key
Create or copy a Capzy API key in your account. Keep it in an environment variable called CAPZY_API_KEY.
Open your accountSend a URL
POST to /scrape with clientKey and url. Set renderJs only when you need JavaScript. Add extractionRules to return named fields.
Read the status before the result
Check errorId and status. A ready response contains result. A processing response contains taskId, which you can poll with getTaskResult. Polling returns the completed data in solution.
# Install: pip install requests
import os
import time
import requests
api = "https://api.capzy.ai"
key = os.environ["CAPZY_API_KEY"]
response = requests.post(api + "/scrape", json={
"clientKey": key,
"url": "https://example.com",
}, timeout=120)
response.raise_for_status()
data = response.json()
task_id = data.get("taskId")
# /scrape may return a task still processing after its wait deadline.
deadline = time.monotonic() + 120
while data.get("status") == "processing" and not data.get("errorId"):
if time.monotonic() >= deadline:
raise TimeoutError("Scrape is still processing")
time.sleep(2)
response = requests.post(api + "/getTaskResult", json={
"clientKey": key, "taskId": task_id,
}, timeout=30)
response.raise_for_status()
data = response.json()
if data.get("solution") is not None:
data["result"] = data["solution"]
if data.get("errorId") or data.get("status") != "ready":
raise RuntimeError(data)
print(data["result"]["content"])Build the request around the page
Only clientKey and url are required. Add one capability at a time so you can see its effect on output and cost.
clientKey / urlRequired · strings- Your Capzy API key and the full target URL, including https://. Read the target site's terms and make sure your use is permitted.
renderJsOptional · default false- Use a browser for pages populated by JavaScript. With rendering enabled, waitForSelector can wait for the content you need.
extractionRulesOptional · object- Name each field and give it a CSS selector, for example {"title":"h1"}. Read extracted data in result.extracted.data.
aspOptional · default false- Enable the anti-bot handling add-on when the target requires it. Support depends on the site's protection; a successful result is not guaranteed.
proxyPool / proxyCountryOptional · egress- Choose datacenter or residential, then a two-letter country code when needed. Selecting a country alone does not switch the pool to residential.
formatOptional · raw, text, markdown- Choose the content format your application needs. Use the full reference for screenshots, browser scenarios, sessions and caching.
Know where your data lands
The response envelope carries status and error information. This is an illustrative ready response for the extraction example.
{
"errorId": 0,
"status": "ready",
"result": {
"extracted": {
"data": {
"title": "Example Domain"
}
}
}
}errorId0- Check errorId and status. A ready response contains result. A processing response contains taskId, which you can poll with getTaskResult. Polling returns the completed data in solution.
result.extracted.datatitle- Map field names to CSS selectors. The example extracts the first heading from example.com.
Pricing
Proxy traffic is charged by MB; rendering, anti-bot handling and extraction have their own components. Current rates are shown below.
Loading current prices…
A few things to know
Do I need Web Scraper API or Data API?
Use Web Scraper API when you have a URL and want control over rendering or selectors. Use Data API when a supported site's endpoint already returns the structured data you need.
Why are the extracted fields empty?
Inspect the returned content and confirm that your selectors match it. If the fields appear only after JavaScript executes, enable renderJs and use waitForSelector.
What if the request is still processing?
The /scrape route waits for a result up to its deadline. If it returns status processing, poll /getTaskResult using clientKey and taskId until it completes. Handle failed status and errorId before reading result.
Try the request against your page.
Use the dashboard playground to inspect output and cost before putting a scraper into production.
