{"uid":"cap_PypmkwayMg2MM4MrVLiJZ","slug":"boring-api-geo-nearest-1152c352","name":"boring-api · geo /nearest","description":"Pure-library spatial math and timezone lookup. Distance, bearing, polygons, point-in-polygon, timezone-by-coords. No external API calls — all computed in-Worker.","url":"https://geo.boring-api.com/nearest","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"origin":{"type":"object"},"candidates":{"type":"array"}}},"responseSchema":{"type":"object"},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_F521sOuync71594U0gr3U","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Finds the nearest candidate location(s) to an origin point using pure in-Worker spatial math — no external API calls.","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Find nearest warehouse to customer","prompt":"A customer is at 51.5074, -0.1278 (London). I have warehouses at {lat:52.48,lng:-1.90}, {lat:53.48,lng:-2.24}, {lat:51.45,lng:-2.59}, and {lat:50.82,lng:-0.14}. Which warehouse is closest to them? Just run the spatial math, no external APIs."},{"title":"Closest charging station lookup","prompt":"My EV driver is currently at coordinates 37.7749, -122.4194. I have a list of charging stations: {lat:37.80,lng:-122.43}, {lat:37.76,lng:-122.39}, {lat:37.73,lng:-122.47}, {lat:37.79,lng:-122.40}. Which one is nearest? Use pure distance math only."},{"title":"Route driver to nearest depot","prompt":"A delivery driver is at 48.8566, 2.3522. Find the nearest depot from this list: {lat:48.90,lng:2.37}, {lat:48.84,lng:2.29}, {lat:48.87,lng:2.41}, {lat:48.82,lng:2.35}. I just need the math done in-house, no mapping service required."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-15T12:43:12.793Z","isFirstParty":false}