# Offender Map API
> The Map API reference: send a map view, get clusters, pins or named pins of registered sex offenders to draw, and open the full record behind any marker.
- **HTML:** https://offendersearch.app/docs/map

## Introduction

The Map API puts registered sex offenders on a map that you draw. Your app sends the view the map is showing. We return what to draw for it: clusters when zoomed out, pins closer in, names close up, and the complete record when one is opened.

- **Your map, any library.** The response is plain JSON or GeoJSON. There are complete examples for [MapLibre](https://offendersearch.app/docs/map/maplibre.md), [Leaflet](https://offendersearch.app/docs/map/leaflet.md) and [Google Maps](https://offendersearch.app/docs/map/google-maps.md).
- **Any size of view.** A whole country or one street is one map request. The zoom decides how much detail comes back.
- **The same data as search.** The map covers the same 58 registries as the Sex Offender API, and an opened record is the same record object `POST /v1/search` returns.
- **Build before you pay.** [Test mode](https://offendersearch.app/docs/map/test-mode.md) returns made-up people in the real response shape, with no plan.

> A pin shows a registered address, not a person's current location. Every response carries this sentence in `notice`. Show it on the map.

## The routes

| Route | What it does | Billed |
| --- | --- | --- |
| `GET /v1/map/viewport` | One map view: clusters, pins, or named pins. | 1 map request |
| `POST /v1/map/area` | The same answer for a drawn shape: a polygon, or a route with a buffer. | 1 map request |
| `GET /v1/map/groups/{groupId}` | The people behind a many-people pin or an approximate-area pin. | 1 map request per page |
| `GET /v1/map/records/{markerId}` | The complete record behind a marker or a saved reference. | 1 record open |
| `GET /v1/map/status` | Your plan, rates, limits and this month’s usage. | Free |
| `POST /v1/map/enable` | Turn the Map API on. | Charges the $300 monthly minimum |
| `POST /v1/map/disable` | Turn it off. | Free |

Base URL: `https://api.offendersearch.app`. Send your key in the `X-API-Key` header. See [Access & keys](https://offendersearch.app/docs/map/access.md).

## Three detail levels

The zoom of the view picks what comes back. The response says which in `mode`.

What a view returns at each zoom.

```text
Zoom 3–12              Zoom 13–14             Zoom 15+
mode: clusters         mode: pins             mode: markers

  ( 412 )    ( 96 )      •    •     •          • J. Tester   • S. Demo
       ( 1.3k )             •    •                  (12)  • A. Sample

a count per grid cell  one pin per address    pins with a name label
                       no name                many-people pins
```

| Zoom | `mode` | Returned |
| --- | --- | --- |
| 3–12 | `clusters` | A count for each grid cell, with its extent and a breakdown. |
| 13–14 | `pins` | One pin for each address: a position, with no name. |
| 15+ | `markers` | Pins with a name label and basic fields. |

See [The viewport request](https://offendersearch.app/docs/map/viewport.md) for the exact rules and [Clusters & markers](https://offendersearch.app/docs/map/clusters-and-markers.md) for every field.

## Price

$2.00 per 1,000 map requests and $0.015 per record opened, with a $300 monthly minimum applied toward usage.

Clusters and pins are never charged per person. A view that has not changed (HTTP 304), the status route and test mode are free. See [Billing](https://offendersearch.app/docs/map/billing.md) for worked months.

## A first request

This runs with any key, before the plan is on, because it is in test mode.

GET /v1/map/viewport

```bash
curl -G https://api.offendersearch.app/v1/map/viewport \
  -H "X-API-Key: $OFFENDERSEARCH_KEY" \
  -d bbox=-83.2,39.8,-82.8,40.1 \
  -d zoom=10 \
  -d sandbox=true
```

The [Quickstart](https://offendersearch.app/docs/map/quickstart.md) takes it from here.

## Contents

- [Quickstart](https://offendersearch.app/docs/map/quickstart.md) — A first request in test mode, the response, turning it on, and drawing it.
- [Turn it on](https://offendersearch.app/docs/map/turn-it-on.md) — Who can turn it on, what is charged when you do, and what turning it off does.
- [Access & keys](https://offendersearch.app/docs/map/access.md) — A secret key from your server, a browser key for your own sites, and phone apps.
- [Test mode](https://offendersearch.app/docs/map/test-mode.md) — Made-up people in the real response shape. No plan needed, never billed.
- [The viewport request](https://offendersearch.app/docs/map/viewport.md) — Every parameter, how zoom picks the detail level, and the caching headers.
- [Clusters & markers](https://offendersearch.app/docs/map/clusters-and-markers.md) — Field tables for every object in a response, plus the GeoJSON form.
- [The click sequence](https://offendersearch.app/docs/map/click-sequence.md) — Each thing a person does on the map, the call it makes, and what it costs.
- [Open a record](https://offendersearch.app/docs/map/open-a-record.md) — The record route, when an open is charged, marker id life, and saved links.
- [Near an address](https://offendersearch.app/docs/map/near-an-address.md) — A centre and a radius instead of a box, distances, and a count with no pins.
- [Drawn areas & routes](https://offendersearch.app/docs/map/drawn-areas.md) — Everyone inside a polygon, or within a set distance of a route.
- [Filters & lists](https://offendersearch.app/docs/map/filters-and-lists.md) — Housing and precision filters, the breakdown, and a list beside the map.
- [MapLibre](https://offendersearch.app/docs/map/maplibre.md) — A complete MapLibre GL map to copy and paste. Also fits Mapbox GL.
- [Leaflet](https://offendersearch.app/docs/map/leaflet.md) — A complete Leaflet map to copy and paste.
- [Google Maps](https://offendersearch.app/docs/map/google-maps.md) — A complete Google Maps page to copy and paste.
- [Billing](https://offendersearch.app/docs/map/billing.md) — The two rates, what is free, the monthly minimum, and five worked months.
- [Limits & errors](https://offendersearch.app/docs/map/limits-and-errors.md) — Every limit with its number, and every error code with its cause and fix.

## Turn it on

Any paying account can turn the Map API on. Turning it on charges the $300 minimum that day, and it covers the rest of that calendar month.

- Dashboard: https://offendersearch.app/dashboard/map-api
- No account yet: https://offendersearch.app/sign-up?next=%2Fdashboard%2Fmap-api
- Product overview: https://offendersearch.app/sex-offender-map-api

---

## Related

- Index: [Offendersearch API documentation](https://offendersearch.app/docs.md)
