Home / API docs / Custom Extraction API
Web Content

Custom Extraction API

POST /api/extract/custom $0.01 per call USDC on Base · x402

CUSTOM EXTRACTION — POST {content, schema} and get structured JSON back. Define fields as {"company":"string","total":"number","due_date":"date"} (types or plain-language descriptions) and the engine pulls them from any unstructured text: emails, invoices, job posts, resumes, chat logs. Missing fields return null — never invented. Content up to 16,000 chars, 40 fields max. Parsing a PDF/DOCX/CSV by URL first? GET /api/extract ($0.02).

Parameters

NameInDescription
contentbodyrequiredThe unstructured text to extract from, up to 16,000 characters
schemabodyrequiredFields to extract: {name: type-or-description}. Types: string, number, boolean, date, string[], number[] — or a plain-language description ('the total in USD')
instructionsbodyOptional extra guidance, e.g. 'dates are DD/MM/YYYY in this document'

Example request

curl -X POST "https://api.webbersites.com/api/extract/custom" \
  -H "Content-Type: application/json" \
  -d '{"content":"Hi \u2014 invoice INV-2041 from Acme Corp is attached. Total is $1,284.50, due August 15th. Thanks, Dana","schema":{"company":"string","invoice_number":"string","total":"number","due_date":"date"}}'
# first call returns 402 + payment requirements; an x402 client pays and retries automatically

Example response

{
    "data": {
        "company": "Acme Corp",
        "invoice_number": "INV-2041",
        "total": 1284.5,
        "due_date": "2026-08-15"
    },
    "missing": [],
    "model": "gemini-2.5-flash-lite"
}
MCP tool: post_extract_custom — via npx -y webbersites-x402-mcp (local, key stays on your machine) or the remote endpoint https://api.webbersites.com/mcp.

How payment works

There is no signup and no API key. Call the endpoint; it replies 402 Payment Required with machine-readable payment requirements. Your client signs a USDC transfer authorization (EIP-3009, gasless) and retries with the X-PAYMENT header — @x402/fetch does this automatically. See the overview for a working snippet.