> [!WARNING]
> **Warning:** This feature is available only to advertisers who have spent more than $1,000 USD and are in good standing with Google Ads policies. To troubleshoot sub-account creation issues in your Google Ads Manager account, [contact support](https://support.google.com/google-ads/supporthub) or read the [manager account guidelines](https://support.google.com/google-ads/answer/7456139).

To create a new client account, submit a pre-populated [`Customer`](https://developers.google.com/google-ads/api/reference/rpc/v26/Customer.md.txt) object
using the [`CreateCustomerClient`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerService/CreateCustomerClient.md.txt) method on [`CustomerService`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerService.md.txt).

Unlike standard entity creation (such as creating campaigns using `mutate`
calls), you must specify the **customer ID of the manager account** in the
request rather than the ID of the customer being created.

## Request and customer fields

When calling [`CustomerService.CreateCustomerClient`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerService/CreateCustomerClient.md.txt), configure
[`CreateCustomerClientRequest`](https://developers.google.com/google-ads/api/reference/rpc/v26/CreateCustomerClientRequest.md.txt) and its nested [`Customer`](https://developers.google.com/google-ads/api/reference/rpc/v26/Customer.md.txt) object as
shown in the following table:

| Field or header | Requirement | Mutability and description |
|---|---|---|
| `customer_id` | Required | The 10-digit customer ID (without hyphens) of the direct parent **manager account** under which the new client account is created. |
| `login-customer-id` (header) | Conditional | Required in the request headers if the authenticated user accesses the parent manager account (`customer_id`) through an ancestor manager account higher in the hierarchy. |
| `customer_client.descriptive_name` | Required | **Mutable:** Display name for the new account (for example, `"Acct Created with CustomerService"`). Can be updated later with [`CustomerService.MutateCustomer`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerService/MutateCustomer.md.txt). |
| `customer_client.currency_code` | Required | **Immutable after creation:** 3-character ISO 4217 billing currency code (for example, `USD` or `EUR`). See [supported currency codes](https://developers.google.com/google-ads/api/data/codes-formats.md.txt#currency_codes). |
| `customer_client.time_zone` | Required | **Immutable after creation:** Account time zone ID (for example, `America/New_York`). See [supported time zones](https://developers.google.com/google-ads/api/data/codes-formats.md.txt#timezone_ids). |
| `email_address` and `access_role` | Optional (allowlist only) | Invites a user (`ADMIN`, `STANDARD`, `READ_ONLY`, or `EMAIL_ONLY`) to the created account during creation. Accounts not on the allowlist must invite users after creation using [`CustomerUserAccessInvitationService`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerUserAccessInvitationService.md.txt). |
| `validate_only` | Optional | When `true`, validates the request parameters and manager eligibility without creating the account. |

> [!NOTE]
> **Note:** Additional [`Customer`](https://developers.google.com/google-ads/api/reference/rpc/v26/Customer.md.txt) settings such as `tracking_url_template`, `final_url_suffix`, `auto_tagging_enabled`, and `call_reporting_setting` can be configured or updated on the newly created customer ID using [`CustomerService.MutateCustomer`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerService/MutateCustomer.md.txt) with a `FieldMask`.

## Code example

The following example demonstrates how to create a customer account under an
existing manager account:


### Java

```java
private void runExample(GoogleAdsClient googleAdsClient, Long managerId) {
  // Formats the current date/time to use as a timestamp in the new customer description.
  String dateTime = ZonedDateTime.now().format(DateTimeFormatter.RFC_1123_DATE_TIME);

  // Initializes a Customer object to be created.
  Customer customer =
      Customer.newBuilder()
          .setDescriptiveName("Account created with CustomerService on '" + dateTime + "'")
          .setCurrencyCode("USD")
          .setTimeZone("America/New_York")
          // Optional: Sets additional attributes of the customer.
          .setTrackingUrlTemplate("{lpurl}?device={device}")
          .setFinalUrlSuffix("keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}")
          .build();

  // Sends the request to create the customer.
  try (CustomerServiceClient client =
      googleAdsClient.getLatestVersion().createCustomerServiceClient()) {
    CreateCustomerClientResponse response =
        client.createCustomerClient(managerId.toString(), customer);
    System.out.printf(
        "Created a customer with resource name '%s' under the manager account with"
            + " customer ID '%d'.%n",
        response.getResourceName(), managerId);
  }
}
      
```

### C#

```c#
public void Run(GoogleAdsClient client, long managerCustomerId)
{
    // Get the CustomerService.
    CustomerServiceClient customerService = client.GetService(Services.V26.CustomerService);

    Customer customer = new Customer()
    {
        DescriptiveName = $"Account created with CustomerService on '{DateTime.Now}'",

        // For a list of valid currency codes and time zones see this documentation:
        // https://developers.google.com/google-ads/api/reference/data/codes-formats#codes_formats.
        CurrencyCode = "USD",
        TimeZone = "America/New_York",

        // The below values are optional. For more information about URL
        // options see: https://support.google.com/google-ads/answer/6305348.
        TrackingUrlTemplate = "{lpurl}?device={device}",
        FinalUrlSuffix = "keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"
    };

    try
    {
        // Create the account.
        CreateCustomerClientResponse response = customerService.CreateCustomerClient(
            managerCustomerId.ToString(), customer);

        // Display the result.
        Console.WriteLine($"Created a customer with resource name " +
            $"'{response.ResourceName}' under the manager account with customer " +
            $"ID '{managerCustomerId}'");
    }
    catch (GoogleAdsException e)
    {
        Console.WriteLine("Failure:");
        Console.WriteLine($"Message: {e.Message}");
        Console.WriteLine($"Failure: {e.Failure}");
        Console.WriteLine($"Request ID: {e.RequestId}");
        throw;
    }
}
      
```

### PHP

```php
public static function runExample(GoogleAdsClient $googleAdsClient, int $managerCustomerId)
{
    $customer = new Customer([
        'descriptive_name' => 'Account created with CustomerService on ' . date('Ymd h:i:s'),
        // For a list of valid currency codes and time zones see this documentation:
        // https://developers.google.com/google-ads/api/reference/data/codes-formats.
        'currency_code' => 'USD',
        'time_zone' => 'America/New_York',
        // The below values are optional. For more information about URL
        // options see: https://support.google.com/google-ads/answer/6305348.
        'tracking_url_template' => '{lpurl}?device={device}',
        'final_url_suffix' => 'keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}'
    ]);

    // Issues a mutate request to create an account
    $customerServiceClient = $googleAdsClient->getCustomerServiceClient();
    $response = $customerServiceClient->createCustomerClient(
        CreateCustomerClientRequest::build($managerCustomerId, $customer)
    );

    printf(
        'Created a customer with resource name "%s" under the manager account with '
        . 'customer ID %d.%s',
        $response->getResourceName(),
        $managerCustomerId,
        PHP_EOL
    );
}
      
```

### Python

```python
def main(client: GoogleAdsClient, manager_customer_id: str) -> None:
    """The main method that creates all necessary entities for the example.

    Args:
        client: an initialized GoogleAdsClient instance.
        manager_customer_id: a manager client customer ID.
    """
    customer_service: CustomerServiceClient = client.get_service(
        "CustomerService"
    )
    customer: Customer = client.get_type("Customer")
    now: str = datetime.today().strftime("%Y%m%d %H:%M:%S")
    customer.descriptive_name = f"Account created with CustomerService on {now}"
    # For a list of valid currency codes and time zones see this documentation:
    # https://developers.google.com/google-ads/api/reference/data/codes-formats
    customer.currency_code = "USD"
    customer.time_zone = "America/New_York"
    # The below values are optional. For more information about URL
    # options see: https://support.google.com/google-ads/answer/6305348
    customer.tracking_url_template = "{lpurl}?device={device}"
    customer.final_url_suffix = (
        "keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"
    )

    response: CreateCustomerClientResponse = (
        customer_service.create_customer_client(
            customer_id=manager_customer_id, customer_client=customer
        )
    )
    print(
        f'Customer created with resource name "{response.resource_name}" '
        f'under manager account with ID "{manager_customer_id}".'
    )
      
```

### Ruby

```ruby
def create_customer(manager_customer_id)
  # GoogleAdsClient will read a config file from
  # ENV['HOME']/google_ads_config.rb when called without parameters
  client = Google::Ads::GoogleAds::GoogleAdsClient.new

  customer = client.resource.customer do |c|
    c.descriptive_name = "Account created with CustomerService on #{(Time.new.to_f * 1000).to_i}"

    # For a list of valid currency codes and time zones, see this documentation:
    # https://developers.google.com/google-ads/api/reference/data/codes-formats
    c.currency_code = "USD"
    c.time_zone = "America/New_York"

    # The below values are optional. For more information about URL options, see:
    # https://support.google.com/google-ads/answer/6305348
    c.tracking_url_template = "{lpurl}?device={device}"
    c.final_url_suffix = "keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"
  end

  response = client.service.customer.create_customer_client(
    customer_id: manager_customer_id,
    customer_client: customer
  )

  puts "Created a customer with resource name #{response.resource_name} under" +
      " the manager account with customer ID #{manager_customer_id}."
end
      
```

### Perl

```perl
sub create_customer {
  my ($api_client, $manager_customer_id) = @_;

  # Initialize a customer to be created.
  my $customer = Google::Ads::GoogleAds::V26::Resources::Customer->new({
      descriptiveName => "Account created with CustomerService on #" . uniqid(),

      # For a list of valid currency codes and time zones, see this documentation:
      # https://developers.google.com/google-ads/api/reference/data/codes-formats
      currencyCode => "USD",
      timeZone     => "America/New_York",

      # The below values are optional. For more information about URL options, see:
      # https://support.google.com/google-ads/answer/6305348
      trackingUrlTemplate => "{lpurl}?device={device}",
      finalUrlSuffix      =>
        "keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"
  });

  # Create the customer client.
  my $create_customer_client_response =
    $api_client->CustomerService()->create_customer_client({
      customerId     => $manager_customer_id,
      customerClient => $customer
    });

  printf
    "Created a customer with resource name '%s' under the manager account " .
    "with customer ID %d.\n", $create_customer_client_response->{resourceName},
    $manager_customer_id;

  return 1;
}
      
```

### curl

```console
# Creates a customer client.
#
# Variables:
#   API_VERSION,
#   MANAGER_CUSTOMER_ID,
#   OAUTH2_ACCESS_TOKEN:
#     See https://developers.google.com/google-ads/api/rest/auth#request_headers
#     for details.
#
curl -f --request POST \
"https://googleads.googleapis.com/v${API_VERSION}/customers/${MANAGER_CUSTOMER_ID}:createCustomerClient" \
--header "Content-Type: application/json" \
--header "login-customer-id: ${MANAGER_CUSTOMER_ID}" \
--header "Authorization: Bearer ${OAUTH2_ACCESS_TOKEN}" \
--data @- <<EOF
{
  "customerClient": {
    "descriptiveName": "Account created with CustomerService #${RANDOM}",
    "currencyCode": "USD",
    "timeZone": "America/New_York"
  }
}
EOF
      
```

<br />

## Response and next steps

On success, [`CreateCustomerClient`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerService/CreateCustomerClient.md.txt) returns a `CreateCustomerClientResponse`
containing the `resource_name` (`customers/{new_customer_id}`) of the newly
created account (plus an `invitation_link` if `email_address` and `access_role`
were included by a manager account on the allowlist). You can then use this
resource name or customer ID to verify the account in your hierarchy, grant user
access, configure billing, or populate campaigns.

### Verify the created account in the manager hierarchy

Query the [`customer_client`](https://developers.google.com/google-ads/api/fields/v26/customer_client.md.txt) resource against the manager
account (`customer_id`) using [`GoogleAdsService.SearchStream`](https://developers.google.com/google-ads/api/reference/rpc/v26/GoogleAdsService/SearchStream.md.txt)
to inspect the newly created sub-account:

```sql
SELECT
  customer_client.id,
  customer_client.resource_name,
  customer_client.client_customer,
  customer_client.descriptive_name,
  customer_client.currency_code,
  customer_client.time_zone,
  customer_client.manager,
  customer_client.level,
  customer_client.status
FROM customer_client
WHERE customer_client.level = 1
  AND customer_client.id = {new_customer_id}
```

### Invite users to the new account

If your manager account isn't on the allowlist for setting `email_address` and
`access_role` directly on [`CreateCustomerClientRequest`](https://developers.google.com/google-ads/api/reference/rpc/v26/CreateCustomerClientRequest.md.txt), send an access
invitation to the newly created `new_customer_id` using
[`MutateCustomerUserAccessInvitation`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerUserAccessInvitationService/MutateCustomerUserAccessInvitation.md.txt) on
[`CustomerUserAccessInvitationService`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerUserAccessInvitationService.md.txt). When authenticating through the
parent manager account, include `login-customer-id: {manager_customer_id}` in
the HTTP request headers:

```json
POST https://googleads.googleapis.com/v26/customers/{new_customer_id}/customerUserAccessInvitations:mutate
{
  "operation": {
    "create": {
      "emailAddress": "user@example.com",
      "accessRole": "ADMIN"
    }
  }
}
```

## Error handling

Calls to [`CreateCustomerClient`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerService/CreateCustomerClient.md.txt) can return the following errors:

- [`CustomerError`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerErrorEnum.CustomerError.md.txt): Indicates account-level creation restrictions, such as `CREATION_DENIED_INELIGIBLE_MCC` (the manager account isn't eligible to create new accounts) or `CREATION_DENIED_FOR_POLICY_VIOLATION` (customer creation is denied due to a policy violation).
- [`ManagerLinkError`](https://developers.google.com/google-ads/api/reference/rpc/v26/ManagerLinkErrorEnum.ManagerLinkError.md.txt): Indicates hierarchy or account limit constraints, such as `TOO_MANY_ACCOUNTS`, `TOO_MANY_ACCOUNTS_AT_MANAGER`, or `MAX_DEPTH_EXCEEDED`.
- [`AccessInvitationError`](https://developers.google.com/google-ads/api/reference/rpc/v26/AccessInvitationErrorEnum.AccessInvitationError.md.txt): Returned if an optional `email_address` (along with `access_role`, available only to accounts on the allowlist) is provided on [`CreateCustomerClientRequest`](https://developers.google.com/google-ads/api/reference/rpc/v26/CreateCustomerClientRequest.md.txt) to invite a user to the new account and the invitation fails (for example, `INVALID_EMAIL_ADDRESS`, `GOOGLE_CONSUMER_ACCOUNT_NOT_ALLOWED`, or `EMAIL_DOMAIN_POLICY_VIOLATED`). Accounts that aren't on the allowlist should invite users after account creation using [`CustomerUserAccessInvitationService`](https://developers.google.com/google-ads/api/reference/rpc/v26/CustomerUserAccessInvitationService.md.txt).
- [`CurrencyCodeError.UNSUPPORTED`](https://developers.google.com/google-ads/api/reference/rpc/v26/CurrencyCodeErrorEnum.CurrencyCodeError.md.txt#unsupported) or [`TimeZoneError.INVALID_TIME_ZONE`](https://developers.google.com/google-ads/api/reference/rpc/v26/TimeZoneErrorEnum.TimeZoneError.md.txt#invalid_time_zone): Returned when the specified `currency_code` or `time_zone` on the [`Customer`](https://developers.google.com/google-ads/api/reference/rpc/v26/Customer.md.txt) object is invalid or unsupported.