Mercury · Structured Extract
GET /buy/extract
What it does
TYPED structured extract for autonomous agents — URL + schema → a clean, type-safe JSON record. Where /buy/fetch returns page TEXT (and ?extract= returns string-only fields), THIS returns the schema-conformant object an LLM/RAG/trading pipeline actually consumes: pass ?url=…&schema=title,price:number,rating:number,inStock:boolean and get back { title:"…", price:19.99, rating:4.5, inStock:true } — numbers as numbers, booleans as booleans, absent fields null (honest). `schema` accepts the URL-friendly compact form (field[:type], type in string|number|integer|boolean) OR a Firecrawl/OpenAI-style JSON-Schema object ({"properties":{"price":{"type":"number"}}}). That is Firecrawl's paid 'JSON mode' headline guarantee — type-safety, 'numbers as numbers not strings' — done DETERMINISTICALLY from the page's own JSON-LD/OpenGraph/meta/microdata: keyless, NO LLM call, NO API key, NO signup, $0.004/call, paid in-band over HTTP 402 (x402, USDC on Base mainnet). The typed record is folded into the SIGNED provenance attestation too (EIP-191, ecrecoverable OFFLINE), so a buyer can prove the EXTRACTED FIELDS — not just raw bytes — are exactly what MERCURY resolved. Honest charge-per-ATTEMPT: every call returns a structured result (success OR an ok:false reason). Same SSRF guard, 5s timeout, 10MB cap, no mint.
The goal it serves: turn a page into a typed record an agent can act on, with the signed receipt proving the fields are exactly what Mercury resolved from the source — deterministic, keyless, no LLM.
Schemas & output preview
Input schema — the exact request shape the route validates.
{
"type": "object",
"properties": {
"url": {
"type": "string",
"maxLength": 2048,
"description": "the page to extract from (http/https)"
},
"schema": {
"type": "string",
"maxLength": 1024,
"description": "fields to extract. COMPACT: comma list of field[:type] (type in string|number|integer|boolean, default string), e.g. title,price:number,rating:number,inStock:boolean. OR a JSON-Schema string ({\"properties\":{\"price\":{\"type\":\"number\"}}}). Resolved from JSON-LD/OpenGraph/meta/microdata."
},
"format": {
"type": "string",
"enum": [
"text",
"markdown"
],
"description": "optional: text (default) or markdown for the page-text field"
}
},
"required": [
"url",
"schema"
],
"additionalProperties": false
}Output schema — the exact response shape the handler returns.
{
"type": "object",
"properties": {
"ok": {
"type": "boolean",
"description": "true on success; false on an honest failure (still delivered)"
},
"url": {
"type": "string",
"description": "final URL after redirects"
},
"status": {
"type": "integer",
"description": "upstream HTTP status"
},
"extract": {
"type": "object",
"description": "the TYPED record: each requested field resolved + coerced to its declared type (numbers as numbers, booleans as booleans), absent fields null. Deterministic, keyless, no LLM.",
"additionalProperties": {
"type": [
"string",
"number",
"boolean",
"null"
]
}
},
"schema": {
"type": "object",
"description": "echo of the resolved field->type map that was applied",
"additionalProperties": {
"type": "string"
}
},
"coerced": {
"type": "array",
"description": "names of the fields that were actually type-cast (present only when non-empty)",
"items": {
"type": "string"
}
},
"title": {
"type": "string",
"description": "page <title>"
},
"text": {
"type": "string",
"description": "cleaned page text (also returned; markdown if ?format=markdown)"
},
"bytes": {
"type": "integer",
"description": "raw body size"
},
"contentType": {
"type": "string"
},
"truncated": {
"type": "boolean"
},
"redirects": {
"type": "array",
"items": {
"type": "string"
},
"description": "redirect chain followed"
},
"fetchedAt": {
"type": "string",
"description": "ISO timestamp of the fetch (also in the signed attestation)"
},
"metered": {
"type": "boolean"
},
"delivered": {
"type": "string"
},
"kind": {
"type": "string"
},
"error": {
"type": "string",
"description": "present only when ok:false"
},
"attestation": {
"type": "object",
"description": "EIP-191 provenance receipt over the page text + the typed extract record (canonical key order), ecrecoverable OFFLINE (key at /.well-known/mercury-attestation). Proves the FIELDS are genuine + untampered.",
"properties": {
"keyId": {
"type": "string"
},
"alg": {
"type": "string"
},
"address": {
"type": "string"
},
"contentHash": {
"type": "string"
},
"nonce": {
"type": "string"
},
"signedAt": {
"type": "string"
},
"signature": {
"type": "string"
},
"verify": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"howTo": {
"type": "string"
}
}
}
}
}
},
"required": [
"ok",
"url"
],
"additionalProperties": false
}Output preview — a real example response, shown free (you only pay when you call the route).
{
"ok": true,
"url": "https://example.com/",
"status": 200,
"title": "Example Domain",
"extract": {
"title": "Example Domain",
"price": null,
"inStock": null
},
"schema": {
"title": "string",
"price": "number",
"inStock": "boolean"
},
"contentType": "text/html; charset=utf-8",
"truncated": false,
"attestation": {
"keyId": "mercury-x402-attestation-v1:0x<signer>",
"alg": "EIP-191-personal_sign",
"address": "0x<signer-from-/.well-known/mercury-attestation>",
"contentHash": "0x<sha256 of text+extract>",
"nonce": "0x<16-random-bytes>",
"signedAt": "2026-06-03T00:00:00.000Z",
"signature": "0x<65-byte EIP-191 signature>",
"verify": {
"message": "mercury-x402:fetch-attestation:v1\nurl=https://example.com/\nstatus=200\nsha256=0x…\nfetchedAt=2026-06-03T00:00:00.000Z\nnonce=0x…",
"howTo": "EIP-191 ecrecover this message; signer must equal address. Recompute sha256(text+extract)==contentHash."
}
}
}Pay & call
Your agent calls the route; the 402 challenge carries the exact price ($0.004, USDC on Base mainnet); the x402 client settles via the CDP facilitator and retries. No key, no signup.
import { wrapFetchWithPayment } from "x402-fetch";
const pay = wrapFetchWithPayment(fetch, account); // viem account holding a little USDC on Base
const res = await pay("https://network.mercury-hq.com/buy/extract?url=https://example.com&schema=id:integer,name,price:number");
const out = await res.json(); // the result + `attestation` (the signed receipt)Prepaid alternative — the same route accepts an API key:
# Same route, prepaid API-key rail (Bearer mk_live_…) — get a key at https://network.mercury-hq.com/developers
curl -H "Authorization: Bearer mk_live_YOURKEY" "https://network.mercury-hq.com/buy/extract?url=https://example.com&schema=id:integer,name,price:number"Verify the receipt
Recover the EIP-191 signature over sha256(content)‖url‖status‖fetchedAt‖nonce and confirm the signer equals the pinned attestation key 0xACB40253BD71Bb9a5d491b2c6EFF755F2A33Fc75 (published at /.well-known/mercury-attestation). No callback to Mercury — the receipt verifies offline, forever. Verification is always free: POST the receipt to /x402/verify or run ecrecover yourself.
| Fact | Value |
|---|---|
| Attestation signer (pinned) | 0xACB40253BD71Bb9a5d491b2c6EFF755F2A33Fc75 |
| Key published at | /.well-known/mercury-attestation |
| Live verifier (free) | /x402/verify |
| Settlement | real USDC on Base mainnet (eip155:8453) via CDP — auditable on BaseScan |
Related
Cited Feed
$0.005Cited Links
$0.005Cited Metadata
$0.006Cited Table
$0.006More: all services · /catalog · the headline web-fetch · agent twin of this page: GET /university/docs/extract?format=md