- [Resource: AudienceSegment](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegment)
  - [JSON representation](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegment.SCHEMA_REPRESENTATION)
- [NonRuleBasedFirstPartyAudienceSegment](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#NonRuleBasedFirstPartyAudienceSegment)
  - [JSON representation](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#NonRuleBasedFirstPartyAudienceSegment.SCHEMA_REPRESENTATION)
- [RuleBasedFirstPartyAudienceSegment](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#RuleBasedFirstPartyAudienceSegment)
  - [JSON representation](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#RuleBasedFirstPartyAudienceSegment.SCHEMA_REPRESENTATION)
- [Rule](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#Rule)
  - [JSON representation](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#Rule.SCHEMA_REPRESENTATION)
- [ThirdPartyAudienceSegment](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#ThirdPartyAudienceSegment)
  - [JSON representation](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#ThirdPartyAudienceSegment.SCHEMA_REPRESENTATION)
- [AudienceSegmentApprovalStatus](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentApprovalStatus)
- [AudienceSegmentLicenseType](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentLicenseType)
- [AudienceSegmentStatus](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentStatus)
- [AudienceSegmentType](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentType)
- [Methods](https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#METHODS_SUMMARY)

## Resource: AudienceSegment

The `AudienceSegment` resource.

| JSON representation |
|---|
| ``` { "name": string, "sharedId": string, "categoryIds": [ string ], // The following is a list of mutually exclusive fields. At most one of the // fields will be set in a response: "nonRuleBasedFirstPartyAudienceSegment": { object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#NonRuleBasedFirstPartyAudienceSegment`) }, "ruleBasedFirstPartyAudienceSegment": { object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#RuleBasedFirstPartyAudienceSegment`) }, "thirdPartyAudienceSegment": { object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#ThirdPartyAudienceSegment`) } // End of mutually exclusive fields. "displayName": string, "description": string, "status": enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentStatus`), "size": string, "mobileWebSize": string, "idfaSize": string, "adIdSize": string, "ppidSize": string, "dataProviderDisplayName": string, "segmentType": enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentType`) } ``` |

| Fields ||
|---|---|
| `name` | `string` Identifier. The resource name of the `AudienceSegment`. Format: `networks/{networkCode}/audienceSegments/{audienceSegmentId}` The `audienceSegmentId` is not always numerical and may have one of the following suffixes: - `~direct` for directly licensed third-party segments - `~global` for globally licensed third-party segments |
| `sharedId` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. The ID of the `AudienceSegment`. Up to two resources may share this ID. |
| `categoryIds[]` | `string (https://developers.google.com/discovery/v1/type-format format)` Optional. Unordered list. IDs of the categories that this audience segment belongs to. See `segment_categories` for additional information about the categories. |
| Based on the `type` classification, the `AudienceSegment` has additional information in zero or one of the following sub-types. The following is a list of mutually exclusive fields. At most one of the fields will be set in a response: ||
| `nonRuleBasedFirstPartyAudienceSegment` | ``object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#NonRuleBasedFirstPartyAudienceSegment`)`` Optional. An `AudienceSegment` owned by the publisher network that does not contain a rule. Cookies are usually added to these segments through cookie upload. |
| `ruleBasedFirstPartyAudienceSegment` | ``object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#RuleBasedFirstPartyAudienceSegment`)`` Optional. An `AudienceSegment` owned by the publisher network that contains a rule. |
| `thirdPartyAudienceSegment` | ``object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#ThirdPartyAudienceSegment`)`` Output only. An `AudienceSegment` owned by a data provider and licensed to the Ad Manager publisher network. |
| End of mutually exclusive fields. ||
| `displayName` | `string` Required. Display name of the `AudienceSegment`. The attribute has a maximum length of 255 characters. |
| `description` | `string` Optional. Description of the `AudienceSegment`. This has a maximum length of 8192 characters. |
| `status` | ``enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentStatus`)`` Output only. Non-empty default. Status of the `AudienceSegment` used to determine whether the segment is available for targeting. Defaults to `ACTIVE` if not set. |
| `size` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. Number of unique identifiers in the `AudienceSegment`. |
| `mobileWebSize` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. Number of unique mobile web identifiers in the `AudienceSegment`. |
| `idfaSize` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. Number of unique Identifier for Advertisers (IDFA) identifiers in the `AudienceSegment`. |
| `adIdSize` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. Number of unique AdID identifiers in the `AudienceSegment`. |
| `ppidSize` | `string (https://developers.google.com/discovery/v1/type-format format)` Output only. Number of unique publisher-provided (PPID) identifiers in the `AudienceSegment`. |
| `dataProviderDisplayName` | `string` Output only. Display name of the owner data provider. For a first-party audience segment, this is the display name of the publisher network. Otherwise, this is the display name of the entity providing the audience segment. |
| `segmentType` | ``enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentType`)`` Output only. Non-empty default. Type of the `AudienceSegment`. Every `AudienceSegment` is either `FIRST_PARTY` or `THIRD_PARTY`. |

## NonRuleBasedFirstPartyAudienceSegment

An `AudienceSegment` owned by the publisher network that does not contain a rule. Cookies are usually added to these segments through cookie upload.

| JSON representation |
|---|
| ``` { "membershipExpirationDays": string } ``` |

| Fields ||
|---|---|
| `membershipExpirationDays` | `string (https://developers.google.com/discovery/v1/type-format format)` Required. Number of days after which a user's cookie will be removed from the `AudienceSegment` due to inactivity. The field can be between 1 and 540. |

## RuleBasedFirstPartyAudienceSegment

An `AudienceSegment` owned by the publisher network that contains a rule.

| JSON representation |
|---|
| ``` { "rule": { object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#Rule`) }, "pageViews": string, "recencyDays": string, "membershipExpirationDays": string } ``` |

| Fields ||
|---|---|
| `rule` | ``object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#Rule`)`` Required. The rule definition which determines the eligibility criteria for the `AudienceSegment`. |
| `pageViews` | `string (https://developers.google.com/discovery/v1/type-format format)` Required. Number of times a user's cookie must match the `rule` before it's associated with the `AudienceSegment`. This is used with `recencyDays` to determine eligibility of the association. This attribute is between 1 and 12. |
| `recencyDays` | `string (https://developers.google.com/discovery/v1/type-format format)` Optional. Number of days within which a user's cookie must match the `rule` before it's associated with the `AudienceSegment`. This is used with `pageViews` to determine eligibility of the association. This attribute is required if `pageViews` is greater than 1. When set, it can be between 1 and 30. |
| `membershipExpirationDays` | `string (https://developers.google.com/discovery/v1/type-format format)` Required. Number of days after which a user's cookie will be removed from the `AudienceSegment` due to inactivity. The field can be between 1 and 540. |

## Rule

Eligibility criteria for a user to be part of an `AudienceSegment`.

| JSON representation |
|---|
| ``` { "inventoryTargeting": { object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/InventoryTargeting`) }, "customTargeting": { object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/CustomTargeting`) } } ``` |

| Fields ||
|---|---|
| `inventoryTargeting` | ``object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/InventoryTargeting`)`` Required. Specification of inventory (i.e. ad units and placements) that are part of the rule of the RuleBasedFirstPartyAudienceSegment. |
| `customTargeting` | ``object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/CustomTargeting`)`` Optional. Specification of custom criteria that are part of the rule of the RuleBasedFirstPartyAudienceSegment. Once specified, the server may return a normalized but equivalent representation of the rule. There are up to 3 levels of custom criteria allowed. See `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/CustomTargeting` and its sub-messages for limitations. |

## ThirdPartyAudienceSegment

An `AudienceSegment` owned by a data provider and licensed to the Ad Manager publisher network.

| JSON representation |
|---|
| ``` { "cost": { object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/Money`) }, "startTime": string, "endTime": string, "approvalStatus": enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentApprovalStatus`), "licenseType": enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentLicenseType`) } ``` |

| Fields ||
|---|---|
| `cost` | ``object (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/Money`)`` Output only. The CPM cost for the given segment. This is assigned by the data provider. The CPM cost comes from the active pricing if it exists, otherwise it comes from the latest pricing. |
| `startTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. Time which this segment becomes available for use. It is assigned by the data provider. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `endTime` | ``string (`https://protobuf.dev/reference/protobuf/google.protobuf#timestamp` format)`` Output only. Time which this segment ceases to be available. It is assigned by the data provider. Uses RFC 3339, where generated output will always be Z-normalized and use 0, 3, 6 or 9 fractional digits. Offsets other than "Z" are also accepted. Examples: `"2014-10-02T15:01:23Z"`, `"2014-10-02T15:01:23.045123456Z"` or `"2014-10-02T15:01:23+05:30"`. |
| `approvalStatus` | ``enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentApprovalStatus`)`` Output only. Whether the publisher has approved or rejected the segment. |
| `licenseType` | ``enum (`https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments#AudienceSegmentLicenseType`)`` Output only. The license type of the external segment. |

