Verify authentication domain
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
*/
public static Domain getDomain(PostmasterTools service, String domainName) throws IOException {
String query = String.format("domains/%s", domainName);
Domain domain = service.domains().get(query).execute();
System.out.println(domain.toPrettyString());
return domain;
}
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.
"""
def get_domain(service, domain_name):
try:
query = 'domains/' + domain_name
domain = service.domains().get(name=query).execute();
print(domain)
return domain
except errors.HttpError as err:
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
*/
public static ListDomainsResponse listDomains(PostmasterTools service) throws IOException {
ListDomainsResponse listDomainsResponse = service.domains().list().execute();
for (Domain domain : listDomainsResponse.getDomains()) {
System.out.println(domain.toPrettyString());
}
return listDomainsResponse;
}
Python
"""Lists the domains that have been registered by the client.
Args:
service: Authorized Gmail PostmasterTools API instance.
Returns:
Response message for ListDomains.
"""
def list_domains(service):
try:
domains = service.domains().list().execute()
if not domains:
print('No domains found.')
else:
print('Domains:')
for domain in domains['domains']:
print(domain)
return domains
except errors.HttpError as err:
print('An error occurred: %s' % err)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-28 UTC.
[null,null,["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)"]]