# Update an audience

Updates an audience.

```http
PUT https://api.pozy.ai/v1/ads/audiences/{audienceId}
```

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

## Path parameters

- `audienceId` (string, required)

## Request body

Content type: `application/json`

- `name`, string: Up to 255 characters
- `description`, string
- `spec`, object
  - `userOs`, array of string: At least 1 item
  - `userDevice`, array of string: At least 1 item
  - `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
      - `radius`, number
      - `distanceUnit`, string: One of `mile`, `kilometer`
  - `zips`, array of object
    - `key`, string, required
    - `name`, string
  - `metros`, array of object
    - `key`, string, required
    - `name`, string
  - `countryGroups`, array of string: Each item: one of `africa`, `asia`, `europe`, `north_america`, `south_america`, `oceania`, `central_america`, `caribbean`, `eea`, `euro_area`, `nafta`, `mercosur`, `afta`, `apec`, `gcc`, `cisfta`, `emerging_markets`, `itunes_app_store`, `android_free_store`, `android_paid_store`
  - `customLocations`, array of object
    - `latitude`, number, required: -90 to 90
    - `longitude`, number, required: -180 to 180
    - `radius`, number, required
    - `distanceUnit`, string, required: One of `mile`, `kilometer`
    - `name`, string
    - `address`, string
  - `excludedLocations`, object
    - `countries`, array of string
    - `countryGroups`, array of string: Each item: one of `africa`, `asia`, `europe`, `north_america`, `south_america`, `oceania`, `central_america`, `caribbean`, `eea`, `euro_area`, `nafta`, `mercosur`, `afta`, `apec`, `gcc`, `cisfta`, `emerging_markets`, `itunes_app_store`, `android_free_store`, `android_paid_store`
    - `regions`, array of object
      - `key`, string, required
      - `name`, string
    - `cities`, array of object
      - `key`, string, required
      - `radius`, number
      - `distanceUnit`, string: One of `mile`, `kilometer`
    - `zips`, array of object
      - `key`, string, required
      - `name`, string
    - `places`, array of object
      - `key`, string, required
    - `neighborhoods`, array of object
      - `key`, string, required
    - `customLocations`, array of object
      - `latitude`, number, required: -90 to 90
      - `longitude`, number, required: -180 to 180
      - `radius`, number, required
      - `distanceUnit`, string, required: One of `mile`, `kilometer`
      - `name`, string
      - `address`, string
  - `ageMin`, integer: 13 to 100
  - `ageMax`, integer: 13 to 100
  - `gender`, string: One of `all`, `male`, `female`
  - `incomeTier`, string: One of `top_5`, `top_10`, `top_10_25`, `top_25_50`
  - `languages`, array of string
  - `interests`, array of object
    - `id`, string, required
    - `name`, string
  - `behaviors`, array of object
    - `id`, string, required
    - `name`, string
  - `workPositions`, array of object
    - `id`, string, required
    - `name`, string
  - `workEmployers`, array of object
    - `id`, string, required
    - `name`, string
  - `workIndustries`, array of object
    - `id`, string, required
    - `name`, string
  - `industries`, array of string
  - `companySizes`, array of string
  - `seniorities`, array of string
  - `jobFunctions`, array of string
  - `skills`, array of string
  - `audienceInclude`, array of string
  - `audienceExclude`, array of string
  - `communities`, array of string
  - `excludedCommunities`, array of string
  - `conversationKeywords`, array of string
  - `excludedConversationKeywords`, array of string

## Example request

```bash
curl -X PUT "https://api.pozy.ai/v1/ads/audiences/6cb6496d2ca0017ff720f51f" \
  -H "Authorization: Bearer $POZY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Acme",
  "description": "A short description",
  "spec": {
    "userOs": [
      "string"
    ],
    "userDevice": [
      "string"
    ],
    "countries": [
      "string"
    ]
  }
}'
```

```ts
const res = await fetch("https://api.pozy.ai/v1/ads/audiences/6cb6496d2ca0017ff720f51f", {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.POZY_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Acme",
    description: "A short description",
    spec: {
      userOs: [
        "string"
      ],
      userDevice: [
        "string"
      ],
      countries: [
        "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/audiences/6cb6496d2ca0017ff720f51f",
    headers={"Authorization": f"Bearer {os.environ['POZY_API_KEY']}"},
    json={
        "name": "Acme",
        "description": "A short description",
        "spec": {
            "userOs": [
                "string",
            ],
            "userDevice": [
                "string",
            ],
            "countries": [
                "string",
            ],
        },
    },
    timeout=30,
)
resp.raise_for_status()
print(resp.json())
```

## Response 200

- `audience`, object
- `message`, string

```json
{
  "audience": {},
  "message": "Hello from Pozy"
}
```
