Offender Map API · v1.0.0

Drawn areas & routes

Everyone inside a polygon, or within a set distance of a route.

Livehttps://api.offendersearch.appSandboxhttps://sandbox.offendersearch.app

The request

POST /v1/map/area returns everyone inside a shape you draw: a school zone, a delivery area, a walking route. It is one map request. Send one of polygon or route.

A polygon

POST /v1/map/area
curl -X POST https://api.offendersearch.app/v1/map/area \
  -H "X-API-Key: $OFFENDERSEARCH_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "polygon": [
      [-83.01, 39.96], [-82.99, 39.96],
      [-82.99, 39.98], [-83.01, 39.98]
    ],
    "sandbox": true
  }'
  • 3 to 200 points.
  • Each point is [lng, lat]: longitude first, as in GeoJSON.
  • The ring is closed for you. You may repeat the first point at the end, or leave it out.
  • A shape may not cross the date line or span half the globe.

A route with a buffer

POST /v1/map/area
curl -X POST https://api.offendersearch.app/v1/map/area \
  -H "X-API-Key: $OFFENDERSEARCH_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "route": {
      "points": [
        [-83.01, 39.96], [-83.00, 39.97], [-82.99, 39.98]
      ],
      "bufferMiles": 0.25
    },
    "sandbox": true
  }'
  • points: 2 to 200 points along the route, each [lng, lat].
  • bufferMiles: the distance either side of the line, 0.05 to 5 miles.
  • The answer is everyone within that distance of any part of the route.
  • A route may not cross the date line or span half the globe.
For an exact answer along a route, use POST /v1/map/route instead: it reads only the strip along the line, counts each leg and each stop, and is never answered as estimated clusters. See Routes, stops and corridors.

Body fields

Every body field, with its type, default and an example, is in the request table below. Send one of polygon or route; zoom, format, detail, housing and precision work as on the viewport route, and sandbox: true puts the request in test mode.

The response

The response is the viewport response for the shape’s bounding box, limited to what is inside the shape. It has one more field: "shape": "polygon" or "shape": "route".

  • The detail level follows the same zoom rules as a view. Send zoom to ask for a level, or leave it out and the size of the shape picks one.
  • In pins and markers mode, total is exact.
  • In clusters mode, a cluster is included when its centre is inside the shape, and the response carries "totalIsEstimate": true. Zoom in, or draw a smaller shape, for an exact number.
  • Marker ids, group ids and the records route work exactly as they do from a view.

Sex offender map API: POST /v1/map/area request and response fields

POST/v1/map/areaAuth: X-API-Key

Everyone inside a drawn shape: a polygon, or a route with a buffer either side. The answer is the viewport answer for the shape's bounding box, limited to what is inside the shape, plus shape. One map request per answer; test mode and errors are free. An area answer carries no ETag.

Request

Headers
FieldTypeDescription
X-API-Key
required
stringA secret API key (from your server), or a map browser key os_map_pk_… sent from a site on that key's list. A dashboard session can send Authorization: Bearer <token> instead.
X-End-User
optional
stringAny id you use for the person behind this request. Their pin views are then also counted against the per-end-user daily area budget (2,000 distinct areas), so one heavy user is stopped before the account is.
Body · application/json
FieldTypeDescription
polygon
optional
array of arrayA ring of 3 to 200 points, each [lng, lat] in degrees: longitude first, as in GeoJSON. Repeating the first point at the end is accepted; the ring is closed either way. Send this or route, not both.
Example [[-83.01,39.96],[-82.99,39.96],[-82.99,39.98],[-83.01,39.98]]
route
optional
objectA line and a distance either side of it: everyone within bufferMiles of any part of the route. Send this or polygon, not both.
route.points
required
array of array2 to 200 points along the route, each [lng, lat] in degrees.
route.bufferMiles
required
numberThe distance either side of the line, 0.05 to 5 miles.
Example 0.25
zoom
optional
numberAs on GET /v1/map/viewport: 0 to 22, a fraction is floored. Leave it out and the size of the shape picks the zoom.
format
optional · default "json"
string
one of "json", "geojson"
json for the MapViewportResponse shape, geojson for a MapGeoJson FeatureCollection.
detail
optional · default "full"
string
one of "full", "count"
full for what to draw, count for numbers only.
housing
optional
string or array of stringKeep only people with these housing statuses: a comma-separated string or a list of housed, homeless, incarcerated. Leave it out to keep everyone.
Example ["homeless","incarcerated"]
precision
optional
string
one of "street", "any"
street keeps only people with an exact street address. any, or leaving it out, keeps everyone.
sandbox
optional · default false
booleantrue answers in test mode: made-up people, never billed.

Response

200 · application/json

The answer for this shape: the viewport response fields, with shape set and, in clusters mode, totalIsEstimate: true. With format: "geojson" the body is a MapGeoJson FeatureCollection.

The body is the MapViewportResponse object. What to draw for one view (format=json). Returned by GET /v1/map/viewport and POST /v1/map/area. Draw from mode, not from your own zoom.

Errors
StatusCodeWhen
401—The key is missing or invalid. The body is the plain detail string.
403map_not_enabledThe Map API is off for this account (map_paused when we paused it, origin_not_allowed for a browser key used from a site not on its list). Send sandbox=true to build first.
422invalid_shapeBoth or neither of polygon and route, too few or too many points, a point that is not [lng, lat], a buffer outside 0.05 to 5 miles, or a shape that spans half the globe or crosses the date line. invalid_zoom, invalid_filter, invalid_format and invalid_detail as on the viewport route.
429map_busyToo many map requests at the same moment (Retry-After: 1). map_sweep_limit and map_end_user_limit when a daily area budget is used (clusters still work); overloaded when the service is at capacity.
503map_unavailableThe map could not be read just now (map_index_not_ready, map_not_configured likewise). Nothing was charged; retry after Retry-After.

Caching

An area answer carries Cache-Control and no ETag, so there is no 304 for a drawn shape. Keep the answer on your side while the shape is on screen.

Errors

A shape that cannot be read answers 422 invalid_shape: both or neither of polygon and route, too few or too many points, a point that is not [lng, lat], a buffer outside the range, or a shape that crosses the date line. The other viewport errors apply too. See Limits & errors.

Watching an area

This route answers once. To be told when someone new appears in an area, create a location monitor. See location monitoring.

Product overview