# PDF to Structured JSON Extractor

> PDF to Structured JSON Extractor is a paid API for AI agents from doc-json.agent-utils.workers.dev, paid per call via x402, $0.02/call, status unknown (last checked 2026-09-15).

Fetches a remote PDF by URL and returns clean structured JSON including full text, per-page text, page count, byte count, and metadata — pay-per-call via x402.

## Facts

- Endpoint: GET https://doc-json.agent-utils.workers.dev/v1/pdf
- Price: $0.02/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/pdf-to-structured-json-extractor-8bcf52f7
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_NEGWeN1H7Bbc_Tx13Ne_j

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 pdf-to-structured-json-extractor-8bcf52f7
```

Example prompt: Can you fetch the PDF at https://example.com/report.pdf and extract all the text from it, page by page, so I can read through the content?

## When to prefer this

Choose this endpoint when you need to extract structured, machine-readable text and metadata from a remote PDF without managing your own PDF parsing infrastructure. It is ideal for AI agents that need per-page text access, want to detect scanned PDFs before attempting OCR, or need PDF metadata alongside content. It requires no API key — just an x402-compatible micropayment — making it suitable for pay-as-you-go agentic workflows.

## Known failure modes

- URL is not a valid or accessible PDF — returns non-200 HTTP status or content-type mismatch
- PDF is scanned/image-only — hasText returns false, text is empty
- PDF exceeds maxChars limit — text is truncated and truncated flag is set to true
- Network timeout fetching the remote PDF — returns error response
- pageFrom/pageTo out of range — may return empty perPage array or error
- Payment not completed via x402 — request rejected before processing

## How this service works

Web pages, PDFs and feeds turned into clean structured JSON for AI agents: metadata, schema.org data, tables, headings, readable text, per-page PDF text, feed items. Pay per call over x402, no API key.

## Output

Returns a JSON object with: the resolved URL, full concatenated text, per-page text array (each with page number, text, and char count), total page count, byte size, character count, PDF metadata (e.g. producer, format version), fetch timestamp, HTTP status, content type, response latency in ms, hasText flag (false = scanned/image PDF needing OCR), and a truncated flag if the text was capped at maxChars.

## 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",
     "required": [
      "url"
     ],
     "properties": {
      "url": {
       "type": "string",
       "format": "uri",
       "description": "Absolute http(s) URL of the PDF"
      },
      "pageTo": {
       "type": "integer",
       "minimum": 1
      },
      "maxChars": {
       "type": "integer",
       "default": 200000,
       "maximum": 500000,
       "minimum": 1000
      },
      "pageFrom": {
       "type": "integer",
       "minimum": 1,
       "description": "First page to return (1-based)"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object",
     "properties": {
      "url": {
       "type": "string"
      },
      "text": {
       "type": "string"
      },
      "bytes": {
       "type": "integer"
      },
      "chars": {
       "type": "integer"
      },
      "pages": {
       "type": "integer"
      },
      "status": {
       "type": "integer"
      },
      "hasText": {
       "type": "boolean",
       "description": "false means a scanned PDF: OCR needed"
      },
      "perPage": {
       "type": "array",
       "items": {
        "type": "object",
        "properties": {
         "page": {
          "type": "integer"
         },
         "text": {
          "type": "string"
         },
         "chars": {
          "type": "integer"
         }
        }
       }
      },
      "finalUrl": {
       "type": "string"
      },
      "metadata": {
       "type": "object"
      },
      "fetchedAt": {
       "type": "string"
      },
      "truncated": {
       "type": "boolean"
      },
      "responseMs": {
       "type": "integer"
      },
      "contentType": {
       "type": "string"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
  "text": "Dummy PDF file",
  "bytes": 13264,
  "chars": 14,
  "pages": 1,
  "status": 200,
  "hasText": true,
  "perPage": [
   {
    "page": 1,
    "text": "Dummy PDF file",
    "chars": 14
   }
  ],
  "finalUrl": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
  "metadata": {
   "Producer": "OpenOffice.org 2.1",
   "PDFFormatVersion": "1.4"
  },
  "fetchedAt": "2026-09-06T21:30:00.000Z",
  "truncated": false,
  "responseMs": 320,
  "contentType": "application/pdf"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/pdf-to-structured-json-extractor-8bcf52f7/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from doc-json.agent-utils.workers.dev](https://www.zero.xyz/host/doc-json.agent-utils.workers.dev/llms.txt)
