> Documentation index: https://developers.google.com/merchant/api/llms.txt

Google Shopping provides two programmatic read interfaces for retrieving product
status, retail performance metrics, and market insights from
Merchant Center: the **Merchant API Reporting sub-API** (`reports.v1`)
and the **BigQuery Data Transfer Service for Merchant Center** (referred to
as **BigQuery transfers**). Both expose core reporting data, but they target
different latency, scale, and infrastructure requirements.

Use the **Reporting sub-API** for low-latency interactive UIs, targeted
Merchant Center Query Language (MCQL) queries, delegated OAuth 2.0
per-user access, and cloud-agnostic applications without data warehouse storage.
Use **BigQuery transfers** for scheduled full-catalog exports, historical
snapshots and backfills, GoogleSQL joins with internal ERP or CRM data, BigQuery
ML and Vertex AI, unified multi-account and Comparison Shopping Service (CSS)
exports, and zero-code Conversational analytics in BigQuery. Combine both with
the Notifications sub-API for marketplace-scale hybrid architectures.

> [!IMPORTANT]
> **Important:** This guide focuses on architectural selection and integration patterns. For step-by-step Google Cloud setup and IAM instructions, see [Load Merchant Center data into BigQuery](https://cloud.google.com/bigquery/docs/merchant-center-transfer) and [Load CSS Center data into BigQuery](https://docs.cloud.google.com/bigquery/docs/css-center-transfer).

## Compare reporting solutions

Use the following decision tree and technical comparison table to match your
requirements to the right reporting interface:

![Decision tree comparing Reporting sub-API and BigQuery transfers](https://developers.google.com/static/merchant/api/guides/images/reporting-solution-decision-tree.png)

| Technical characteristic | Merchant API: Reporting sub-API (`reports.v1`) | BigQuery Data Transfer Service (BigQuery transfers) |
|---|---|---|
| **Primary use case** | Interactive third-party UIs, store-builder plugins, live diagnostics, and targeted on-demand lookups. | Enterprise data warehouses (EDWs), ERP ingestion, multi-account BI, predictive ML, and zero-code conversational analytics. |
| **Delivery pattern and latency** | **On-demand pull (seconds per call):** Synchronous REST/gRPC endpoint (`accounts.reports.search`) for interactive requests, not scheduled daily full-catalog exports. | **Scheduled bulk export (min. 6 hours, typically daily / 24h):** Automated runs manage retries and schema updates. Exports can take minutes to hours for large catalogs; subsequent SQL queries return in seconds. |
| **Data freshness** | **High at request time:** Reflects the state stored in Google's internal systems in the merchant's timezone. Performance queries for today (or yesterday shortly after midnight) can return partial data; re-query 1 to 2 days later for final totals. | **High at snapshot time (6 to 24h between runs):** Exports a fresh snapshot on a timezone-agnostic schedule and runs automatic `today - 1` and `today - 2` backfills for performance data. |
| **Volume and pagination** | **Low to medium (up to 100,000 rows/page, default 1,000):** Optimized for filtered slices. Paginate larger sets sequentially with `next_page_token` (also usable for batch downloads on small to medium accounts). | **Massive (full catalog / multi-million rows):** Complete catalog dumps and multi-year time series in a single transfer without pagination. |
| **Account hierarchy scope** | **Standalone, sub-accounts, and parent advanced accounts (varies by view)** (`accounts/{account}`). CSS accounts are not supported. See the [Reporting sub-API overview](https://developers.google.com/merchant/api/guides/reports/overview.md.txt) or [`accounts.reports` reference](https://developers.google.com/merchant/api/reference/rest/reports_v1/accounts.reports.md.txt) for per-view advanced account support. | **Standalone, sub-accounts, parent advanced accounts, and CSSs (Products only):** One transfer exports all child accounts into unified date-partitioned tables (`aggregator_id` + `merchant_id`). |
| **Data granularity and privacy thresholds** | **Flexible (query-time selection):** Choose fields and dimensions in MCQL `SELECT`. Fewer dimensions aggregate metrics higher and reduce loss from privacy anonymization thresholds. | **Fixed (full-schema export):** Exports all columns with metric views pre-segmented by all dimensions, triggering stricter anonymization thresholds on low-volume slices. |
| **Query language and analytics** | **[Merchant Center Query Language (MCQL)](https://developers.google.com/merchant/api/guides/reports/query-language.md.txt):** Single-view SQL-like syntax (`SELECT`, `FROM`, `WHERE`, `ORDER BY`, `LIMIT`) for server-side filtering. | **GoogleSQL, Conversational analytics, and BigQuery ML / Vertex AI:** Full SQL (`JOIN`, `UNNEST`) across ERP/CRM tables, zero-code chat agents, and predictive ML. |
| **Historical backfills** | **View-dependent:** Query-time date filtering on views with a `date` field (such as `product_performance_view`) within online retention. Snapshot views (such as `product_view`) return only the latest state. | **On-demand backfills:** Up to **14 days** for Products and Inventories; up to **2 years** for Performance and Best Sellers, stored in date-partitioned tables (`_PARTITIONDATE`). |
| **Authentication, quotas, and overhead** | **Delegated OAuth 2.0, cloud-agnostic JSON or Protocol Buffers, no warehouse storage:** Requires custom code for authentication, pagination, and retries. [Quota groups](https://developers.google.com/merchant/api/guides/quotas-limits/quotas.md.txt) enforce daily (`quotaLimit`, resetting at 12:00 PM UTC) and per-minute (`quotaMinuteLimit`) limits on `accounts.reports.search`; every paginated call counts, and parent advanced account credentials share one quota pool. Monitor with [`accounts.quotas.list`](https://developers.google.com/merchant/api/reference/rest/quota_v1/accounts.quotas/list.md.txt). | **Zero-code setup and managed pipelines:** Avoids Merchant API rate limits and per-account polling loops, though BigQuery transfers enforce a [daily transfer run quota](https://docs.cloud.google.com/bigquery/docs/merchant-center-transfer-schedule-transfers#quotas) (including automatic backfill runs). Requires a Google Cloud project, IAM setup, and BigQuery storage and scan cost governance. |

## Data availability and feature parity mapping

The following table maps core reporting domains available across both
interfaces. Parent advanced account support in the Reporting sub-API varies
by view; check the
[`accounts.reports` reference](https://developers.google.com/merchant/api/reference/rest/reports_v1/accounts.reports.md.txt)
for current per-view account scope.

> [!NOTE]
> **Note:** In BigQuery transfers, `<id>` resolves to `<merchant_id>` for standalone accounts, `<aggregator_id>` for parent advanced accounts, or `<css_id>` for CSS accounts (Products only).

| Reporting domain | Reporting sub-API view | BigQuery transfers report tables | Key parity and usage notes |
|---|---|---|---|
| **Products and issues** | `product_view` | **Products:** `Products_<id>` | Both expose product attributes and item-level issues. BigQuery transfers support parent advanced accounts and CSS accounts, storing issues as nested `ARRAY<STRUCT>` fields that require `UNNEST(issues)`. |
| **Performance (Ads and Free Listings)** | `product_performance_view` | **Performance:** `ProductPerformance_<id>` | Both provide clicks, impressions, and conversions. BigQuery transfers support parent advanced accounts and 2-day rolling backfills, but pre-segmentation can yield lower summed impressions due to privacy thresholds. |
| **Price competitiveness** | `price_competitiveness_product_view` | **Price competitiveness:** `PriceCompetitiveness_<id>` | Benchmark price comparisons by country. BigQuery transfers support parent advanced accounts. |
| **Price insights** | `price_insights_product_view` | **Price insights:** `PriceInsights_<id>` | Suggested sale prices and predicted click and conversion uplift. BigQuery transfers support parent advanced accounts. |
| **Best sellers** | `best_sellers_product_cluster_view` `best_sellers_brand_view` | **Best sellers (5 tables):** `BestSellersBrandWeekly_<id>` `BestSellersBrandMonthly_<id>` `BestSellersProductClusterWeekly_<id>` `BestSellersProductClusterMonthly_<id>` `BestSellersEntityProductMapping_<id>` | Popular products and brands on Google Shopping. BigQuery transfers support parent advanced accounts and up to **2 years** of backfill. |
| **Competitive visibility** | `competitive_visibility_competitor_view` `competitive_visibility_top_merchant_view` `competitive_visibility_benchmark_view` | *Not available* | Available on demand through the Reporting sub-API only. |
| **Regional and local inventories** | *Use the [Inventories sub-API](https://developers.google.com/merchant/api/guides/inventories/overview.md.txt)* | **Regional inventories:** `RegionalInventories_<id>` **Local inventories:** `LocalInventories_<id>` | BigQuery transfers provide scheduled tables for store-level and regional overrides (parent advanced accounts and 14-day backfill). |
| **Product targeting** | *Use the [Google Ads API](https://developers.google.com/google-ads/api/docs/shopping-ads/overview.md.txt)* | **Product targeting:** `ProductTargeting_<id>` | BigQuery transfers export Shopping Ads targeting attributes for campaign cross-referencing (standalone, sub-accounts, and parent advanced accounts). |

## Recommended solutions by use case

Match your business and technical goals to the following use cases.

### Use case 1: Interactive third-party applications and store-builder plugins

**Recommended:** Merchant API Reporting sub-API (`reports.v1`)

Use the Reporting sub-API when you run an ecommerce store builder or SaaS
channel management platform and embed a Google Shopping health and performance
dashboard inside your merchant administration portal.

- **Interactive page loads:** Synchronous queries typically return within seconds while a merchant waits for their store admin panel to render.
- **Faster diagnostic feedback:** When a merchant updates a product title or price to resolve a disapproval, your dashboard reflects updates much sooner than a next-day batch transfer.
- **Scoped per-user authentication:** Each request targets the logged-in merchant account or sub-account (`accounts/{account}`) using OAuth 2.0 credentials granted by that merchant.

#### Code sample: Query live disapproved products

The following examples use the Reporting sub-API to retrieve disapproved
products for a single Merchant Center account or sub-account:

### Java

```java
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.shopping.merchant.products.v1.GetProductRequest;
import com.google.shopping.merchant.products.v1.Product;
import com.google.shopping.merchant.products.v1.ProductsServiceClient;
import com.google.shopping.merchant.products.v1.ProductsServiceSettings;
import com.google.shopping.merchant.reports.v1.ReportRow;
import com.google.shopping.merchant.reports.v1.ReportServiceClient;
import com.google.shopping.merchant.reports.v1.ReportServiceClient.SearchPagedResponse;
import com.google.shopping.merchant.reports.v1.ReportServiceSettings;
import com.google.shopping.merchant.reports.v1.SearchRequest;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;

/**
 * This class demonstrates how to get the list of all the disapproved products for a given merchant
 * center account.
 */
public class FilterDisapprovedProductsSample {

  // Gets the product details for a given product using the GetProduct method.
  public static void getProduct(GoogleCredentials credential, Config config, String productName)
      throws Exception {

    // Creates service settings using the credentials retrieved above.
    ProductsServiceSettings productsServiceSettings =
        ProductsServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    // Calls the API and catches and prints any network failures/errors.
    try (ProductsServiceClient productsServiceClient =
        ProductsServiceClient.create(productsServiceSettings)) {

      // The name has the format: accounts/{account}/products/{productId}
      GetProductRequest request = GetProductRequest.newBuilder().setName(productName).build();
      Product response = productsServiceClient.getProduct(request);
      System.out.println(response);
    } catch (Exception e) {
      System.out.println(e);
    }
  }

  // Filters the disapproved products for a given Merchant Center account using the Reporting API.
  // Then, it prints the product details for each disapproved product.
  public static void filterDisapprovedProducts(Config config) throws Exception {
    GoogleCredentials credential = new Authenticator().authenticate();

    ReportServiceSettings reportServiceSettings =
        ReportServiceSettings.newBuilder()
            .setCredentialsProvider(FixedCredentialsProvider.create(credential))
            .build();

    try (ReportServiceClient reportServiceClient =
        ReportServiceClient.create(reportServiceSettings)) {

      // The parent has the format: accounts/{accountId}
      String parent = String.format("accounts/%s", config.getAccountId().toString());
      // The query below is an example of a query for the productView that gets product informations
      // for all disapproved products.
      String query =
          "SELECT offer_id,"
              + "id,"
              + "title,"
              + "price"
              + " FROM product_view"
              // aggregated_reporting_context_status can be one of the following values:
              // NOT_ELIGIBLE_OR_DISAPPROVED, ELIGIBLE, PENDING, ELIGIBLE_LIMITED,
              // AGGREGATED_REPORTING_CONTEXT_STATUS_UNSPECIFIED
              + " WHERE aggregated_reporting_context_status = 'NOT_ELIGIBLE_OR_DISAPPROVED'";

      // Create the search report request.
      SearchRequest request = SearchRequest.newBuilder().setParent(parent).setQuery(query).build();

      System.out.println("Sending search report request for Product View.");
      // Calls the Reports.search API method.
      SearchPagedResponse response = reportServiceClient.search(request);
      System.out.println("Received search reports response: ");
      // Iterates over all report rows in all pages and prints each report row in separate line.
      // Automatically uses the `nextPageToken` if returned to fetch all pages of data.
      for (ReportRow row : response.iterateAll()) {
        System.out.println("Printing data from Product View:");
        System.out.println(row);
        // Optionally, you can get the full product details by calling the GetProduct method.
        String productName =
            "accounts/"
                + config.getAccountId().toString()
                + "/products/"
                + row.getProductView().getId();
        System.out.println("Getting full product details by calling GetProduct method:");
        getProduct(credential, config, productName);
      }

    } catch (Exception e) {
      System.out.println("Failed to search reports for Product View.");
      System.out.println(e);
    }
  }

  public static void main(String[] args) throws Exception {
    Config config = Config.load();
    filterDisapprovedProducts(config);
  }
}
```

### Python

```python
from examples.authentication import configuration
from examples.authentication import generate_user_credentials
from google.shopping.merchant_products_v1 import GetProductRequest
from google.shopping.merchant_products_v1 import ProductsServiceClient
from google.shopping.merchant_reports_v1 import ReportServiceClient
from google.shopping.merchant_reports_v1 import SearchRequest

# Read the merchant account ID from the configuration file.
# This is a global variable used by the functions below.
_ACCOUNT_ID = configuration.Configuration().read_merchant_info()


def get_product(credentials, product_name: str):
  """Gets the product details for a given product name.

  Args:
    credentials: The OAuth2 credentials.
    product_name: The full resource name of the product, e.g.,
      "accounts/{account}/products/{product}".
  """
  # Create a Products API client.
  products_service_client = ProductsServiceClient(credentials=credentials)

  # Prepare the GetProduct request.
  # The name has the format: accounts/{account}/products/{productId}
  request = GetProductRequest(name=product_name)

  # Call the API and print the response or any errors.
  try:
    response = products_service_client.get_product(request=request)
    print(response)
  except RuntimeError as e:
    print(f"Failed to get product {product_name}:")
    print(e)


def filter_disapproved_products():
  """Filters disapproved products and prints their details."""
  # Get OAuth2 credentials.
  credentials = generate_user_credentials.main()

  # Create a Report API client.
  report_service_client = ReportServiceClient(credentials=credentials)

  # Construct the parent resource name for the account.
  # The parent has the format: accounts/{accountId}
  parent = f"accounts/{_ACCOUNT_ID}"

  # Define the query to select disapproved products.
  # This query retrieves product information for all disapproved products.
  # aggregated_reporting_context_status can be one of the following values:
  # NOT_ELIGIBLE_OR_DISAPPROVED, ELIGIBLE, PENDING, ELIGIBLE_LIMITED,
  # AGGREGATED_REPORTING_CONTEXT_STATUS_UNSPECIFIED
  query = (
      "SELECT offer_id, id, title, price "
      "FROM product_view "
      "WHERE aggregated_reporting_context_status ="
      "'NOT_ELIGIBLE_OR_DISAPPROVED'"
  )

  # Create the search report request.
  request = SearchRequest(parent=parent, query=query)

  print("Sending search report request for Product View.")
  try:
    # Call the Reports.search API method.
    response = report_service_client.search(request=request)
    print("Received search reports response: ")

    # Iterate over all report rows.
    # The client library automatically handles pagination.
    for row in response:
      print("Printing data from Product View:")
      print(row)

      # Construct the full product resource name using the product_view.id
      # (which is the REST ID like "en~GB~123") from the report.
      # The product_view.id from the report is the {product_id} part.
      product_name = (
          f"accounts/{_ACCOUNT_ID}/products/{row.product_view.id}"
      )

      # OPTIONAL, get full product details by calling the GetProduct method.
      print("Getting full product details by calling GetProduct method:")
      get_product(credentials, product_name)

  except RuntimeError as e:
    print(e)


if __name__ == "__main__":
  filter_disapproved_products()
```

### Node.js

```javascript
'use strict';
const fs = require('fs');
const authUtils = require('../../authentication/authenticate.js');
const {ProductsServiceClient} = require('@google-shopping/products').v1;
const {ReportServiceClient} = require('@google-shopping/reports').v1;

/**
 * Gets the product details for a given product using the GetProduct method.
 * @param {!Object} authClient - The authenticated Google API client.
 * @param {string} productName - The name of the product to retrieve, in the
 *   format: accounts/{account}/products/{productId}.
 */
async function getProduct(authClient, productName) {
  // Create options object for the client, including authentication.
  const productOptions = {authClient: authClient};

  // Create the Products API client.
  const productsClient = new ProductsServiceClient(productOptions);

  try {
    // Construct the request object.
    const request = {name: productName};
    // Call the API to get the product.
    // getProduct returns a Promise that resolves to an array.
    // The first element is the product resource.
    const response = await productsClient.getProduct(request);
    console.log(response);
  } catch (error) {
    // Log any errors that occur during the API call.
    console.log(error);
  }
}

/**
 * Filters disapproved products for a given Merchant Center account using the
 * Reporting API. Then, it prints the product details for each disapproved
 * product.
 * @param {!Object} authClient - The authenticated Google API client.
 * @param {string} merchantId - The Merchant Center account ID.
 */
async function filterDisapprovedProducts(authClient, merchantId) {
  // Create options object for the client, including authentication.
  const reportOptions = {authClient: authClient};

  // Create the Report API client.
  const reportServiceClient = new ReportServiceClient(reportOptions);

  try {
    // Construct the parent resource name for the report query.
    const parent = `accounts/${merchantId}`;

    // Define the query to select disapproved products.
    // aggregated_reporting_context_status can be one of the following values:
    // NOT_ELIGIBLE_OR_DISAPPROVED, ELIGIBLE, PENDING, ELIGIBLE_LIMITED,
    // AGGREGATED_REPORTING_CONTEXT_STATUS_UNSPECIFIED
    const query = `SELECT offer_id, id, title, price
      FROM product_view
      WHERE aggregated_reporting_context_status = 'NOT_ELIGIBLE_OR_DISAPPROVED'`;

    // Construct the search request.
    const searchRequest = {
      parent: parent,
      query: query,
    };

    console.log('Sending search report request for Product View.');
    // Call the Reports.search API method. This returns an async iterable.
    const iterable = reportServiceClient.searchAsync(searchRequest);
    console.log('Received search reports response: ');

    // Iterate over all report rows in the response.
    for await (const row of iterable) {
      console.log('Printing data from Product View:');
      console.log(row.productView);

      // Construct the full product resource name from the report row.
      // Assumes row.productView and row.productView.id are populated,
      // which should be the case based on the query.
      const productName = `accounts/${merchantId}/products/${row.productView.id}`;

      // OPTIONAL: Get and print the full product details using GetProduct.
      console.log('Getting full product details by calling GetProduct method:');
      // Get and print the full product details.
      await getProduct(authClient, productName);
    }
  } catch (error) {
    console.log('Failed to search reports for Product View.');
    // Log any errors that occur during the report search or processing.
    console.log(error);
  }
}

/**
 * Main function to execute the sample.
 */
async function main() {
  try {
    // Retrieve application configuration.
    const config = authUtils.getConfig();

    // Read merchant ID from the merchant-info.json file.
    const merchantInfo = JSON.parse(
      fs.readFileSync(config.merchantInfoFile, 'utf8'),
    );
    const merchantId = merchantInfo.merchantId;

    // Authenticate and get the OAuth2 client.
    const authClient = await authUtils.getOrGenerateUserCredentials();

    // Call the function to filter disapproved products and get their details.
    await filterDisapprovedProducts(authClient, merchantId);
  } catch (error) {
    // Log any errors that occur during setup or authentication.
    console.error(error.message);
    process.exitCode = 1;
  }
}

main();
```

### PHP

```php
use Google\ApiCore\ApiException;
use Google\Shopping\Merchant\Products\V1\Client\ProductsServiceClient;
use Google\Shopping\Merchant\Products\V1\GetProductRequest;
use Google\Shopping\Merchant\Reports\V1\Client\ReportServiceClient;
use Google\Shopping\Merchant\Reports\V1\SearchRequest;

/**
 * This class demonstrates how to get the list of all the disapproved products for a given merchant
 * center account.
 */
class FilterDisapprovedProducts
{
    /**
     * Gets the product details for a given product using the GetProduct method.
     *
     * @param mixed $credentials The OAuth credentials.
     * @param array $config The configuration data, including 'accountId'.
     * @param string $productName The full resource name of the product to retrieve.
     *      Format: accounts/{account}/products/{product}
     */
    private static function getProduct(
        $credentials,
        array $config,
        string $productName
    ): void {
        // Creates options config containing credentials for the client to use.
        $options = ['credentials' => $credentials];

        // Creates a ProductsServiceClient.
        $productsServiceClient = new ProductsServiceClient($options);

        // Calls the API and catches and prints any network failures/errors.
        try {
            // Construct the GetProductRequest.
            // The name has the format: accounts/{account}/products/{productId}
            $request = new GetProductRequest(['name' => $productName]);

            // Make the API call.
            $response = $productsServiceClient->getProduct($request);

            // Prints the retrieved product.
            // Protobuf messages are printed as JSON strings for readability.
            print $response->serializeToJsonString() . "\n";
        } catch (ApiException $e) {
            // Prints any errors that occur during the API call.
            printf("ApiException was thrown: %s\n", $e->getMessage());
        }
    }

    /**
     * Filters disapproved products for a given Merchant Center account using the Reporting API,
     * then prints the details for each disapproved product.
     *
     * @param array $config The configuration data used for authentication and
     *      getting the account ID.
     */
    public static function filterDisapprovedProductsSample(array $config): void
    {
        // Gets the OAuth credentials to make the request.
        $credentials = Authentication::useServiceAccountOrTokenFile();

        // Creates options config containing credentials for the Report client to use.
        $reportClientOptions = ['credentials' => $credentials];

        // Creates a ReportServiceClient.
        $reportServiceClient = new ReportServiceClient($reportClientOptions);

        // The parent resource name for the report.
        // Format: accounts/{accountId}
        $parent = sprintf("accounts/%s", $config['accountId']);

        // The query to select disapproved products from the product_view.
        // This query retrieves offer_id, id, title, and price for products
        // that are 'NOT_ELIGIBLE_OR_DISAPPROVED'.
        $query = "SELECT offer_id, id, title, price FROM product_view"
            . " WHERE aggregated_reporting_context_status = 'NOT_ELIGIBLE_OR_DISAPPROVED'";

        // Create the search report request.
        $request = new SearchRequest([
            'parent' => $parent,
            'query' => $query
        ]);

        print "Sending search report request for Product View.\n";
        // Calls the Reports.search API method.
        try {
            $response = $reportServiceClient->search($request);
            print "Received search reports response: \n";

            // Iterates over all report rows in all pages.
            // The client library automatically handles pagination.
            foreach ($response->iterateAllElements() as $row) {
                print "Printing data from Product View:\n";
                // Prints the ReportRow object as a JSON string.
                print $row->serializeToJsonString() . "\n";

                // Get the full product resource name from the report row.
                // The `id` field in ProductView is the product's full resource name.
                // Format: `accounts/{account}/products/{product}`
                $productName = $parent . "/products/" . $row->getProductView()->getId();
                // OPTIONAL: Call getProduct to retrieve and print full product details.
                // Pass the original credentials and config.
                print "Getting full product details by calling GetProduct method:\n";
                self::getProduct($credentials, $config, $productName);
            }
        } catch (ApiException $e) {
            // Prints any errors that occur during the API call.
            printf("ApiException was thrown: %s\n", $e->getMessage());
        }
    }

    /**
     * Helper to execute the sample.
     */
    public function callSample(): void
    {
        $config = Config::generateConfig();
        self::filterDisapprovedProductsSample($config);
    }
}

// Run the script
$sample = new FilterDisapprovedProducts();
$sample->callSample();
```

### C#

```c#
using System;
using Google.Api.Gax;
using Google.Apis.Auth.OAuth2;
using Google.Shopping.Merchant.Products.V1;
using Google.Shopping.Merchant.Reports.V1;
using Newtonsoft.Json;
using static MerchantApi.Authenticator;

namespace MerchantApi
{
    public class FilterDisapprovedProductsSample
    {
        // Filters disapproved products using the Reporting API and then fetches
        // full product details for each.
        public void FilterDisapprovedProducts(string merchantId)
        {
            Console.WriteLine("=================================================================");
            Console.WriteLine("Filtering for Disapproved Products");
            Console.WriteLine("=================================================================");

            // Authenticate using either oAuth or service account
            ICredential auth = Authenticator.Authenticate(
                MerchantConfig.Load(),
                ProductsServiceClient.DefaultScopes[0]);

            // Create a client for the Reports API.
            ReportServiceClient reportClient = new ReportServiceClientBuilder
            {
                Credential = auth
            }.Build();

            // Create a client for the Products API.
            ProductsServiceClient productsClient = new ProductsServiceClientBuilder
            {
                Credential = auth
            }.Build();

            // The parent has the format: accounts/{accountId}
            string parent = $"accounts/{merchantId}";

            // The query to select disapproved products from the product_view.
            string query =
                "SELECT offer_id, id, title, price " +
                "FROM product_view " +
                "WHERE aggregated_reporting_context_status = 'NOT_ELIGIBLE_OR_DISAPPROVED'";

            // Create the search request for the Reports API.
            SearchRequest request = new SearchRequest
            {
                Parent = parent,
                Query = query,
                PageSize = 1000 // Optional: specify the page size.
            };

            try
            {
                Console.WriteLine("Sending search report request for disapproved products...");
                // Call the Reports.Search API method.
                PagedEnumerable<SearchResponse, ReportRow> response = reportClient.Search(request);
                Console.WriteLine("Received search reports response.");

                // Iterate over all report rows. This handles pagination automatically.
                foreach (ReportRow row in response)
                {
                    Console.WriteLine("---");
                    Console.WriteLine("Found disapproved product from Product View:");
                    Console.WriteLine(JsonConvert.SerializeObject(row.ProductView, Formatting.Indented));

                    // Construct the full product name for the GetProduct request.
                    // Format: accounts/{account}/products/{product}
                    string productName = ProductName.FromAccountProduct(merchantId, row.ProductView.Id).ToString();

                    Console.WriteLine("\nFetching full product details with GetProduct method...");

                    // Get the full product details by calling the GetProduct method.
                    GetProductRequest getRequest = new GetProductRequest { Name = productName };
                    Product product = productsClient.GetProduct(getRequest);

                    Console.WriteLine(JsonConvert.SerializeObject(product, Formatting.Indented));
                }
                Console.WriteLine("---");
            }
            catch (Exception e)
            {
                Console.WriteLine($"Failed to search reports for disapproved products: {e.Message}");
            }
        }

        public static void Main(string[] args)
        {
            // Load configuration settings.
            var config = MerchantConfig.Load();
            string merchantId = config.MerchantId.Value.ToString();

            if (string.IsNullOrEmpty(merchantId))
            {
                Console.WriteLine("MerchantId is not set in the MerchantConfig.json file.");
                return;
            }

            // Create an instance of the sample and run it.
            var sample = new FilterDisapprovedProductsSample();
            sample.FilterDisapprovedProducts(merchantId);
        }
    }
}
```

### Apps Script

```javascript

/**
 * Demonstrates how to filter disapproved products using the Merchant API Reports service.
 */
function filterDisapprovedProducts() {
  // IMPORTANT:
  // Enable the Merchant API Reports sub-API Advanced Service and call it
  // "MerchantApiReports"
  // Enable the Merchant API Products sub-API Advanced Service and call it
  // "MerchantApiProducts"

  // Replace this with your Merchant Center ID.
  const accountId = '<INSERT_MERCHANT_CENTER_ID>';

  // Construct the parent name
  const parent = 'accounts/' + accountId;

  try {
    console.log('Sending search Report request');
    // Set pageSize to the maximum value (default: 1000)
    const pageSize = 1000;
    let pageToken;
    // The query below is an example of a query for the productView that gets product informations
    // for all disapproved products.
    const query = 'SELECT offer_id,' +
        'id,' +
        'price,' +
        'title' +
        ' FROM product_view' +
        ' WHERE aggregated_reporting_context_status = "NOT_ELIGIBLE_OR_DISAPPROVED"';


    // Call the Reports.search API method. Use the pageToken to iterate through
    // all pages of results.
    do {
      const response =
          MerchantApiReports.Accounts.Reports.search({query, pageSize, pageToken}, parent);
      for (const reportRow of response.results) {
        console.log('Printing data from Product View:');
        console.log(reportRow);

        // OPTIONALLY, you can get the full product details by calling the GetProduct method.
        const productName = parent + '/products/' + reportRow.getProductView().getId();
        const product = MerchantApiProducts.Accounts.Products.get(productName);
        console.log(product);
      }
      pageToken = response.nextPageToken;
    } while (pageToken); // Exits when there is no next page token.
  } catch (e) {
    console.log('ERROR!');
    console.log('Error message:' + e.message);
  }
}

```

### cURL

```console
curl -X POST -i \
-H "Authorization: Bearer {API_TOKEN}" \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
"https://merchantapi.googleapis.com/reports/v1/accounts/{ACCOUNT_ID}/reports:search" \
-d '{
  "query": "SELECT offer_id, id, title, price FROM product_view WHERE aggregated_reporting_context_status = '\''NOT_ELIGIBLE_OR_DISAPPROVED'\''"
}'
```

For a full HTTP request and response walkthrough, see
[Identify product issues](https://developers.google.com/merchant/api/guides/reports/get-started.md.txt#identify-product-issues).

### Use case 2: Enterprise data warehouse, ERP pipeline, or predictive ML

**Recommended:** BigQuery Data Transfer Service (BigQuery transfers)

Use BigQuery transfers when you build an enterprise data warehouse, join
Merchant Center data with internal ERP or CRM tables, retain multi-month
historical snapshots, or train predictive ML models across standalone, advanced,
or CSS accounts.

- **Cross-domain ERP and warehouse joins:** Write GoogleSQL to join `ProductPerformance_<id>`, `Products_<id>`, and `PriceInsights_<id>` directly with internal warehouse inventory, wholesale costs, and supplier margins.
- **Automated full-catalog history:** Schedule daily transfers into date-partitioned tables across standalone accounts, parent advanced accounts, or CSS accounts without building custom pagination workers.
- **Predictive AI and ML:** Train and run [BigQuery ML (BQML)](https://cloud.google.com/bigquery/docs/bqml-introduction) or [Vertex AI](https://cloud.google.com/vertex-ai/docs) models directly on transferred tables for demand forecasting, price elasticity prediction, product categorization, and anomaly detection.

> [!IMPORTANT]
> **Important:** Because BigQuery on-demand pricing bills by bytes scanned, always filter queries by `_PARTITIONDATE` (and by `merchant_id` when analyzing individual sub-accounts in an advanced account table). For high-frequency single-account queries over large tables, create clustered tables or materialized views partitioned by date and clustered by `merchant_id`.

#### Code sample: Join performance, price insights, and ERP costs (GoogleSQL)

The following GoogleSQL query joins 30 days of `ProductPerformance_` metrics
with the latest `PriceInsights_` snapshot and an example internal ERP cost table
to find high-traffic offers whose suggested sale price preserves positive
margin:

```sql
WITH performance_30d AS (
  SELECT
    merchant_id,
    offer_id,
    ANY_VALUE(title) AS title,
    SUM(clicks) AS clicks_30d,
    SUM(impressions) AS impressions_30d
  FROM
    `<project_id>.<dataset_id>.ProductPerformance_<id>`
  WHERE
    _PARTITIONDATE BETWEEN DATE_SUB(CURRENT_DATE(), INTERVAL 30 DAY)
    AND DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
  GROUP BY
    merchant_id,
    offer_id
),
latest_price_insights AS (
  SELECT
    merchant_id,
    offer_id,
    price.amount_micros / 1e6 AS current_price,
    suggested_price.amount_micros / 1e6 AS suggested_price,
    price.currency_code,
    predicted_clicks_change_fraction
  FROM
    `<project_id>.<dataset_id>.PriceInsights_<id>`
  WHERE
    _PARTITIONDATE = DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY)
    AND suggested_price.amount_micros IS NOT NULL
)
SELECT
  perf.merchant_id,
  perf.offer_id,
  perf.title,
  perf.clicks_30d,
  perf.impressions_30d,
  pi.current_price,
  pi.suggested_price,
  pi.currency_code,
  erp.unit_cost,
  ROUND(pi.suggested_price - erp.unit_cost, 2) AS projected_margin,
  pi.predicted_clicks_change_fraction
FROM
  performance_30d AS perf
JOIN
  latest_price_insights AS pi
  ON perf.merchant_id = pi.merchant_id
  AND perf.offer_id = pi.offer_id
JOIN
  `<project_id>.erp_dataset.product_costs` AS erp
  ON perf.offer_id = erp.offer_id
  AND pi.currency_code = erp.currency_code
WHERE
  pi.suggested_price > erp.unit_cost
ORDER BY
  perf.clicks_30d DESC
LIMIT 50;
```

For partitioned query patterns and table schemas, see
[Query your Google Merchant Center Transfers data](https://cloud.google.com/bigquery/docs/merchant-center-query-your-data).

### Use case 3: Zero-code business insights with Conversational analytics

**Recommended:** BigQuery transfers paired with
[Conversational analytics in BigQuery](https://cloud.google.com/bigquery/docs/conversational-analytics)

Use BigQuery transfers with Conversational analytics when marketing managers,
merchandisers, or business analysts want quick answers from Merchant Center
data without writing Python or SQL.

- **End-to-end zero-code setup:** Schedule a transfer in the Google Cloud console with zero code, then ask plain-English questions directly over your `Products_`, `ProductPerformance_`, `PriceInsights_`, and `BestSellers_` tables.
- **Customizable BigQuery data agents:** Add custom instructions, glossary terms, and verified queries (for example, always filtering by the latest `_PARTITIONDATE` or defining high-priority inventory for your brand).
- **Natural-language forecasting and anomaly detection:** Powered by Gemini for Google Cloud, Conversational analytics translates questions into SQL and calls built-in BigQuery AI/ML functions (`AI.FORECAST`, `AI.DETECT_ANOMALIES`, `AI.KEY_DRIVERS`, `ML.SEASONALITY`) to answer questions like *"Identify the key drivers for changes in clicks across my
  product categories last month."*

### Use case 4: Global-scale multi-merchant marketplace

**Recommended:** Hybrid architecture combining BigQuery transfers, the
Notifications sub-API, and the Reporting sub-API

Marketplaces and enterprise channel integrators managing thousands of seller
sub-accounts and tens of millions of listings need both macro analytical
visibility and real-time operational agility. Combine both reporting interfaces
with the Notifications sub-API in three layers:

- **Layer 1 (BigQuery transfers):** Daily parent advanced account exports power marketplace-wide BI, ERP joins, and predictive ML.
- **Layer 2 (Notifications sub-API and Cloud Pub/Sub):** Event-driven push notifications alert your platform immediately when a product status changes.
- **Layer 3 (Reporting sub-API):** On-demand queries serve live seller portal drill-downs and diagnostics.

![Three-layer hybrid architecture for multi-merchant reporting](https://developers.google.com/static/merchant/api/guides/images/reporting-hybrid-architecture.jpg)

Separating these layers lets you operate at marketplace scale without exhausting
Merchant API quotas or incurring unnecessary BigQuery scan costs.

## Common architectural anti-patterns to avoid

- **Mirroring full product catalogs into a data warehouse with daily
  Reporting sub-API cron jobs:** Running scheduled jobs that paginate through entire line-item catalogs with `accounts.reports.search` consumes quota on every page (and draws from a shared quota pool when using parent advanced account credentials), which risks exhausting daily and per-minute limits. **Mitigation:** Use BigQuery transfers for scheduled full-catalog warehouse exports and historical archives, and reserve the Reporting sub-API for interactive, filtered, or aggregated on-demand queries.
- **Powering live merchant UI widgets directly from BigQuery transfers:** Batch schedules (6 to 24 hours) leave UI statuses stale after a merchant submits a fix, and uncached analytical queries add latency and scan costs on every page load. **Mitigation:** Use the Reporting sub-API (or `products.get` / `products.list`) for live UI views, or cache aggregated BigQuery results in a low-latency serving layer.
- **Using the Notifications sub-API to synchronize full catalog state:** The [Notifications sub-API](https://developers.google.com/merchant/api/guides/notifications/overview.md.txt) only emits delta events when a resource status changes; unchanged products are never sent. **Mitigation:** Pair real-time status-change alerts with daily BigQuery transfers (for full catalog baselines) or on-demand Reporting sub-API lookups.

## Next steps and related resources

- **Merchant API reporting and quotas:**
  - [Reporting sub-API overview](https://developers.google.com/merchant/api/guides/reports/overview.md.txt)
  - [Get started with Reporting sub-API](https://developers.google.com/merchant/api/guides/reports/get-started.md.txt)
  - [Merchant Center Query Language (MCQL) reference](https://developers.google.com/merchant/api/guides/reports/query-language.md.txt)
  - [Paginate query results](https://developers.google.com/merchant/api/guides/reports/paging.md.txt)
  - [Quotas and rate limits in Merchant API](https://developers.google.com/merchant/api/guides/quotas-limits/quotas.md.txt)
- **BigQuery Data Transfer Service and AI/ML:**
  - [Load Merchant Center data into BigQuery](https://cloud.google.com/bigquery/docs/merchant-center-transfer)
  - [Query your Google Merchant Center Transfers data](https://cloud.google.com/bigquery/docs/merchant-center-query-your-data)
  - [Merchant Center BigQuery table schemas](https://cloud.google.com/bigquery/docs/merchant-center-products-schema)
  - [Conversational analytics in BigQuery overview](https://cloud.google.com/bigquery/docs/conversational-analytics)
  - [Introduction to BigQuery ML (BQML)](https://cloud.google.com/bigquery/docs/bqml-introduction)
- **Complementary Merchant API interfaces:**
  - [Notifications sub-API overview](https://developers.google.com/merchant/api/guides/notifications/overview.md.txt)
  - [Merchant API MCP access service](https://developers.google.com/merchant/api/guides/agentic-tools/merchant-data-mcp.md.txt)