> [!IMPORTANT]
> **Important:** [Upgrade your Customer Match workflows to the Data Manager
> API](https://developers.google.com/data-manager/api/devguides/audiences/display-video/customer-match/upgrade) for an improved developer experience and access to additional features. We don't recommend implementing new Customer Match workflows using the Display \& Video 360 API.

Once you have prepared your customer data, use a [`create`](https://developers.google.com/display-video/api/reference/rest/current/firstPartyAndPartnerAudiences/create) request
to create an audience.

> [!NOTE]
> **Note:** A membership duration is required when creating a Customer Match audience. The membership duration is expressed in days. A user's membership begins when their data is uploaded. When the user's membership expires, they are removed from the list.

Here's how to create a Customer Match audience using [hashed user phone
numbers](https://developers.google.com/display-video/api/guides/tasks/upload-customer-match-audience/prepare-data#contact_information):

### Java

```java
// Provide the membership duration of the audience in days.
long membershipDurationDays = membership-duration-days;

// Provide the signals of consent for the customers.
String adUserDataConsent = ad-user-data-consent;
String adPersonalizationConsent = ad-personalization-consent;

// Provide the list of hashed phone numbers to use to populate the audience.
List<String> hashedPhoneNumbers = hashed-phone-numbers;

// Build list of ContactInfo objects.
List<ContactInfo> contactInfos = new ArrayList<>();
for (String hashedNumber : hashedPhoneNumbers) {
  contactInfos.add(
      new ContactInfo()
          .setHashedPhoneNumbers(Arrays.asList(hashedNumber)));
}

// Build the customer match FirstPartyAndPartnerAudience object.
FirstPartyAndPartnerAudience audience =
    new FirstPartyAndPartnerAudience()
        .setDisplayName(display-name)
        .setFirstPartyAndPartnerAudienceType("TYPE_FIRST_PARTY")
        .setAudienceType("CUSTOMER_MATCH_CONTACT_INFO")
        .setMembershipDurationDays(membershipDurationDays)
        .setContactInfoList(
            new ContactInfoList()
                .setContactInfos(contactInfos)
                .setConsent(
                    new Consent()
                        .setAdUserData(adUserDataConsent)
                        .setAdPersonalization(adPersonalizationConsent)));

// Call the API to create the audience.
FirstPartyAndPartnerAudience response =
    service
        .firstPartyAndPartnerAudiences()
        .create(audience)
        .setAdvertiserId(advertiser-id)
        .execute();

// Display the new audience ID.
System.out.printf(
    "Customer Match audience was created with ID %s.",
    response.getFirstPartyAndPartnerAudienceId());
```

### Python

```python
# Provide the parent advertiser ID to create the audience under.
advertiser_id = advertiser-id

# Provide the display name of the audience.
display_name = display-name

# Provide the membership duration of the audience in days.
membership_duration_days = membership-duration-days

# Provide the signals of consent for the customers.
ad_user_data_consent = ad-user-data-consent
ad_personalization_consent = ad-personalization-consent

# Provide the list of hashed phone numbers to use to populate the audience.
hashed_phone_numbers = hashed-phone-numbers

# Build list of ContactInfo objects.
contact_infos = []
for hashed_phone_number in hashed_phone_numbers:
  contact_infos.append({"hashedPhoneNumbers": [hashed_phone_number]})

# Create the customer match FirstPartyAndPartnerAudience object.
audience_obj = {
    "displayName": display_name,
    "firstPartyAndPartnerAudienceType": "TYPE_FIRST_PARTY",
    "audienceType": "CUSTOMER_MATCH_CONTACT_INFO",
    "membershipDurationDays": membership_duration_days,
    "contactInfoList": {
        "contactInfos": contact_infos,
        "consent": {
            "adUserData": ad_user_data_consent,
            "adPersonalization": ad_personalization_consent,
        },
    },
}

# Build and execute request.
audience_response = (
    service.firstPartyAndPartnerAudiences()
    .create(advertiserId=advertiser_id, body=audience_obj)
    .execute()
)

# Print ID of new audience.
print(
    "Customer Match audience was created with ID "
    f'{audience_response["firstPartyAndPartnerAudienceId"]}.'
)
```

### PHP

```php
// Provide the parent advertiser ID to create the audience under.
$advertiserId = advertiser-id;

// Provide the display name of the audience.
$displayName = display-name;

// Provide the membership duration of the audience in days.
$membershipDurationDays = membership-duration-days;

// Provide the signals of consent for the customers.
$adUserDataConsent = ad-user-data-consent;
$adPersonalizationConsent = ad-personalization-consent;

// Provide the list of hashed phone numbers to use to populate the audience.
$hashedPhoneNumbers = hashed-phone-numbers;

// Build list of ContactInfo objects.
$contactInfos = array();
foreach ($hashedPhoneNumbers as $hashedPhoneNumber) {
    $contactInfo = new Google_Service_DisplayVideo_ContactInfo();
    $contactInfo->setHashedPhoneNumbers(array($hashedPhoneNumber));
    $contactInfos[] = $contactInfo;
}

// Create the customer match FirstPartyAndPartnerAudience object.
$audience = new Google_Service_DisplayVideo_FirstPartyAndPartnerAudience();
$audience->setDisplayName($displayName);
$audience->setFirstPartyAndPartnerAudienceType('TYPE_FIRST_PARTY');
$audience->setAudienceType('CUSTOMER_MATCH_CONTACT_INFO');
$audience->setMembershipDurationDays($membershipDurationDays);

$contactInfoList = new Google_Service_DisplayVideo_ContactInfoList();
$contactInfoList->setContactInfos($contactInfos);
$consent = new Google_Service_DisplayVideo_Consent();
$consent->setAdUserData($adUserDataConsent);
$consent->setAdPersonalization($adPersonalizationConsent);
$contactInfoList->setConsent($consent);
$audience->setContactInfoList($contactInfoList);

$createAudienceOptParams = array(
    'advertiserId' => $advertiserId
);

// Call the API, creating the audience.
try {
    $result = $this->service->firstPartyAndPartnerAudiences->create($audience, $createAudienceOptParams);
} catch (\Exception $e) {
    $this->renderError($e);
    return;
}

// Print ID of new audience.
printf(
    '<p>Customer Match audience was created with ID %s.</p>',
    $result['firstPartyAndPartnerAudienceId']
);
```