# UK Street-Level Crime Data - Categories and Outcomes (`alaudinburki/uk-police-crime`) Actor

Recorded street-level crime for a location and month as flat rows - category, street, coordinates and outcome - from the official UK police open data API.

- **URL**: https://apify.com/alaudinburki/uk-police-crime.md
- **Developed by:** [alaudin burki](https://apify.com/alaudinburki) (community)
- **Categories:** Developer tools
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 92.3% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $1.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.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## 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.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## UK Street-Level Crime Data — Categories and Outcomes

Street-level crime recorded by police in England, Wales and Northern Ireland, returned as one flat row
per crime. Give the Actor a latitude, a longitude and a month, and it reads the recorded crimes near
that point from the UK police open data API and flattens each one — category, street, coordinates,
location type and outcome — into a row you can open in a spreadsheet or load into a database. There is
no API key, no account and no browser involved.

### How to use

1. Enter the **latitude** and **longitude** of the area you care about (decimal degrees) and the
   **month** as `YYYY-MM`.
2. Leave **Max rows** at 500, or raise it if the month and area are busy.
3. Run the Actor. Rows appear in the dataset's Overview tab; a `SUMMARY` record in the key-value store
   reports how many rows were fetched and whether the cap truncated the run.

```json
{
  "latitude": 52.629729,
  "longitude": -1.131592,
  "date": "2024-01",
  "maxItems": 500
}
```

### Inputs

| Input | Purpose | Default |
|---|---|---|
| `latitude` | Latitude of the point to search around, in decimal degrees, WGS 84. | `52.629729` when left blank |
| `longitude` | Longitude of the same point, in decimal degrees, WGS 84. | `-1.131592` when left blank |
| `date` | The month to fetch, as `YYYY-MM`. This is a month, not a day. | `2024-01` when left blank |
| `maxItems` | Hard ceiling on rows. The runner stops taking rows at this number. | `500` |
| `maxPages` | Kept for consistency with other Actors. This source answers one location-month in a single response, so the Actor makes one request per run and this setting does not change the result. | `5` |

### Output

One row per recorded crime, de-duplicated on the crime's own id and sorted, so the same month always
comes back in the same order.

| Field | Meaning |
|---|---|
| `category` | The crime category as the police record it, for example `burglary` or `anti-social-behaviour`. |
| `month` | The month the crime belongs to, as the source writes it, `YYYY-MM`. A period, not a timestamp. |
| `street` | Street name from the source, which prefixes it, e.g. `On or near High Road`. No house number and no exact address. |
| `latitude` | Latitude of the anonymised map point. Passed through as the API sends it, which is a **string** — cast it before doing arithmetic. |
| `longitude` | Longitude of the same anonymised point, also a string. |
| `locationType` | The source's location classification, e.g. `Force` or `Residential Building/House`. |
| `outcome` | The outcome category recorded for the case (`Under investigation`, `Unable to prosecute suspect`, …). The field is **omitted** when the case has no outcome record yet. |
| `outcomeDate` | The month the outcome was recorded, when there is one. Omitted alongside `outcome`. |

Each row also carries `id` (the source's `persistent_id`, or a fallback built from month, category and
coordinates), `source`, `firstSeenAt` and `scrapedAt`, so a row stays identifiable after export.

### Why this is different

The Police API returns deeply nested records — the street is at `location.street.name`, the outcome at
`outcome_status.category`. This Actor delivers one **standalone** flat row per crime with those paths
already resolved, which is what a spreadsheet, a CSV export or a SQL load actually needs. Rows are
sorted deterministically and de-duplicated before they are pushed, so two runs over the same month do
not disagree. And when the row cap stops the run early, the dataset says so through `SUMMARY.truncated`
and `stopReason` instead of silently looking complete.

### Limitations

- **Snap points, not addresses.** The published coordinates are moved to a nearby anonymised point.
  That is the API's privacy design; do not treat the coordinate as the scene of the crime.
- **Outcomes are often missing.** A crime with no outcome record omits `outcome` and `outcomeDate`
  entirely — that is an open or unresolved case, not a parsing failure.
- **Past months get revised.** Forces reclassify and remove records, so the same month fetched twice
  can differ.
- **One point, one month, per run.** The API returns crimes near the coordinate, not a whole force
  area. For a city, run several points or several months.
- **Coordinates arrive as strings**, because that is how the source sends them, even though the
  dataset schema declares numbers.
- **No personal data.** No names, ages or identities are present, and none can be derived here.

### FAQ

**Do I need an API key?** No. The request carries no key or token, and no account is required.

**Why is the dataset empty for my month?** Either the month has no records near that point, or the
month string is not `YYYY-MM`. The run log distinguishes an empty source from an unreachable one.

**Can I get a whole year in one run?** No. Each run is one month; schedule twelve runs, or run it on a
schedule and let each run write its own dataset.

**Why is `outcome` missing on some rows?** The case has no outcome recorded yet. The field is left out
rather than filled with a guess.

**Are the coordinates exact?** No. They are deliberately offset by the publisher, so they locate a
street, not a building.

### Pricing and limits

The price is shown on the Actor's Apify pricing panel before you run it. Limits are enforced in code:
`maxItems` is a hard ceiling, de-duplication happens before the push, and the run records why it
stopped in `SUMMARY`. Raising `maxItems` is the only setting that changes how much data a run can
return.

# Actor input Schema

## `latitude` (type: `number`):

Latitude of the area, e.g. 52.629729.

## `longitude` (type: `number`):

Longitude of the area, e.g. -1.131592.

## `date` (type: `string`):

Month as YYYY-MM, e.g. 2024-01.

## `maxItems` (type: `integer`):

Stop after this many rows.

## `maxPages` (type: `integer`):

Stop after this many pages.

## Actor input object example

```json
{
  "maxItems": 500,
  "maxPages": 5
}
```

# Actor output Schema

## `results` (type: `string`):

One row per item, with the 8 fields listed under Views.

# 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 = {
    "maxItems": 500,
    "maxPages": 5
};

// Run the Actor and wait for it to finish
const run = await client.actor("alaudinburki/uk-police-crime").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 = {
    "maxItems": 500,
    "maxPages": 5,
}

# Run the Actor and wait for it to finish
run = client.actor("alaudinburki/uk-police-crime").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 '{
  "maxItems": 500,
  "maxPages": 5
}' |
apify call alaudinburki/uk-police-crime --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,alaudinburki/uk-police-crime"
        }
    }
}
```

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/vQZdaDXjvE7pjRSMO/builds/j8ctaqQ3LBHvY1Z1o/openapi.json
