To provide a safe and trustworthy ad ecosystem for users and to comply with
emerging regulations, Google now requires advertisers to complete one or more
[verification programs](https://support.google.com/adspolicy/answer/9703665).

If you're required to complete a verification program, a deadline might be set
for the verification process. If the deadline passes before you complete
verification, your account could be paused.

You can also proactively undergo verification without being required to do so.
The [`IdentityVerificationService`](https://developers.google.com/google-ads/api/reference/rpc/v26/IdentityVerificationService.md.txt)
offers methods to do the following:

- Retrieve the status of the verification process for a customer account, including any deadlines
- Start a verification process

## Retrieve verification status

> [!IMPORTANT]
> **Important:** All requests to `GetIdentityVerification` for both standard and basic access are rate limited. Fewer requests are allowed per minute when compared to [other services](https://developers.google.com/google-ads/api/docs/best-practices/quotas.md.txt).  
>
> We recommend that you [cache the results](https://developers.google.com/google-ads/api/docs/productionize/manage-data-efficiently.md.txt#cache-your-data) and, if you need to poll the status of the identity verification process for a customer account, do so with a long polling interval.

To retrieve the status of the advertiser identity verification process for a
customer account, call the [`GetIdentityVerification`](https://developers.google.com/google-ads/api/reference/rpc/v26/IdentityVerificationService/GetIdentityVerification.md.txt) method:


### Java

```java
private IdentityVerification getIdentityVerification(
    long customerId, IdentityVerificationServiceClient identityVerificationServiceClient) {
  GetIdentityVerificationResponse response =
      identityVerificationServiceClient.getIdentityVerification(Long.toString(customerId));
  if (response.getIdentityVerificationCount() == 0) {
    return null;
  }
  IdentityVerification identityVerification = response.getIdentityVerification(0);
  String deadline =
      identityVerification
          .getIdentityVerificationRequirement()
          .getVerificationCompletionDeadlineTime();
  IdentityVerificationProgress progress = identityVerification.getVerificationProgress();
  System.out.printf(
      "Account %d has a verification completion deadline of '%s' and status '%s' for advertiser"
          + " identity verification.%n",
      customerId, deadline, progress.getProgramStatus());
  return identityVerification;
}

      
```

### C#

```c#
private static IdentityVerification GetIdentityVerification(
        GoogleAdsClient client, long customerId)
{
    IdentityVerificationServiceClient identityVerificationService =
        client.GetService(Services.V26.IdentityVerificationService);

    try {
        GetIdentityVerificationResponse response =
            identityVerificationService.GetIdentityVerification(
                new GetIdentityVerificationRequest()
                {
                    CustomerId = customerId.ToString()
                }
            );

            if (response.IdentityVerification.Count == 0)
            {
                return null;
            }

            IdentityVerification identityVerification = response.IdentityVerification[0];
            string deadline =
                identityVerification.IdentityVerificationRequirement.VerificationCompletionDeadlineTime;
             IdentityVerificationProgress identityVerificationProgress =
                identityVerification.VerificationProgress;
            Console.WriteLine($"Account {customerId} has a verification completion " +
                $"deadline of {deadline} and status " +
                $"{identityVerificationProgress.ProgramStatus} for advertiser identity " +
                "verification.");

            return identityVerification;
    } 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
private static function getIdentityVerification(
    int $customerId,
    IdentityVerificationServiceClient $identityVerificationServiceClient
) {
    // Gets an identity verification response.
    $response = $identityVerificationServiceClient->getIdentityVerification(
        GetIdentityVerificationRequest::build($customerId)
    );
    if (empty($response->getIdentityVerification())) {
        return null;
    }

    // Prints some details about the retrieved identity verification.
    /** @var IdentityVerification $identityVerification */
    $identityVerification = $response->getIdentityVerification()->getIterator()->current();
    $deadline = $identityVerification->getIdentityVerificationRequirement()
        ->getVerificationCompletionDeadlineTime();
    $progress = $identityVerification->getVerificationProgress();
    printf(
        "Account %d has a verification completion deadline of '%s' and status '%s' for"
        . " advertiser identity verification.%s",
        $customerId,
        $deadline,
        IdentityVerificationProgramStatus::name($progress->getProgramStatus()),
        PHP_EOL
    );

    return $identityVerification;
}
      
```

### Python

```python
def get_identity_verification(
    client: GoogleAdsClient, customer_id: str
) -> Optional[IdentityVerification]:
    """Retrieves the status of the advertiser identity verification process.

    Args:
        client: An initialized GoogleAdsClient instance.
        customer_id: The client customer ID str.

    Returns:
        either an IdentityVerification instance, or None
    """
    service: IdentityVerificationServiceClient = client.get_service(
        "IdentityVerificationService"
    )
    response: GetIdentityVerificationResponse = (
        service.get_identity_verification(customer_id=customer_id)
    )

    # Check if the response contains any indentity verifications. If not, then
    # None will be returned.
    if response.identity_verification:
        identity_verification_data: IdentityVerification = (
            response.identity_verification[0]
        )
        deadline: str = (
            identity_verification_data.identity_verification_requirement.verification_completion_deadline_time
        )
        # progress is an enum member
        progress: (
            IdentityVerificationProgramStatusEnum.IdentityVerificationProgramStatus
        ) = identity_verification_data.verification_progress.program_status

        print(
            f"Account {customer_id} has a verification completion deadline "
            "of {deadline} and status {progress.name} for advertiser identity "  # Use .name for string representation of enum
            "verification."
        )

        return identity_verification_data
      
```

### Ruby

```ruby
def get_identity_verification(client, customer_id)
  response = client.service.identity_verification.get_identity_verification(
    customer_id: customer_id
  )

  return nil if response.nil? || response.identity_verification.empty?

  identity_verification = response.identity_verification.first
  deadline = identity_verification.
    identity_verification_requirement.
    verification_completion_deadline_time
  progress = identity_verification.verification_progress
  puts "Account #{customer_id} has a verification completion deadline " \
    "of #{deadline} and status #{progress.program_status} for advertiser " \
    "identity verification."

  identity_verification
end
      
```

### Perl

```perl
sub get_identity_verification {
  my ($api_client, $customer_id) = @_;

  my $response = $api_client->IdentityVerificationService()->get({
    customerId => $customer_id
  });

  if (!defined $response->{identityVerification}) {
    printf "Account %s does not require advertiser identity verification.",
      $customer_id;
    return;
  }

  my $identity_verification = $response->{identityVerification}[0];
  my $deadline = $identity_verification->{identityVerificationRequirement}
    {verificationCompletionDeadlineTime};
  my $identity_verification_progress =
    $identity_verification->{verificationProgress};

  printf "Account %s has a verification completion deadline of %s and status " .
    "%s for advertiser identity verification.", $customer_id, $deadline,
    $identity_verification_progress->{programStatus};
  return $identity_verification;
}
      
```

### curl

> [!NOTE]
> **Note:** While a direct REST code sample for this step isn't provided here, you can achieve this using a manual REST request.   
>
> Refer to the Google Ads API REST interface documentation and the method-specific reference pages. You will need to construct the JSON payload based on the proto definitions.   
>
> Key Resources:
>
> - [Using REST](https://developers.google.com/google-ads/api/rest/overview.md.txt)
> - [REST Interface Structure](https://developers.google.com/google-ads/api/rest/design/overview.md.txt)
> - [JSON Field Mappings](https://developers.google.com/google-ads/api/rest/design/json-mappings.md.txt)
> - Consult the [REST API Reference](https://developers.google.com/google-ads/api/reference/rpc/latest/overview) for the specific service and method.

<br />

If the customer account is enrolled in the mandatory advertiser identity
verification program, the service returns a non-empty response containing a
list of [`IdentityVerification`](https://developers.google.com/google-ads/api/reference/rpc/v26/IdentityVerification.md.txt) objects. An empty response indicates that
the customer account is not required to undergo advertiser identity
verification.

The Google Ads API only supports the `ADVERTISER_IDENTITY_VERIFICATION`
program, so that would be the only item in the list.

An `IdentityVerification` object contains the following properties:

- An [`IdentityVerificationRequirement`](https://developers.google.com/google-ads/api/reference/rpc/v26/IdentityVerificationRequirement.md.txt) describing the deadlines to
  start and to complete the verification process

- An [`IdentityVerificationProgress`](https://developers.google.com/google-ads/api/reference/rpc/v26/IdentityVerificationProgress.md.txt) describing the current status of the
  verification process: this can also include the action URL for the user to
  complete the verification process.

## Start verification process

If a customer account is enrolled in the mandatory advertiser identity
verification program (that is, `GetIdentityVerification` returned a non-empty
response with a deadline for the verification process completion), or if you
want to undergo proactive verification when `GetIdentityVerification` returns
an empty response, you can start a verification session by calling
[`StartIdentityVerification`](https://developers.google.com/google-ads/api/reference/rpc/v26/IdentityVerificationService/StartIdentityVerification.md.txt):


### Java

```java
private void startIdentityVerification(
    long customerId, IdentityVerificationServiceClient identityVerificationServiceClient) {
  // Sends a request to start the identity verification process.
  identityVerificationServiceClient.startIdentityVerification(
      Long.toString(customerId), IdentityVerificationProgram.ADVERTISER_IDENTITY_VERIFICATION);
}
      
```

### C#

```c#
private static void StartIdentityVerification(GoogleAdsClient client, long customerId)
{
    IdentityVerificationServiceClient identityVerificationService =
        client.GetService(Services.V26.IdentityVerificationService);

    StartIdentityVerificationRequest request = new StartIdentityVerificationRequest()
    {
        CustomerId = customerId.ToString(),
        VerificationProgram = IdentityVerificationProgram.AdvertiserIdentityVerification
    };

    try {
        identityVerificationService.StartIdentityVerification(request);
    } 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
private static function startIdentityVerification(
    int $customerId,
    IdentityVerificationServiceClient $identityVerificationServiceClient
): void {
    // Sends a request to start the identity verification process.
    $identityVerificationServiceClient->startIdentityVerification(
        StartIdentityVerificationRequest::build(
            $customerId,
            IdentityVerificationProgram::ADVERTISER_IDENTITY_VERIFICATION
        )
    );
}
      
```

### Python

```python
def start_identity_verification(
    client: GoogleAdsClient, customer_id: str
) -> None:
    """Starts the identity verification process.

    Args:
        client: An initialized GoogleAdsClient instance.
        customer_id: The client customer ID str.
    """
    service: IdentityVerificationServiceClient = client.get_service(
        "IdentityVerificationService"
    )
    # Sends a request to start the identity verification process.
    # The verification_program argument expects an IdentityVerificationProgramEnum value (int).
    service.start_identity_verification(
        customer_id=customer_id,
        verification_program=client.enums.IdentityVerificationProgramEnum.ADVERTISER_IDENTITY_VERIFICATION.value,
    )
      
```

### Ruby

```ruby
def start_identity_verification(client, customer_id)
  client.service.identity_verification.start_identity_verification(
    customer_id: customer_id,
    verification_program: :ADVERTISER_IDENTITY_VERIFICATION,
  )
end
      
```

### Perl

```perl
sub start_identity_verification {
  my ($api_client, $customer_id) = @_;

  my $request =
    Google::Ads::GoogleAds::V26::Services::IdentityVerificationService::StartIdentityVerificationRequest
    ->new({
      customerId          => $customer_id,
      verificationProgram => ADVERTISER_IDENTITY_VERIFICATION
    });

  $api_client->AdvertiserIdentityVerificationService()
    ->start_identity_verification($request);
}
      
```

### curl

> [!NOTE]
> **Note:** While a direct REST code sample for this step isn't provided here, you can achieve this using a manual REST request.   
>
> Refer to the Google Ads API REST interface documentation and the method-specific reference pages. You will need to construct the JSON payload based on the proto definitions.   
>
> Key Resources:
>
> - [Using REST](https://developers.google.com/google-ads/api/rest/overview.md.txt)
> - [REST Interface Structure](https://developers.google.com/google-ads/api/rest/design/overview.md.txt)
> - [JSON Field Mappings](https://developers.google.com/google-ads/api/rest/design/json-mappings.md.txt)
> - Consult the [REST API Reference](https://developers.google.com/google-ads/api/reference/rpc/latest/overview) for the specific service and method.

<br />

This will only succeed if there isn't another verification session in progress.
If a session is already in progress, the call returns an
[`IdentityVerificationError.VERIFICATION_ALREADY_STARTED`](https://developers.google.com/google-ads/api/reference/rpc/v26/IdentityVerificationErrorEnum.IdentityVerificationError.md.txt#verification_already_started) error.
Once you have started a verification session, subsequent calls to
`GetIdentityVerification` will return the action URL for the user to complete
the verification process and the expiration time of the action URL.

After the expiration time has passed, you can call `StartIdentityVerification`
again to start a new verification session.