Stay organized with collectionsSave and categorize content based on your preferences.
Your online store's URL is your homepage for Merchant Center. You first set or
update your homepage URL. Then, to unlock various Merchant Center features and
enable advertising on Google surfaces, you need to verify that you have control
over the website associated with this URL. After your website is verified, you
can claim the homepage in Merchant Center.
You can manage your homepage settings using Merchant API, including the
following operations:
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.accounts.v1.GetHomepageRequest;importcom.google.shopping.merchant.accounts.v1.Homepage;importcom.google.shopping.merchant.accounts.v1.HomepageName;importcom.google.shopping.merchant.accounts.v1.HomepageServiceClient;importcom.google.shopping.merchant.accounts.v1.HomepageServiceSettings;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to get the homepage for a given Merchant Center account */publicclassGetHomepageSample{publicstaticvoidgetHomepage(Configconfig)throwsException{// Obtains OAuth token based on the user's configuration.GoogleCredentialscredential=newAuthenticator().authenticate();// Creates service settings using the credentials retrieved above.HomepageServiceSettingshomepageServiceSettings=HomepageServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();// Creates Homepage name to identify Homepage.Stringname=HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();// Calls the API and catches and prints any network failures/errors.try(HomepageServiceClienthomepageServiceClient=HomepageServiceClient.create(homepageServiceSettings)){// The name has the format: accounts/{account}/homepageGetHomepageRequestrequest=GetHomepageRequest.newBuilder().setName(name).build();System.out.println("Sending Get Homepage request:");Homepageresponse=homepageServiceClient.getHomepage(request);System.out.println("Retrieved Homepage below");System.out.println(response);}catch(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();getHomepage(config);}}
use Google\ApiCore\ApiException;use Google\Shopping\Merchant\Accounts\V1\GetHomepageRequest;use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;/*** This class demonstrates how to get the homepage for a given Merchant Center account*/class GetHomepage{/*** Gets the homepage for a given Merchant Center account.** @param array $config The configuration data for authentication and account ID.* @return void* @throws ApiException if the API call fails.*/public static function getHomepageSample(array $config): void{// Gets the OAuth credentials to make the request.$credentials = Authentication::useServiceAccountOrTokenFile();// Creates options config containing credentials for the client to use.$options = ['credentials' => $credentials];// Creates a client.$homepageServiceClient = new HomepageServiceClient($options);// Creates Homepage name to identify Homepage.// The name has the format: accounts/{account}/homepage$name = "accounts/" . $config['accountId'] . "/homepage";// Calls the API and catches and prints any network failures/errors.try {$request = new GetHomepageRequest(['name' => $name]);print "Sending Get Homepage request:\n";$response = $homepageServiceClient->getHomepage($request);print "Retrieved Homepage below\n";print_r($response);} catch (ApiException $e) {print $e->getMessage();}}/*** Helper to execute the sample.** @return void*/public function callSample(): void{$config = Config::generateConfig();// Makes the call to get the homepage.self::getHomepageSample($config);}}// Run the script$sample = new GetHomepage();$sample->callSample();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shopping.merchant_accounts_v1importGetHomepageRequestfromgoogle.shopping.merchant_accounts_v1importHomepageServiceClient_ACCOUNT=configuration.Configuration().read_merchant_info()defget_homepage():"""Gets the homepage for a given Merchant Center account."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=HomepageServiceClient(credentials=credentials)# Creates Homepage name to identify Homepage.name="accounts/"+_ACCOUNT+"/homepage"# Creates the request.request=GetHomepageRequest(name=name)# Makes the request and catches and prints any error messages.try:response=client.get_homepage(request=request)print("Retrieved Homepage below")print(response)exceptRuntimeErrorase:print(e)if__name__=="__main__":get_homepage()
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.protobuf.FieldMask;importcom.google.shopping.merchant.accounts.v1.Homepage;importcom.google.shopping.merchant.accounts.v1.HomepageName;importcom.google.shopping.merchant.accounts.v1.HomepageServiceClient;importcom.google.shopping.merchant.accounts.v1.HomepageServiceSettings;importcom.google.shopping.merchant.accounts.v1.UpdateHomepageRequest;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to update a homepage to a new URL. */publicclassUpdateHomepageSample{publicstaticvoidupdateHomepage(Configconfig,Stringuri)throwsException{GoogleCredentialscredential=newAuthenticator().authenticate();HomepageServiceSettingshomepageServiceSettings=HomepageServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();// Creates homepage name to identify homepage.Stringname=HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();// Create a homepage with the updated fields.Homepagehomepage=Homepage.newBuilder().setName(name).setUri(uri).build();FieldMaskfieldMask=FieldMask.newBuilder().addPaths("uri").build();try(HomepageServiceClienthomepageServiceClient=HomepageServiceClient.create(homepageServiceSettings)){UpdateHomepageRequestrequest=UpdateHomepageRequest.newBuilder().setHomepage(homepage).setUpdateMask(fieldMask).build();System.out.println("Sending Update Homepage request");Homepageresponse=homepageServiceClient.updateHomepage(request);System.out.println("Updated Homepage Name below");System.out.println(response.getName());}catch(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();// The URI (a URL) of the store's homepage.Stringuri="https://example.com";updateHomepage(config,uri);}}
use Google\ApiCore\ApiException;use Google\Protobuf\FieldMask;use Google\Shopping\Merchant\Accounts\V1\Homepage;use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;use Google\Shopping\Merchant\Accounts\V1\UpdateHomepageRequest;/*** This class demonstrates how to update a homepage to a new URL.*/class UpdateHomepage{/*** Updates a homepage to a new URL.** @param array $config The configuration data for authentication and account ID.* @param string $uri The new URI for the homepage.* @return void* @throws ApiException if the API call fails.*/public static function updateHomepageSample(array $config, string $uri): void{// Gets the OAuth credentials to make the request.$credentials = Authentication::useServiceAccountOrTokenFile();// Creates options config containing credentials for the client to use.$options = ['credentials' => $credentials];// Creates a client.$homepageServiceClient = new HomepageServiceClient($options);// Creates Homepage name to identify Homepage.// The name has the format: accounts/{account}/homepage$name = "accounts/" . $config['accountId'] . "/homepage";// Create a homepage with the updated fields.$homepage = new Homepage(['name' => $name, 'uri' => $uri]);// Create field mask to specify which fields to update.$fieldMask = new FieldMask(['paths' => ['uri']]);try {$request = new UpdateHomepageRequest(['homepage' => $homepage,'update_mask' => $fieldMask]);print "Sending Update Homepage request\n";$response = $homepageServiceClient->updateHomepage($request);print "Updated Homepage Name below\n";print $response->getName() . "\n";} catch (ApiException $e) {print $e->getMessage();}}/*** Helper to execute the sample.** @return void*/public function callSample(): void{$config = Config::generateConfig();// The URI (a URL) of the store's homepage.$uri = "https://example.com";// Makes the call to update the homepage.self::updateHomepageSample($config, $uri);}}// Run the script$sample = new UpdateHomepage();$sample->callSample();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.protobufimportfield_mask_pb2fromgoogle.shopping.merchant_accounts_v1importHomepagefromgoogle.shopping.merchant_accounts_v1importHomepageServiceClientfromgoogle.shopping.merchant_accounts_v1importUpdateHomepageRequest_ACCOUNT=configuration.Configuration().read_merchant_info()defupdate_homepage(new_uri):"""Updates a homepage to a new URL."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=HomepageServiceClient(credentials=credentials)# Creates Homepage name to identify Homepage.name="accounts/"+_ACCOUNT+"/homepage"# Create a homepage with the updated fields.homepage=Homepage(name=name,uri=new_uri)# Create a FieldMask for the "uri" field.field_mask=field_mask_pb2.FieldMask(paths=["uri"])# Creates the request.request=UpdateHomepageRequest(homepage=homepage,update_mask=field_mask)# Makes the request and catches and prints any error messages.try:response=client.update_homepage(request=request)print("Updated Homepage Name below")print(response.name)exceptRuntimeErrorase:print(e)if__name__=="__main__":# The URI (a URL) of the store's homepage.uri="https://example.com"update_homepage(uri)
To claim your online store's homepage, use theclaimmethod. But before you can claim your homepage, you must complete verification,
which is the process that proves you own the website.
Here's an example HTTPS request:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage:claim
Here's an example request payload if you want to overwrite an existing claim
from another account:
{"overwrite":true}
A successful request returns theHomepageresource. If the claim is successful, theclaimedfield will betrue.
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.accounts.v1.ClaimHomepageRequest;importcom.google.shopping.merchant.accounts.v1.Homepage;importcom.google.shopping.merchant.accounts.v1.HomepageName;importcom.google.shopping.merchant.accounts.v1.HomepageServiceClient;importcom.google.shopping.merchant.accounts.v1.HomepageServiceSettings;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to claim the homepage for a given Merchant Center account. */publicclassClaimHomepageSample{// Executing this method requires admin access.publicstaticvoidclaimHomepage(Configconfig)throwsException{// Obtains OAuth token based on the user's configuration.GoogleCredentialscredential=newAuthenticator().authenticate();// Creates service settings using the credentials retrieved above.HomepageServiceSettingshomepageServiceSettings=HomepageServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();// Creates Homepage name to identify Homepage.// The name has the format: accounts/{account}/homepageStringname=HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();// Calls the API and catches and prints any network failures/errors.try(HomepageServiceClienthomepageServiceClient=HomepageServiceClient.create(homepageServiceSettings)){ClaimHomepageRequestrequest=ClaimHomepageRequest.newBuilder().setName(name).build();System.out.println("Sending Claim Homepage request:");// If the homepage is already claimed, this will recheck the// verification (unless the merchant is exempt from claiming, which also// exempts from verification) and return a successful response. If ownership// can no longer be verified, it will return an error, but it won't lose an existing// claim. In case of failure, a canonical error message will be returned:// * PERMISSION_DENIED: user doesn't have the necessary permissions on this// MC account;// * FAILED_PRECONDITION:// - The account is not a Merchant Center account;// - MC account doesn't have a homepage;// - claiming failed (in this case the error message will contain more// details).Homepageresponse=homepageServiceClient.claimHomepage(request);System.out.println("Retrieved Homepage below");System.out.println(response);}catch(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();claimHomepage(config);}}
use Google\ApiCore\ApiException;use Google\Shopping\Merchant\Accounts\V1\ClaimHomepageRequest;use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;/*** This class demonstrates how to claim the homepage for a given Merchant Center account.*/class ClaimHomepage{/*** Claims the homepage for a given Merchant Center account.** @param array $config The configuration data for authentication and account ID.* @return void* @throws ApiException if the API call fails.*/public static function claimHomepageSample(array $config): void{// Gets the OAuth credentials to make the request.$credentials = Authentication::useServiceAccountOrTokenFile();// Creates options config containing credentials for the client to use.$options = ['credentials' => $credentials];// Creates a client.$homepageServiceClient = new HomepageServiceClient($options);// Creates Homepage name to identify Homepage.// The name has the format: accounts/{account}/homepage$name = "accounts/" . $config['accountId'] . "/homepage";// Calls the API and catches and prints any network failures/errors.try {$request = new ClaimHomepageRequest(['name' => $name]);print "Sending Claim Homepage request:\n";$response = $homepageServiceClient->claimHomepage($request);print "Retrieved Homepage below\n";print_r($response);} catch (ApiException $e) {print $e->getMessage();}}/*** Helper to execute the sample.** @return void*/public function callSample(): void{$config = Config::generateConfig();// Makes the call to claim the homepage.self::claimHomepageSample($config);}}// Run the script$sample = new ClaimHomepage();$sample->callSample();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shopping.merchant_accounts_v1importClaimHomepageRequestfromgoogle.shopping.merchant_accounts_v1importHomepageServiceClient_ACCOUNT=configuration.Configuration().read_merchant_info()defclaim_homepage():"""Claims the homepage for a given Merchant Center account."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=HomepageServiceClient(credentials=credentials)# Creates Homepage name to identify Homepage.name="accounts/"+_ACCOUNT+"/homepage"# Creates the request.request=ClaimHomepageRequest(name=name)# Makes the request and catches and prints any error messages.try:response=client.claim_homepage(request=request)print("Retrieved Homepage below")print(response)exceptRuntimeErrorase:print(e)if__name__=="__main__":claim_homepage()
To remove the claimed status from your store's homepage, use theunclaimmethod. You might do this if you've changed your website or no longer want to
have the current URL associated with your account in a claimed state.
Here's an example HTTPS request:
POST https://merchantapi.googleapis.com/accounts/v1/accounts/{ACCOUNT_ID}/homepage:unclaim
importcom.google.api.gax.core.FixedCredentialsProvider;importcom.google.auth.oauth2.GoogleCredentials;importcom.google.shopping.merchant.accounts.v1.Homepage;importcom.google.shopping.merchant.accounts.v1.HomepageName;importcom.google.shopping.merchant.accounts.v1.HomepageServiceClient;importcom.google.shopping.merchant.accounts.v1.HomepageServiceSettings;importcom.google.shopping.merchant.accounts.v1.UnclaimHomepageRequest;importshopping.merchant.samples.utils.Authenticator;importshopping.merchant.samples.utils.Config;/** This class demonstrates how to unclaim the homepage for a given Merchant Center account. */publicclassUnclaimHomepageSample{// Executing this method requires admin access.publicstaticvoidunclaimHomepage(Configconfig)throwsException{// Obtains OAuth token based on the user's configuration.GoogleCredentialscredential=newAuthenticator().authenticate();// Creates service settings using the credentials retrieved above.HomepageServiceSettingshomepageServiceSettings=HomepageServiceSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(credential)).build();// Creates Homepage name to identify Homepage.// The name has the format: accounts/{account}/homepageStringname=HomepageName.newBuilder().setAccount(config.getAccountId().toString()).build().toString();// Calls the API and catches and prints any network failures/errors.try(HomepageServiceClienthomepageServiceClient=HomepageServiceClient.create(homepageServiceSettings)){UnclaimHomepageRequestrequest=UnclaimHomepageRequest.newBuilder().setName(name).build();System.out.println("Sending Unclaim Homepage request:");Homepageresponse=homepageServiceClient.unclaimHomepage(request);System.out.println("Retrieved Homepage below");System.out.println(response);}catch(Exceptione){System.out.println(e);}}publicstaticvoidmain(String[]args)throwsException{Configconfig=Config.load();unclaimHomepage(config);}}
use Google\ApiCore\ApiException;use Google\Shopping\Merchant\Accounts\V1\Client\HomepageServiceClient;use Google\Shopping\Merchant\Accounts\V1\UnclaimHomepageRequest;/*** This class demonstrates how to unclaim the homepage for a given Merchant Center account.*/class UnclaimHomepage{/*** Unclaims the homepage for a given Merchant Center account.** @param array $config The configuration data for authentication and account ID.* @return void* @throws ApiException if the API call fails.*/public static function unclaimHomepageSample(array $config): void{// Gets the OAuth credentials to make the request.$credentials = Authentication::useServiceAccountOrTokenFile();// Creates options config containing credentials for the client to use.$options = ['credentials' => $credentials];// Creates a client.$homepageServiceClient = new HomepageServiceClient($options);// Creates Homepage name to identify Homepage.// The name has the format: accounts/{account}/homepage$name = "accounts/" . $config['accountId'] . "/homepage";// Calls the API and catches and prints any network failures/errors.try {$request = new UnclaimHomepageRequest(['name' => $name]);print "Sending Unclaim Homepage request:\n";$response = $homepageServiceClient->unclaimHomepage($request);print "Retrieved Homepage below\n";print_r($response);} catch (ApiException $e) {print $e->getMessage();}}/*** Helper to execute the sample.** @return void*/public function callSample(): void{$config = Config::generateConfig();// Makes the call to unclaim the homepage.self::unclaimHomepageSample($config);}}// Run the script$sample = new UnclaimHomepage();$sample->callSample();
fromexamples.authenticationimportconfigurationfromexamples.authenticationimportgenerate_user_credentialsfromgoogle.shopping.merchant_accounts_v1importHomepageServiceClientfromgoogle.shopping.merchant_accounts_v1importUnclaimHomepageRequest_ACCOUNT=configuration.Configuration().read_merchant_info()defunclaim_homepage():"""Unclaims the homepage for a given Merchant Center account."""# Gets OAuth Credentials.credentials=generate_user_credentials.main()# Creates a client.client=HomepageServiceClient(credentials=credentials)# Creates Homepage name to identify Homepage.# The name has the format: accounts/{account}/homepagename="accounts/"+_ACCOUNT+"/homepage"# Creates the request.request=UnclaimHomepageRequest(name=name)# Makes the request and catches and prints any error messages.try:response=client.unclaim_homepage(request=request)print(f"Unclaimed Homepage:{response}")exceptRuntimeErrorase:print(f"Failed to unclaim homepage:{e}")if__name__=="__main__":unclaim_homepage()
[[["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 2025-08-07 UTC."],[],["The core actions for managing your store's homepage involve claiming, retrieving, unclaimed, and updating. Claiming it is necessary to unlock features and proves ownership. These operations are performed through API methods: `accounts.homepage.claim`, `accounts.homepage.getHomepage`, `accounts.homepage.unclaim`, and `accounts.homepage.updateHomepage`. Each method uses a specific HTTP request (POST, GET, PATCH) targeting your Merchant Center account ID to either claim, view, remove the claim, or modify the homepage details. Each method returns the new status.\n"],null,[]]