Docs🌐 WebStructured Data Extractor
POST/api/extract$0.03

🌐 Structured Data Extractor

Point at any URL and define a JSON schema — SparkForge will fetch the page and use Claude Haiku to extract exactly the data fields you specified. Perfect for price monitoring, lead generation, product data extraction, and any scenario where you need structured data from unstructured web content.

Request Body

ParameterTypeRequiredDescriptionDefault
urlstringrequiredURL to fetch and extract data from
schemaobjectrequiredField definitions: { fieldName: 'string' | 'number' | 'boolean' | 'array' | 'object' }
instructionsstringoptionalOptional extraction hints for the AI (e.g. 'extract the main product price')

Response Fields

FieldTypeDescription
dataobjectExtracted data matching your schema
urlstringURL that was fetched
extractedAtstringISO 8601 timestamp of extraction

Code Examples

cURL
bash
curl -X POST https://sparkforge.sh/api/extract \
  -H "Content-Type: application/json" \
  -H "X-PAYMENT: <x402-payment-token>" \
  -d '{
    "url": "https://example.com/product/widget-pro",
    "schema": {
      "name": "string",
      "price": "number",
      "description": "string",
      "in_stock": "boolean"
    },
    "instructions": "Extract main product information from the page"
  }'
Python
python
import requests

response = requests.post(
    "https://sparkforge.sh/api/extract",
    headers={"Content-Type": "application/json", "X-PAYMENT": "<token>"},
    json={
        "url": "https://example.com/product/widget-pro",
        "schema": {
            "name": "string",
            "price": "number",
            "description": "string",
            "in_stock": "boolean"
        },
        "instructions": "Extract the main product details"
    }
)

data = response.json()["data"]
print(f"{data['name']}: ${data['price']} ({'In Stock' if data['in_stock'] else 'Out of Stock'})")
TypeScript / Node.js
typescript
const res = await fetch402("https://sparkforge.sh/api/extract", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    url: "https://example.com/product/widget-pro",
    schema: {
      name: "string",
      price: "number",
      description: "string",
      in_stock: "boolean",
    },
    instructions: "Extract the main product details",
  }),
});

const { data, extractedAt } = await res.json();
console.log(data.name, data.price, data.in_stock);

Example Response

json
{
  "data": {
    "name": "ACME Widget Pro",
    "price": 29.99,
    "description": "A high-quality widget for all your professional needs. Durable, lightweight, and built to last.",
    "in_stock": true
  },
  "url": "https://example.com/product/widget-pro",
  "extractedAt": "2026-02-28T16:00:00.000Z"
}

💳 Payment via x402

This endpoint costs $0.03 per call, paid in USDC on Base, Polygon, or Solana. Use the @x402/fetch library to handle payments automatically, or implement the x402 handshake manually.

bash
# Free demo mode (no payment)
curl https://sparkforge.sh/api/extract?demo=true

# Or try via MCP (Claude Desktop, Cursor, Windsurf)
# Add to mcp config: { "url": "https://sparkforge.sh/api/mcp" }
Previous
AI Smart Summarizer
Next
Crypto News Summarizer