StructAPI

Structured data extraction from any URL. Send a URL + CSS selectors, get JSON back.

Quickstart

1. Get an API key:

curl -X POST https://structapi.duckdns.org/keys -H "Content-Type: application/json" -d '{}'

2. Extract data:

curl -X POST https://structapi.duckdns.org/extract \
  -H "Content-Type: application/json" \
  -H "X-API-Key: ***" \
  -d '{
    "url": "https://news.ycombinator.com",
    "fields": [
      {"name": "title", "selector": ".titleline a"},
      {"name": "points", "selector": ".score", "multiple": true}
    ]
  }'

Endpoints

POST /keys — Create a new API key
POST /extract — Extract fields using CSS selectors
POST /auto — Auto-detect page structure
GET /usage — Check your API usage
GET /health — Health check

Field Specification

PropertyTypeRequiredDescription
namestringYesKey name in output JSON
selectorstringYesCSS selector to locate elements
attrstringNoAttribute to extract (default: "text")
multiplebooleanNoReturn an array of all matches

Client Examples

Python:

import requests
resp = requests.post("https://structapi.duckdns.org/extract",
    headers={"X-API-Key": "sk-..."},
    json={"url": "https://example.com", "fields": [{"name":"h1","selector":"h1"}]})
print(resp.json())

Node.js:

const resp = await fetch('https://structapi.duckdns.org/extract', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json', 'X-API-Key': 'sk-...' },
  body: JSON.stringify({ url: 'https://example.com', fields: [{ name: 'title', selector: 'h1' }] })
});
console.log(await resp.json());

Pricing

TierRequests/MonthPrice
Free100Free
Starter10,000$29/mo
Pro50,000$99/mo
Scale200,000$299/mo

Proxy tiers (residential IPs, geo-targeting, JS rendering) launch after first 5 paying customers.