---
title: "POST /route/snapToRoads:batch"
method: POST
path: "/route/snapToRoads:batch"
---

# POST /route/snapToRoads:batch

`POST /route/snapToRoads:batch`

The Snap To Roads Batch API sends batches of up to **100** queries as a single
call to the [Snap To Roads
API](/rest/api/maps/route/post-snap-to-roads?view=rest-maps-2025-01-01). This
API enables efficient processing of multiple queries in one request, reducing
the need for individual calls.

### Submit Synchronous Batch Request
The Synchronous API is recommended for lightweight batch requests. When the
service receives a request, it will respond as soon as the batch items are
calculated and there will be no possibility to retrieve the results later. The
Synchronous API will return a timeout error (a 408 response) if the request
takes longer than 60 seconds. The number of batch items is limited to **100**
for this API.
```
POST https://atlas.microsoft.com/route/snapToRoads:batch?api-version=2025-01-01
```
### POST Body for Batch Request
To send the _snap to roads_ queries you will use a `POST` request where the
request body will contain the `batchItems` array in `json` format and the
`Content-Type` header will be set to `application/json`. Here's a sample
request body containing 1 _snap to roads_ queries:


```
{
  "batchItems": [
    {
      "optionalId": "bbc9c0f6-ab52-49d8-a788-a658fa654c94",
      "type": "FeatureCollection",
      "features": [
        {
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [
              -122.336691,
              47.59085
            ]
          },
          "properties": {
          }
        },
        {
          "type": "Feature",
          "geometry": {
            "type": "Point",
            "coordinates": [
              -122.336023,
              47.601616
            ]
          },
          "properties": {
          }
        }
      ],
      "includeSpeedLimit": true,
      "travelMode": "driving"
    }
  ]
}
```

A _snap to roads_ batchItem object can accept any of the supported _snap to
roads_ [Request
body](/rest/api/maps/route/post-snap-to-roads?view=rest-maps-2025-01-01#request-body)



The batch should contain at least **1** query.


### Batch Response Model
The batch response contains a `summary` component that indicates the
`totalRequests` that were part of the original batch request and
`successfulRequests` i.e. queries which were executed successfully. The batch
response also includes a `batchItems` array which contains a response for each
and every query in the batch request. The `batchItems` will contain the results
in the exact same order the original queries were sent in the batch request.
Each item is of one of the following types:

- [`SnapToRoadsResponse`](/rest/api/maps/route/post-snap-to-roads#response) -
If the query completed successfully.

- `Error` - If the query failed. The response will contain a `code` and a
`message` in this case.

## Query parameters

- `api-version` string, required

## Headers

- `x-ms-client-id` string
- `Accept-Language` string

## Response `200`

The request has succeeded.

- SnapToRoadsBatchResponse — This object is returned from a successful Snap To Roads Batch service call.
  - `summary` SnapToRoadsBatchResponseSummary — Summary for the batch request
    - `successfulRequests` integer — Number of successful requests in the batch
    - `totalRequests` integer — Total number of requests in the batch
  - `batchItems` SnapToRoadsBatchResponseItem[] — Array containing the batch results.
    - `optionalId` string — Id of the request which would show in corresponding batchItem.
    - `type` 'FeatureCollection' — Specifies the `GeoJSON` type. The only supported object type is `FeatureCollection`. For more information, see [RFC 7946](https://www.rfc-editor.org/rfc/rfc7946).
    - `features` SnapToRoadFeaturesItem[] — `GeoJSON` feature object that contains Geometry object and additional properties. Refer to [RFC 7946, Section 3.2](https://www.rfc-editor.org/rfc/rfc7946#section-3.2) for details.
      - `type` 'Feature' — Specifies the `GeoJSON` type. The only supported object type is Feature. For more information, see [RFC 7946](https://www.rfc-editor.org/rfc/rfc7946).
      - `geometry` GeoJsonPoint — A valid `GeoJSON` geometry object. The type must be one of the seven valid GeoJSON geometry types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon and GeometryCollection. Please refer to [RFC 7946](https://tools.ietf.org/html/rfc7946#section-3.1) for details.
        - `type` 'Point' | 'MultiPoint' | 'LineString' | 'MultiLineString' | 'Polygon' | 'MultiPolygon' | 'GeometryCollection' | 'Feature' | 'FeatureCollection', required — Specifies the `GeoJSON` type. Must be one of the nine valid GeoJSON object types - Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon, GeometryCollection, Feature and FeatureCollection.
      - `bbox` number[] — A rectangular area on the earth defined as a bounding box object. The sides of the rectangles are defined by latitude and longitude values. For more information, see [RFC 7946, Section 5](https://www.rfc-editor.org/rfc/rfc7946#section-5). Example: "bbox": [-10.0, -10.0, 10.0, 10.0]
      - `properties` SnapToRoadsFeatureProperties — Snap to Roads properties.
        - `inputIndex` integer — Identify the corresponding index in the original list of points for each snapped point. Only the snapped points will return indices and can be used to distinguish them from the interpolated points.
        - `isInterpolated` boolean — Identify whether this is the interpolated point.
        - `name` string — Name of the road the point is snapped to.
        - `speedLimitInKilometersPerHour` number, double — Speed limit in kilometers per hour.
    - `error` CommonErrorDetail — The error detail.
      - `code` string — The error code.
      - `message` string — The error message.
      - `target` string — The error target.
      - `details` CommonErrorDetail[] — The error details.
      - `additionalInfo` ErrorAdditionalInfo[] — The error additional info.
        - `type` string — The additional info type.
        - `info` object — The additional info.

## Other responses

- `default` — An unexpected error response.

---

[API](https://skmtc.net/azure/apis/maps-route.md) · [All operations](https://skmtc.net/azure/apis/maps-route/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/azure/maps-route/revisions/4b7b4a919999/schema)
