# Nearest

Snap a point to the nearest road, within 1 km.

`GET /v2/nearest`. Auth: API key or our website.

## Parameters

| Parameter | Required | Description |
|---|---|---|
| `point` | Yes | `lng,lat` |
| `profile` | No | `car` (default) or `car_night` |

## Example

```bash
curl -s -H "X-API-Key: $QUADRUPER_KEY" \
  'https://quadruper.com/v2/nearest?point=122.5621,10.7202&profile=car'
```

This is an example response:

```json schema=nearest-response
{
  "location": [122.56215, 10.72031],
  "distance_m": 12.3,
  "attribution": [{ "source": "osm", "text": "© OpenStreetMap contributors", "license": "ODbL-1.0" }]
}
```

## Response fields

| Field | Description |
|---|---|
| `location` | The snapped point, `[lng, lat]` |
| `distance_m` | How far the input was from the road |

A point more than 1 km from a road returns `422 point_not_snapped`, the same limit routes have.

Some engines ignore `profile` here, so the road may be one that cars can't use. To be sure a car can reach the point, call [`POST /v2/route`](route.md).
