# Crime Grade Scraper (`lexis-solutions/crimegrade-scraper`) Actor

CrimeGrade Scraper for Apify extracts structured crime and safety data from CrimeGrade, including crime grades, offense rates, cost of crime, comparisons, and nearby city stats for real estate research, relocation analysis, and location intelligence.

- **URL**: https://apify.com/lexis-solutions/crimegrade-scraper.md
- **Developed by:** [Lexis Solutions](https://apify.com/lexis-solutions) (community)
- **Categories:** Real estate, AI, Agents
- **Stats:** 11 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $9.00 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## 🔍 CrimeGrade Scraper

![CrimeGrade Scraper](https://i.ibb.co/dxyx75w/crime-grade.png)

### ❓ What is this scraper?

This scraper extracts structured crime statistics and safety data from **crimegrade.org**.

CrimeGrade is a platform that grades US cities and neighborhoods on their crime levels, providing detailed breakdowns of violent crime, property crime, cost of crime, and more.

This scraper collects clean and consistent crime data such as:

- Overall and category crime grades (violent, property, other)
- Crime rates per category (assault, robbery, theft, etc.)
- Cost of crime per resident and total city cost
- Crime cost comparison against state and national averages
- Nearby cities crime grades for regional context

All data is standardized into a structured format, making it easy to use for analysis, integrations, or storage.

***

### ⚡ Why this scraper?

CrimeGrade provides highly valuable, structured crime data that is difficult to collect at scale manually.

With this scraper, you can:

- Assess the safety of US cities and neighborhoods
- Compare crime rates across regions
- Analyze the economic cost of crime per city
- Build datasets for real estate apps, relocation tools, or research
- Identify the safest or most dangerous areas in a state

***

### 📥 Input

```json
{
  "zipCodes": ["12345"],
  "cityUrls": [
    {
      "url": "https://crimegrade.org/safest-places-in-virginia-beach-va/"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": ["RESIDENTIAL"],
    "apifyProxyCountry": "US"
  }
}
```

You can provide **ZIP codes**, **direct city URLs**, or both. ZIP codes are automatically resolved to their corresponding city pages.

***

### 📤 Output

Each city is returned as a structured JSON object:

```json
{
  "url": "https://crimegrade.org/safest-places-in-schenectady-ny/",
  "title": "The Safest and Most Dangerous Places in Schenectady, NY: Crime Maps and Statistics",
  "overall_crime_grade": "B-",
  "grades": {
    "violent_crime_grade": "C-",
    "property_crime_grade": "C-",
    "other_crime_grade": "A+"
  },
  "crime_cost": {
    "rows": [
      { 
        "crime": "Assault",
        "costToCity": "$8.64 million", 
        "costPerResident": "$62"
      }
    ],
    "totals": {
      "costToCity": "$43,271,430",
      "costPerResident": "$309"
    }
  },
  "crime_cost_comparison": [
    { "label": "Schenectady, NY", "cost": "$309" },
    { "label": "New York", "cost": "$335" },
    { "label": "USA", "cost": "$464" }
  ],
  "crime_rate": [
    { "label": "assault", "rate": "2.287" },
    { "label": "robbery", "rate": "1.064" },
    { "label": "total_violent_crime", "rate": "3.722 (C-)" },
    { "label": "theft", "rate": "12.72" },
    { "label": "total_property_crime", "rate": "16.36 (C-)" }
  ],
  "nearby_cities_crime": [
    {
      "city": "Rotterdam, NY",
      "url": "https://crimegrade.org/safest-places-in-rotterdam-ny/",
      "overall_crime_grade": "B-",
      "violent_crime_grade": "C",
      "property_crime_grade": "C-"
    }
  ]
}
```

***

### Need to scrape other sites?

Check out our other scrapers on Apify:

- [Bodacc.fr Scraper](https://apify.com/lexis-solutions/bodacc-fr-scraper)
- [Ballotpedia.org Scraper](https://apify.com/lexis-solutions/ballotpedia-org-scraper)
- [Doxpop.com Scraper](https://apify.com/lexis-solutions/doxpop-com-scraper)

***

👀 p.s.

Got feedback or need an extension?

Lexis Solutions is a [certified Apify Partner](https://apify.com/partners/find). We can help you with custom solutions or data extraction projects.

Contact us over [Email](mailto:scraping@lexis.solutions) or [LinkedIn](https://www.linkedin.com/company/lexis-solutions)

### Support Our Work 💝

If you're happy with our work and scrapers, you're welcome to leave us a company review [here](https://apify.com/partners/find/lexis-solutions/review) and leave a review for the scrapers you're subscribed to. It will take you less than a minute but it will mean a lot to us!

### Image Credit

Image Credit: https://crimegrade.org/

# Actor input Schema

## `zipCodes` (type: `array`):

List of US ZIP codes to look up and scrape crime data for.

## `cityUrls` (type: `array`):

Direct CrimeGrade city URLs to scrape.

## `proxyConfiguration` (type: `object`):

Your proxy configuration from Apify.

## Actor input object example

```json
{
  "zipCodes": [
    "12345"
  ],
  "cityUrls": [
    {
      "url": "https://crimegrade.org/safest-places-in-virginia-beach-va/"
    }
  ],
  "proxyConfiguration": {
    "useApifyProxy": true,
    "apifyProxyGroups": [
      "RESIDENTIAL"
    ],
    "apifyProxyCountry": "US"
  }
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "zipCodes": [
        "12345"
    ],
    "cityUrls": [
        {
            "url": "https://crimegrade.org/safest-places-in-virginia-beach-va/"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("lexis-solutions/crimegrade-scraper").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "zipCodes": ["12345"],
    "cityUrls": [{ "url": "https://crimegrade.org/safest-places-in-virginia-beach-va/" }],
}

# Run the Actor and wait for it to finish
run = client.actor("lexis-solutions/crimegrade-scraper").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "zipCodes": [
    "12345"
  ],
  "cityUrls": [
    {
      "url": "https://crimegrade.org/safest-places-in-virginia-beach-va/"
    }
  ]
}' |
apify call lexis-solutions/crimegrade-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,lexis-solutions/crimegrade-scraper"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/jggLs9b7V82J3GeZV/builds/R8wMlRbLvQSkPhp63/openapi.json
