# Edit a Google campaign's device, location, excluded location, or language targeting

Edits a Google campaign's device, location, excluded location, or language targeting. Works with Google Ads.

```http
PUT https://api.pozy.ai/v1/ads/campaigns/{campaignId}/targeting
```

- Area: Ads / Ad Campaigns
- Auth: Authorization: Bearer pz_live_...

## Path parameters

- `campaignId` (string, required)

## Request body

Content type: `application/json`

- `platform`, string, required: One of `google`
- `targeting`, object, required
  - `devices`, array of string or object
    - one of: string
    - one of: Option 2
      - `device`, string, required: One of `MOBILE`, `DESKTOP`, `TABLET`, `CONNECTED_TV`
      - `bidModifier`, number, required
  - `locations`, array of string or object
    - one of: array of string
    - one of: Option 2
      - `countries`, array of string
      - `regions`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
      - `cities`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
      - `zips`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
      - `metros`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
  - `languages`, array of string
  - `excludedLocations`, array of string or object
    - one of: array of string
    - one of: Option 2
      - `countries`, array of string
      - `regions`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
      - `cities`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
      - `zips`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
      - `metros`, array of string or object
        - one of: string
        - one of: Option 2
          - `key`, string, required
          - `name`, string
  - `locationTargetingType`, string: One of `presence`, `presence_or_interest`

## Example request

```bash
curl -X PUT "https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e/targeting" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "platform": "google",
  "targeting": {
    "devices": [
      "MOBILE"
    ],
    "locations": [
      "string"
    ],
    "languages": [
      "string"
    ]
  }
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e/targeting", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    platform: "google",
    targeting: {
      devices: [
        "MOBILE"
      ],
      locations: [
        "string"
      ],
      languages: [
        "string"
      ]
    }
  }),
});
const data = await res.json();
if (!res.ok) throw new Error(data?.error ?? `Request failed with status ${res.status}`);
console.log(data);
```

```python
import os
import requests

resp = requests.put(
    "https://api.pozy.ai/v1/ads/campaigns/65a3737dd8b11ea61f199e6e/targeting",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "platform": "google",
        "targeting": {
            "devices": [
                "MOBILE",
            ],
            "locations": [
                "string",
            ],
            "languages": [
                "string",
            ],
        },
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `campaignId`, string
- `adGroupId`, string
- `updated`, array of string: Each item: one of `devices`, `locations`, `excludedLocations`, `languages`, `locationTargetingType`
- `locationTargetingType`, string: One of `presence`, `presence_or_interest`. Can be null
- `devices`, array of object
  - `device`, string: One of `MOBILE`, `DESKTOP`, `TABLET`, `CONNECTED_TV`
  - `included`, boolean
  - `bidModifier`, number: Can be null
- `locations`, array of object
  - `geoTargetId`, string
  - `negative`, boolean
  - `name`, string: Can be null
  - `canonicalName`, string: Can be null
  - `type`, string: Can be null
  - `countryCode`, string: Can be null
- `excludedLocations`, array of object
  - `geoTargetId`, string
  - `negative`, boolean
  - `name`, string: Can be null
  - `canonicalName`, string: Can be null
  - `type`, string: Can be null
  - `countryCode`, string: Can be null
- `languages`, array of object
  - `code`, string
  - `id`, string
  - `name`, string

```json
{
  "campaignId": "65a3737dd8b11ea61f199e6e",
  "adGroupId": "6ad180be375f36f2c328e52b",
  "updated": [
    "devices"
  ],
  "locationTargetingType": "presence",
  "devices": [
    {
      "device": "MOBILE",
      "included": true,
      "bidModifier": 12.5
    }
  ],
  "locations": [
    {
      "geoTargetId": "686554da543721f04aabf2a9",
      "negative": true,
      "name": "Acme",
      "canonicalName": "Acme",
      "type": "string",
      "countryCode": "US"
    }
  ],
  "excludedLocations": [
    {
      "geoTargetId": "686554da543721f04aabf2a9",
      "negative": true,
      "name": "Acme",
      "canonicalName": "Acme",
      "type": "string",
      "countryCode": "US"
    }
  ],
  "languages": [
    {
      "code": "string",
      "id": "6bfebd43ddc270f6d2c56fc5",
      "name": "Acme"
    }
  ]
}
```
