> For the complete documentation index, see [llms.txt](https://docs.mediarithmics.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mediarithmics.io/api-reference/display-campaign/location-selections.md).

# Location Selections

Operations related to Location Selections that define the geographical targeting of a Display Campaign or one of its Ad Groups. Support inclusion and exclusion of locations to restrict ad delivery to the relevant areas.

## GET /display\_campaigns/{campaign\_id}/locations/{id}

> find location

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Location Selections","description":"Operations related to Location Selections that define the geographical targeting of a Display Campaign or one of its Ad Groups. Support inclusion and exclusion of locations to restrict ad delivery to the relevant areas."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/display_campaigns/{campaign_id}/locations/{id}":{"get":{"parameters":[{"name":"campaign_id","schema":{"type":"integer","format":"int64"},"style":"simple","explode":false,"required":true,"in":"path"},{"style":"simple","in":"path","name":"id","schema":{"type":"integer","format":"int64"},"explode":false,"required":true}],"tags":["Location Selections"],"description":"","summary":"find location","operationId":"findLocation","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/LocationSelectionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"schemas":{"LocationSelectionResource":{"type":"object","properties":{"postal_code":{"type":"string","readOnly":false},"geoname_id":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/LocationSelectionType"},"country":{"type":"string","readOnly":false},"geozone_id":{"type":"string","readOnly":false},"exclude":{"type":"boolean","default":false,"readOnly":false},"admin1":{"type":"string","readOnly":false},"admin2":{"type":"string","readOnly":false},"city":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":false}},"required":["exclude","id","type"]},"LocationSelectionType":{"type":"string","enum":["POSTAL_CODE","GEONAME","URBAN_AREA","GEOJSON"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## PUT /display\_campaigns/{campaign\_id}/locations/{id}

> Update a location

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Location Selections","description":"Operations related to Location Selections that define the geographical targeting of a Display Campaign or one of its Ad Groups. Support inclusion and exclusion of locations to restrict ad delivery to the relevant areas."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/display_campaigns/{campaign_id}/locations/{id}":{"put":{"tags":["Location Selections"],"parameters":[{"explode":false,"schema":{"type":"integer","format":"int64"},"required":true,"style":"simple","name":"campaign_id","in":"path"},{"explode":false,"schema":{"type":"integer","format":"int64"},"in":"path","style":"simple","required":true,"name":"id"}],"description":"","operationId":"updateLocation","summary":"Update a location","requestBody":{"description":"The location to update","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationSelectionResource"}}},"required":true},"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/LocationSelectionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}}}}},"components":{"schemas":{"LocationSelectionResource":{"type":"object","properties":{"postal_code":{"type":"string","readOnly":false},"geoname_id":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/LocationSelectionType"},"country":{"type":"string","readOnly":false},"geozone_id":{"type":"string","readOnly":false},"exclude":{"type":"boolean","default":false,"readOnly":false},"admin1":{"type":"string","readOnly":false},"admin2":{"type":"string","readOnly":false},"city":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":false}},"required":["exclude","id","type"]},"LocationSelectionType":{"type":"string","enum":["POSTAL_CODE","GEONAME","URBAN_AREA","GEOJSON"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## DELETE /display\_campaigns/{campaign\_id}/locations/{id}

