# web.document

Read a public PDF: its text page by page in reading order, Markdown, tables as rows and columns, and its metadata.

PDF document, one of the Web scrapers.

| | |
| --- | --- |
| Id | `web.document` |
| Version | 1 |
| Billed per | request — 1 unit for a charged run |
| Runs | within one request |

Start it with `POST /v1/scrapers/web.document/runs`. How runs work is in [Running a scraper](https://docs.enrichednow.com/running-a-scraper.md); what a run costs is in [Usage and units](https://docs.enrichednow.com/usage-and-units.md).

## Inputs

The fields of `input`. A field that is not listed here is refused.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `url` | string | yes | The PDF's address: http or https, on a public host name. Limit: at most 2048 characters. |
| `max_pages` | integer | no | Read the first this many pages. A longer document is read that far and `truncated` says so. Limit: 1 to 500. Default: `100`. |
| `ocr` | boolean | no | Read scanned pages that have no text layer with OCR (English; the first ten such pages of the document). False lists them in `unread_scans` without reading them, which is faster. Default: `true`. |
| `timeout_s` | number | no | Seconds for the whole run: fetching the file and reading it. Limit: 15 to 120. Default: `60`. |

## Record fields

Every record of a run has these fields. A value that is not known is `null` — never an empty string and never `0`.

| Field | Type | Notes |
| --- | --- | --- |
| `url` | string | The address that was asked for. |
| `final_url` | string | The address that answered, after redirects. |
| `status` | integer | The HTTP status of the answer. |
| `content_type` | string or null | The media type the server named, e.g. application/pdf; servers also send PDFs as application/octet-stream. |
| `bytes` | integer | The file's size in bytes. |
| `sha256` | string | The SHA-256 of the file, to tell whether it changed since a previous read. |
| `title` | string or null | The title in the file's metadata. |
| `author` | string or null | The author in the file's metadata. |
| `subject` | string or null | The subject in the file's metadata. |
| `keywords` | string or null | The keywords in the file's metadata, as written. |
| `creator` | string or null | The program the document was made with, from the metadata (e.g. Microsoft Word). |
| `producer` | string or null | The program that wrote the PDF, from the metadata. |
| `created_at` | string (date-time) or null | When the file says it was created. |
| `modified_at` | string (date-time) or null | When the file says it was last changed. |
| `pdf_version` | string or null | The PDF version the file declares, e.g. 1.7. |
| `page_count` | integer | Pages in the document. |
| `pages_read` | integer | Pages read: all of them, or the first `max_pages`. |
| `encrypted` | boolean | True when the file is encrypted but opens without a password (an owner password that restricts printing or copying). A file that needs a password to open is not read. Default: `false`. |
| `tagged` | boolean | True when the file declares itself tagged (structured for screen readers). Default: `false`. |
| `restrictions` | array of string | What the file's owner does not allow, as its permission flags say: `print`, `modify`, `copy_text`, `annotate`, `fill_forms`, `accessibility`, `assemble`, `print_high_quality`. Empty when everything is allowed (a file that is not encrypted). Reported, not acted on: the file is read either way. |
| `markdown` | string | The pages read, as Markdown: headings, paragraphs, lists and tables. |
| `text_length` | integer | Characters of text in the pages read (each page has its own `word_count`). |
| `pages` | array of object | Each page read, with its text in reading order. |
| `pages[].number` | integer | The page number, from 1. |
| `pages[].width` | number | The page's width in points (1/72 inch). |
| `pages[].height` | number | The page's height in points. |
| `pages[].text` | string | The page's text in reading order, one line of the page per line. |
| `pages[].text_source` | "text" \| "ocr_layer" \| "ocr" \| "none" | Where the text comes from. `text`: the page's own text (on a scan that was not read, only what is printed over it, such as a stamp). `ocr_layer`: a scanned page whose file carries a hidden text layer made by OCR, read as it is. `ocr`: a scanned page we read with OCR. `none`: no text (a blank page, or a scan that was not read). |
| `pages[].scanned` | boolean | True when the page is an image of a page (a scan): images cover at least half of it and it shows almost no text of its own, or its text is a hidden OCR layer. |
| `pages[].ocr_confidence` | number or null | For a page we read with OCR: the engine's mean confidence in its words, 0 to 100. |
| `pages[].image_cover` | number | The share of the page covered by images, 0 to 1. |
| `pages[].word_count` | integer | Words in `text`. |
| `tables` | array of object | The tables read from the pages, in page order, each with its `confidence` (`high` only when every label, heading and figure was placed without a guess) and its `issues`. |
| `tables[].page` | integer | The page it is on, from 1. |
| `tables[].header` | array of string or null | The column headings, one per column (null for a column without one); null when the table shows none. Headings written on several lines are joined. |
| `tables[].rows` | array of array of string | The rows, top to bottom, one cell per column as the page writes it ("$ 36,034", "(1,984)", "—"); null for an empty cell. A row with only its first cell is a section label, such as "Assets:". |
| `tables[].bbox` | array of number | Its box on the page in points, [x0, y0, x1, y1], measured from the bottom left corner. |
| `tables[].confidence` | "high" \| "low" | `high` when every row's label, every heading and every figure was placed without a guess. `low` when one was not, or when no heading was found (`issues` says which): check a `low` table against the page before using its numbers. Default: `"high"`. |
| `tables[].issues` | array of string | What could not be placed with certainty, each making the table `low`: `figures_joined` (two figures in one cell), `signs_apart` (signs not joined to their figures), `figures_in_labels`, `words_in_figures` (words among the figures, such as a form's lines read across its boxes), `labels_missing` (no column of labels was found), `labels_uncertain` (a label alone on its line could head the rows below or go on in the next), `heading_unplaced` (which columns a heading stands over could not be told, or two columns came out under one heading), `header_incomplete` and `no_header` (no column headings were found). And one that is only said: `heading_spans_columns` (a heading over several columns, written over each). |
| `outline` | array of object | The document's outline (its bookmarks), when it has one; the first 500 entries. |
| `outline[].level` | integer | Its depth in the outline, from 1. |
| `outline[].title` | string | The entry's title. |
| `outline[].page` | integer or null | The page it leads to, from 1; null when it leads nowhere in the file. |
| `unread_scans` | array of integer | Scanned pages without a text layer that were not read: OCR was not asked for, the limit of pages read with OCR was reached, or OCR found no text. |
| `unreadable_pages` | array of integer | Pages the document lists but that cannot be loaded (a damaged page tree); they have no entry in `pages`. |
| `truncated` | boolean | True when not every page was read (`max_pages`, or the text limit). Default: `false`. |
| `fetched_at` | string (date-time) | When the file was fetched, in UTC. |

## Example request

It starts a run with this scraper's example input and waits up to 60 seconds for it. The key is read from `ENRICHEDNOW_API_KEY`.

```bash
curl -X POST "https://api.enrichednow.com/v1/scrapers/web.document/runs?wait=60" \
  -H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"url":"https://www.federalreserve.gov/releases/h41/current/h41.pdf","max_pages":1}}'
```

## Example response

The run, once it has ended. A run that has not ended within `wait` comes back with `202` and the status `queued` or `running`.

```json
{
  "id": "run_841742f37553189ff9c27ba1",
  "scraper_id": "web.document",
  "scraper_version": 1,
  "status": "ok",
  "reason": null,
  "input": {
    "url": "https://www.federalreserve.gov/releases/h41/current/h41.pdf",
    "max_pages": 1
  },
  "record_count": 1,
  "units": 1,
  "units_per_request": 1,
  "units_per_record": null,
  "units_per_page": null,
  "diagnostics": {
    "requests": 1,
    "bytes": 259214,
    "wall_ms": 885,
    "facts": {}
  },
  "created_at": "2026-11-16T22:37:50.170950Z",
  "started_at": "2026-11-16T22:37:50.178331Z",
  "finished_at": "2026-11-16T22:37:51.066313Z"
}
```

Its records, from `GET /v1/runs/{id}/records`. The record is a real one: this scraper's own parser read it from a page recorded from the site.

```json
{
  "records": [
    {
      "url": "https://www.federalreserve.gov/releases/h41/current/h41.pdf",
      "final_url": "https://www.federalreserve.gov/releases/h41/current/h41.pdf",
      "status": 200,
      "content_type": "application/pdf",
      "bytes": 190004,
      "sha256": "02b69213c7e62b96d49913bb7372da7b23de10e427eaabb5118652781226b439",
      "title": null,
      "author": null,
      "subject": null,
      "keywords": null,
      "creator": "Microsoft Office Word",
      "producer": "Aspose.Words for .NET 21.3.0",
      "created_at": "2023-03-16T13:38:00Z",
      "modified_at": "2026-10-21T16:04:00Z",
      "pdf_version": "1.7",
      "page_count": 11,
      "pages_read": 1,
      "encrypted": false,
      "tagged": false,
      "restrictions": [],
      "markdown": "# FEDERAL RESERVE statistical release\n\nH.4.1\n\n## Factors Affecting Reserve Balances of Depository Institutions and Condition Statement of Federal Reserve Banks November 19, 2026\n\n1. Factors Affecting Reserve Balances of Depository … [truncated]",
      "text_length": 2085,
      "pages": [
        {
          "number": 1,
          "width": 612,
          "height": 792,
          "text": "FEDERAL RESERVE statistical release\nH.4.1\nFactors Affecting Reserve Balances of Depository Institutions and\nCondition Statement of Federal Reserve Banks November 19, 2026\n1. Factors Affecting Reserve Balances of Depository Institutions … [truncated]",
          "text_source": "text",
          "scanned": false,
          "ocr_confidence": null,
          "image_cover": 0.012,
          "word_count": 344
        }
      ],
      "tables": [
        {
          "page": 1,
          "header": [
            "Reserve Bank credit, related items, and reserve balances of depository institutions at Federal Reserve Banks",
            "Averages of daily figures Week ended Nov 18, 2026",
            "Averages of daily figures Change from week ended Nov 11, 2026"
          ],
          "rows": [
            [
              "Reserve Bank credit",
              "6,705,670",
              "-1,792"
            ],
            [
              "Securities held outright1",
              "6,472,783",
              "+3,620"
            ],
            [
              "U.S. Treasury securities",
              "4,586,939",
              "+3,645"
            ]
          ],
          "bbox": [
            35.2,
            273.9,
            571.7,
            618.1
          ],
          "confidence": "high",
          "issues": [
            "heading_spans_columns"
          ]
        }
      ],
      "outline": [],
      "unread_scans": [],
      "unreadable_pages": [],
      "truncated": true,
      "fetched_at": "2026-11-25T06:04:10.365601Z"
    }
  ],
  "next_cursor": null
}
```

What was done to the record for this page, and nothing else — the API returns every value whole. A text that was cut ends with `… [truncated]`.

- Shortened: `markdown`: 2,513 characters, the first 230 shown.
- Shortened: `pages[0].text`: 2,085 characters, the first 235 shown.
- Shortened: `tables[0].header`: 5 items, the first 3 shown.
- Shortened: `tables[0].rows`: 29 items, the first 3 shown.
- Shortened: `tables[0].rows[0]`: 5 items, the first 3 shown.
- Shortened: `tables[0].rows[1]`: 5 items, the first 3 shown.
- Shortened: `tables[0].rows[2]`: 5 items, the first 3 shown.

A run does not always end `ok`. [Results and statuses](https://docs.enrichednow.com/results-and-statuses.md#reason-codes) lists every status and the reasons every scraper shares; [the reasons of the Web scrapers](https://docs.enrichednow.com/results-and-statuses.md#web) are in their own section there.
