Extract structured data from a web page for an AI agent: the manual method, then one call
When an AI agent needs a few facts from a web page (a company's address, a product price, the date of an event, the key points of an article), the problem is rarely the answer itself. It is the path to it: fetch the HTML, strip the navigation and scripts, find the right block of text, then ask a model to return fields in the shape your code expects.
This guide gives you the manual method first, because it costs nothing and you should know how it works. Then it shows the shortcut.
The manual method (free)
- Open the page and read the target fields by hand. Write down the exact fields you need, with their types:
title: string,price: number,published: date,key_points: string[]. Without a schema, the output will drift from one run to the next. - Get the clean text. In a browser, use reader view or select the main article. From a script, fetch the URL and remove
script,styleandnavelements before reading the text. For PDFs, use a PDF text extractor. - Check the source. Keep the URL and the access date. An extracted value without its source cannot be audited later.
- Validate the output. Check that numbers are numbers, dates parse, and each value appears in the source text. If a value is not in the text, return
nullrather than guessing. - Repeat for each page. This works for a few pages. It becomes fragile at scale because every site has its own layout.
The one-call method
Tolca's extract-url endpoint does steps 2 to 4 in one request. You send a public URL and the fields you want; it returns JSON matching your schema, plus the page title and the source URL.
- Price: 0.03 USD per call, paid in USDC over x402 (Base or Solana), no account.
- Endpoint:
POST https://tolca.tonbot.ca/v1/extract-url - Input:
url(any public HTML article, PDF or JSON page) andschema(field names mapped to a type or a description). Optionalmax_chars(1000 to 60000, default 30000). - Output:
data(your fields), page title, and source.
Example request body:
{
"url": "https://example.com/blog/post",
"schema": {
"title": "string",
"author": "string",
"key_points": "string[]"
}
}
The same capability is available through the MCP endpoint https://tolca.tonbot.ca/mcp/public if your agent framework already speaks MCP.
When to use the manual method instead
- You need the data once, for a single page: read it yourself, it takes less time than setting up a pipeline.
- The page requires a login or is behind a paywall: an extractor should not be used to get around access rules. Check the site's terms first.
- The result feeds a legal or financial decision: always confirm the value against the original page.
Checklist before you ship an extraction step
- The schema lists every field, with a type.
- Missing values return
null, not an invented value. - The source URL is stored next to the data.
- A sample of 10 pages was checked by hand.
Tolca's extraction is one tool among others; the manual method above works with any provider, and it is the baseline to test against.
POST https://tolca.tonbot.ca/v1/verify-business (x402, USDC on Base) · free in Claude or ChatGPT through MCP: https://tolca.tonbot.ca/mcp/public