Remulous Labs › UCRLens › API vs. FBI data
Guide · Crime dataHow to get FBI crime data by city
There are two practical ways to work with FBI UCR crime statistics at the city level: download and decode the FBI's raw Return A (RETA) master file yourself, or call one normalized API. This page compares them honestly so you can pick the right one.
Short answer
The FBI RETA file is public, so decoding it yourself is viable for a one-time pull of a single year. But for anything ongoing — many cities, per-100k rates, or multi-year trends — the fixed-width parsing, agency-code mapping, and rate math become a recurring chore, and a normalized API like UCRLens is the cheaper path. The dividing line is how many cities and years you need, and whether you want rates and trends ready-computed.
Why the raw FBI file is hard to use
The data is public, but it ships as a fixed-width master record built for archival, not for querying.
Fixed-width master format
RETA is a positional record — offense counts, population, and agency identifiers are packed into fixed character positions you must decode against the published layout.
Agency codes, not city names
Records are keyed by ORI agency identifiers, not city names. You map thousands of agency codes to the cities they cover before you can answer "what about Dayton?"
Monthly counts, no rates
Offenses arrive as monthly submissions. You sum them into annual totals and compute per-100k rates from the agency's submitted population yourself.
Uneven reporting
Not every agency reports every year, so coverage is patchy. You have to track which city-years are present and how complete a given submission was.
Side by side
Parsing the FBI RETA master file yourself vs. calling the UCRLens API.
| Parse FBI files yourself | UCRLens API | |
|---|---|---|
| Format | Fixed-width master record, decode by position. | Clean JSON per city, state, or nation. |
| Geography | ORI agency codes; map to cities yourself. | Query by city + state directly. |
| Offenses | Monthly counts; roll up yourself. | All 8 Part I offenses, annualized rollups. |
| Rates | Compute per-100k from population yourself. | rate_per_100k precomputed on every offense. |
| Trends | Stitch multiple yearly files together. | Up to 8 years in one /v1/crime/trends call. |
| Provenance | You track which file version each row came from. | data_source field identifies the file version. |
| Upfront cost | Build a fixed-width parser and code map first. | Minutes — get a key and query. |
| Best when | One-time pull of a single year. | Many cities, ready-computed rates and trends. |
What the API call looks like
"Crime stats for Dayton, OH in 2024" — one request instead of decoding a fixed-width file.
Dayton, OH — 2024
curl -X GET "https://us-city-crime-statistics-fbi-ucr17.p.rapidapi.com/v1/crime/city?city=Dayton&state=OH&year=2024" \
-H "X-RapidAPI-Key: YOUR_KEY_HERE" \
-H "X-RapidAPI-Host: us-city-crime-statistics-fbi-ucr17.p.rapidapi.com"See the full request examples (cURL, JavaScript, Python) and the OpenAPI spec ↗ on the UCRLens page.
Frequently asked questions
Where does city-level FBI crime data come from?
It comes from the FBI's Uniform Crime Reporting (UCR) program. Local law enforcement agencies submit monthly offense counts to the FBI, which compiles them into the Return A (RETA) master file — the official federal source for city-level Part I crime data. The file is released as a fixed-width master record covering thousands of agencies, not as a queryable service.
Can I parse the FBI RETA master file myself?
Yes, the data is public. But the RETA master file is a fixed-width record format with agency identifiers, monthly counts, and population figures packed into positional fields — you must decode the layout, map agency codes to cities, sum monthly counts into annual totals, and compute per-100k rates from the submitted population yourself. Coverage also varies by year because not every agency reports every year.
What is the advantage of a crime data API over the raw FBI files?
A crime data API like UCRLens turns the RETA master file into clean JSON you query by city, state, or nation. It returns all 8 Part I offenses with both raw counts and per-100k rates already computed, exposes multi-year trends in one call, and carries a data_source field identifying the file version. You skip the fixed-width parsing, agency-code mapping, and rate math entirely.
How do I get crime statistics for a specific city?
Query by city and state. With UCRLens that is GET /v1/crime/city?city=Dayton&state=OH&year=2024, which returns violent and property rollups plus all 8 Part I offenses with counts and per-100k rates. From the raw RETA file you would locate the agency records for that city, sum the monthly figures, and compute rates against the submitted population yourself.