Stay organized with collections
Save and categorize content based on your preferences.
You can verify a specific domain or all authentication domains you have
registered with Postmaster.
Verify a specific domain
To verify a specific domain, call
domains.get()
with the name of the domain. Following is a code sample showing how to verify a
specific domain:
Java
/** * Gets a specific domain registered by the client. * * @param service Authorized Gmail PostmasterTools API instance. * @param domainName The fully qualified domain name. * @return The domain * @throws IOException */publicstaticDomaingetDomain(PostmasterToolsservice,StringdomainName)throwsIOException{Stringquery=String.format("domains/%s",domainName);Domaindomain=service.domains().get(query).execute();System.out.println(domain.toPrettyString());returndomain;}
Python
"""Gets a specific domain registered by the client.Args:service: Authorized Gmail PostmasterTools API instance.domain_name: The fully qualified domain name.Returns:The domain."""defget_domain(service,domain_name):try:query='domains/'+domain_namedomain=service.domains().get(name=query).execute();print(domain)returndomainexcepterrors.HttpErroraserr:print('An error occurred: %s'%err)
Verify all domains
To verify all domains, call
domains.list().
Following is a code sample showing how to verify all domains:
Java
/** * Lists the domains that have been registered by the client. * * @param service Authorized Gmail PostmasterTools API instance. * @return Response message for ListDomains. * @throws IOException */publicstaticListDomainsResponselistDomains(PostmasterToolsservice)throwsIOException{ListDomainsResponselistDomainsResponse=service.domains().list().execute();for(Domaindomain:listDomainsResponse.getDomains()){System.out.println(domain.toPrettyString());}returnlistDomainsResponse;}
Python
"""Lists the domains that have been registered by the client.Args:service: Authorized Gmail PostmasterTools API instance.Returns:Response message for ListDomains."""deflist_domains(service):try:domains=service.domains().list().execute()ifnotdomains:print('No domains found.')else:print('Domains:')fordomainindomains['domains']:print(domain)returndomainsexcepterrors.HttpErroraserr:print('An error occurred: %s'%err)
[[["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-28 UTC."],[],[],null,["# Verify authentication domain\n\nYou can verify a specific domain or all authentication domains you have\nregistered with Postmaster.\n\nVerify a specific domain\n------------------------\n\nTo verify a specific domain, call\n[`domains.get()`](/workspace/gmail/postmaster/reference/rest/v1/domains/get)\nwith the name of the domain. Following is a code sample showing how to verify a\nspecific domain: \n\n### Java\n\n /**\n * Gets a specific domain registered by the client.\n *\n * @param service Authorized Gmail PostmasterTools API instance.\n * @param domainName The fully qualified domain name.\n * @return The domain\n * @throws IOException\n */\n public static Domain getDomain(PostmasterTools service, String domainName) throws IOException {\n String query = String.format(\"domains/%s\", domainName);\n Domain domain = service.domains().get(query).execute();\n System.out.println(domain.toPrettyString());\n return domain;\n }\n\n### Python\n\n \"\"\"Gets a specific domain registered by the client.\n\n Args:\n service: Authorized Gmail PostmasterTools API instance.\n domain_name: The fully qualified domain name.\n\n Returns:\n The domain.\n \"\"\"\n def get_domain(service, domain_name):\n try:\n query = 'domains/' + domain_name\n domain = service.domains().get(name=query).execute();\n print(domain)\n return domain\n except errors.HttpError as err:\n print('An error occurred: %s' % err)\n\nVerify all domains\n------------------\n\nTo verify all domains, call\n[`domains.list()`](/workspace/gmail/postmaster/reference/rest/v1/domains/list).\nFollowing is a code sample showing how to verify all domains: \n\n### Java\n\n /**\n * Lists the domains that have been registered by the client.\n *\n * @param service Authorized Gmail PostmasterTools API instance.\n * @return Response message for ListDomains.\n * @throws IOException\n */\n public static ListDomainsResponse listDomains(PostmasterTools service) throws IOException {\n ListDomainsResponse listDomainsResponse = service.domains().list().execute();\n for (Domain domain : listDomainsResponse.getDomains()) {\n System.out.println(domain.toPrettyString());\n }\n return listDomainsResponse;\n }\n\n### Python\n\n \"\"\"Lists the domains that have been registered by the client.\n\n Args:\n service: Authorized Gmail PostmasterTools API instance.\n\n Returns:\n Response message for ListDomains.\n \"\"\"\n def list_domains(service):\n try:\n domains = service.domains().list().execute()\n if not domains:\n print('No domains found.')\n else:\n print('Domains:')\n for domain in domains['domains']:\n print(domain)\n return domains\n except errors.HttpError as err:\n print('An error occurred: %s' % err)"]]