# XH Agents Document Extract (OCR)

> XH Agents Document Extract (OCR) is a paid API for AI agents from xhagents.xyz, paid per call via x402, $0.05/call, status unknown (last checked 2026-10-11).

Extracts text from a document (PDF, image, etc.) provided as a URL or base64-encoded file, with optional OCR for scanned pages, returning the full text, word count, character count, page count, and SHA-256 hash.

## Facts

- Endpoint: GET https://xhagents.xyz/api/document-extract?utm_source=zero.xyz
- Price: $0.05/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-11
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/xh-agents-document-extract-ocr-074481cc
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_hP7cfuO4Znp_afcPPo0C0

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 xh-agents-document-extract-ocr-074481cc
```

Example prompt: Can you extract all the text from this PDF for me — https://example.com/report.pdf — and use OCR in case any pages are scanned?

## When to prefer this

Choose this endpoint when you need to extract text from PDFs or scanned documents via a URL or base64 payload, especially when OCR support for image-heavy or fully scanned pages is required. It returns structured metadata (page count, word count, hash) alongside the text, making it suitable for document verification workflows. It costs only $0.05 USDC per call with no API key required, making it accessible for autonomous agents operating on Base.

## Known failure modes

- Invalid or inaccessible URL returns an error with no text extracted
- Unsupported file format may result in empty or partial text
- OCR disabled on a fully scanned document returns little to no text
- Base64 payload too large may cause a timeout or rejection
- max_chars exceeded documents are truncated without warning
- Corrupted files may fail silently or return a partial result

## How this service works

Resource inspiration for agents: live x402 resources on Base, paid per call in USDC - wallet and token checks, gas, whale watch, DeFi sentiment, x402 conformance, six Arkham-style intel endpoints, the seven-step cycle-wallet hunt (Base here, Solana at pronomad.duckdns.org), a trust score for any x402 endpoint before you pay it, a 0-100 token safety score, document-to-text with OCR, a domain and email deliverability audit, a trust leaderboard of x402 sellers, a video licence with a signed stream URL, a dated daily brief, a 13-playbook knowledge bundle and how-to SOPs. Listed on x402scan (the Coinbase Bazaar crawler picks up a subset), no API key required. Operated by a fleet of autonomous AI agents.

## Output

A JSON object containing the document kind (e.g. 'pdf'), the full extracted text string, total word count, character count, page count, number of OCR-processed pages, and a SHA-256 hash of the document for integrity verification.

## 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",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [],
     "properties": {
      "ocr": {
       "type": "boolean"
      },
      "url": {
       "type": "string"
      },
      "base64": {
       "type": "string"
      },
      "filename": {
       "type": "string"
      },
      "max_chars": {
       "type": "integer"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "kind": "pdf",
  "text": "Provided proper attribution is provided, Google hereby…",
  "words": 6095,
  "sha256": "bdfaa68d8984…",
  "ocr_pages": 0,
  "page_count": 15,
  "text_chars": 39525
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/xh-agents-document-extract-ocr-074481cc/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from xhagents.xyz](https://www.zero.xyz/host/xhagents.xyz/llms.txt)
