Verify a domain in Search Console with one TXT record

Add a Domain property in Google Search Console, verify it with a DNS TXT record, submit the sitemap, and make the property visible to you.

Simon, Founder of Shipyard

By · Founder of Shipyard

6 minute read

Domain property, one DNS record

To set up Google Search Console for a new domain, add it as a Domain property, publish the TXT record Google gives you at the root of the domain, press Verify, and submit the address of your sitemap. That single record covers every subdomain and both http and https, and it is the only verification method a Domain property accepts.

Search Console is Google's own report on your site: which pages it has indexed, which searches show them, and what it failed to read. It does not improve rankings. It replaces guessing with evidence, and it starts collecting from the moment the property exists, which is the reason to add it at launch and not three months later.

Two property types, compared

Google offers two kinds of website property. For a new product the Domain property is nearly always right, because you do not yet know whether traffic will arrive on www, on the bare domain or on a subdomain you add next year.

Domain propertyURL-prefix property
You enterexample.com, with no protocol and no pathhttps://www.example.com/, the exact prefix
CoversAll subdomains and all protocolsOnly addresses that begin with that prefix
VerificationDNS record onlyHTML file, meta tag, Google Analytics, Tag Manager or DNS
Name in the APIsc-domain:example.comThe URL itself
Choose it whenYou own the whole domainYou control only one path or host, or need to split data by protocol or folder

Publishing the verification record

In Search Console, open the property selector, choose Add property, pick Domain and type the bare domain. Google shows a TXT value that begins with google-site-verification=. Add it at your DNS provider as the record shown at the end of this section.

Most DNS providers show the root of the domain as @; some want the field left empty. The record sits next to any TXT records already there. A domain can hold several TXT records at the root, so do not paste this value into an existing SPF record. The only TXT records that must stay unique are the SPF line itself and the DMARC record, and this is neither.

DNS records
Type   Name   Value
TXT    @      google-site-verification=AbCdEf123456...   (the full string from Search Console)

If Verify says the record was not found

Google's own wording for this case is that the TXT record was not found, with the note that a new record can take anywhere from a few minutes to a couple of days to become visible. On a DNS provider with an API it is usually minutes. Before waiting, rule out the avoidable causes.

Leave the record in place

Verification is not a one-time event. Search Console checks from time to time that the token is still there. If it disappears you are notified, and if nothing is fixed your access to the property lapses after a grace period. When every verified owner loses access, so does every user they invited. Treat the TXT record as permanent, and when you tidy DNS a year from now, recognise it by its prefix.

Submitting the sitemap

A sitemap is a file that lists the pages you want found, normally at /sitemap.xml. Submitting it means telling Google its address; nothing is uploaded. Open Sitemaps in the left menu, paste the full URL and press Submit. You need owner permission to do this in the report. Without it, the documented alternative is a line in robots.txt of the form Sitemap: https://example.com/sitemap.xml.

What Google requires of the file is modest: UTF-8, absolute URLs, and at most 50,000 URLs or 50 MB uncompressed per file. It ignores the priority and changefreq fields entirely and uses lastmod only when the dates prove to be consistently accurate, so a sitemap that stamps today's date on every page teaches Google to disregard the field.

The report then shows one of three statuses.

StatusMeaningWhat to do
SuccessThe file was fetched and parsedNothing. It does not mean the pages are indexed
Has errorsFetched, but some entries could not be read; the valid URLs are still queuedOpen the row and fix the listed lines
Couldn't fetchGoogle could not retrieve the fileOpen the URL in a private window. A login wall, a redirect or a 404 is the usual cause. Run a live URL Inspection on the sitemap address to see what Googlebot received

Owners, and why a robot-verified property can be invisible

Search Console has two kinds of owner with identical rights. A verified owner proved ownership with a token. A delegated owner was added by another owner without a token. This distinction explains a confusing situation: when a script verifies the domain with a service account, the service account is the verified owner, and the property does not appear when you open Search Console with your own Google account. Nothing is broken. You were never added.

The fix is to add your own address to the owner list, either in Settings, then Users and permissions, or in the same API call sequence that did the verification.

The whole flow as four API calls

Two Google APIs are involved, and both must be enabled in the Cloud project behind the credentials: the Site Verification API proves ownership, and the Search Console API manages the property and its sitemaps.

The body of the first call is printed below, followed by the full sequence. The second call is the one to retry. Until Google's resolvers see the record it answers with an error, so a script should poll it every twenty seconds or so and give up after a sensible limit, then be safe to run again.

JSON
{
  "site": { "type": "INET_DOMAIN", "identifier": "example.com" },
  "verificationMethod": "DNS_TXT"
}
StepRequestScope
Get the tokenPOST /siteVerification/v1/token with site type INET_DOMAIN and method DNS_TXTsiteverification
Verify after the record is livePOST /siteVerification/v1/webResource?verificationMethod=DNS_TXTsiteverification
Add the propertyPUT /webmasters/v3/sites/sc-domain%3Aexample.comwebmasters
Submit the sitemapPUT /webmasters/v3/sites/sc-domain%3Aexample.com/sitemaps/{url-encoded sitemap URL}webmasters

Shipyard's part: four calls and a DNS record

During a launch Shipyard performs those four calls with your service account key, which stays in the keychain on your computer. It requests the token, writes the TXT record into your Cloudflare zone, and polls the verify call every 20 seconds for up to 15 minutes. Once Google confirms, it adds the email address you gave as an additional owner, so the property shows up in your own Search Console, then adds the sc-domain: property and submits https://yourdomain/sitemap.xml.

The TXT record is tracked as one Shipyard created, so a teardown removes it and the property. Left to you: creating the service account and its key, enabling the two APIs, and making sure the app really serves a sitemap at that address. If it does not, the Sitemaps report will say Couldn't fetch until it does.

Expect a quiet first week

Expect a delay. Google says it takes a few days for data to begin to accrue on a new property, and indexing a new domain is slower than verifying it. For the handful of pages that matter most, URL Inspection has a Request indexing button. Google applies a quota to these requests, and a successful inspection is explicitly not a promise that the page will appear in results.

When a page stays out of the index, inspect it before changing anything. The report names the reason. On a new site the usual ones are self-inflicted: a noindex tag left over from development, a robots.txt that still blocks everything, or content that only renders after sign-in.

Sources

Launch in an hour, not a weekend

Shipyard connects your accounts once, then sets up the domain, hosting, database, email and payments for every new product.

See how it works

Read next