### Caution

`StreetAddress` resolution is not available when using batch geometry creation.

## Why Batch Upload Distance Targeting Geometries?

The Kevel API enables you to create, override, or remove multiple geometry objects associated with a flight in one single API call. This provides efficiency and allows you to make changes to a geometry object without making individual API calls for each object.

## API Syntax

When using the Batch Upload Distance Targeting Geometries API endpoint, it is important to understand the syntax required to make the request. Because the Kevel API is a RESTful API, there is a specific request format that must be followed to ensure the endpoint can process the request. The format is:

`POST https://api.kevel.co/v1/flight/{FlightID}/distance/batch`

Where:

- `POST`\- the type of API request being made.
- `https://api.kevel.co` \- the URL for the request.
- `v1` \- the API version.
- `flight` \- the API endpoint being called.
- `FlightID` \- the ID associated with the flight.
- `distance` \- the distance targeting geometry object that contains the `Distance`, `Latitude`, `Longitude`, and `StreetAddress` body parameters used for distance targeting.
- `batch` \- the geometry objects you want to create, override, or remove in the flight.

FlightID

int32

required

The ID of the flight

ReplaceExisting

boolean

Defaults to false

Whether to replace any existing geometries on a flight. Defaults to false.

Geometries

array of objects

required

Must contain at least 0 geometry objects. If 1 or more objects are present, `Distance`, `Latitude`, and `Longitude` (float) are all required.

## Batch create/override

```shell
curl -X POST -H "X-Adzerk-ApiKey:$ADZERK_API_KEY" https://api.kevel.co/v1/flight/1234567/distance/batch -d '{"ReplaceExisting": false, "Geometries": [{"Latitude": -89.05, "Longitude": -170.1, "Distance": 5},{"Latitude": 14, "Longitude": 57.1, "Distance": 5}]}'
```

## Remove all geometries on the flight

```shell
curl -X POST -H "X-Adzerk-ApiKey:$ADZERK_API_KEY" https://api.kevel.co/v1/flight/1234567/distance/batch -d '{"ReplaceExisting": true, "Geometries": []}'
```

## Batch create/override

```json
{
  "InsertedGeometries": 2
}
```

## Remove all geometries on the flight

```json
{
  "InsertedGeometries": 0
}
```
