## 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`.

### Parameters

- **FlightID**  
  - Type: int32  
  - Required  
  - ID of the Flight

- **LocationID**  
  - Type: int32  
  - Required  
  - ID from the Geo-Targeting Endpoint

- **CountryCode**  
  - Type: string  
  - The 2-3 character string that denotes the country you want to target

- **Region**  
  - Type: string  
  - The 2-3 character string that denotes the region (or state) that you want to target

- **MetroCode**  
  - Type: int32  
  - The 3 digit number that denotes the metropolitan area you want to target. US only.

- **isExclude**  
  - Type: boolean  
  - Defaults to false  
  - If `true`, this will exclude the country from targeting. Defaults to `false/null`

# Response

```
200
{
  "LocationId": 76543,
  "FlightId": 12345,
  "CountryCode": "US",
  "Region": "NC",
  "MetroCode": 560,
  "IsExclude": false
}
```

### Example Request

```
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}'
```

Updated 9 months ago
