Use SnapAPI as a tool in LangChain, OpenAI, or Claude tool calling. Your agent gets structured page understanding — type, CTA, tech stack, and optional snapshot — not just raw HTML.
# Get tool definition
curl "https://snapapi.tech/v1/tool"
# Analyze a page (structured intelligence)
curl "https://snapapi.tech/v1/analyze?url=https://example.com" \
-H "x-api-key: YOUR_KEY" | jq '{page_type, primary_cta, technologies, word_count}'import requests
def snapapi_analyze(url: str, screenshot: bool = False) -> dict:
"""Analyze a webpage — returns page type, CTA, technologies, and structure."""
params = {"url": url}
if screenshot:
params["screenshot"] = "true"
response = requests.get(
"https://snapapi.tech/v1/analyze",
params=params,
headers={"x-api-key": "YOUR_KEY"}
).json()
return {
"page_type": response.get("page_type"),
"primary_cta": response.get("primary_cta"),
"technologies": response.get("technologies", []),
"word_count": response.get("word_count"),
"screenshot": response.get("screenshot", "") # base64 if requested
}
# Use with LangChain, OpenAI function calling, etc.
result = snapapi_analyze("https://stripe.com")
print(result["page_type"]) # "landing"
print(result["primary_cta"]["text"]) # "Start now"// OpenAI function calling tool definition
const tools = [{
type: "function",
function: {
name: "analyze_webpage",
description: "Analyze a webpage — returns page type, primary CTA, technologies, word count, and optional visual snapshot",
parameters: {
type: "object",
properties: {
url: { type: "string", description: "URL to analyze" },
screenshot: { type: "boolean", description: "Include visual snapshot (base64)" }
},
required: ["url"]
}
}
}];
// When agent calls the tool
async function analyze_webpage({ url, screenshot = false }) {
const params = new URLSearchParams({ url });
if (screenshot) params.set("screenshot", "true");
const res = await fetch(
"https://snapapi.tech/v1/analyze?" + params,
{ headers: { "x-api-key": "YOUR_KEY" } }
);
return await res.json();
}