> Removes a location

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Location Selections","description":"Operations related to Location Selections that define the geographical targeting of a Display Campaign or one of its Ad Groups. Support inclusion and exclusion of locations to restrict ad delivery to the relevant areas."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/display_campaigns/{campaign_id}/locations/{id}":{"delete":{"responses":{"200":{"$ref":"#/components/responses/simple"},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"in":"path","explode":false,"required":true,"style":"simple","schema":{"type":"integer","format":"int64"},"name":"campaign_id"},{"required":true,"name":"id","style":"simple","in":"path","explode":false,"schema":{"type":"integer","format":"int64"}}],"operationId":"removeLocation","tags":["Location Selections"],"description":"","summary":"Removes a location"}}},"components":{"responses":{"simple":{"description":"Success response","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]}},"required":["status"]}}}},"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}},"schemas":{"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}}}}
```

## GET /display\_campaigns/{campaign\_id}/locations

> find Locations

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Location Selections","description":"Operations related to Location Selections that define the geographical targeting of a Display Campaign or one of its Ad Groups. Support inclusion and exclusion of locations to restrict ad delivery to the relevant areas."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/display_campaigns/{campaign_id}/locations":{"get":{"tags":["Location Selections"],"summary":"find Locations","responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"max_results":{"type":"integer"},"first_result":{"type":"integer"},"count":{"type":"integer"},"status":{"type":"string","enum":["ok"]},"total":{"type":"integer"},"data":{"type":"array","items":{"$ref":"#/components/schemas/LocationSelectionResource"}}},"required":["count","data","first_result","max_results","status","total"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"style":"simple","explode":false,"required":true,"in":"path","schema":{"type":"integer","format":"int64"},"name":"campaign_id"}],"operationId":"findLocations","description":""}}},"components":{"schemas":{"LocationSelectionResource":{"type":"object","properties":{"postal_code":{"type":"string","readOnly":false},"geoname_id":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/LocationSelectionType"},"country":{"type":"string","readOnly":false},"geozone_id":{"type":"string","readOnly":false},"exclude":{"type":"boolean","default":false,"readOnly":false},"admin1":{"type":"string","readOnly":false},"admin2":{"type":"string","readOnly":false},"city":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":false}},"required":["exclude","id","type"]},"LocationSelectionType":{"type":"string","enum":["POSTAL_CODE","GEONAME","URBAN_AREA","GEOJSON"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```

## POST /display\_campaigns/{campaign\_id}/locations

> Create a location

```json
{"openapi":"3.1.1","info":{"title":"mediarithmics openapi API","version":"1.0.0"},"tags":[{"name":"Location Selections","description":"Operations related to Location Selections that define the geographical targeting of a Display Campaign or one of its Ad Groups. Support inclusion and exclusion of locations to restrict ad delivery to the relevant areas."}],"servers":[{"url":"http://api.mediarithmics.local/v1","description":"Development server"},{"url":"https://api.mediarithmics.com/v1","description":"Production server"}],"paths":{"/display_campaigns/{campaign_id}/locations":{"post":{"description":"","requestBody":{"description":"The location to create","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LocationSelectionResource"}}},"required":true},"summary":"Create a location","tags":["Location Selections"],"responses":{"200":{"description":"Success !","content":{"application/json":{"schema":{"type":"object","properties":{"status":{"type":"string","enum":["ok"]},"data":{"$ref":"#/components/schemas/LocationSelectionResource"}},"required":["data","status"]}}}},"400":{"$ref":"#/components/responses/error"},"401":{"$ref":"#/components/responses/error"},"403":{"$ref":"#/components/responses/error"},"404":{"$ref":"#/components/responses/error"},"500":{"$ref":"#/components/responses/error"},"503":{"$ref":"#/components/responses/error"}},"parameters":[{"in":"path","schema":{"type":"integer","format":"int64"},"required":true,"name":"campaign_id","style":"simple","explode":false}],"operationId":"createLocation"}}},"components":{"schemas":{"LocationSelectionResource":{"type":"object","properties":{"postal_code":{"type":"string","readOnly":false},"geoname_id":{"type":"string","readOnly":false},"type":{"$ref":"#/components/schemas/LocationSelectionType"},"country":{"type":"string","readOnly":false},"geozone_id":{"type":"string","readOnly":false},"exclude":{"type":"boolean","default":false,"readOnly":false},"admin1":{"type":"string","readOnly":false},"admin2":{"type":"string","readOnly":false},"city":{"type":"string","readOnly":false},"id":{"type":"string","readOnly":false}},"required":["exclude","id","type"]},"LocationSelectionType":{"type":"string","enum":["POSTAL_CODE","GEONAME","URBAN_AREA","GEOJSON"],"readOnly":false},"errorResponse":{"type":"object","properties":{"status":{"type":"string","enum":["error"]},"error_code":{"type":"string","enum":["AUTHENTICATION_ERROR","AUTHORIZATION_ERROR","BAD_REQUEST_DATA","BAD_REQUEST_FORMAT","CONSTRAINT_VIOLATION_EXCEPTION","EMAIL_ALREADY_EXISTS","MAC_ERROR","RESOURCE_NOT_FOUND","SERVICE_UNAVAILABLE","TOKEN_ERROR"]},"error_id":{"type":"string"},"error":{"type":"string"}},"required":["error","error_code","error_id","status"]}},"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/errorResponse"}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.mediarithmics.io/api-reference/display-campaign/location-selections.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
