WebPerception API: Quickstart Guide — From Zero to Web Data in 5 Minutes
Target keyword: "web scraping API quickstart" (1,200/mo) + "web scraping API tutorial" (1,900/mo)
Word count: ~1,600
---
You have an AI agent that needs to see the web. Maybe it monitors competitor prices, extracts product data, or takes screenshots for visual QA. The problem? Building reliable web scraping infrastructure is a nightmare.
WebPerception API gives your agent eyes on the web — scraping, extraction, and screenshots through three simple endpoints. No browser farms. No proxy rotation. No headless Chrome configs.
Here's how to go from zero to structured web data in under 5 minutes.
Step 1: Get Your API Key (Free)
Sign up at mantisapi.com — the free tier gives you 100 API calls per month. No credit card required.
Once you have your key, set it as an environment variable:
export MANTIS_API_KEY="your-api-key-here"
Step 2: Scrape Your First Page
The /scrape endpoint returns clean, structured content from any URL.
import requests
response = requests.post(
"https://api.mantisapi.com/scrape",
headers={"Authorization": f"Bearer {MANTIS_API_KEY}"},
json={"url": "https://news.ycombinator.com"}
)
data = response.json()
print(data["content"]) # Clean text/markdown content
print(data["metadata"]) # Title, description, links
That's it. One call. No Puppeteer setup, no proxy configuration, no CAPTCHA handling. WebPerception handles all of that behind the scenes.
What You Get Back
{
"content": "Clean markdown or text content of the page...",
"metadata": {
"title": "Hacker News",
"description": "...",
"url": "https://news.ycombinator.com",
"links": ["https://...", "https://..."],
"statusCode": 200
}
}
Step 3: Extract Structured Data with AI
The /extract endpoint is where it gets powerful. Instead of writing CSS selectors or regex patterns, you describe what you want in plain English.
response = requests.post(
"https://api.mantisapi.com/extract",
headers={"Authorization": f"Bearer {MANTIS_API_KEY}"},
json={
"url": "https://example.com/products/widget-pro",
"prompt": "Extract the product name, price, rating, and number of reviews"
}
)
data = response.json()
print(data["extracted"])
Output
{
"extracted": {
"product_name": "Widget Pro",
"price": "$49.99",
"rating": 4.7,
"num_reviews": 1243
}
}
No selectors. No XPath. No breaking when the site redesigns. The AI extraction adapts to any page layout.
Step 4: Take Screenshots
The /screenshot endpoint captures full-page or viewport screenshots — perfect for visual monitoring, QA, or archiving.
response = requests.post(
"https://api.mantisapi.com/screenshot",
headers={"Authorization": f"Bearer {MANTIS_API_KEY}"},
json={
"url": "https://mantisapi.com",
"fullPage": True
}
)
# Save the screenshot
with open("screenshot.png", "wb") as f:
f.write(response.content)
Use cases:
- Visual regression testing — compare screenshots before/after deploys
- Competitor monitoring — track pricing page changes visually
- Compliance archiving — snapshot pages for legal/regulatory records
Step 5: Build an Agent with WebPerception
Here's a real-world example: a competitive intelligence agent that monitors competitor pricing daily.
import requests
import json
MANTIS_API_KEY = "your-api-key"
COMPETITORS = [
"https://competitor-a.com/pricing",
"https://competitor-b.com/pricing",
"https://competitor-c.com/pricing"
]
def check_competitor_prices():
results = []
for url in COMPETITORS:
response = requests.post(
"https://api.mantisapi.com/extract",
headers={"Authorization": f"Bearer {MANTIS_API_KEY}"},
json={
"url": url,
"prompt": "Extract all pricing tiers with plan name, monthly price, and key features"
}
)
results.append({
"url": url,
"pricing": response.json()["extracted"]
})
return results
# Run daily via cron, send results to Slack/email
prices = check_competitor_prices()
print(json.dumps(prices, indent=2))
Three competitors. Three API calls. Structured pricing data. No scraping infrastructure to maintain.
Pricing
| Plan | Calls/Month | Price | Per Call |
|------|------------|-------|---------|
| Free | 100 | $0 | $0 |
| Starter | 5,000 | $29/mo | $0.0058 |
| Pro | 25,000 | $99/mo | $0.0040 |
| Scale | 100,000 | $299/mo | $0.0030 |
Overage: $0.005 per additional call on any paid plan.
Using WebPerception with Popular Frameworks
LangChain
from langchain.tools import tool
import requests
@tool
def web_scrape(url: str) -> str:
"""Scrape a webpage and return its content."""
response = requests.post(
"https://api.mantisapi.com/scrape",
headers={"Authorization": f"Bearer {MANTIS_API_KEY}"},
json={"url": url}
)
return response.json()["content"]
@tool
def web_extract(url: str, query: str) -> dict:
"""Extract structured data from a webpage using natural language."""
response = requests.post(
"https://api.mantisapi.com/extract",
headers={"Authorization": f"Bearer {MANTIS_API_KEY}"},
json={"url": url, "prompt": query}
)
return response.json()["extracted"]
OpenAI Function Calling
tools = [
{
"type": "function",
"function": {
"name": "web_scrape",
"description": "Scrape a webpage and return clean content",
"parameters": {
"type": "object",
"properties": {
"url": {"type": "string", "description": "URL to scrape"}
},
"required": ["url"]
}
}
},
{
"type": "function",
"function": {
"name": "web_extract",
"description": "Extract structured data from a webpage",
"parameters": {
"type": "object",
"properties": {
"url": {"type": "string", "description": "URL to extract from"},
"prompt": {"type": "string", "description": "What data to extract"}
},
"required": ["url", "prompt"]
}
}
}
]
What's Next?
Sign up free — 100 calls/month, no credit card
Read the API docs — full endpoint reference
Join the community — share what you're building, get help from other agent developers
---
WebPerception API is built by Mantis — web perception infrastructure for AI agents. Give your agents eyes on the web.