Share your feedback about the Google Ads (AdWords) API. Take the 2021 AdWords API and Google Ads API Annual Survey.

Managing User Access

As an administrator, you can get the list of users with access to an account by building a Google Ads Query Language statement to query all the CustomerUserAccess entities associated with a customer ID. Here is a typical query:

SELECT
  customer_user_access.user_id,
  customer_user_access.email_address,
  customer_user_access.access_role,
  customer_user_access.access_creation_date_time,
  customer_user_access.inviter_user_email_address
FROM customer_user_access

You can also audit users who have access to your account, modify their access levels, and remove user accounts. Learn more about account access levels.

Here is a code example demonstrating how to modify the access role of a user. This call assumes that you have identified the correct user access by running the query shown above.

private void ModifyUserAccess(GoogleAdsClient client, long customerId, long userId,
    AccessRole accessRole)
{
    // Get the CustomerUserAccessService.
    CustomerUserAccessServiceClient userAccessService = client.GetService(
        Services./google-ads/api/reference/rpc/v9/.CustomerUserAccessService);

    // Creates the modified user access.
    CustomerUserAccess userAccess = new CustomerUserAccess()
    {
        ResourceName = ResourceNames.CustomerUserAccess(customerId, userId),
        AccessRole = accessRole
    };

    // Creates the operation.
    CustomerUserAccessOperation operation = new CustomerUserAccessOperation()
    {
        Update = userAccess,
        UpdateMask = FieldMasks.AllSetFieldsOf(userAccess)
    };

    // Updates the user access.
    MutateCustomerUserAccessResponse response =
        userAccessService.MutateCustomerUserAccess(
            customerId.ToString(), operation);

    // Displays the result.
    Console.WriteLine($"Successfully modified customer user access with " +
        $"resource name '{response.Result.ResourceName}'.");
}