# `harvest_page_structures` — Auto-Harvest Tables, Repeating Cards & Metadata

> Part of [DOM Harvest & Table Grid Edge API](https://dom-harvest.apikeg.com/llms.txt) (`com.apikeg/dom-harvest`)

Zero-selector structural HTML harvester: extracts canonical/OpenGraph/Twitter metadata, Schema.org JSON-LD, normalized 2D tables (resolving multi-header rowspan/colspan merges + cell links), and repeating sibling card collections across 100-500 items without truncation.

**Why call instead of DIY:** Compresses 250KB+ noisy DOMs by >90% tokens without dropping items 21-500 or misaligning colspan/rowspan financial columns; runs deterministically in <20ms at $0.002.

- **REST Endpoint:** `POST https://dom-harvest.apikeg.com/v1/harvest-page-structures`
- **MCP Server:** `https://dom-harvest.apikeg.com/mcp` (tool: `harvest_page_structures`)
- **Pricing:** $0.002 USD per HTML page structure harvest (x402 instant micropayment)
- **Free Dry-Run:** `POST https://dom-harvest.apikeg.com/v1/harvest-page-structures?dry_run=true`

## Input JSON Schema
```json
{
  "type": "object",
  "properties": {
    "html": {
      "type": "string",
      "minLength": 1,
      "maxLength": 4000000,
      "description": "Raw HTML page or fragment to tokenize and harvest into structured JSON."
    },
    "baseUrl": {
      "type": "string",
      "maxLength": 2048,
      "description": "Optional origin/page URL used to resolve relative href, src, canonical, and OpenGraph URLs."
    },
    "includeMatrix": {
      "type": "boolean",
      "default": true,
      "description": "Include the resolved 2D string matrix alongside typed row records on each extracted table."
    },
    "minCollectionItems": {
      "type": "integer",
      "default": 3,
      "minimum": 2,
      "maximum": 50,
      "description": "Minimum repeating sibling cards required to emit an auto-detected repeatingCollection."
    }
  },
  "required": [
    "html"
  ],
  "additionalProperties": false
}
```

## Examples
### Harvest merged financial table and product cards
```bash
curl -X POST "https://dom-harvest.apikeg.com/v1/harvest-page-structures" \
  -H "Content-Type: application/json" \
  -d '{"baseUrl":"https://shop.example.com/catalog","includeMatrix":true,"minCollectionItems":3,"html":"<html><head><title>Catalog</title></head><body><table><thead><tr><th rowspan='2'>Region</th><th colspan='2'>Q1 2026</th></tr><tr><th>Revenue</th><th>Growth</th></tr></thead><tbody><tr><td>NA</td><td>$1,200,000</td><td>18%</td></tr></tbody></table></body></html>"}'
```
Expected output: Returns metadata, jsonLd, normalized tables with 'Q1 2026 / Revenue' typed numeric rows, repeatingCollections, and token-reduction metrics.
