Merchant API v1beta was discontinued and shut down on February 28, 2026. For steps to transition to the latest stable version, seeMigrate from v1beta to v1.
Manage API data sources for product uploadsStay organized with collectionsSave and categorize content based on your preferences.
The Data Sources sub-API lets you create and manage data sources
specifically for uploading products through the API. You need to
specify at least one data source to be able to provide product details to the
Merchant Center.
This guide walks you through common use cases for managing these API-based data
sources. For information about uploading products using these data sources, see
theAdd and manage productsguide.
You can also manage your data sources through the Merchant Center user
interface. For more information, seeManage your data sources.
Special considerations
When working with data sources in the Merchant API, keep the following in
mind:
Rules: The Data Sources sub-API supports default rules for linking
supplemental data sources to primary data sources. You can manage
the order of supplemental data sources within the default rule. Complex
custom rule creation and management aren't supported directly with this API.
You can manage this using theMerchant Center UI.
Advanced account supplemental data sources: The API doesn't support
supplemental data sources and rules for advanced (multi-client) accounts.
You can managesupplemental data sourcesandrulesonly using the Merchant Center UI.
Create a primary data source for products
When you want to create aPrimaryProductDataSourcethat can accept products with any label and language, don't specifyfeedLabelandcontentLanguage. This setup simplifies management for merchants who don't
require distinct rules or configurations for different country or language
targets, as it allows them to manage only one data source ID.
Otherwise, you can create a data source and restrict it to a specific label and
language. If you plan to use data source rules or other configurations (like
country targeting) that apply to specific combinations of labels and languages,
specify thefeedLabelandcontentLanguage.
Note that the data source labelhas no impacton targeted country. For
example, usingUSas a label doesn't automatically target users in the
United States. To control where the products are displayed and eligible, you
set:
When products are inserted into this data source using theproducts.insertmethod, the API accepts any combination offeedLabelandcontentLanguageprovided within the product data itself. The data source
serves as a single container for products targeting multiple different language
and label combinations. If you have a straightforward setup that doesn't use
complex data source rules, we recommend omitting thefeedLabelandcontentLanguagefields.
Restrictions and considerations
Creating a data source compatible with any label and language is only
supported for primary data sources utilizing theAPI.
These data sources can be linked with either broad or targeted supplemental
data sources. Matching during processing occurs based on the individual
product's specificfeedLabelandcontentLanguage.
Here is an example:
POST https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources
{"displayName":"My API Primary Product Source","primaryProductDataSource":{}}
A successful request returns the newly-createdDataSourceresource. You can
use thenameof the newly-created data source to refer to this data source
when inserting products with the Products sub-API.
{"name":"accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}","dataSourceId":"{DATASOURCE_ID}","displayName":"My API Primary Product Source","primaryProductDataSource":{},"input":"API"}
The following code samples show how to create aPrimaryProductDataSourcewithout setting thefeedLabelandcontentLanguagefields.
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shopping.merchant_datasources_v1importCreateDataSourceRequestfromgoogle.shopping.merchant_datasources_v1importDataSourcefromgoogle.shopping.merchant_datasources_v1importDataSourcesServiceClientfromgoogle.shopping.merchant_datasources_v1importPrimaryProductDataSource_ACCOUNT=configuration.Configuration().read_merchant_info()_PARENT=f"accounts/{_ACCOUNT}"defcreate_primary_product_data_source_multiple_languages():"""Creates a `DataSource` resource."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=DataSourcesServiceClient(credentials=credentials)# Creates a PrimaryProductDataSource.primary_datasource=PrimaryProductDataSource()primary_datasource.countries=["GB"]# Creates a DataSource and populates its attributes.data_source=DataSource()data_source.display_name="Example Multiple Languages Primary DataSource"data_source.primary_product_data_source=primary_datasource# Creates the request.request=CreateDataSourceRequest(parent=_PARENT,data_source=data_source)# Makes the request and catches and prints any error messages.try:response=client.create_data_source(request=request)print(f"DataSource successfully created:{response}")exceptRuntimeErrorase:print("DataSource creation failed")print(e)if__name__=="__main__":create_primary_product_data_source_multiple_languages()
curl -X POST \"https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources" \-H "Authorization: Bearer{API_TOKEN}" \-H "Content-Type: application/json" \-d '{"displayName": "Primary Product Data Multiple Languages","primaryProductDataSource": {"countries": ["GB"]}}'
Data source for a specific label and language
To create a data source that only accepts products for a specific label and
language combination, set thefeedLabelandcontentLanguagefields using thedataSources.createmethod:
POST https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources
{"displayName":"My API Primary Product Source (US-en)","primaryProductDataSource":{"feedLabel":"US","contentLanguage":"en","countries":["US"]}}
A successful request returns the newly-createdDataSourceresource. You can
usenameof the newly-created data source to refer to this data source when
inserting products with the Products sub-API.
{"name":"accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}","dataSourceId":"{DATASOURCE_ID}","displayName":"My API Primary Product Source (US-en)","primaryProductDataSource":{"feedLabel":"US","contentLanguage":"en","countries":["US"]},"input":"API"}
The following code samples show how to create a data source that only accepts
products for a specific label and language combination.
"""Sample for creating a primary product data source."""fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shopping.merchant_datasources_v1importCreateDataSourceRequestfromgoogle.shopping.merchant_datasources_v1importDataSourcefromgoogle.shopping.merchant_datasources_v1importDataSourcesServiceClientfromgoogle.shopping.merchant_datasources_v1importPrimaryProductDataSource# Used for setting the destination type, e.g., SHOPPING_ADS.fromgoogle.shopping.typeimporttypesasmerchant_api_types# Fetches the Merchant Center account ID from the configuration file.# This ID is essential for constructing the 'parent' resource path# required by the API._ACCOUNT_ID=configuration.Configuration().read_merchant_info()# Constructs the parent resource name format for Data Source operations._PARENT=f"accounts/{_ACCOUNT_ID}"defcreate_primary_product_data_source(display_name:str)->None:"""Creates a primary product data source for the 'en' language and 'GB' region, targeting specific destinations.Args:display_name: The user-visible name for the new data source in MerchantCenter.Returns:The resource name of the newly created data source if successful,otherwise None."""# Obtains OAuth 2.0 credentials for API authentication.credentials=generate_user_credentials.main()# Initializes the DataSourcesServiceClient with the obtained credentials.client=DataSourcesServiceClient(credentials=credentials)# Configures the PrimaryProductDataSource.# This section defines the core properties of the product data feed.primary_product_data_source=PrimaryProductDataSource()# Sets the target countries for this data source.primary_product_data_source.countries=["GB"]# Sets the content language for the products.primary_product_data_source.content_language="en"# Sets the feed label, often matching the country or language.primary_product_data_source.feed_label="GB"# Defines the destinations for this data source and their states.# If destinations are not explicitly listed, defaults will be used.# Configure Shopping Ads destination (enabled).destination_shopping_ads=PrimaryProductDataSource.Destination()destination_shopping_ads.destination=(merchant_api_types.Destination.DestinationEnum.SHOPPING_ADS)destination_shopping_ads.state=(PrimaryProductDataSource.Destination.State.ENABLED)# Configure Free Listings destination (disabled).destination_free_listings=PrimaryProductDataSource.Destination()destination_free_listings.destination=(merchant_api_types.Destination.DestinationEnum.FREE_LISTINGS)destination_free_listings.state=(PrimaryProductDataSource.Destination.State.DISABLED)primary_product_data_source.destinations=[destination_free_listings,destination_shopping_ads]# Assembles the DataSource object.data_source=DataSource()data_source.display_name=display_namedata_source.primary_product_data_source=primary_product_data_source# Prepares the CreateDataSourceRequest.# This request includes the parent account and the data source configuration.request=CreateDataSourceRequest(parent=_PARENT,data_source=data_source)try:# Executes the API call to create the data source.print("Sending Create PrimaryProduct DataSource request")response=client.create_data_source(request=request)# Confirms creation and prints the new data source's name.print("Created DataSource Name below")print(response)exceptRuntimeErrorase:# Handles any errors encountered during the API request.print(e)if__name__=="__main__":# Sets the desired display name for the data source in Merchant Center.datasource_display_name="British Primary Product Data"# Calls the function to create the data source.create_primary_product_data_source(datasource_display_name)
Create a supplemental API data source and link it to a primary data source
Supplemental data sources enable you to provide additional product data that
complements your primary data sources.
Step 1: Create the supplemental API data source
Create a supplemental data source usingdataSources.create.
If you want your supplemental data source to be applicable to any primary data
source, you can omitfeedLabelandcontentLanguage. To target primary data
sources with matching configurations, specifyfeedLabelandcontentLanguage.
Supplemental data source recommendations
Support for any label and language: You can create supplemental data
sources to support any label and language or targeted to specific ones.
Linking flexibility: A primary data source can be linked with
supplemental data sources, regardless if the primary data source targets
a specific label and language or not. Note that suppmemental data sources
don't target any label or language. Matching occurs during processing based
on the product's specificfeedLabelandcontentLanguage.
Store data source names for future use: After creating your supplemental
data sources, store their names in your local database to refer to them
directly in future API calls.
POST https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources
{"displayName":"My API Supplemental Source","supplementalProductDataSource":{}}
This returns the newly-created supplementalDataSourceresource. Note itsname(which includes thedataSourceId).
{"name":"accounts/{ACCOUNT_ID}/dataSources/{SUPPLEMENTAL_DATASOURCE_ID}","dataSourceId":"{SUPPLEMENTAL_DATASOURCE_ID}","displayName":"My API Supplemental Source","supplementalProductDataSource":{},"input":"API"}
The following code samples show how to create a supplemental product data source
without setting thefeedLabelandcontentLanguagefields.
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shoppingimportmerchant_datasources_v1_ACCOUNT=configuration.Configuration().read_merchant_info()_PARENT=f"accounts/{_ACCOUNT}"defcreate_supplemental_product_data_source_multiple_languages():"""Creates a `DataSource` resource."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=merchant_datasources_v1.DataSourcesServiceClient(credentials=credentials)# Creates a SupplementalProductDataSource.supplemental_datasource=(merchant_datasources_v1.SupplementalProductDataSource())# Creates a DataSource and populates its attributes.data_source=merchant_datasources_v1.DataSource()data_source.display_name=("Example Multiple Languages Supplemental DataSource")data_source.supplemental_product_data_source=supplemental_datasource# Creates the request.request=merchant_datasources_v1.CreateDataSourceRequest(parent=_PARENT,data_source=data_source)# Makes the request and catches and prints any error messages.try:response=client.create_data_source(request=request)print(f"DataSource successfully created:{response}")exceptRuntimeErrorase:print("DataSource creation failed")print(e)if__name__=="__main__":create_supplemental_product_data_source_multiple_languages()
curl -X POST \"https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources" \-H "Authorization: Bearer{API_TOKEN}" \-H "Content-Type: application/json" \-d '{"displayName": "Supplemental API Product Data Multiple Languages","supplementalProductDataSource": {}}'
Step 2: Link the supplemental data source to a primary data source
Update your primary data source to link to the newly-created supplemental data
source. You can achieve this by modifying thedefaultRuleof thePrimaryProductDataSourcewith thedataSources.patchmethod.
ThetakeFromDataSourceslist in thedefaultRulespecifies the order of
precedence. Attributes are taken from the first data source in the list that
provides them. Theselfshorthand points to the primary data source itself.
The following examples shows the default rule setting which first takes data
from the primary data source and if the attribute is not available there, it
takes the attribute from the supplemental source.
A successful request returns the updated primaryDataSourceresource.
{"name":"accounts/{ACCOUNT_ID}/dataSources/{PRIMARY_DATASOURCE_ID}","dataSourceId":"{PRIMARY_DATASOURCE_ID}","displayName":"My API Primary Product Source","primaryProductDataSource":{"countries":["US","GB","DE"],"defaultRule":{"takeFromDataSources":[{"self":true},{"supplementalDataSourceName":"accounts/{ACCOUNT_ID}/dataSources/{SUPPLEMENTAL_DATASOURCE_ID}"}]}},"input":"API"}
The following code samples show how to connect a supplemental data source to the
primary data source.
You can update properties of an existing data source, such as itsdisplayName.
Use thedataSources.patchmethod and specify the fields to update in theupdateMask.
{"name":"accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}","displayName":"Updated API Primary Source Name"}
A successful request returns the updatedDataSourceresource.
{"name":"accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}","dataSourceId":"{DATASOURCE_ID}","displayName":"Updated API Primary Source Name","primaryProductDataSource":{"feedLabel":"US","contentLanguage":"en","countries":["US"]},"input":"API"}
The following code samples show how to use thepatchmethod to update a data
source.
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.protobufimportfield_mask_pb2fromgoogle.shoppingimportmerchant_datasources_v1# ENSURE you fill in the datasource ID for the sample to# work._ACCOUNT=configuration.Configuration().read_merchant_info()# An ID automatically assigned to the datasource after creation by Google._DATASOURCE="[INSERT_DATASOURCE_HERE]"_NAME=f"accounts/{_ACCOUNT}/dataSources/{_DATASOURCE}"defupdate_data_source():"""Updates the specified `DataSource` resource."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=merchant_datasources_v1.DataSourcesServiceClient(credentials=credentials)# Creates a DataSource and populates its attributes.data_source=merchant_datasources_v1.DataSource()data_source.name=_NAME# To identify the data source to update.data_source.display_name="Example DataSource 2"# Sets field mask to include only the fields you want to update.field_mask=field_mask_pb2.FieldMask(paths=["display_name"])# Creates the request.request=merchant_datasources_v1.UpdateDataSourceRequest(data_source=data_source,update_mask=field_mask)# Makes the request and catch and print any error messages.try:client.update_data_source(request=request)print("Update successful")exceptRuntimeErrorase:print("Update failed")print(e)if__name__=="__main__":update_data_source()
To remove a data source from your Merchant Center account, use thedataSources.deletemethod. If a supplemental data source is linked to any primary data source, you
won't be able to delete it until you remove all links to it.
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shoppingimportmerchant_datasources_v1# ENSURE you fill in the datasource ID for the sample to# work._ACCOUNT=configuration.Configuration().read_merchant_info()# An ID automatically assigned to the datasource after creation by Google._DATASOURCE="[INSERT_DATASOURCE_HERE]"_NAME=f"accounts/{_ACCOUNT}/dataSources/{_DATASOURCE}"defdelete_data_source():"""Deletes the specified `DataSource` resource.Delete works for any datasource type.If Type "Supplemental", delete will only work if it's not linked to anyprimary feed. If a link exists and the Type is "Supplemental", you will needto remove the supplemental feed from the default and/or custom rule(s) of anyprimary feed(s) that references it. Then retry the delete."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=merchant_datasources_v1.DataSourcesServiceClient(credentials=credentials)# Creates the request.request=merchant_datasources_v1.DeleteDataSourceRequest(name=_NAME)# Makes the request and catches and prints any error messages.try:# No response is returned on request.client.delete_data_source(request=request)print("Deletion successful")exceptRuntimeErrorase:print("Deletion failed")print(e)if__name__=="__main__":delete_data_source()
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2026-05-29 UTC."],[],[]]