---
updatedAt: 2025-10-09T17:48:57.000Z
agentTools:
  projectIndex: https://docs.uplynk.com/llms.txt
---

# Update Audience

v4

Updates an audience or a superaudience.

You may not convert an audience to a superaudience or vice versa. As a result, you may not modify the type property.

### Request

Request syntax:

PATCH /audiences/[Audience ID](#Update-AudienceID)

Define the following variable when submitting the above request:

| VariableA variable represents a value that must be replaced. A variable consists of either a URL segment (e.g., "0001" in /0001/) or a query string value (e.g., "3" in mediaTypes=3). | Description                                                                                                                                                                                 |
| -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Audience ID  Required                                                                                                                                                                  | Identifies an audience by its system-defined or external ID.  Use the [Get Multiple Audiences endpoint](#GetMultipleAudiences) to retrieve a list of audiences/superaudience and their IDs. |

Request body parameters:

Pass the following request body parameters:

| Name           | Data Type             | Description                                                                                                                                                                                                                                                                             |     |                                                    |
| :------------- | :-------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-- | :------------------------------------------------- |
| country\_codes | List of string values | Audience only  Identifies the set of countries associated with this audience. Specify each country by its two character country code (ISO 3166).  [View a list of country codes.](http://dev.maxmind.com/geoip/legacy/codes/iso3166/)                                                   |     |                                                    |
| desc           | String                | Defines the name of the audience or superaudience.                                                                                                                                                                                                                                      |     |                                                    |
| devices        | List of string values | Audience only  Identifies the set of devices associated with this audience. Specify a name or description for each desired device.  Each value in this List will be compared against the value defined for the [repl.cbdevice playback URL parameter](../Security/Blackout.htm#Device). |     |                                                    |
| dma\_codes     | List of string values | Audience only  Identifies the set of designated market areas (DMA) associated with this audience. Specify the ID for each desired United States DMA.  [Request Nielsen DMA data.](https://www.nielsen.com/dma-regions/)                                                                 |     |                                                    |
| external\_id   | String                | Defines the external ID associated with this audience or superaudience.                                                                                                                                                                                                                 |     |                                                    |
| ip\_networks   | List of string values | Audience only  Identifies the set of IP addresses or subnets associated with this audience. Specify each desired IP address or subnet.                                                                                                                                                  |     |                                                    |
| match\_type    | String                | Determines the set of criteria that will be required to qualify a viewer for this audience or superaudience. Valid values are: ALL                                                                                                                                                      | ANY | NONE [Learn more.](../Security/Blackout.htm#match) |
| sub\_audiences | List of string values | Superaudience only  Defines the set of audiences associated with this superaudience. Specify the system-defined ID for each desired audience.  [Learn more.](../Security/Blackout.htm#GroupingAudiences)                                                                                |     |                                                    |
| zip\_codes     | List of string values | Audience only  Identifies the set of United States zip codes associated with this audience. Specify each desired 5 digit zip code.                                                                                                                                                      |     |                                                    |

### Response

A successful request returns a 200 OK response that contains the following properties:

| Name           | Data Type             | Description                                                                                                                                                                                                                                                                                |                                      |                                  |
| :------------- | :-------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------- | :------------------------------- |
| @id            | String                | Indicates the relative path to an endpoint that returns this audience or superaudience.                                                                                                                                                                                                    |                                      |                                  |
| @type          | String                | Returns Audience.                                                                                                                                                                                                                                                                          |                                      |                                  |
| country\_codes | List of string values | Audience only  Indicates the set of countries associated with this audience. Each value identifies a country by its two character country code (ISO 3166).  [View a list of country codes.](http://dev.maxmind.com/geoip/legacy/codes/iso3166/)                                            |                                      |                                  |
| created        | String                | Indicates the timestamp (UTC) at which the audience or superaudience was created.  Syntax (ISO 8601): YYYY-MM-DDThh:mm:ss.sssZ                                                                                                                                                             |                                      |                                  |
| desc           | String                | Indicates the name of the audience or superaudience.                                                                                                                                                                                                                                       |                                      |                                  |
| devices        | List of string values | Audience only  Indicates the set of devices associated with this audience. Each value identifies a device by its name or description.  Each value in this List will be compared against the value defined for the [repl.cbdevice playback URL parameter](../Security/Blackout.htm#Device). |                                      |                                  |
| dma\_codes     | List of string values | Audience only  Indicates the set of designated market areas (DMA) associated with this audience. Each value identifies a United States DMS by its ID.  [Request Nielsen DMA data.](https://www.nielsen.com/intl-campaigns/us/dma-maps.html)                                                |                                      |                                  |
| external\_id   | String                | Indicates the external ID associated with this audience or superaudience.                                                                                                                                                                                                                  |                                      |                                  |
| id             | String                | Identifies this audience or superaudience by its system-defined ID.                                                                                                                                                                                                                        |                                      |                                  |
| ip\_networks   | List of string values | Audience only  Indicates the set of IP addresses or subnets associated with this audience. Each value identifies either an IP address or IP network.                                                                                                                                       |                                      |                                  |
| match\_type    | String                | Determines the set of criteria that will be required to qualify a viewer for this audience or superaudience. Valid values are: ALL                                                                                                                                                         | ANY                                  | NONE [Learn more.](https://docs.uplynk.com/reference/blackout) |
| owner          | String                | Indicates the system-defined ID for the user that owns this audience or superaudience.                                                                                                                                                                                                     |                                      |                                  |
| sub\_audiences | List of string values | Superaudience only  Indicates the set of audiences associated with this superaudience. Each value identifies an audience by its system-defined ID.  [Learn more.](https://docs.uplynk.com/reference/blackout)                                                                                                            |                                      |                                  |
| type           | String                | Indicates whether this configuration is an audience or a superaudience. Valid values are: Single                                                                                                                                                                                           | Multiple [Learn more.](https://docs.uplynk.com/reference/blackout) |                                  |
| zip\_codes     | List of string values | Audience only  Indicates the set of United States zip codes associated with this audience. Each value identifies a zip code.                                                                                                                                                               |                                      |                                  |

### Sample Request/Response

The code below (Python 3) shows how to update an audience.

This code imports names from the `api_auth` module for V4 APIs (see below).

<TutorialTile
  backgroundColor="#018FF4"
  emoji="🦉"
  id="682d18228dd6230012097fad"
  link="https://docs.uplynk.com/v2.0/recipes/api-auth-for-classic-authentication-v4-apis"
  slug="api-auth-for-classic-authentication-v4-apis"
  title="API Auth for Classic Authentication (V4 APIs)"
/> 

```python
import json, requests
from api_auth import APICredentials, APIParams
audience_id = 'abc11672b78c4d03bf4756ec3ea46a22' # Replace with the ID for the desired audience.

class Audience:
    def __init__(self):
        self.host = "https://services.uplynk.com"

    def run(self):
        """
        Update an audience.
        """
        self._update_audience()

    def _update_audience(self):
        url = "{}{}{}".format(self.host, "/api/v4/audiences/", audience_id)

        payload = {
            'country_codes': ['US', 'MX'] # Replace with the desired country codes.
        }

        headers = {'Content-Type': 'application/json'}

        response = requests.patch(
            url, params=APIParams(APICredentials()).get_params({}), data=json.dumps(payload), headers=headers
        )

        print(response.json())

Audience().run()
```

Response:

```json
{
	'@id': '/api/v4/audiences/abc11672b78c4d03bf4756ec3ea46a22',
	'@type': 'Audience',
	'created': '2021-06-30T22:32:09.362Z',
	'id': 'cc1c1672b78c4d03bf4756ec3ea46a45',
	'owner': 'abc123def456ghi789jkl012mno345pq',
	'match_type': 'ANY',
	'external_id': 'NorthAmerica',
	'country_codes': ['MX', 'US'],
	'dma_codes': [],
	'desc': 'My New audience',
	'devices': [],
	'ip_networks': [],
	'zip_codes': [],
	'sub_audiences': [],
	'type': 'Single'
}
```