Adding neighborhood crime information to a property search or location dashboard means turning a ZIP code into data that users can compare. By the end of this guide, you’ll be able to call the Crime Data By ZipCode API, read its grades and crime breakdown, and use nearby ZIP results without losing leading zeros.
What the API returns
The Crime Data By ZipCode API accepts a ZIP code and returns an overall crime grade, category grades, individual crime rates, and comparison data. The response is organized around the requested ZIP rather than an individual street address.
The example includes violent, property, and other crime categories. It also contains grades for nearby ZIP codes and ZIP codes grouped under Similar Population Crime Rates. That makes the response useful for property-search interfaces, location research tools, and internal dashboards that need more context than a single overall grade.
Grades and rates answer different display needs: a grade is compact enough for a search result, while the breakdown provides more detail for a dedicated location page. Confirm the rate units, reporting period, source information, and grade methodology on the API page before presenting the numbers as a basis for decisions.
Getting started on Zyla API Hub
Open the API listing on Zyla API Hub, create a free account if you need one, and select Subscribe or Start Free Trial when available. You’ll get an API key to use in the authorization header.
The marketplace uses subscriptions and quotas rather than pay-per-call billing. The first API offers a 7-day trial or 50 requests; check the API page for current access options, pricing, and trial terms. Zyla’s catalog contains more than 10,000 public APIs, accessible through one account and API key.
Keep the key on your server or in a secure environment rather than embedding it in a browser application. The examples below use YOUR_API_KEY so you can replace it locally.
Get crime rates by ZIP
The available endpoint is Get Crime Rates by ZIP. It uses GET and requires the zip query parameter. The listing describes that parameter as a number; the documented request sends 01370 exactly as shown.
Request URL: https://zylalabs.com/api/824/crime-data-by-zipcode-api/583/get-crime-rates-by-zip
Send the API key as a Bearer token. This complete request uses the documented ZIP and endpoint:
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 response example
The listing’s response example is reproduced below. Its final section is truncated, so the block is an excerpt rather than a complete JSON document; parse the complete response returned by your request instead.
{"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…
For the requested ZIP, Overall contains the ZIP and four grades. Crime BreakDown is an array whose entries contain category-specific rates and totals. The sample’s rate values are strings, so convert them deliberately if you need numeric operations; preserve their original strings if you want to display the supplied precision.
Crime Rates Nearby provides comparison grades alongside Nearby Zip. Similar Population Crime Rates has a separate Similar Zip field. Keep those groups labeled separately: the example does not establish that a similar-population ZIP is also nearby.
Read the response in Python
This example uses Python’s standard library and calls the same endpoint. Replace YOUR_API_KEY, then run it in an environment where the key is protected.
import json
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
url = "https://zylalabs.com/api/824/crime-data-by-zipcode-api/583/get-crime-rates-by-zip?zip=01370"
request = Request(
url,
headers={"Authorization": "Bearer YOUR_API_KEY"},
method="GET",
)
try:
with urlopen(request, timeout=30) as response:
data = json.load(response)
except HTTPError as error:
raise SystemExit(f"API request failed with HTTP status {error.code}")
except URLError as error:
raise SystemExit(f"Could not reach the API: {error.reason}")
except json.JSONDecodeError:
raise SystemExit("The API response was not valid JSON")
overall = data.get("Overall", {})
print("ZIP:", overall.get("Zipcode", "Unavailable"))
print("Overall grade:", overall.get("Overall Crime Grade", "Unavailable"))
print("Violent crime grade:", overall.get("Violent Crime Grade", "Unavailable"))
print("Property crime grade:", overall.get("Property Crime Grade", "Unavailable"))
for category in data.get("Crime BreakDown", []):
property_rates = category.get("Property Crime Rates")
if property_rates is not None:
print("Theft rate:", property_rates.get("Theft", "Unavailable"))
for nearby in data.get("Crime Rates Nearby", []):
print(
"Nearby:",
nearby.get("Nearby Zip", "Unavailable"),
"overall grade:",
nearby.get("Overall Crime Grade", "Unavailable"),
)
The code searches the breakdown entries for Property Crime Rates rather than assuming that category will always occupy a particular array position. It also uses the exact response keys, including spaces and capitalization. Check for missing values before displaying them, and handle failed requests separately from a valid response with unavailable fields.
Practical crime-data use cases
Property-search pages
Show the overall and category grades next to a property’s ZIP, then let users open a detail view for the breakdown. In the documented example, the overall grade is B while the violent crime grade is C-; displaying both prevents a single summary grade from hiding that distinction.
Keep the requested ZIP visible beside the grades. A ZIP-level result describes the area represented by that ZIP, so avoid presenting the result as an assessment of a particular building.
Nearby-area comparisons
Use Crime Rates Nearby to build a comparison list without treating its entries as the requested ZIP’s own grades. Display the returned Nearby Zip text and the corresponding overall, violent, and property grades together.
The example’s nearby entry for 01338, MA has an overall grade of B- and a violent crime grade of D. A comparison interface can expose that difference directly rather than sorting or summarizing by the overall grade alone.
Location research dashboards
A research dashboard can group assault, robbery, rape, and murder under violent crime, and theft, vehicle theft, burglary, and arson under property crime. Keep the API’s labels and category boundaries visible so a reader can trace a displayed number back to the response.
For repeated lookups, consider caching results by the exact ZIP string to avoid spending quota on identical requests. Choose a refresh policy after checking the source and update information on the API page; a cache is a product decision, not a guarantee that the underlying data remains unchanged.
Store ZIP codes as text in your application even though the request parameter is documented as numeric. The example’s 01370 begins with a zero, and converting it to an integer before constructing the request would remove that character.
Call the API from an AI agent
For an MCP-compatible agent, use the Zyla MCP endpoint https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY with your API key. It works with Claude Code, Cursor, Windsurf, and other MCP-compatible clients. The MCP link provides the entry point for that workflow.
Ask the agent to retrieve crime data for the ZIP and report the overall and category grades separately. If it includes nearby or similar-population results, have it label those groups explicitly rather than combining them with the requested area’s breakdown. Review the returned fields before using an agent-generated summary in a product.
FAQ
What parameter does the endpoint require?
Get Crime Rates by ZIP requires zip. The documented request uses zip=01370; retain the leading zero when constructing the URL.
Are the crime rates returned as numbers?
In the official example, rate values such as Theft are JSON strings. Convert them when needed for calculations, and verify the applicable units before labeling a chart or comparing rates.
Does the response include nearby ZIP codes?
Yes. The example includes Crime Rates Nearby, with a ZIP label and overall, violent, and property grades for each shown entry. It also includes a separate similar-population comparison group.
How is access billed?
Access uses a subscription and quota, not pay-per-call billing. Check the listing for current access options, pricing, and the terms of the first-API trial.
Ready to integrate ZIP-level crime data? Create a free Zyla account, get your API key, and Start 7-day trial on Crime Data By ZipCode API from the marketplace listing.