You have a US ZIP code and need crime data you can show in a property search, location dashboard, or other application. By the end of this guide, you can request a crime-grade breakdown, read the response in Python, and handle the details that matter before displaying the results.
What crime data can you get by ZIP?
Crime Rate by Zip US API returns a JSON object for a ZIP-code lookup. Its example response includes an overall crime grade, violent and property crime grades, category-level rates, and grades for nearby ZIP codes and ZIP codes with similar populations.
Those fields support several different views. A property search could show the overall grade alongside a listing, while a location dashboard could display violent, property, and other crime categories separately. The nearby and similar-population arrays can support comparison views without making a separate request for every row in the example response.
The grades and rates should be presented as area-level information, not as a prediction about a particular address or person. Before using the rates in a calculation or decision, confirm their units, reference period, methodology, and freshness with the API provider.
Getting started on Zyla API Hub
Open Zyla API Hub and find the Crime Rate by Zip US API listing. Create a free account, then click Subscribe or Start Free Trial when available to get an API key for the endpoint.
Zyla uses a subscription and quota model 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 and pricing. Keep the key on your server and send it in the Authorization header as a bearer token.
Request data for a ZIP code
The available endpoint is Get Data by Zip. It uses GET and accepts one required query parameter, zip, as a string. Its request URL is:
https://zylalabs.com/api/7518/crime-rate-by-zip-us-api/12137/get-data-by-zip
This request uses the documented ZIP value. Replace YOUR_API_KEY with your Zyla API key before running it:
curl -s -X GET "https://zylalabs.com/api/7518/crime-rate-by-zip-us-api/12137/get-data-by-zip?zip=90001" \
-H "Authorization: Bearer YOUR_API_KEY"
Keep ZIP codes as strings throughout your application. That avoids changing their representation before they reach the zip parameter or when you compare the requested value with the returned Zipcode.
Read the response
The official response excerpt below is truncated at the end. It also shows 94109 in Overall.Zipcode, while the request above uses 90001; treat it as an illustration of the response fields, not as the result of that particular request.
{"Overall":{"Zipcode":"94109","Overall Crime Grade":"F","Violent Crime Grade":"F","Property Crime Grade":"F","Other Crime Grade":"D","Fact":"A crime occurs every 1 hour 13 minutes (on average) in 94109.","Risk":"300%","Risk Detail":"Your home is 300% more likely to be robbed with no home security system."},"Crime BreakDown":[{"Violent Crime Rates":{"Assault":"10.79","Robbery":"4.241","Rape":"0.4693","Murder":"0.0512"},"0":{"Total Violent Crime":"15.55","Total Violent Crime Score":"(F)"}},{"Property Crime Rates":{"Theft":"53.50","Vehicle Theft":"3.201","Burglary":"11.97","Arson":"3.769"},"0":{"Total Property Crime":"72.44","Total Property Crime Score":"(F)"}},{"Other Crime Rates":{"Kidnapping":"0.4706","Drug Crimes":"25.36","Vandalism":"7.459","Identity Theft":"1.050","Animal Cruelty":"0.0542"},"0":{"Total Other Rate":"34.39","Total Other Score":"(D)"}}],"Crime Rates Nearby":[{"Nearby Zip":"94108, CA","Overall Crime Grade":"F","Violent Crime Grade":"F","Property Crime Grade":"F"},{"Nearby Zip":"94102, CA","Overall Crime Grade":"F","Violent Crime Grade":"F","Property Crime Grade":"F"},{"Nearby Zip":"94133, CA","Overall Crime Grade":"D-","Violent Crime Grade":"F","Property Crime Grade":"F"},{"Nearby Zip":"94104, CA","Overall Crime Grade":"F","Violent Crime Grade":"F","Property Crime Grade":"F"},{"Nearby Zip":"94115, CA","Overall Crime Grade":"C+","Violent Crime Grade":"D-","Property Crime Grade":"C-"},{"Nearby Zip":"94123, CA","Overall Crime Grade":"C+","Violent Crime Grade":"D-","Property Crime Grade":"D+"},{"Nearby Zip":"94111, CA","Overall Crime Grade":"D-","Violent Crime Grade":"F","Property Crime Grade":"D-"},{"Nearby Zip":"94103, CA","Overall Crime Grade":"F","Violent Crime Grade":"F","Property Crime Grade":"F"},{"Nearby Zip":"94105, CA","Overall Crime Grade":"F","Violent Crime Grade":"F","Property Crime Grade":"F"},{"Nearby Zip":"94117, CA","Overall Crime Grade":"B","Violent Crime Grade":"D","Property Crime Grade":"C"}],"Similar Population Crime Rates":[{"Similar Zip":"22003, VA","Overall Crime Grade":"A-","Violent Crime Grade":"A+","Property Crime Grade":"A+"},{"Similar Zip":"30518, GA","Overall Crime Grade":"A-","Violent Crime Grade":"A+","Property Crime Grade":"A+"},{"Similar Zip":"89123, NV","Overall Crime Grade":"B-","Violent Crime Grade":"B+","Property Crime Grade":"B+"},{"Similar Zip":"28227, NC","Overall Crime Grade":"A-","Violent Crime Grade":"B-","Property Crime Grade":"B-"},{"Similar Zip":"80022, CO","Overall Crime Grade":"F","Violent Crime…
Use Overall for the requested ZIP and headline grades. Crime BreakDown is an array of category objects; the example also puts category totals and scores under a key named 0. The nearby and similar-population arrays contain comparison ZIP labels and grades.
Field names contain spaces and capitalization that your parser must preserve. In the example, individual rates and totals are strings, not JSON numbers. The Fact and Risk Detail fields are explanatory text; they should not be substituted for a numeric rate or treated as a calculation for a particular property.
Call the endpoint from Python
This example uses Python’s standard library. It requests the same URL as the curl command, checks that the returned ZIP matches the requested ZIP, and reads the headline grades and nearby entries. Replace YOUR_API_KEY before running it.
import json
from urllib.error import HTTPError, URLError
from urllib.request import Request, urlopen
url = "https://zylalabs.com/api/7518/crime-rate-by-zip-us-api/12137/get-data-by-zip?zip=90001"
requested_zip = "90001"
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 exc:
raise SystemExit(f"API request failed with HTTP status {exc.code}") from exc
except URLError as exc:
raise SystemExit(f"Could not reach the API: {exc.reason}") from exc
except json.JSONDecodeError as exc:
raise SystemExit("The API response was not valid JSON") from exc
overall = data.get("Overall", {})
returned_zip = overall.get("Zipcode")
if returned_zip != requested_zip:
raise SystemExit(
f"Requested ZIP {requested_zip}, but response ZIP was {returned_zip}"
)
print("ZIP:", returned_zip)
print("Overall:", overall.get("Overall Crime Grade"))
print("Violent:", overall.get("Violent Crime Grade"))
print("Property:", overall.get("Property Crime Grade"))
print("Other:", overall.get("Other Crime Grade"))
for nearby in data.get("Crime Rates Nearby", []):
print(
nearby.get("Nearby Zip"),
nearby.get("Overall Crime Grade"),
nearby.get("Violent Crime Grade"),
nearby.get("Property Crime Grade"),
)
The ZIP check prevents your application from attaching a response to the wrong location. The example uses get for fields that may not be present, so a missing grade displays as None rather than being silently turned into a grade or rate. In a user interface, handle that case explicitly as unavailable.
Put the data to work
For a property-search page, start with Overall Crime Grade and label it with the returned ZIP. Add the violent and property grades as separate values rather than collapsing them into a new score. That lets a reader see which category they are looking at and avoids implying that the API returned a street-level assessment.
For a comparison screen, use Crime Rates Nearby for nearby ZIP rows and Similar Population Crime Rates for a separate similar-population view. Keep those groups distinct: a nearby ZIP and a similar-population ZIP answer different comparison questions. Preserve the ZIP labels and grade strings as returned, including plus and minus signs.
For an internal location dashboard, the Crime BreakDown array can support category panels. Match objects by their category keys, such as Violent Crime Rates and Property Crime Rates, rather than assuming the same array position will always contain the same category. If you convert a returned rate string to a number, retain the original value for display and confirm the unit before adding a label or performing calculations.
Repeated lookups for the same ZIP can consume subscription quota. Consider caching successful responses by the requested ZIP, record when your application retrieved them, and choose a refresh policy appropriate to your product after confirming the data’s update cadence. Do not cache an error or a response whose Overall.Zipcode does not match the request as if it were a successful result.
Use the API from an AI agent
Zyla APIs can also be called through an MCP-compatible client, including Claude Code, Cursor, and Windsurf. Configure the client with https://mcp.zylalabs.com/mcp?apikey=YOUR_API_KEY, using your own key.
An agent can then use the API to retrieve ZIP-level crime information for a task. Ask it to identify the returned ZIP and distinguish the overall grade from the category breakdown; review the result before using it in a product or decision.
FAQ
What parameter does Get Data by Zip require?
It requires zip, passed as a string in the query. The documented request uses zip=90001.
Does the response include more than an overall grade?
Yes. The example includes violent, property, and other crime grades, category-level rates, nearby ZIP grades, and similar-population ZIP grades.
Why does the example response show a different ZIP from the request?
The supplied request uses 90001, while the supplied response excerpt identifies 94109. Check Overall.Zipcode in an actual response before displaying or storing it against the requested ZIP.
Can I parse the response excerpt as JSON?
No. The published excerpt ends partway through a field, so it is not a complete JSON document. Parse the complete response returned by the endpoint instead.
Ready to integrate? Create a free Zyla account, then Start 7-day trial on Crime Rate by Zip US API and get your API key. Check the listing for current access options and pricing.