Documentation menu
Search docs…⌘K

API reference

Snap coordinate to the nearest road network point

Finds the nearest street or highway segment to a given coordinate.

Endpoint

GEThttps://api.wayline.cloud/v1/nearest
Bearer Auth

Requires an API key (authentication). Product overview: Snap to Roads API. Billing: see units & pricing.

Parameters

NameInTypeDescription
pointrequiredqueryPointStringCoordinate to snap, formatted as lat,lng.
countqueryintegerNumber of candidate snapped points to return (1 to 5).Default: 1
profilequerystringRouting profile. car (default, alias driving), motorcycle (aliases bike, motorbike, two_wheeler) or bicycle (alias cycling). A profile is served only in regions that list it in GET /v1/coverage; otherwise the request fails with PROFILE_UNAVAILABLE. Responses always echo the canonical name. One of: car, driving, motorcycle, bike, motorbike, two_wheeler, bicycle, cyclingDefault: car

Example

curl "https://api.wayline.cloud/v1/nearest?point=37.7694,-122.4862" \
  -H "Authorization: Bearer $WAYLINE_API_KEY"
Response (example)
{
  "request_id": "req_01JD8Q8K5Y2D",
  "waypoints": [
    {
      "location": [
        37.770599999999995,
        -122.4871
      ],
      "name": "",
      "distance_meters": 38
    }
  ],
  "region": "us",
  "map_version": "20261121-2330",
  "units_charged": 1
}

Response

200 — Successful nearest road snapping response.

Response fields
FieldTypeDescription
waypointsrequiredNearestWaypoint[]
waypoints[].locationrequiredPointFlexible coordinate input accepted as string, object, or array.
waypoints[].namestring
waypoints[].distance_metersrequiredinteger
profilestringCanonical routing profile used (car, motorcycle or bicycle).
regionrequiredstring
map_versionrequiredstring
warningsstring[]
units_chargedrequiredinteger

Response headers

  • X-Request-Id — Unique identifier for tracking and debugging this request.
  • X-RateLimit-Limit — Maximum permitted requests in current window.
  • X-RateLimit-Remaining — Remaining request quota in current window.
  • X-RateLimit-Reset — Seconds until the rate limit window resets.
  • X-Units-Charged — Billable request units consumed by this request.
  • X-Cache — Cache lookup status (`HIT` or `MISS`).
  • X-Region — Region code serving this routing request (e.g. `bd`).

Errors

StatusWhen
400Bad request (invalid coordinates, out of coverage, too many elements, etc.).
401Missing or invalid API key, or expired key.
402Free quota exhausted, no payment method, account suspended, or the monthly spend limit you set was reached. Never billed. Raise or remove the limit in the dashboard (Billing) and retry; nothing else changes.
403Account disabled, key IP restriction failed, origin not allowed, or scope not permitted.
404No route found between the requested coordinates.
429Rate limit exceeded or test key daily quota reached.
500Internal server error.
503Upstream routing service temporarily unavailable.

Error bodies contain a code such as OUT_OF_COVERAGE — see the error reference.

Try it

Interactive API Console

GET /v1/nearest

Sends a real request from your browser using a test key (free, never billed). The key stays in this browser tab only.

No key yet? Create a free test key.

Was this page helpful?