You need crime risk by ZIP this week, not a GIS overhaul. By the end of this guide you’ll query one endpoint, pass a ZIP, and get an overall crime grade plus a breakdown of violent, property, and other crime rates you can drop straight into your product.
What you get from the Crime Data By ZipCode API
The Crime Data By ZipCode API returns a JSON object for a given U.S. ZIP code with:
- Overall Crime Grade plus separate grades for Violent, Property, and Other crime.
- Category-level crime rates (e.g., Assault, Robbery, Theft, Vehicle Theft, etc.).
- Totals and scores per category.
- Nearby ZIPs with their grades.
- ZIPs with similar population and their grades.
Common use cases include property search overlays, relocation tools, delivery-service risk filters, and internal safety dashboards. You pass a ZIP and get consistent, structured data you can render immediately.
Getting started on Zyla API Hub
Zyla API Hub gives you one account, one API key, and a subscription + quota model that works across more than 10,000 public APIs. To use this API:
- Open the API page on Zyla API Hub.
- On the listing page, click Subscribe or Start Free Trial (when available) to get your key.
- Call the endpoint with Authorization: Bearer YOUR_API_KEY.
You can start a 7-day trial directly from the listing: Start 7-day trial on Crime Data By ZipCode API. Check the API page for current access options and pricing.
Endpoint you’ll use
This API exposes a single, developer-friendly endpoint.
- Name: Get Crime Rates by ZIP
- Method: GET
- URL: https://zylalabs.com/api/824/crime-data-by-zipcode-api/583/get-crime-rates-by-zip
- Required query parameter: zip (number). Example: 01370
- Auth: Authorization: Bearer YOUR_API_KEY
Quick test with curl
Copy/paste and replace YOUR_API_KEY with your key:
curl -s -X GET "https://zylalabs.com/api/824/crime-data-by-zipcode-api/583/get-crime-rates-by-zip?zip=01370" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response
{"Overall":{"Zipcode":"01370","Overall Crime Grade":"B","Violent Crime Grade":"C-","Property Crime Grade":"B","Other Crime Grade":"B"},"Crime BreakDown":[{"Violent Crime Rates":{"Assault":"2.759","Robbery":"0.4627","Rape":"0.5506","Murder":"0.0218"},"0":{"Total Violent Crime":"3.795","Total Violent Crime Score":"(C-)"}},{"Property Crime Rates":{"Theft":"8.498","Vehicle Theft":"0.6988","Burglary":"1.563","Arson":"0.0619"},"0":{"Total Property Crime":"10.82","Total Property Crime Score":"(B)"}},{"Other Crime Rates":{"Kidnapping":"0.1303","Drug Crimes":"1.553","Vandalism":"3.749","Identity Theft":"0.4203","Animal Cruelty":"0.0490"},"0":{"Total \"Other\" Rate":"5.902","Total \"Other\" Score":"(B)"}}],"Crime Rates Nearby":[{"Nearby Zip":"01338, MA","Overall Crime Grade":"B-","Violent Crime Grade":"D","Property Crime Grade":"B-"},{"Nearby Zip":"01340, MA","Overall Crime Grade":"A-","Violent Crime Grade":"A-","Property Crime Grade":"B"},{"Nearby Zip":"01341, MA","Overall Crime Grade":"A","Violent Crime Grade":"C-","Property Crime Grade":"A"},{"Nearby Zip":"01301, MA","Overall Crime Grade":"C+","Violent Crime Grade":"C-","Property Crime Grade":"C"},{"Nearby Zip":"01330, MA","Overall Crime Grade":"A","Violent Crime Grade":"A-","Property Crime Grade":"A"},{"Nearby Zip":"01346, MA","Overall Crime Grade":"A","Violent Crime Grade":"C","Property Crime Grade":"A"},{"Nearby Zip":"01339, MA","Overall Crime Grade":"A-","Violent Crime Grade":"C","Property Crime Grade":"A"},{"Nearby Zip":"01342, MA","Overall Crime Grade":"A","Violent Crime Grade":"B+","Property Crime Grade":"A+"},{"Nearby Zip":"01376, MA","Overall Crime Grade":"B-","Violent Crime Grade":"C+","Property Crime Grade":"B-"},{"Nearby Zip":"01337, MA","Overall Crime Grade":"A","Violent Crime Grade":"B-","Property Crime Grade":"A"}],"Similar Population Crime Rates":[{"Similar Zip":"34217, FL","Overall Crime Grade":"A-","Violent Crime Grade":"C+","Property Crime Grade":"C+"},{"Similar Zip":"72046, AR","Overall Crime Grade":"F","Violent Crime Grade":"D-","Property Crime Grade":"D-"},{"Similar Zip":"52778, IA","Overall Crime Grade":"B","Violent Crime Grade":"A-","Property Crime Grade":"A-"},{"Similar Zip":"54126, WI","Overall Crime Grade":"A","Violent Crime Grade":"A+","Property Crime Grade":"A+"},{"Similar Zip":"02715, MA","Overall Crime Grade":"A+","Violent Crime Grade":"A-","Property Crime Grade":"A-"},{"Similar Zip":"67025, KS","Overall Crime Grade":"B-","Violent Crime Grade":"B+","Property Crime Grade":"B+"},{"Sim…
What to read from this payload:
- Overall: use Overall Crime Grade and the sub-grades to color a ZIP badge or risk meter.
- Crime BreakDown: read category rates (e.g., Assault, Theft) and the per-category totals and scores.
- Crime Rates Nearby: offer alternative ZIPs with their grades.
- Similar Population Crime Rates: show comparable ZIPs’ grades for context.
Note: numeric rates are returned as strings. Convert to numbers in your code if you need to compute with them.
Python example: fetch grades and key rates
This sample calls the same endpoint, parses the JSON, and extracts grades and a few rate values. Replace YOUR_API_KEY with your key.
import os
import requests
API_KEY = os.getenv("ZYLALABS_API_KEY", "YOUR_API_KEY")
ZIP = "01370"
url = "https://zylalabs.com/api/824/crime-data-by-zipcode-api/583/get-crime-rates-by-zip"
resp = requests.get(url, params={"zip": ZIP}, headers={"Authorization": f"Bearer {API_KEY}"}, timeout=20)
resp.raise_for_status()
data = resp.json()
overall = data.get("Overall", {})
grades = {
"zip": overall.get("Zipcode"),
"overall": overall.get("Overall Crime Grade"),
"violent": overall.get("Violent Crime Grade"),
"property": overall.get("Property Crime Grade"),
"other": overall.get("Other Crime Grade")
}
# Traverse Crime BreakDown to extract a few representative rates
assault = robbery = theft = None
for section in data.get("Crime BreakDown", []):
if "Violent Crime Rates" in section:
v = section["Violent Crime Rates"]
assault = float(v.get("Assault")) if v.get("Assault") is not None else None
robbery = float(v.get("Robbery")) if v.get("Robbery") is not None else None
if "Property Crime Rates" in section:
p = section["Property Crime Rates"]
theft = float(p.get("Theft")) if p.get("Theft") is not None else None
print("Grades:", grades)
print("Key rates:", {"Assault": assault, "Robbery": robbery, "Theft": theft})
# Nearby ZIPs list (first three)
nearby = data.get("Crime Rates Nearby", [])[:3]
print("Nearby:", nearby)
Implementation notes that save time
- Authentication: always send Authorization: Bearer YOUR_API_KEY.
- Input: zip is numeric. Ensure you pass a 5-digit ZIP. If your UI captures ZIP+4, strip the suffix.
- Parsing: fields like “Assault”, “Theft” are strings. Convert to float if needed.
- Caching: cache by ZIP to avoid repeat lookups in the same session. Crime grades change slowly relative to request cadence, so a daily cache is usually sufficient.
- Fallbacks: if a ZIP is missing or returns incomplete breakdowns, display the Overall Crime Grade and Nearby ZIPs as alternatives.
- UI mapping: treat grades (A+ to F) as ordered categories for color scales; don’t assume a linear numeric scale unless you convert explicitly.
- Errors: surface non-2xx responses with the message and ZIP input to your logs. Add client-side input validation for 5-digit ZIPs.
Common patterns and use cases
- Property search: show an Overall Crime Grade badge on listing pages keyed by property ZIP.
- Lead qualification: route sales leads from lower-risk ZIPs to priority queues.
- Logistics: filter delivery windows or add driver alerts using the Violent and Property grades.
- Insurance quoting: incorporate category totals (e.g., Vehicle Theft) into internal risk models.
- Relocation tools: suggest Nearby ZIPs with higher grades as alternatives.
Calling the API from AI agents via MCP
If you use MCP-compatible clients (e.g., Claude Code, Cursor, Windsurf), you can call Zyla APIs through the MCP gateway. Point your client at the MCP endpoint and include your key as configured by your tool. Learn more here: MCP.
The same hub endpoint is reachable through the gateway, so the only change is how your client routes the request and attaches Authorization. Refer to your MCP client’s docs for tool configuration and prompt routing.
End-to-end wiring checklist
- Get an API key from the listing page on Zyla API Hub.
- Validate and normalize the ZIP to a 5-digit numeric string.
- GET https://zylalabs.com/api/824/crime-data-by-zipcode-api/583/get-crime-rates-by-zip with zip and Bearer token.
- Render Overall Crime Grade immediately; lazy-load detailed breakdowns if your UI needs them.
- Offer nearby alternatives using Crime Rates Nearby if the grade is below your threshold.
- Cache responses per ZIP to reduce latency and calls.
FAQ
What parameter does the endpoint require?
Pass zip as a number in the query string, e.g., zip=01370.
How do I authenticate?
Send Authorization: Bearer YOUR_API_KEY in the request headers.
What does the API return?
A JSON object containing overall and category crime grades, detailed rates, nearby ZIP grades, and similar-population ZIP grades.
Are the numeric rates numbers or strings?
They are strings in the payload; cast to float in your code when needed.
How is billing handled?
Zyla uses a subscription + quota model (not pay-per-call). Check the API page for current access options. You can start a 7-day trial on the listing page.
Ready to integrate? Create your account on Zyla API Hub, get your key, and ship your crime-by-ZIP feature using the listing’s endpoint. Start here: Crime Data By ZipCode API.
Official API response
{"Overall":{"Zipcode":"01370","Overall Crime Grade":"B","Violent Crime Grade":"C-","Property Crime Grade":"B","Other Crime Grade":"B"},"Crime BreakDown":[{"Violent Crime Rates":{"Assault":"2.759","Robbery":"0.4627","Rape":"0.5506","Murder":"0.0218"},"0":{"Total Violent Crime":"3.795","Total Violent Crime Score":"(C-)"}},{"Property Crime Rates":{"Theft":"8.498","Vehicle Theft":"0.6988","Burglary":"1.563","Arson":"0.0619"},"0":{"Total Property Crime":"10.82","Total Property Crime Score":"(B)"}},{"Other Crime Rates":{"Kidnapping":"0.1303","Drug Crimes":"1.553","Vandalism":"3.749","Identity Theft":"0.4203","Animal Cruelty":"0.0490"},"0":{"Total \"Other\" Rate":"5.902","Total \"Other\" Score":"(B)"}}],"Crime Rates Nearby":[{"Nearby Zip":"01338, MA","Overall Crime Grade":"B-","Violent Crime Grade":"D","Property Crime Grade":"B-"},{"Nearby Zip":"01340, MA","Overall Crime Grade":"A-","Violent Crime Grade":"A-","Property Crime Grade":"B"},{"Nearby Zip":"01341, MA","Overall Crime Grade":"A","Violent Crime Grade":"C-","Property Crime Grade":"A"},{"Nearby Zip":"01301, MA","Overall Crime Grade":"C+","Violent Crime Grade":"C-","Property Crime Grade":"C"},{"Nearby Zip":"01330, MA","Overall Crime Grade":"A","Violent Crime Grade":"A-","Property Crime Grade":"A"},{"Nearby Zip":"01346, MA","Overall Crime Grade":"A","Violent Crime Grade":"C","Property Crime Grade":"A"},{"Nearby Zip":"01339, MA","Overall Crime Grade":"A-","Violent Crime Grade":"C","Property Crime Grade":"A"},{"Nearby Zip":"01342, MA","Overall Crime Grade":"A","Violent Crime Grade":"B+","Property Crime Grade":"A+"},{"Nearby Zip":"01376, MA","Overall Crime Grade":"B-","Violent Crime Grade":"C+","Property Crime Grade":"B-"},{"Nearby Zip":"01337, MA","Overall Crime Grade":"A","Violent Crime Grade":"B-","Property Crime Grade":"A"}],"Similar Population Crime Rates":[{"Similar Zip":"34217, FL","Overall Crime Grade":"A-","Violent Crime Grade":"C+","Property Crime Grade":"C+"},{"Similar Zip":"72046, AR","Overall Crime Grade":"F","Violent Crime Grade":"D-","Property Crime Grade":"D-"},{"Similar Zip":"52778, IA","Overall Crime Grade":"B","Violent Crime Grade":"A-","Property Crime Grade":"A-"},{"Similar Zip":"54126, WI","Overall Crime Grade":"A","Violent Crime Grade":"A+","Property Crime Grade":"A+"},{"Similar Zip":"02715, MA","Overall Crime Grade":"A+","Violent Crime Grade":"A-","Property Crime Grade":"A-"},{"Similar Zip":"67025, KS","Overall Crime Grade":"B-","Violent Crime Grade":"B+","Property Crime Grade":"B+"},{"Sim…
Official API response
{"Overall":{"Zipcode":"01370","Overall Crime Grade":"B","Violent Crime Grade":"C-","Property Crime Grade":"B","Other Crime Grade":"B"},"Crime BreakDown":[{"Violent Crime Rates":{"Assault":"2.759","Robbery":"0.4627","Rape":"0.5506","Murder":"0.0218"},"0":{"Total Violent Crime":"3.795","Total Violent Crime Score":"(C-)"}},{"Property Crime Rates":{"Theft":"8.498","Vehicle Theft":"0.6988","Burglary":"1.563","Arson":"0.0619"},"0":{"Total Property Crime":"10.82","Total Property Crime Score":"(B)"}},{"Other Crime Rates":{"Kidnapping":"0.1303","Drug Crimes":"1.553","Vandalism":"3.749","Identity Theft":"0.4203","Animal Cruelty":"0.0490"},"0":{"Total \"Other\" Rate":"5.902","Total \"Other\" Score":"(B)"}}],"Crime Rates Nearby":[{"Nearby Zip":"01338, MA","Overall Crime Grade":"B-","Violent Crime Grade":"D","Property Crime Grade":"B-"},{"Nearby Zip":"01340, MA","Overall Crime Grade":"A-","Violent Crime Grade":"A-","Property Crime Grade":"B"},{"Nearby Zip":"01341, MA","Overall Crime Grade":"A","Violent Crime Grade":"C-","Property Crime Grade":"A"},{"Nearby Zip":"01301, MA","Overall Crime Grade":"C+","Violent Crime Grade":"C-","Property Crime Grade":"C"},{"Nearby Zip":"01330, MA","Overall Crime Grade":"A","Violent Crime Grade":"A-","Property Crime Grade":"A"},{"Nearby Zip":"01346, MA","Overall Crime Grade":"A","Violent Crime Grade":"C","Property Crime Grade":"A"},{"Nearby Zip":"01339, MA","Overall Crime Grade":"A-","Violent Crime Grade":"C","Property Crime Grade":"A"},{"Nearby Zip":"01342, MA","Overall Crime Grade":"A","Violent Crime Grade":"B+","Property Crime Grade":"A+"},{"Nearby Zip":"01376, MA","Overall Crime Grade":"B-","Violent Crime Grade":"C+","Property Crime Grade":"B-"},{"Nearby Zip":"01337, MA","Overall Crime Grade":"A","Violent Crime Grade":"B-","Property Crime Grade":"A"}],"Similar Population Crime Rates":[{"Similar Zip":"34217, FL","Overall Crime Grade":"A-","Violent Crime Grade":"C+","Property Crime Grade":"C+"},{"Similar Zip":"72046, AR","Overall Crime Grade":"F","Violent Crime Grade":"D-","Property Crime Grade":"D-"},{"Similar Zip":"52778, IA","Overall Crime Grade":"B","Violent Crime Grade":"A-","Property Crime Grade":"A-"},{"Similar Zip":"54126, WI","Overall Crime Grade":"A","Violent Crime Grade":"A+","Property Crime Grade":"A+"},{"Similar Zip":"02715, MA","Overall Crime Grade":"A+","Violent Crime Grade":"A-","Property Crime Grade":"A-"},{"Similar Zip":"67025, KS","Overall Crime Grade":"B-","Violent Crime Grade":"B+","Property Crime Grade":"B+"},{"Sim…