# agent402.tools HTML Link Extractor

> agent402.tools HTML Link Extractor is a paid API for AI agents from agent402.tools, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-13).

Enumerates all hyperlinks in an HTML string, returning each href, anchor text, and rel attribute, with optional base URL resolution and regex filtering.

## Facts

- Endpoint: POST https://agent402.tools/api/html-links
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agent402-tools-html-link-extractor-b9e04198
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_2qPeYPepl3uU1cReuAYCv

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability agent402-tools-html-link-extractor-b9e04198 -d '<json body>'
```

Example prompt: Pull out every link from this HTML and resolve relative hrefs against https://example.com — only return links matching the regex ^https://example\.com/blog, deduplicated, up to 100 results.

## When to prefer this

Use this endpoint when you have raw HTML and need a deterministic, structured list of all outlinks without writing custom regex or DOM parsing code. Ideal for crawling pipelines, link audits, or sitemap extraction where you need href, anchor text, and rel attributes together with optional filtering and relative URL resolution.

## Known failure modes

- HTML string exceeds 5MB limit — returns error
- Invalid regex pattern in filter field — returns parse error
- Malformed base URL — relative hrefs may not resolve correctly
- limit out of range (not 1-1000) — returns validation error
- Empty HTML string — returns empty link list

## How this service works

Enumerate every <a href> in an HTML string with its anchor text and rel attribute. Optionally resolves relative hrefs against a base URL and filters by a regex on the href. The deterministic way to crawl a page's outlinks without writing a regex.

## Output

A list of up to 1000 unique hyperlinks found in the HTML, each with its resolved href, anchor text, and rel attribute value, filtered by any provided regex pattern.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "base": {
   "type": "string",
   "description": "Optional base URL to resolve relative hrefs against"
  },
  "html": {
   "type": "string",
   "description": "Raw HTML string to scan (max 5MB)"
  },
  "limit": {
   "type": "number",
   "description": "Max links to return, 1-1000 (default 200)"
  },
  "filter": {
   "type": "string",
   "description": "Optional regex applied to the href - only matching links are returned"
  },
  "unique": {
   "type": "boolean",
   "description": "Deduplicate by href (default true)"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "count": 2,
  "links": [
   {
    "rel": "",
    "href": "https://agent402.tools/about",
    "text": "About"
   },
   {
    "rel": "",
    "href": "https://example.com/",
    "text": "External"
   }
  ]
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agent402-tools-html-link-extractor-b9e04198/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agent402.tools](https://www.zero.xyz/host/agent402.tools/llms.txt)
