Extract Rent Roll Data From PDFs With Python
Extract rent roll PDFs into typed Python rows, preserve printed values and source evidence, and flag missing data and totals that need review.


A rent roll PDF arrives with nine units across two pages. One tenant name wraps onto a second line, the column header repeats on page two, two units are vacant, one occupied unit has a blank square-footage cell, and the last row prints property totals. If your extraction code turns the blank into zero, drops the leading zero from unit 0201, or counts the page subtotal as a unit, the totals can still look plausible and nothing errors out.
This guide builds a Python pipeline that extracts that rent roll with Unsiloed and produces typed unit rows you can defend. Printed text and available per-field citations stay in the saved API response, alongside the typed CSV output. Blank values can have no citation. Missing and unusual values go to a review file instead of being guessed, and the rows are reconciled against the totals printed on the report. Our earlier article on audit-ready financial data extraction explains why rent rolls need confidence scores and citations. This one is the working code.
TLDR:
- Ask the API for every cell exactly as printed, then convert to
Decimal,intanddatein your own code, so a blank never becomes0and0201never becomes201. - Enable citations explicitly.
enable_citationsdefaults tofalseon/v2/extract. - Poll with a deadline, honor
Retry-Afteron429and503, and resume a timed-out job by its ID instead of resubmitting. - Check relationships per row: occupied units need a tenant and rent, vacant units shouldn't have either, and subtotal or header rows must never become units.
- Reconcile against printed totals only when every contributing value is present. Otherwise, report the total as not computable and list the units that block it.
Decide the Record Grain Before You Write the Schema
A rent roll is a point-in-time report, so every row in the output carries the report date. This example uses one row per unit, with base market and contract rent as monthly amounts. If your rent rolls list several charge lines per unit (CAM, parking, storage), choose one row per charge instead and key it on unit plus charge code. Mixing the two grains in one table is how charges get double counted.
The example extracts these fields:
| Field | Printed example | Typed as | Why it stays separate |
|---|---|---|---|
unit |
0201 |
str |
Leading zeroes are part of the ID |
tenant |
Bluebird Tax Services |
str or None |
Blank means vacant or missing, and the status field tells you which |
status |
Occupied |
str |
Drives which other fields are required |
sqft |
1,000 |
int or None |
A blank is not zero square feet |
lease_start, lease_end |
02/01/2022, MTM |
date or None |
Text such as MTM is kept, not converted into a date |
market_rent, contract_rent |
3,000.00, 0.00 |
Decimal or None |
0.00 can mean free rent, while a blank means no value |
Generate a Synthetic Rent Roll With the Hard Cases
Download the Python project, unpack it, enter the rent-roll-python directory, and run:
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python make_sample.py
python -m unittest -v
make_sample.py uses ReportLab to write sample/rent-roll.pdf and sample/expected.json. The property, tenants and amounts are invented, and the page footer says so. The document contains the layouts that break row extraction:
- A tenant name that wraps onto a second line (unit 102)
- A column header repeated at the top of page two
- Two vacant units with blank tenant, lease and contract rent cells
- A free-rent unit printed as
0.00(unit 105) - A month-to-month lease printed as
MTM(unit 104) - An occupied unit with a blank square-footage cell (unit 0202)
- An occupied unit whose lease end is before the report date (unit 0204)
- A page subtotal row and a property total row
The printed property total of 11,950 square feet includes unit 0202, even though that row's cell is blank. That happens when a report total comes from the property management system rather than from the visible rows, and it gives the reconciliation step a gap to catch.
Write a Schema That Asks for Printed Values
The schema in rent-roll-schema.json requests every cell as a string, exactly as printed. Type conversion happens later, in code you can test. That split keeps formatting the model would otherwise have to interpret: 0201 stays 0201, 0.00 stays distinct from a blank, and MTM arrives as text instead of as a guessed date.
This abridged excerpt shows two fields; use the complete schema in the download:
"units": {
"type": "array",
"description": "One record per unit row in the rent roll table, across every page. A tenant name that wraps onto a second line belongs to the same unit. Exclude repeated column header rows, page subtotal rows and property total rows.",
"items": {
"type": "object",
"properties": {
"unit": {"type": "string", "description": "Unit or suite ID exactly as printed, keeping leading zeroes such as 0201"},
"contract_rent": {"type": "string", "description": "Monthly contract rent exactly as printed, including commas and decimals. A printed 0.00 stays 0.00. Empty string if the cell is blank"}
},
"required": ["unit", "contract_rent"],
"additionalProperties": false
}
}
The full schema also covers tenant, status, square footage, both lease dates and market rent, plus a printed_totals object for the values on the property total row. The schema reference requires "type": "object" at the root and "additionalProperties": false at every object level, and the field descriptions do most of the work of telling the model which rows count as units.
Submit the Rent Roll and Poll With a Deadline
/v2/extract is asynchronous. The POST returns a job_id, and you poll GET /extract/{job_id} until the status is completed, review or failed. The Extract API reference lists enable_citations with a default of false, so the client sets it explicitly. Without it, the default gamma tier still returns the nested score shape, but grounding_score is 0.0 and citation is null.
The capacity and backpressure guide says a 429 or 503 is rejected before a job is created, so resubmitting after Retry-After can't duplicate work. A network error during the POST is different: the job may already exist, so the client raises instead of retrying. Polling is bounded by a deadline (abridged from rentroll/client.py):
def wait(self, job_id, timeout=300, poll_every=5, max_transient_errors=3):
deadline = self.clock() + timeout
transient_errors = 0
while True:
delay = poll_every
try:
response = self.session.get(f"{self.base_url}/extract/{job_id}",
headers=self.headers, timeout=30)
except (requests.ConnectionError, requests.Timeout) as exc:
transient_errors += 1
if transient_errors > max_transient_errors:
raise ExtractionError(f"Polling job {job_id} kept failing: {exc}") from exc
response = None
if response is not None:
if response.status_code in (429, 503):
delay = max(poll_every, _retry_after(response, poll_every))
elif response.status_code >= 500:
transient_errors += 1
if transient_errors > max_transient_errors:
raise ExtractionError(f"Polling job {job_id} returned HTTP {response.status_code} repeatedly")
elif response.status_code != 200:
raise ExtractionError(f"Polling job {job_id} failed with HTTP {response.status_code}")
else:
transient_errors = 0
job = response.json()
status = str(job.get("status", "")).lower()
if status in ("completed", "review"):
if not isinstance(job.get("result"), dict):
raise ExtractionError(f"Job {job_id} is {status} but has no result")
return job
if status == "failed":
raise ExtractionError(f"Job {job_id} failed: {job.get('error') or 'no detail'}")
if status not in ("queued", "processing"):
raise ExtractionError(f"Job {job_id} returned unknown status {status!r}")
if self.clock() + delay > deadline:
raise JobTimeout(job_id, timeout)
self.sleep(delay)
A JobTimeout means your deadline passed, not that the job failed. It carries the job ID, and run.py extract ... --job-id <id> resumes polling the same job. A review status returns the result for inspection, and the pipeline treats the whole run as needing review.
Run the extraction with your key in UNSILOED_API_KEY or in a .env file. The client reads the key without printing it, and run.py replaces the presigned file_url before saving the response:
python run.py extract sample/rent-roll.pdf rent-roll-schema.json output/raw-response.json
What a Rent Roll Row Looks Like in the Response
Each array item comes back with per-property value, score and nullable citation fields, as the job results reference describes. This is unit 0202 from our live run, trimmed to three fields:
{
"unit": {
"value": "0202",
"score": {"grounding_score": 0.98, "extraction_score": 0.99},
"citation": {"bbox": [42, 120, 68, 131], "page": 2, "page_width": 792.0, "page_height": 612.0}
},
"sqft": {
"value": "",
"score": {"grounding_score": 0.0, "extraction_score": 0.98},
"citation": null
},
"contract_rent": {
"value": "3,800.00",
"score": {"grounding_score": 0.98, "extraction_score": 0.99},
"citation": {"bbox": [612, 120, 653, 132], "page": 2, "page_width": 792.0, "page_height": 612.0}
}
}
In all three of our runs, a blank cell came back as an empty string with citation: null and a grounding_score of 0.0, because there is nothing on the page to point to. That is observed behavior on this fixture rather than a documented guarantee, so the code handles None and "" the same way. The bbox is [left, top, right, bottom] in PDF points with a top-left origin. We drew every returned box from the first two runs onto the rendered pages, and each one sat on the cell it cites.
Convert Printed Strings Into Typed Rows Without Guessing
rentroll/normalize.py converts each string with a small parser that either returns a typed value, returns None for a blank, or raises. It never rounds, swaps characters or fills in a default:
AMOUNT = r"(?:\d{1,3}(?:,\d{3})+|\d+)(?:\.\d{2})?"
MONEY = re.compile(rf"^(?:\(\$?\s*{AMOUNT}\)|-?\$?\s*{AMOUNT})$")
def parse_money(raw):
"""'3,450.00' -> Decimal('3450.00'); '(450.00)' -> Decimal('-450.00'); '' -> None."""
text = raw.strip()
if not text:
return None
if not MONEY.match(text):
raise ParseError("money_not_numeric", raw)
negative = text.startswith("(") or "-" in text
digits = text.strip("()").replace("$", "").replace(",", "").replace("-", "").strip()
return -Decimal(digits) if negative else Decimal(digits)
A value like 3,4S0.00, which OCR can produce from a smudged 5, raises money_not_numeric. The row keeps contract_rent = None, and an issue records the raw text, page and bounding box. Dates accept MM/DD/YYYY and ISO only, so 31/01/2027 raises. The parser assumes month-first dates: 01/02/2027 becomes January 2 even if the source meant February 1. Configure the date format per source system before adapting this example to day-first reports. MTM becomes lease_end = None with lease_end_open = True and a review item. If the API returns a number where the schema asked for a string, the row gets an unexpected_type error rather than a conversion that could drop a leading zero.

