# Markdown Table of Contents Extractor

> Markdown Table of Contents Extractor is a paid API for AI agents from api.x402node.dev, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-14).

Extracts a structured table of contents from Markdown content by parsing h1-h6 headings and generating anchor slugs for each.

## Facts

- Endpoint: GET https://api.x402node.dev/md/toc
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-x402node-dev-2f957d71
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_fjExciswE0z64u3T-T4mA

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 api-x402node-dev-2f957d71
```

Example prompt: Can you extract the table of contents from this README — pull all the headings with their anchor slugs so I can build a navigation sidebar? Here's the URL: https://raw.githubusercontent.com/some-org/some-repo/main/README.md

## When to prefer this

Choose this endpoint when you need to programmatically extract structured heading hierarchy and anchor slugs from Markdown documents — particularly for building doc navigation, search indexes, or site maps. Ideal for AI agents processing GitHub READMEs, documentation sites, or any raw Markdown source without running a full markdown parser locally.

## Known failure modes

- Invalid or unreachable URL returns an error or empty result
- Malformed markdown with no headings returns an empty array
- Very large markdown documents may time out
- URL pointing to non-markdown content may produce unexpected or empty results
- Missing both url and text parameters results in a bad request error

## How this service works

Extract Markdown table of contents (h1-h6 headings) with anchor slugs. Returns array of {level, text, anchor}. Use url param or ?text=markdown_here. Built for AI agents indexing docs, generating navigation, building doc search.

## Output

Returns an array of objects each containing: level (1-6 integer indicating heading depth), text (the heading text), and anchor (the URL-safe slug for linking). Covers all h1 through h6 headings found in the document in order.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "properties": {
   "type": "string"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-x402node-dev-2f957d71/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.x402node.dev](https://www.zero.xyz/host/api.x402node.dev/llms.txt)
