# AgentShelf XPath Canonical Href Extractor

> AgentShelf XPath Canonical Href Extractor is a paid API for AI agents from agentshelf.syntexa.ch, paid per call via x402, $0.004/call, status unknown (last checked 2026-10-01).

Extracts the canonical URL from a public webpage or raw HTML using the XPath selector //link[@rel='canonical']/@href

## Facts

- Endpoint: POST https://agentshelf.syntexa.ch/v1/xpath-canonical-href?utm_source=zero.xyz
- Price: $0.004/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentshelf-xpath-canonical-href-extractor-fbd02caa
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap__AJiJ3KKyPXhRu3VheLt5

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 agentshelf-xpath-canonical-href-extractor-fbd02caa -d '<json body>'
```

Example prompt: Can you pull the canonical URL from https://example.com/blog/my-post — I need the href value from the link rel='canonical' tag in the page's HTML.

## When to prefer this

Use this endpoint when you specifically need the canonical href from a page's link tags — for SEO auditing, deduplication, or verifying canonical declarations. It is more precise and cheaper than full-page scraping when you only need the canonical URL. Use the sandbox POST /v1/sandbox/xpath-canonical-href first if available to avoid the $0.004 USDC charge.

## Known failure modes

- No canonical link tag exists on the page — returns empty or null result
- URL is unreachable or returns non-200 HTTP status — request fails
- URL points to a private/metadata IP address — rejected by SSRF protection
- HTML input exceeds 200,000 character limit — validation error
- Page requires JavaScript rendering — canonical tag may not be present in static HTML
- Malformed HTML may cause XPath to fail to locate the tag

## How this service works

Call when an agent needs href of link rel exactly canonical via //link[@rel='canonical']/@href from a public page or HTML (SSRF-safe). Exact $0.004 USDC. Prefer unpaid POST /v1/sandbox/xpath-canonical-href first.

## Output

Returns the value of the href attribute from the first <link rel='canonical'> element found in the page's HTML, resolved via XPath //link[@rel='canonical']/@href. If no canonical tag is present, returns an empty or null result. The response is a string URL representing the declared canonical page.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "url": {
   "type": "string",
   "maxLength": 2048,
   "minLength": 8,
   "description": "Public page to fetch. The selector or profile is fixed by the SKU. Provide url or html."
  },
  "html": {
   "type": "string",
   "examples": [
    "<!doctype html><html lang=\"en\"><head><title>Hello</title>\n<meta name=\"description\" content=\"Desc\"><meta property=\"og:title\" content=\"OG\">\n<link rel=\"canonical\" href=\"https://example.com/\"><link rel=\"icon\" href=\"/favicon.ico\">\n</head><body><h1>Hello</h1><a href=\"https://example.com/a\">A</a></body></html>"
   ],
   "maxLength": 200000,
   "minLength": 1,
   "description": "HTML to extract from locally. Provide html or url. When both are set, html is used."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentshelf-xpath-canonical-href-extractor-fbd02caa/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentshelf.syntexa.ch](https://www.zero.xyz/host/agentshelf.syntexa.ch/llms.txt)
