---
name: scrape-anything
description: Agent handbook for W4-C05 Scrape-Anything (https://scrape.fastmesh.dev) — multi-tier adaptive structured extraction across embedded JS (__NEXT_DATA__/__NUXT__/JSON-LD/OG), complex rowspan/colspan HTML tables, pure-stream binary PDFs (FlateDecode + /AcroForm), recursive robots.txt/sitemapindex/RSS/Atom XML, and binary .xlsx/CSV spreadsheets with strict JSON Schema validation, multi-hop SSRF protection, anti-fake-200 zero-billing, Remote /mcp, and 0%-commission treg hub.
---

# Scrape-Anything (`scrape.fastmesh.dev`) — Agent Integration Skill

> **Hard Guarantees**: Public-only non-intrusive extraction (zero CAPTCHA/login bypass) · Strict caller-defined JSON Schema validation · Multi-hop DNS/IP SSRF firewall (`HTTP 422`, `$0`) · Anti-fake-200 content gate (`$0` on Cloudflare/Turnstile/hCaptcha/reCAPTCHA/DataDome/PerimeterX/login walls/soft-404s/blank SPA shells) · Adaptive `7d-30d` SQLite WAL archive cache (`10%` same-tenant repeat rate, zero poisoning) · Canonical 64-char `receipt_sha256` · **Zero customer data resale & zero model training**.

## Integration Surfaces & Pricing

| Surface | Endpoint / Tool ID | Protocol & Pricing |
| :--- | :--- | :--- |
| **Remote MCP Server** | `https://scrape.fastmesh.dev/mcp` | JSON-RPC 2.0 (`initialize`, `tools/list`, `tools/call`: `scrape_extract`, `scrape_table`, `scrape_pdf`, `scrape_sitemap`, `scrape_spreadsheet`, `scrape_batch`) |
| **REST + OpenAPI 3.1** | `https://scrape.fastmesh.dev/openapi.json` | `POST /v1/extract` (alias `/v1/scrape`), `POST /v1/sitemap`, `POST /v1/batch`, `GET /v1/pricing`, `GET /health` |
| **treg hub (`0%` Commission)** | `scrape-anything-verified-extract` | `$0.015` (`15,000` micros) verified hit; `$0` on miss, fake-200, schema fail, or SSRF `422` |
| **Causal Bazaar Public Card** | `c05_scrape_anything_verified_extract_v1` | `is_public=1`, `price_micros: 15000` (`$0.015`), strict `$0`-on-miss settlement |
| **Prepaid Credit Packs (Creem)** | `https://scrape.fastmesh.dev/#pricing` | `$15` Starter (1,000 hits) / `$59` Growth (5,000 hits, `$0.0118`) / `$199` Scale (20,000 hits, `$0.00995`), `$0/mo` recurring, never expire |

---

## 1. Calling via REST API (`POST /v1/extract`, `/v1/sitemap`, `/v1/batch`)

### A. Single Extraction With Strict JSON Schema (`$0.015` verified / `$0` on mismatch or block)

Always pass a tight `json_schema` and `max_cost_micros` so your agent pays ONLY when required fields are present and properly typed:

```bash
curl -fsSL -X POST "https://scrape.fastmesh.dev/v1/extract" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.python.org/3/",
    "format_hint": "auto",
    "json_schema": {
      "type": "object",
      "required": ["title"],
      "properties": {
        "title": { "type": "string", "minLength": 2 }
      }
    },
    "tenant_id": "agent_default",
    "allow_cache": true,
    "max_cost_micros": 15000
  }'
```

Inline extraction is also supported for private HTML tables, XML, CSV, or base64-encoded binary PDF / `.xlsx` documents (`content_text` or `content_base64` + `content_type` + `format_hint`):

```bash
curl -fsSL -X POST "https://scrape.fastmesh.dev/v1/extract" \
  -H "Content-Type: application/json" \
  -d '{
    "content_text": "sku,price_usd\nSTARTER,15.0\nGROWTH,59.0",
    "content_type": "text/csv",
    "format_hint": "spreadsheet",
    "json_schema": {
      "type": "object",
      "required": ["rows"],
      "properties": {
        "rows": { "type": "array", "minItems": 1 }
      }
    }
  }'
```

### B. Recursive Sitemap, `robots.txt` & RSS/Atom Discovery (`POST /v1/sitemap`, `$0.010`)

```bash
curl -fsSL -X POST "https://scrape.fastmesh.dev/v1/sitemap" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://docs.python.org/robots.txt",
    "include_pattern": "/3/library/",
    "max_urls": 50,
    "max_depth": 2
  }'
```

### C. Concurrent Batch Extraction With Hard Spend Ceiling (`POST /v1/batch`)

```bash
curl -fsSL -X POST "https://scrape.fastmesh.dev/v1/batch" \
  -H "Content-Type: application/json" \
  -d '{
    "items": [
      { "url": "https://docs.python.org/3/" },
      { "url": "https://pypi.org/" }
    ],
    "json_schema": {
      "type": "object",
      "required": ["title"],
      "properties": { "title": { "type": "string", "minLength": 1 } }
    },
    "tenant_id": "agent_batch_01",
    "max_cost_micros": 30000
  }'
```

---

## 2. Calling via Remote `/mcp` (JSON-RPC 2.0)

Exposed flat tools: `scrape_extract`, `scrape_table`, `scrape_pdf`, `scrape_sitemap`, `scrape_spreadsheet`, `scrape_batch`.

```bash
# 1. Discover tools
curl -fsSL -X POST "https://scrape.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# 2. Extract structured JSON via MCP
curl -fsSL -X POST "https://scrape.fastmesh.dev/mcp" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": 2,
    "method": "tools/call",
    "params": {
      "name": "scrape_extract",
      "arguments": {
        "url": "https://docs.python.org/3/",
        "json_schema": {
          "type": "object",
          "required": ["title"],
          "properties": { "title": { "type": "string", "minLength": 1 } }
        }
      }
    }
  }'
```

---

## 3. Calling via `treg hub` (`0%` Seller Commission)

```bash
# Verified structured extraction ($0.015 on verified schema-passing hit; $0 on miss/fake-200/schema-fail/SSRF)
treg call scrape-anything-verified-extract --data '{
  "mode": "extract",
  "url": "https://docs.python.org/3/",
  "json_schema": {
    "type": "object",
    "required": ["title"],
    "properties": { "title": { "type": "string", "minLength": 1 } }
  }
}'

# Recursive sitemap / robots.txt / RSS discovery
treg call scrape-anything-verified-extract --data '{
  "mode": "sitemap",
  "url": "https://docs.python.org/robots.txt",
  "max_urls": 50,
  "max_depth": 2
}'
```

---

## 4. Safe Agent Handling of `$0` Blocked, Fake-200, Schema-Fail & SSRF Responses

Autonomous agents MUST follow these rules when inspecting responses from `scrape.fastmesh.dev`:

1. **Fake-200 / CAPTCHA / Login Wall (`ok: false`, `blocked_reason != null`, `billed_micros: 0`)**:
   - **STOP immediately for that URL.** NEVER attempt to solve, bypass, or evade a CAPTCHA, Cloudflare Turnstile challenge, WAF gate, or login wall.
   - Report the block cleanly to the user or switch to an official public API/feed/alternative public source. Confirm `billed_micros === 0` so no retry budget was lost.
2. **Strict JSON Schema Mismatch (`ok: false`, `schema_valid: false`, `billed_micros: 0`)**:
   - Inspect `validation_errors` (exact JSON paths) to distinguish target layout drift from an overly strict schema.
   - Do NOT ingest partial or unvalidated data into production databases.
3. **SSRF Firewall Rejection (`HTTP 422`, `blocked_reason: "ssrf_blocked"` or `"ssrf_redirect_blocked"`, `billed_micros: 0`)**:
   - Treat the URL as untrusted (loopback `127.0.0.1`, `[::1]`, RFC 1918, `169.254.169.254`, `file://`, or malicious redirect hop). Do not retry.
4. **Encrypted PDF (`ok: false`, `blocked_reason: "encrypted_pdf"`, `billed_micros: 0`)**:
   - Request an unencrypted public version from the user; never attempt password cracking.
5. **Same-Tenant Cache Optimization (`cache_hit: true`, `billed_micros: 1500`)**:
   - Reuse a consistent `tenant_id` with `allow_cache: true` to benefit from `10%` repeat refresh pricing (`$0.0015`) on unchanged pages; pass `allow_cache: false` only when fresh live updates are strictly required.

---

## 5. Response Schema Reference

Every `/v1/extract` response returns:
- `ok` (bool), `status` (int: `200` or `422`)
- `format_detected` (`js_embedded` | `html_table` | `pdf` | `sitemap_xml` | `spreadsheet`)
- `schema_valid` (bool), `validation_errors` (list of JSON path strings)
- `blocked_reason` (string or `null`)
- `billed_micros` (int >= 0; strictly `0` on any miss/fake-200/schema-fail/SSRF), `upstream_cost_micros` (int)
- `cache_hit` (bool), `billing_tier` (string)
- `receipt_sha256` (64-char hex SHA-256 provenance digest)
- `data` (schema-validated structured JSON object/array), `markdown` (clean Markdown text)

Operations & Privacy Contact: `ops@fastmesh.dev` · Full Technical Library: `https://scrape.fastmesh.dev/seo_geo/` · Machine Index: `https://scrape.fastmesh.dev/llms.txt`
