# POST /v1/snap

> Index: https://kartpunkt.se/llms.txt

operationId: `snapPoints`. Meet points to the road network.
Tag: `roads`.

Where each point meets the profile's network: the nearest point of a road within radius_m, with snap_m, the road's name and number, and its road reference there. Use it to see where a point meets the network before you route from it; for the roads around a point and their facts, use POST /v1/roads/nearby. It costs a request and no calculation.

## Request

`POST https://api.kartpunkt.se/v1/snap` with `Authorization: Bearer $KARTPUNKT_API_KEY` and `Content-Type: application/json`, from your backend (never browser code: the key would leak, and CORS is not enabled).

Example body:

```json
{
  "points": [
    {
      "lat": 63.72059,
      "lon": 19.342166,
      "street": "Skolvägen"
    },
    {
      "lat": 63.720632,
      "lon": 19.345215
    },
    {
      "lat": 63.724508,
      "lon": 19.339523,
      "street": "Skolvägen"
    },
    {
      "lat": 56,
      "lon": 19.5
    }
  ],
  "profile": "car_shortest"
}
```

JSON body:

- `points` (array of [StreetPoint](https://api.kartpunkt.se/docs/shapes/StreetPoint.md), 1..100 items, required): The points to meet to the network, answered in results in the same order.
- `profile` ([Profile](https://api.kartpunkt.se/docs/shapes/Profile.md), optional, default "car_shortest")
- `radius_m` (number <= 2000, optional, default 500): The straight-line search bound round each point, in metres.
- `network` ([NetworkSelector](https://api.kartpunkt.se/docs/shapes/NetworkSelector.md), optional)

## Response 200

Example:

```json
{
  "results": [
    {
      "point": {
        "lat": 63.7207239,
        "lon": 19.3421866
      },
      "snap_m": 14.97,
      "street_matched": true,
      "ref": "0:17733@0.016646-0.016646",
      "road": {
        "name": "Skolvägen",
        "number": null
      }
    },
    {
      "point": {
        "lat": 63.7206325,
        "lon": 19.3452151
      },
      "snap_m": 0.05,
      "street_matched": null,
      "ref": "0:17733@0.266710-0.266710",
      "road": {
        "name": "Skolvägen",
        "number": null
      }
    },
    {
      "point": {
        "lat": 63.7208214,
        "lon": 19.3389572
      },
      "snap_m": 411.98,
      "street_matched": true,
      "ref": "0:17732@0.499991-0.499991",
      "road": {
        "name": "Skolvägen",
        "number": null
      }
    },
    null
  ],
  "provenance": {
    "synthetic": true,
    "network": {
      "id": "snap_01k7exampleexampleexample0",
      "dataset": "nvdb",
      "source_date": "2026-10-13",
      "built_at": "2026-10-13T07:00:00.000Z",
      "graph": "snap_01k7exampleexampleexample0",
      "profile": "car_shortest",
      "experimental": false
    },
    "sources": [
      {
        "id": "nvdb",
        "name": "Trafikverket, NVDB",
        "licence": "CC0-1.0",
        "attribution": "Vägdata från NVDB, Trafikverket, CC0 1.0",
        "url": "https://creativecommons.org/publicdomain/zero/1.0/",
        "updated": "2026-10-13"
      }
    ]
  }
}
```

- `results` (array of object | null): One per point sent, in order; null where no road of the profile's network lies within radius_m.
  - `point` ([Point](https://api.kartpunkt.se/docs/shapes/Point.md)): Where the point meets the network: the nearest point of the road.
  - `snap_m` (number): Straight-line metres from the point sent to where it meets the network; never part of a distance_m.
  - `street_matched` (boolean | null): true when the point met a road of the street sent, false when it met the nearest road instead. null when no street was sent or no road is near.
  - `ref` ([RoadRef](https://api.kartpunkt.se/docs/shapes/RoadRef.md) | null): The road's reference at that point, its two measures equal; null on a road with no NVDB link.
  - `road` (object): The road the point meets.
    - `name` (string | null): The road's name in NVDB; null where it has none.
    - `number` (string | null): The road's number (vägnummer): 'E6' for a europaväg, else digits; null where it has none.
- `provenance` ([Provenance](https://api.kartpunkt.se/docs/shapes/Provenance.md))

## Errors

Every error is `{ error, message, param?, doc_url }`; `message` says what to do next. All codes: [https://api.kartpunkt.se/errors](https://api.kartpunkt.se/errors). What to do on each, with retries: [https://api.kartpunkt.se/docs/recipes/errors-and-retries.md](https://api.kartpunkt.se/docs/recipes/errors-and-retries.md).

- [`invalid_request`](https://api.kartpunkt.se/errors/invalid_request) (400): The request does not match the API schema. Fix the fields named in this message; see /openapi.json.
- [`unauthorized`](https://api.kartpunkt.se/errors/unauthorized) (401): Missing or unknown API key. Send it as 'Authorization: Bearer <key>' (or 'x-api-key'), read from the KARTPUNKT_API_KEY environment variable. The user creates a kp_test_ key on their Kartpunkt account page (https://kartpunkt.se/konto) and puts it in KARTPUNKT_API_KEY themselves; never ask them to paste a key into chat.
- [`live_access_required`](https://api.kartpunkt.se/errors/live_access_required) (403): This account is not approved for live data: kp_live_ keys are for customers under contract. Use a kp_test_ key. To ask for live access, the account holder writes to hej@kartpunkt.se, or orders a plan at https://kartpunkt.se/konto#plan.
- [`use_not_permitted`](https://api.kartpunkt.se/errors/use_not_permitted) (403): This operation would use a data source in a way its licence or approval does not allow (see GET /v1/sources). It cannot be answered for this key.
- [`network_unavailable`](https://api.kartpunkt.se/errors/network_unavailable) (404): No network snapshot matches that id or as_of. List the snapshots with GET /v1/networks and send one of their ids, or leave network out for the active one.
- [`network_not_active`](https://api.kartpunkt.se/errors/network_not_active) (409): That network snapshot is not the one served now, and answers on another snapshot are computed as jobs. Send the same input to POST /v1/jobs with this operation, then read GET /v1/jobs/{id}.
- [`profile_unavailable`](https://api.kartpunkt.se/errors/profile_unavailable) (409): This profile cannot be answered on the network snapshot asked for: it was built without the data the profile needs (see GET /v1/profiles and the snapshot's manifest at GET /v1/networks/{id}). Use another profile or a newer snapshot.
- [`network_pruned`](https://api.kartpunkt.se/errors/network_pruned) (410): That network snapshot was pruned: its tables and graph are deleted, so nothing can be answered on it again, as a job or otherwise. Leave network out to answer on the active network, and store that answer's provenance.network.id; GET /v1/networks lists the snapshots that are not pruned.
- [`too_large`](https://api.kartpunkt.se/errors/too_large) (413): Too much for one synchronous call. Send the same input to POST /v1/jobs with this operation and read the result from GET /v1/jobs/{id}, or split it.
- [`quota_exceeded`](https://api.kartpunkt.se/errors/quota_exceeded) (429): Request limit or plan quota reached (per minute, per day, or the account plan's monthly quota). Wait the number of seconds in the Retry-After header, then retry; without Retry-After, no wait helps: tell the account holder what this message says.
- [`internal_error`](https://api.kartpunkt.se/errors/internal_error) (500): Something failed on our side. Retry after a few seconds; if it keeps failing, contact hej@kartpunkt.se.
- [`live_data_unavailable`](https://api.kartpunkt.se/errors/live_data_unavailable) (503): Live data is not available yet: it opens when Kartpunkt's import of Lantmäteriet's address register completes. Use a kp_test_ key until then.
- [`routing_unavailable`](https://api.kartpunkt.se/errors/routing_unavailable) (503): Road distances and routes are not available yet: Kartpunkt's road graph from Trafikverket's NVDB has not been built. Try again later.

## Limits

| Limit | Synchronous |
| --- | --- |
| `points` | 100 |
| `radius_m` (at most) | 2000 |
| Request body | 1 MB |

## Metering

A request only: no calculations, no live call, no address limit.