Keep Tenant, Unit and Vacancy Relationships Intact
A rent roll row ties a tenant, a unit and an amount together, so the checks run per row rather than per column. rentroll/validate.py applies these rules:
- Occupied units need a tenant, lease start, contract rent and square footage. A missing value becomes
missing_<field>. - A printed
0.00contract rent on an occupied unit becomeszero_contract_rent. It might be a free-rent period, so it goes to review rather than being treated as an error or as missing. - Vacant units with a tenant name or a nonzero contract rent become
vacant_with_tenantorvacant_with_contract_rent. This catches a tenant name that slid onto the wrong row. - A lease end before the report date on an occupied unit becomes
lease_end_before_report_date. The rent roll may reflect a holdover or a renewal that hasn't been recorded, and a person checks which. - A unit ID that reads like a header or total row (
Unit,Page 1 Subtotal) is an error, as is a blank unit ID, which is what a wrapped tenant name looks like when it splits into its own row. - A repeated unit ID flags every copy as
duplicate_unit.
These rules flag rows. They don't decide whether a lease or tenant is acceptable for any purpose.
Route Missing and Low-Confidence Data to Review
Two evidence checks run on every non-blank value. An extraction_score below the review threshold (0.90 by default, set with --review-below) becomes low_extraction_score, and a value with no page citation becomes no_citation. Treat 0.90 as a starting point to tune on your own documents. Our article on confidence score thresholds covers how to choose one.
Process the saved response:
python run.py process output/raw-response.json output/
On our live run, every non-blank value scored 0.99 and carried a citation, so no item was routed for low confidence. Five items went to review for content reasons, and review.csv lists them:
unit,field,code,severity,raw,page,page_source,bbox
104,lease_end,lease_end_open_ended,review,MTM,1,field,"[462, 165, 488, 176]"
105,contract_rent,zero_contract_rent,review,0.00,1,field,"[612, 181, 636, 194]"
0202,sqft,missing_sqft,review,,2,row,
0204,lease_end,lease_end_before_report_date,review,04/30/2026,2,field,"[462, 154, 513, 164]"
,total_sqft,reconciliation_not_computable,review,"11,950",,,
A blank cell has no citation of its own, so the 0202 item falls back to the page where that row's other values were cited and marks page_source as row. A reviewer can open page 2 and look at the unit 0202 row without searching the document. rows.csv keeps typed values beside their raw_* columns and row-level cited pages. Per-value boxes and scores stay in raw-response.json, so retain both files for an extraction audit trail.
Reconcile Extracted Rows Against Printed Totals
Most rent rolls print totals, which gives you an independent check on the extracted rows. The pipeline compares six metrics: total, occupied and vacant unit counts, total square footage, total market rent, and total contract rent from occupied units. The rule that makes the reconciliation defensible is that a total is compared only when every value contributing to it is present:
def _sum(rows, field, include):
"""Sum a field over included rows. None means the sum is not computable."""
total, missing = Decimal("0"), []
for row in rows:
if not include(row):
continue
if row.get(field) is None:
missing.append(row["raw"].get("unit"))
else:
total += row[field]
return total, missing
If missing is not empty, the result is not_computable and the blocking units are listed. Summing blanks as zero would have reported a 1,300 square foot mismatch on this fixture and pointed the reviewer at the wrong problem. Vacant units don't contribute to contract rent, so their blank contract rent cells don't block that total. Comparisons use Decimal with a tolerance of zero by default.

