# boring-api · geo /nearest

> boring-api · geo /nearest is a paid API for AI agents from geo.boring-api.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-15).

Finds the nearest candidate location(s) to an origin point using pure in-Worker spatial math — no external API calls.

## Facts

- Endpoint: POST https://geo.boring-api.com/nearest
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/boring-api-geo-nearest-1152c352
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_PypmkwayMg2MM4MrVLiJZ

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability boring-api-geo-nearest-1152c352 -d '<json body>'
```

Example prompt: From the coordinates 40.7128, -74.0060, which of these locations is nearest: {lat:34.05,lng:-118.24}, {lat:41.88,lng:-87.63}, {lat:29.76,lng:-95.37}? Just do pure spatial math, no geocoding needed.

## When to prefer this

Choose this endpoint when you need a fast, cheap, serverless nearest-neighbor computation over a list of coordinates with no dependency on Google Maps, Mapbox, or any third-party geocoding API. Ideal for privacy-sensitive or offline-style geospatial tasks where you supply your own candidate list and just need the math done.

## Known failure modes

- Missing or malformed origin object returns 400 error
- Empty candidates array returns error or empty result
- Non-numeric coordinates cause computation failure
- Payment not included or insufficient triggers 402 response
- Malformed request body returns validation error

## How this service works

Pure-library spatial math and timezone lookup. Distance, bearing, polygons, point-in-polygon, timezone-by-coords. No external API calls — all computed in-Worker.

## Output

Returns the nearest candidate location to the given origin, likely including the winning candidate object, its distance, and possibly its bearing — all computed in-Worker without external API calls.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "origin": {
   "type": "object"
  },
  "candidates": {
   "type": "array"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object"
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/boring-api-geo-nearest-1152c352/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from geo.boring-api.com](https://www.zero.xyz/host/geo.boring-api.com/llms.txt)