## AudienceSegmentApprovalStatus

Specifies the approval status of a ThirdPartyAudienceSegment.

| Enums ||
|---|---|
| `AUDIENCE_SEGMENT_APPROVAL_STATUS_UNSPECIFIED` | Default value. This value is unused. |
| `APPROVED` | Indicates that this segment is approved and can be targeted. |
| `REJECTED` | Indicates that this segment is rejected and cannot be targeted. |
| `UNAPPROVED` | Indicates that this segment is waiting to be approved or rejected. It cannot be targeted. |

## AudienceSegmentLicenseType

Specifies the license type of a ThirdPartyAudienceSegment.

| Enums ||
|---|---|
| `AUDIENCE_SEGMENT_LICENSE_TYPE_UNSPECIFIED` | Default value. This value is unused. |
| `DIRECT` | Indicates that the license is the result of a direct contract between the data provider and the publisher. |
| `GLOBAL` | Indicates that the license is the result of an agreement between Google and the data provider, which agrees to license their audience segments to all the publishers and/or advertisers of the Google ecosystem. |

## AudienceSegmentStatus

Specifies the status of an AudienceSegment.

| Enums ||
|---|---|
| `AUDIENCE_SEGMENT_STATUS_UNSPECIFIED` | Default value. This value is unused. |
| `ACTIVE` | Indicates that this audience segment is available for targeting. |
| `INACTIVE` | Indicates that this audience segment is not available for targeting. |
| `UNUSED` | Indicates that this audience segment was deactivated by Google because it is unused. |

## AudienceSegmentType

Specifies the type of an AudienceSegment.

| Enums ||
|---|---|
| `AUDIENCE_SEGMENT_TYPE_UNSPECIFIED` | Default value. This value is unused. |
| `FIRST_PARTY` | Indicates that the segment is a first party segment created and owned by the publisher. |
| `SHARED` | Indicates that the segment is a first party segment shared by other clients. |
| `THIRD_PARTY` | Indicates that the segment is a third party segment licensed by the publisher from data providers. This does not include Google-provided licensed segments. |

| ## Methods ||
|---|---|
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/batchActivate` | Activates `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/batchApprove` | Approves `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/batchCreate` | Creates `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/batchDeactivate` | Deactivates `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/batchPopulate` | Populates `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/batchReject` | Rejects `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/batchUpdate` | Batch updates `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/create` | Creates an `AudienceSegment` object. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/get` | Retrieves an `AudienceSegment` object. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/list` | Lists `AudienceSegment` objects. |
| ### `https://developers.google.com/ad-manager/api/beta/reference/rest/v1/networks.audienceSegments/patch` | Updates an `AudienceSegment` object. |