---
updatedAt: 2025-10-08T09:20:55.000Z
agentTools:
  projectIndex: https://dev.kevel.com/llms.txt
---

# Update Geo-Targeting

## Why Update Geo-Targeting?

You may find it necessary at some point to change existing geo-targeting settings for a flight to make updates, or alter a flight's performance in a campaign. The Kevel API enables you to update these geo-targeting settings using the Update Geo-Targeting API endpoint. When you use this API endpoint, you can then make changes to the geo-targeting settings for a specified flight.

> 📘 Note
>
> You can update any field except for `FlightID` and `LocationID`.

## API Syntax

When using the Update Geo-Targeting 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:

`PUT https://api.kevel.co/v1/flight/{FlightID}/geotargeting/{LocationID}`

Where:

* `PUT` - 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.
* `geotargeting` - the geo-targeting settings for the flight.
* `LocationID` - The ID associated with the geographical location where the flight is being served.

> 📘 Clearing attribute values
>
> To unset or clear an attribute, set its value to `NULL`.

# 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}/geotargeting/{LocationID}": {
      "put": {
        "summary": "Update Geo-Targeting",
        "description": "",
        "operationId": "update-geo-targeting",
        "parameters": [
          {
            "name": "FlightID",
            "in": "path",
            "description": "ID of the Flight",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          },
          {
            "name": "LocationID",
            "in": "path",
            "description": "ID from the Geo-Targeting Endpoint",
            "schema": {
              "type": "integer",
              "format": "int32"
            },
            "required": true
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "CountryCode": {
                    "type": "string",
                    "description": "The 2-3 character string that denotes the country you want to target"
                  },
                  "Region": {
                    "type": "string",
                    "description": "The 2-3 character string that denotes the region (or state) that you want to target"
                  },
                  "MetroCode": {
                    "type": "integer",
                    "description": "The 3 digit number that denotes the metropolitan area you want to target. US only.",
                    "format": "int32"
                  },
                  "City": {
                    "type": "string",
                    "description": "The name of the city you want to target"
                  },
                  "CityGeonameId": {
                    "type": "integer",
                    "description": "The numeric geoname ID that denotes the city you want to target. This is the value matched for city targeting. Retrieve valid IDs from the List Cities in Region endpoint.",
                    "format": "int32"
                  },
                  "isExclude": {
                    "type": "boolean",
                    "description": "If `true`, this will exclude the country from targeting. Defaults to `false/null`",
                    "default": "false"
                  }
                }
              },
              "examples": {
                "JSON": {
                  "value": {
                    "FlightId": 12345,
                    "CountryCode": "US",
                    "Region": "NC",
                    "MetroCode": 560,
                    "City": "Durham",
                    "CityGeonameId": 4464368,
                    "IsExclude": false
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n  \"LocationId\":76543,\n  \"FlightId\":12345,\n  \"CountryCode\":\"US\",\n  \"Region\":\"NC\",\n  \"MetroCode\":560,\n  \"City\":\"Durham\",\n  \"CityGeonameId\":4464368,\n  \"IsExclude\":false\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "LocationId": {
                      "type": "integer",
                      "example": 76543,
                      "default": 0
                    },
                    "FlightId": {
                      "type": "integer",
                      "example": 12345,
                      "default": 0
                    },
                    "CountryCode": {
                      "type": "string",
                      "example": "US"
                    },
                    "Region": {
                      "type": "string",
                      "example": "NC"
                    },
                    "MetroCode": {
                      "type": "integer",
                      "example": 560,
                      "default": 0
                    },
                    "City": {
                      "type": "string",
                      "example": "Durham"
                    },
                    "CityGeonameId": {
                      "type": "integer",
                      "example": 4464368,
                      "default": 0
                    },
                    "IsExclude": {
                      "type": "boolean",
                      "example": false,
                      "default": "false"
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl -X PUT -H 'X-Adzerk-ApiKey:<APIKEY>' -H \"Content-Type:application/json\" \"https://api.kevel.co/v1/flight/12345/geotargeting/76543\" --data-binary '{\"FlightId\":12345,\"CountryCode\":\"US\",\"Region\":\"NC\",\"MetroCode\":560, \"IsExclude\":true}'"
            },
            {
              "language": "javascript",
              "code": "const Adzerk = require('@adzerk/management-sdk');\nconst apiKey = process.env.ADZERK_API_KEY;\n\nasync function updateGeoTargeting() {\n  let specifications = await Adzerk.fetchSpecifications();\n  let client = await Adzerk.buildClient({apiKey, specifications});\n\n  let geoTargeting = await client.run(\"geoTargeting\", \"update\", {\n    locationId: 76543,\n    flightId: 12345,\n    countryCode: \"US\",  // United States\n    region: \"NC\",       // North Carolina\n  });\n\n  console.log(geoTargeting);\n}\n\nupdateGeoTargeting();"
            },
            {
              "language": "ruby",
              "code": "require \"adzerk\"\n\ndef update_geo_targeting()\n    client = Adzerk::Client.new(ENV[\"ADZERK_API_KEY\"])\n    flight_id = 12345\n    location_id = 67890\n    data = client.geotargetings.get(flight_id, location_id)\n    data[:region] = \"MN\"\n    pp client.geotargetings.update(flight_id, location_id, data)\nend\nupdate_geo_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
}
```