This page describes how to stop data collection using the Roads Selection API:

- **[Delete a route](https://developers.google.com/maps/documentation/roads-management-insights/roads-selection/delete.md.txt#delete)** : Stop data collection for a single route using the `delete` endpoint.
- **[Batch delete routes](https://developers.google.com/maps/documentation/roads-management-insights/roads-selection/delete.md.txt#batch)** : Stop data collection for multiple routes in a single request using the `batchDelete` endpoint.

## Delete a route

Send a `DELETE` request to the [`delete`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes/delete.md.txt) endpoint to delete a selected route
from your project and stop data collection.

```html
https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID
```

The request must include the project number and the [`name`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes.md.txt#SelectedRoute.FIELDS.name) of the
[`SelectedRoute`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes.md.txt#SelectedRoute) to delete.

The following code sample shows the structure of a `DELETE` request to the
[`delete`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes/delete.md.txt) endpoint:

```
curl -X DELETE \
-H 'X-Goog-User-Project: PROJECT_NUMBER' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
"https://roads.googleapis.com/selection/v1/projects/"\
"PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID"
```

On success, the API returns an empty JSON object.

## Batch delete routes

To delete multiple routes in a single request, use the
[`batchDelete`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes/batchDelete.md.txt)
endpoint. This endpoint lets you delete up to 1,000 routes in one call. Batch
deletion is atomic: if any route in the batch request fails or is missing,
no routes in the batch are deleted.

Send a `POST` request to the [`batchDelete`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes/batchDelete.md.txt) endpoint:

```html
https://roads.googleapis.com/selection/v1/projects/PROJECT_NUMBER/selectedRoutes:batchDelete
```

The **request body** must be a JSON object containing a `names` array.
Each string element within this array is the [`name`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes.md.txt#SelectedRoute.FIELDS.name) of a
[`SelectedRoute`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes.md.txt#SelectedRoute) to be deleted.

The following code sample shows the structure of a `POST` request to the
[`batchDelete`](https://developers.google.com/maps/documentation/roads-management-insights/reference/rest/v1/selection.v1.projects.selectedRoutes/batchDelete.md.txt) endpoint:

```
curl -X POST -d '
    {"names": [
      "projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID_1",
      "projects/PROJECT_NUMBER/selectedRoutes/SELECTED_ROUTE_ID_2"
    ]}' \
-H 'X-Goog-User-Project: PROJECT_NUMBER' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer ACCESS_TOKEN' \
"https://roads.googleapis.com/selection/v1/projects/"\
"PROJECT_NUMBER/selectedRoutes:batchDelete"
```

On success, the API returns an empty JSON object. Data collection on the
deleted route stops immediately. Permanent resource deletion completes in
the background, and can take a few minutes to complete for large batch sizes.

Use the
[get](https://developers.google.com/maps/documentation/roads-management-insights/roads-selection/get.md.txt#get_a_specific_selected_route)
operation to check the status of your route. Retrying a request after permanent
deletion has finished returns a `404 Not Found` error, confirming that resource
deletion is complete.