# code-block-extract

> code-block-extract is a paid API for AI agents from intel.rallylive.ca, paid per call via x402, $0.01/call, status unknown (last checked 2026-09-14).

Extracts all code blocks from a webpage, returning each block's language hint, line count, and text content, plus per-language counts.

## Facts

- Endpoint: GET https://intel.rallylive.ca/page/codeblocks
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/code-block-extract-db48595b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_nhsh-I75UhaaiBEVroK4r

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 code-block-extract-db48595b
```

Example prompt: Can you pull all the code blocks from https://docs.example.com/getting-started and tell me what languages they use and how many lines each one has?

## When to prefer this

Choose this endpoint when you need to systematically extract and catalog code examples from documentation pages, blog posts, or tutorials — especially when you want language classification and line counts alongside the raw text. It is purpose-built for documentation mining workflows where structured metadata about each snippet matters, as opposed to generic HTML scraping endpoints that return unstructured page content.

## Known failure modes

- Page URL is unreachable or returns non-200 status — no blocks returned
- Page has no <pre> or <code> elements — empty list returned
- Language hints absent from class names or fences — language reported as unknown or null
- Dynamic/JavaScript-rendered content not captured if page requires JS execution
- Malformed HTML may cause incomplete block parsing

## How this service works

Code block extraction from a page: every <pre>/<code> block with its language hint (from class names or fences), line count and text, plus the counts by language. Mine documentation for examples. $0.01 per page.

## Output

A structured list of every <pre>/<code> block found on the page, each with its detected programming language (from class names or fence markers), line count, and full text content, plus an aggregate count of blocks per language across the page.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "properties": {}
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/code-block-extract-db48595b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from intel.rallylive.ca](https://www.zero.xyz/host/intel.rallylive.ca/llms.txt)
