Create a Customer Match audience by sending a
[`CreateUserListRequest`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists).

> [!NOTE]
> **Note:** Operations that create, update, or delete user lists must comply with the [EU Political Ads Regulation (EU PAR) policy](https://developers.google.com/google-ads/api/docs/api-policy/eu-par) and may return an `EU_POLITICAL_ADVERTISING_DECLARATION_REQUIRED` error if the account lacks the required declaration.

## Construct the request body

Create a [`UserList`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists#UserList)
resource. Here are the common fields to set.

`displayName`
:   **Required** The display name of the list. The name must be unique among all
    of the lists owned by the account.

`description`
:   A brief description of the list.

`integrationCode`
:   An ID from your system.

`membershipDuration`

:   The duration an audience member remains in the list after added. The value
    must correspond to whole days. If not set, defaults to the maximum.

    If using JSON, calculate the number of seconds by multiplying the duration
    days by `86400` (the number of seconds per day). Then set the value to the
    multiplication result, followed by `s`. For example, if you want a
    membership duration of 90 days, use the value `7776000s` since `90 * 86400 =
    7776000`.

    If using the protocol buffer format, use the convenience method for
    constructing a
    [`Duration`](https://protobuf.dev/reference/protobuf/google.protobuf/#duration)
    object based on the number of days, if such a convenience method exists. For
    example, the `protobuf-java-util` library for Java has a
    [`fromDays()`](https://protobuf.dev/reference/java/api-docs/com/google/protobuf/util/Durations.html#fromDays-long-)
    convenience method. Otherwise, calculate the number of seconds by
    multiplying the duration days by `86400` (the number of seconds per day),
    and use the result to set the `seconds` field of the `Duration` object.

### Required fields for Customer Match


The `ingestedUserListInfo` field is required for a Customer Match audience.

Here are the fields to set on the
[`IngestedUserListInfo`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists#ingesteduserlistinfo)
based on the type of data you want to use to add audience members to the list.

#### Contact information list

Set the following fields if you want to use contact information (hashed email
addresses, phone numbers, or addresses) to define your audience members:

`uploadKeyTypes`

:   Set to a list containing the `CONTACT_ID` upload key type.

    The `uploadKeyTypes` list must contain only *one* entry.

`contactIdInfo`

:   Set to a
    [`ContactIdInfo`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists#contactidinfo)
    message with the `dataSourceType` set to the appropriate value from the
    [`DataSourceType`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists#datasourcetype)
    enum.

#### Mobile ID list

Set the following fields if you want to use mobile IDs to define your audience
members:

`uploadKeyTypes`

:   Set to a list containing the `MOBILE_ID` upload key type.

    The `uploadKeyTypes` list must contain only *one* entry.

`mobileIdInfo`

:   Set to a
    [`MobileIdInfo`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists#mobileidinfo)
    message:

    - Set the `dataSourceType` to the appropriate value from the
      [`DataSourceType`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists#datasourcetype)
      enum.

    - Set the `keySpace` to `IOS` or `ANDROID`.

    - Set the `appId` to the string that uniquely identifies the mobile
      application from which the data was collected.

      - For iOS, the ID string is the 9 digit string that appears at the end
        of the App Store URL. For example, `476943146` for the "Flood-It!"
        app with App Store link
        <https://apps.apple.com/us/app/flood-it/id476943146>.

      - For Android, the ID string is the application's package name. For
        example, `com.labpixies.flood` for the "Flood-It!" app with
        Google Play link
        <https://play.google.com/store/apps/details?id=com.labpixies.flood>.

#### User ID list

Set the following fields if you want to use user IDs to define your audience
members:

`uploadKeyTypes`

:   Set to a list containing the `USER_ID` upload key type.

    The `uploadKeyTypes` list must contain only *one* entry.

<br />

## Construct the request

To create a Customer Match audience, construct a [`create`
request](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists) for the `UserList` resource.

1. Set the `parent` field to the resource name of the account. The resource
   name must follow the format
   `accountTypes/{accountType}/accounts/{account}`.

   <br />

2. Use the `UserList` you constructed for the body of the request.

3. If your credentials aren't for a Google Account that's a user on the
   `parent`, set headers as described in [Configure destinations and
   headers](https://developers.google.com/data-manager/api/devguides/concepts/destinations#resource-management).


Here are sample requests in JSON for the different types of user information.
Each request sets the `membershipDuration` to `2592000s`, where `2592000` is the
number of seconds in 30 days. Click the **Open in API Explorer** button to try a
request.

### Contact information


[Open in API Explorer](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists/create?apix=true&apix_params=%0A%7B%22resource%22:%7B%22description%22:%22Customer+Match+for+contact+info%22,%22displayName%22:%22Contact+info+audience%22,%22ingestedUserListInfo%22:%7B%22contactIdInfo%22:%7B%22dataSourceType%22:%22DATA_SOURCE_TYPE_FIRST_PARTY%22%7D,%22uploadKeyTypes%22:%5B%22CONTACT_ID%22%5D%7D,%22membershipDuration%22:%222592000s%22%7D%7D "Open this sample in API Explorer")

```json
{
    "description": "Customer Match for contact info",
    "displayName": "Contact info audience",
    "ingestedUserListInfo": {
        "contactIdInfo": {
            "dataSourceType": "DATA_SOURCE_TYPE_FIRST_PARTY"
        },
        "uploadKeyTypes": [
            "CONTACT_ID"
        ]
    },
    "membershipDuration": "2592000s"
}
```

<br />

### Mobile IDs


[Open in API Explorer](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists/create?apix=true&apix_params=%0A%7B%22resource%22:%7B%22description%22:%22Customer+Match+for+mobile+IDs%22,%22displayName%22:%22Mobile+ID+audience%22,%22ingestedUserListInfo%22:%7B%22mobileIdInfo%22:%7B%22dataSourceType%22:%22DATA_SOURCE_TYPE_FIRST_PARTY%22,%22keySpace%22:%22ANDROID%22,%22appId%22:%22com.labpixies.flood%22%7D,%22uploadKeyTypes%22:%5B%22MOBILE_ID%22%5D%7D,%22membershipDuration%22:%222592000s%22%7D%7D "Open this sample in API Explorer")

```json
{
    "description": "Customer Match for mobile IDs",
    "displayName": "Mobile ID audience",
    "ingestedUserListInfo": {
        "mobileIdInfo": {
            "dataSourceType": "DATA_SOURCE_TYPE_FIRST_PARTY",
            "keySpace": "ANDROID",
            "appId": "com.labpixies.flood"
        },
        "uploadKeyTypes": [
            "MOBILE_ID"
        ]
    },
    "membershipDuration": "2592000s"
}
```

### User IDs


[Open in API Explorer](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists/create?apix=true&apix_params=%0A%7B%22resource%22:%7B%22description%22:%22Customer+Match+for+user+IDs%22,%22displayName%22:%22User+ID+audience%22,%22ingestedUserListInfo%22:%7B%22userIdInfo%22:%7B%22dataSourceType%22:%22DATA_SOURCE_TYPE_FIRST_PARTY%22%7D,%22uploadKeyTypes%22:%5B%22USER_ID%22%5D%7D,%22membershipDuration%22:%222592000s%22%7D%7D "Open this sample in API Explorer")

```json
{
    "description": "Customer Match for user IDs",
    "displayName": "User ID audience",
    "ingestedUserListInfo": {
        "userIdInfo": {
            "dataSourceType": "DATA_SOURCE_TYPE_FIRST_PARTY"
        },
        "uploadKeyTypes": [
            "USER_ID"
        ]
    },
    "membershipDuration": "2592000s"
}
```

<br />

## Send the request

Send the request and, if required, include
[request headers](https://developers.google.com/data-manager/api/devguides/concepts/destinations#resource-management).

If the request succeeds, the response contains the created
[`UserList`](https://developers.google.com/data-manager/api/reference/rest/v1/accountTypes.accounts.userLists#UserList) with the
`id` and `name` populated. Make note of the values in these fields since you
need them in requests to add audience members to the audience.

If the request fails,
[inspect the errors](https://developers.google.com/data-manager/api/devguides/concepts/understand-errors) to determine the
cause of the failure, update the request and headers to fix any issues, and then
send the updated request and headers.