The page is parsed, not invented
DocIR lists blocks on a page. That page index is the citation. Markdown can stay readable without printing a page break on every line, as long as the structured record still has the page.
If the chunker drops the page, no later prompt can reliably recover it.
What the answer should show
Show the source name and the page. If you have a block id, keep it on the citation even if the interface only prints the page.
A quote should be a span of the chunk, not a paraphrase presented as the source. The reviewer compares the quote to that page.
Slides, sheets, and rows
A slide citation is the slide number. A sheet citation is the sheet name and the rows. Do not label those as PDF pages.
The parse should make the unit obvious. DocIR pages cover paged files. A CSV cites a row range instead.
Which number a reviewer can check
DocIR pageIndex starts at 0. For a PDF, pageIndex 0 is the first page in the file, and the file position to print is pageIndex plus 1. A number drawn in the footer can be different, including roman numerals, so keep the file position and do not replace it with the footer.
A PPTX heading already says Slide N, with N starting at 1, and that slide's pageIndex is N minus 1. An XLSX citation is the heading Sheet: plus the sheet title. A CSV citation is the row range inside its single table block.
An image-only PDF page that local OCR could read is a paragraph with confidence 0.5 and the block warning OCR fallback was used for an image-only PDF page. Cite the file position as pageIndex plus 1, and show that warning with the quote. A text-layer paragraph does not carry this confidence value. metadata.pdfPageCount, when the container wrote it, is the number of pages in the file and is not a printed footer.
- Copy pageIndex onto the chunk at parse time.
- Show PDF file position as pageIndex plus 1.
- Show Slide N or Sheet: title for those formats.
- Keep a footer number only as extra text, not as the file position.
The file to send
Send one text-based PDF. The citation a reviewer can check is the source file plus pageIndex + 1. pageIndex 0 is the first page. A printed footer can differ.
A slide citation is the Slide N heading, which starts at 1. A sheet citation is the sheet title and the rows. A CSV citation is the file name and the row range. The DocIR page index on a CSV is not a printed page.
- Store pageIndex on the chunk.
- Quote a span of the chunk, then open that page.
- Read metadata.warnings before you print the citation as clean text.
export DOCPARSE_URL="https://docparse.genedai.me"
export DOCPARSE_API_KEY="your_key"
curl -fsS -X POST \
"$DOCPARSE_URL/v1/parse?wait=true" \
-H "Authorization: Bearer $DOCPARSE_API_KEY" \
-F "file=@document.pdf" \
-F "mode=both" \
-o result.json
jq -r '.result.markdown' result.json
jq '.result.document.schemaVersion, .result.document.pages[0].blockIds' result.json
jq '.result.manifest.decision.route, .result.manifest.parserVersion' result.json
Frequently asked questions
Questions this guide answers
Why are RAG citations missing page numbers?
The chunk was cut without copying pageIndex from the block. The model cannot reconstruct a page the record never stored. Copy pageIndex when the chunk is created.
Should Markdown contain a marker on every page?
Keep pageIndex on the block and on the chunk. Print a marker in Markdown when the reader of that file needs it. The citation a reviewer checks is the structured page index, not a line the model guessed.
What does DocParse store for a citation?
docir.v1 stores pages and blocks. Each block has an id and pageIndex. The container sets parserVersion to cloudflare-docparse-container.0.2.0, and metadata.route plus metadata.warnings sit beside the text.