# GET /extract: $0.005 per call

Fetch any public web page and get back clean Markdown, the page title and all links as JSON. Pass the page address as ?url=https://... Scripts, styles, menus and other clutter are removed. Built for AI agents that need to read the web. Private or internal addresses are blocked. Pages over 2 MB or slower than 10 seconds are rejected and you are not charged.

- **Price:** $0.005 in USDC, the same on Base, Solana, Polygon, Arbitrum. Failed calls are never charged.
- **Free trial:** yes, 20 free calls a day from Claude, Cursor or any MCP client ([set-up](/mcp/setup)).
- **Answers cached for:** 10 min
- **Data sources:** the web
- **Lane:** Documents & web ([OpenAPI](/openapi/documents.json))
- **Live health:** [status page](/status)

## Free sample

See an answer for the demo input first, free (no payment, 10 a minute): [https://aayatai.com/sample/extract](/sample/extract). It is a stored real answer when we have one, otherwise an example marked `"kind": "illustrative"`.

```bash
curl "https://aayatai.com/sample/extract"
```

## 1. See the price (free)

Call it without paying: you get `402 Payment Required` and a `PAYMENT-REQUIRED` header with the exact price and where to pay.

```bash
curl -i "https://aayatai.com/extract?url=https%3A%2F%2Fexample.com"
```

## 2. Pay and call (TypeScript)

```bash
npm install @x402/fetch @x402/evm viem
```

```ts
import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

// A wallet used only by your agent, holding a little USDC on Base.
const account = privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`);
const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(account) }],
});

const res = await pay("https://aayatai.com/extract?url=https%3A%2F%2Fexample.com");
console.log(await res.json());
```

## 3. Or as an MCP tool

```ts
// MCP server: https://aayatai.com/mcp (Streamable HTTP). With the x402 MCP client (see /start):
const result = await client.callTool("extract", {"url":"https://example.com"});
```

## Inputs

- `url` **(required)** (string): Full http(s) address of a public web page.

Bad inputs are rejected with HTTP 400 before any payment is asked for.

## Example answer

```json
{
  "url": "https://example.com/",
  "title": "Example Domain",
  "markdown": "# Example Domain\n\nThis domain is for use in illustrative examples in documents...",
  "links": [
    {
      "text": "More information...",
      "href": "https://www.iana.org/domains/example"
    }
  ]
}
```

## Related

- [GET /markdown](/services/markdown) ($0.005): Turn any document URL into clean Markdown for LLMs: web pages, PDFs, Word (.docx), Excel (.xlsx/.xls), OpenDocument, CSV, XML and plain text, up to 10 MB.
- [GET /markdown/rendered](/services/markdown-rendered) ($0.02): Read JavaScript-heavy web pages (single-page apps, React/Vue sites, dashboards) as clean Markdown: the page is loaded in a real headless browser, scripts run, t
- [POST /extract-json](/services/extract-json) ($0.03): AI structured extraction: give a URL (web page, PDF, Word, Excel...) or text plus your own JSON Schema, get back JSON that fits it.

New here? [Getting started in 60 seconds](/start). All services: [Aayat AI](/).