A match is evidence, not proof. If one contract rent is read 90.00 too high and another 90.00 too low, the total still matches. The test suite includes that case to document the limit. Row checks and citations still matter when every total agrees.
What the Live Runs Returned
We ran the example against the production API on November 9, 2026, with the default gamma tier and citations enabled:
| Run | Input | Status | Rows matching the fixture as printed | Review items |
|---|---|---|---|---|
| 1 | Generated PDF with a text layer | completed |
9 of 9 | 5 |
| 2 | Same pages rasterized at 150 DPI, rotated 0.8 degrees, with noise and no text layer | completed |
9 of 9 | 5 |
| 3 | Generated PDF, polling used a 4-second budget, then resumed with --job-id |
completed |
9 of 9 | 5 |
In each run, the wrapped tenant name came back as one value on unit 102, the repeated header and both total rows were excluded from units, 0201 kept its leading zero, and the printed totals matched the fixture. Server-side processing took between 43 and 50 seconds per job, based on the created_at and updated_at timestamps. The raw responses are in the download, with the presigned file URL removed.
These are three runs on one small synthetic document. They show that the pipeline works end to end and that the checks fire where they should. They don't measure accuracy on your rent rolls, and a different run or document can return different values. Test on a representative set of your own reports, with expected values written by hand, before relying on the output.
Limitations of This Example
- The fixture is a clean, two-page commercial rent roll. Reports from property systems can run to hundreds of units, merge several properties, split one unit across charge lines, or print totals per building. Long tables are where multi-page extraction gets harder, so test on your longest reports.
- Requesting strings moves type conversion into your code. That makes the conversion testable, but you have to maintain parsers for every date and number format your property managers use.
- Status handling only knows
OccupiedandVacant. Notice-to-vacate, model, down or non-revenue units go to review asunknown_statusuntil you add rules for them. - Reconciliation checks the rows against the report's own totals. It doesn't check the rent roll against leases, ledgers or operating statements, and a matching total can hide offsetting errors.
- A score and a citation route attention. Neither confirms that a value is correct, and neither replaces a person checking flagged items against the page.
- The pipeline describes the data. It doesn't evaluate a property, lease or tenant, and it isn't an input to investment, lending or underwriting decisions without your own review process.
For a general walkthrough of the same request-and-poll pattern on other documents, see how to convert a PDF to structured JSON with Python.
FAQ
Why ask for rent roll values as strings instead of numbers?
Strings keep what was printed. A number type would turn 0201 into 201 and could turn a blank into 0, and both look valid downstream. Requesting strings and converting them in Python lets you test each conversion, keep the original text beside the typed value, and send anything unparseable to review.
How do I handle vacant units in rent roll extraction?
Keep vacant units as rows with blank tenant, lease and contract rent fields stored as None, not zero. Count them in unit totals, include their market rent, and leave them out of the contract rent total. Flag any vacant unit that has a tenant name or contract rent, because that often means a value landed on the wrong row.
What should happen when a rent roll total doesn't reconcile?
If a value needed for the total is missing, report the total as not computable and list the units that block it. If every value is present and the total still differs, report the difference and review the cited rows. Don't adjust a row to force the total to match.
Sign up for Unsiloed to run this example against your own rent rolls.



