---
updatedAt: 2025-09-18T22:00:26.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Batch Upload Distance Targeting Geometries

> 🚧 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.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "management-api-2",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.kevel.co"
    }
  ],
  "components": {
    "securitySchemes": {
      "sec0": {
        "type": "apiKey",
        "name": "X-Adzerk-ApiKey",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "sec0": []
    }
  ],
  "paths": {
    "/v1/flight/{FlightID}/distance/batch": {
      "post": {
        "summary": "Batch Upload Distance Targeting Geometries",
        "description": "",
        "operationId": "batch-upload-geodistance-targeting-geometries",
        "parameters": [
          {
            "name": "FlightID",
            "in": "path",
            "description": "The ID of the flight",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "Geometries"
                ],
                "properties": {
                  "ReplaceExisting": {
                    "type": "boolean",
                    "description": "Whether to replace any existing geometries on a flight. Defaults to false.",
                    "default": false
                  },
                  "Geometries": {
                    "type": "array",
                    "description": "Must contain at least 0 geometry objects. If 1 or more objects are present, `Distance`, `Latitude`, and `Longitude` (float) are all required.",
                    "items": {
                      "properties": {
                        "Latitude": {
                          "type": "number",
                          "description": "Latitude of the geometry",
                          "format": "float"
                        },
                        "Longitude": {
                          "type": "number",
                          "description": "Longitude of the geometry",
                          "format": "float"
                        },
                        "Distance": {
                          "type": "number",
                          "description": "Distance of the geometry",
                          "format": "float"
                        }
                      },
                      "required": [
                        "Latitude",
                        "Longitude",
                        "Distance"
                      ],
                      "type": "object"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "## Batch create/override\n\n{\n  \"InsertedGeometries\": 2\n}\n\n## Remove all geometries on the flight\n\n{\n  \"InsertedGeometries\": 0\n}"
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "## Batch create/override\n\ncurl -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}]}'\n\n## Remove all geometries on the flight\n\ncurl -X POST -H \"X-Adzerk-ApiKey:$ADZERK_API_KEY\" https://api.kevel.co/v1/flight/1234567/distance/batch -d '{\"ReplaceExisting\": true, \"Geometries\": []}'\n",
              "name": "cURL"
            },
            {
              "language": "javascript",
              "code": "const Adzerk = require('@adzerk/management-sdk');\nconst apiKey = process.env.ADZERK_API_KEY;\n\n// Batch create/override\n\nasync function uploadBatchDistanceTargeting() {\n  let specifications = await Adzerk.fetchSpecifications();\n  let client = await Adzerk.buildClient({apiKey, specifications, logger});\n\n  let distanceTargeting = await client.run(\"distanceTargeting\", \"batchUpload\", {\n    flightId: 12345,\n    replaceExisting: false,\n    geometries: [\n      {\n        Latitude: -89.05,\n        Longitude: 57.1,\n        Distance: 5\n      },\n      {\n        Latitude: 14,\n        Longitude: 57.1,\n        Distance: 5\n      }\n    ]\n  });\n\n  console.log(distanceTargeting);\n}\nuploadBatchDistanceTargeting()\n\n// Remove all geometries on the flight\n\nasync function removeAllDistanceTargeting() {\n  let specifications = await Adzerk.fetchSpecifications();\n  let client = await Adzerk.buildClient({apiKey, specifications, logger});\n\n  let distanceTargeting = await client.run(\"distanceTargeting\", \"batchUpload\", {\n    flightId: 12345,\n    replaceExisting: true,\n    geometries: []\n  });\n\n  console.log(distanceTargeting);\n}\nremoveAllDistanceTargeting()"
            },
            {
              "language": "ruby",
              "code": "require \"adzerk\"\n\n# Batch create/override\n\ndef upload_batch_distance_targeting()\n    client = Adzerk::Client.new(ENV[\"ADZERK_API_KEY\"])\n    flight_id = 12345\n    data = {\n        replace_existing: false,\n        geometries: [\n            {\n                latitude: -89.05,\n                longitude: 57.1,\n                distance: 5\n            },\n            {\n                latitude: 14,\n                longitude: 57.1,\n                distance: 5\n            }\n        ]\n    }\n    pp client.distance_targetings.batch_upload(flight_id, data)\nend\nupload_batch_distance_targeting()\n\n# Remove all geometries on the flight\n\ndef remove_all_distance_targeting()\n    client = Adzerk::Client.new(ENV[\"ADZERK_API_KEY\"])\n    flight_id = 12345\n    data = {\n        replace_existing: true,\n        geometries: []\n    }\n    pp client.distance_targetings.batch_upload(flight_id, data)\nend\nremove_all_distance_targeting()"
            }
          ],
          "samples-languages": [
            "curl",
            "javascript",
            "ruby"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [
      {
        "key": "X-Adzerk-Sdk-Version",
        "value": "Readme.io:ManagementAPI2"
      }
    ],
    "explorer-enabled": false,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true
}
```