Add a DNS TXT record to verify your domain
Add a DNS TXT record to verify your domain with thelastapi CLI, the HTTP API, or the console to prove ownership for external services.
On this page 8 sections
To add a DNS TXT record to verify your domain, run vibiz domains records add <domain> TXT <name> "<value>" using a full-access API key, or enter the values under Domains in the console. If the verification service asks for a record at your root domain, set <name> to @; if it asks for a specific host prefix, pass the relative prefix name. Most records publish and answer DNS queries within a minute or two.
This guide walks through adding TXT verification records to your domain, inspecting your active DNS zone, verifying propagation, and handling domains managed elsewhere.
Why services ask for TXT records
When you connect a domain to external platforms, those platforms need cryptographic or token-based proof that you control the domain's DNS zone. Common verification workflows include:
- Search consoles: Proving ownership to search engines so you can submit sitemaps, inspect indexing, and monitor search impressions.
- AI lab business profiles: Verifying your company identity for organizational API profiles or developer teams.
- External mail tools: Authorizing a specialized transactional delivery service or receiving gateway outside your standard setup.
- SSL certificate validation: Answering manual domain control validation challenges when required by external certificate authorities.
When you buy a domain directly through thelastapi using vibiz domains buy, thelastapi hosts the authoritative nameservers for that domain. You do not need a separate DNS provider or registrar dashboard to manage verification records. Everything is controlled through the CLI, the API, or the web console. For an architectural overview of how bought domains attach to projects, see the Domains documentation.
If your project is backing a newly incorporated business entity, you may also need these verification records while establishing merchant accounts or search console properties. You can read more about setting up your legal entity in our guide on how to form a US LLC or C-Corp from your terminal.
Adding a TXT record with the CLI
To add a TXT verification record, use the vibiz domains records add command. You must use a full-access account key; Limited keys receive a 403 owner_only error with a link to confirm the change in the console.
1. Adding a record at a subdomain prefix
Many services require a verification record at a dedicated subdomain, such as an OpenAI business profile verification token:
vibiz domains records add canetada.app TXT openai-business-profile "openai-business-profile=abc123token"In this command:
canetada.appis the bought domain in your account.TXTis the record type.openai-business-profileis the host name. Because names are relative to the root domain, this creates a record foropenai-business-profile.canetada.app."openai-business-profile=abc123token"is the exact string token provided by the third-party service.
2. Adding a record at the root domain
When a service asks for a record at the root domain (the zone apex), pass @ or empty quotes "" as the name:
vibiz domains records add canetada.app TXT @ "google-site-verification=9s8df7a8sd7f8as7df"Both relative names and full host names are accepted. If you pass openai-business-profile.canetada.app instead of openai-business-profile, the CLI resolves it to the correct relative zone entry automatically.
3. Checking for duplicate records
Adding DNS records through thelastapi is idempotent. If you run the exact same add command twice with the identical type, name, and value, the existing record is returned without creating a duplicate copy. The API responds with HTTP status 200 and created: false.
Adding a TXT record via the HTTP API
If you configure your domain via automated scripts or CI/CD pipelines, you can add TXT records by calling the HTTP API directly.
Send a POST request to /v1/domains/:domain/records:
curl -X POST "https://thelastapi.dev/v1/domains/canetada.app/records" \
-H "Authorization: Bearer $VIBIZ_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"type": "TXT",
"name": "@",
"value": "google-site-verification=9s8df7a8sd7f8as7df",
"ttl": 3600
}'A successful creation returns status 201 Created with the JSON record object:
{
"id": "rec_98234710",
"type": "TXT",
"name": "",
"fqdn": "canetada.app",
"value": "google-site-verification=9s8df7a8sd7f8as7df",
"ttl": 3600,
"priority": null,
"managed": false,
"managed_by": null
}If you prefer using the browser, open the console, navigate to Domains, select your domain, and open the DNS records tab. You will find a list of all existing records and an input form to create new entries.
Inspecting and verifying your DNS records
Once you add the record, list the active records on your domain to confirm that it was written to the zone:
vibiz domains records canetada.appTo output raw JSON for programmatic verification, append the --json flag:
vibiz domains records canetada.app --jsonOver HTTP, you can retrieve all domain records with a GET request:
curl "https://thelastapi.dev/v1/domains/canetada.app/records" \
-H "Authorization: Bearer $VIBIZ_API_KEY"Testing DNS propagation
Records added to bought domains typically resolve globally within one to two minutes. You can test public resolution directly from your terminal using dig:
dig +short TXT openai-business-profile.canetada.appIf the record is placed at the apex domain, query the apex:
dig +short TXT canetada.appOnce the terminal outputs your verification string, trigger the "Verify" button on the third-party service dashboard.
Removing verification records
After domain ownership has been permanently confirmed, some services allow you to remove the verification TXT entry. You can delete user-created records using their record ID:
vibiz domains records remove canetada.app rec_98234710Over HTTP, send a DELETE request:
curl -X DELETE "https://thelastapi.dev/v1/domains/canetada.app/records/rec_98234710" \
-H "Authorization: Bearer $VIBIZ_API_KEY"Notice the distinction between user-created records and managed records. Thelastapi automatically manages records required for app hosting, TLS certificates, and email forwarding (such as MX, SPF, DKIM, and root CAA records). Those entries carry managed: true and specify managed_by: "hosting" or managed_by: "email". Attempting to delete a managed record returns a 409 managed_record error unless you pass the --force flag. Verification TXT records you create yourself are unmanaged (managed: false) and can be removed without --force.
Bought domains vs. connected external domains
How you handle TXT verification records depends entirely on where your domain's DNS is hosted.
| Domain setup | Where DNS lives | How to add a TXT record |
|---|---|---|
Bought through thelastapi (vibiz domains buy) | thelastapi nameservers | vibiz domains records add or console DNS tab |
Connected from outside (vibiz domains add --elsewhere) | External registrar or DNS provider | Add the record in your external DNS provider |
When you connect an external domain that was purchased elsewhere using vibiz domains add <domain>, thelastapi does not host that domain's DNS zone. If you attempt to add records to an external domain using vibiz domains records add, the API returns an error:
{
"error": {
"code": "invalid_request",
"status": 400,
"reason": "dns_elsewhere",
"message": "DNS records of a domain connected from elsewhere must be added where the domain was bought."
}
}For externally connected domains, you must add whatever TXT or CNAME records are required in the third-party provider where you manage your nameservers. Once you have added the required ownership proof at your external DNS host, run:
vibiz domains verify yourdomain.comThis instructs thelastapi to check the public DNS records again immediately. For bought domains, this step is unnecessary because thelastapi already controls the zone and trusts the domain automatically. For example, when setting up internal access rules, bought domains are immediately ready to restrict sign-up to your company's email domain without external DNS verification steps.
Record specifications and error codes
When adding DNS records, keep the following limits and validation rules in mind:
- Supported record types:
A,AAAA,CNAME,MX,TXT, andCAA. - TXT value length: A single TXT record value can contain up to 2,048 characters.
- Apex CNAME restriction: A
CNAMErecord cannot be placed at the apex (@) because DNS standards do not permit CNAMEs at the root. Use anArecord or attach the domain using project hosting rules instead.
Here are common errors you might encounter when adding records:
| HTTP Status | Error Code | Reason | Resolution |
|---|---|---|---|
400 | invalid_request | dns_elsewhere | The domain was connected from outside. Add records at your external registrar. |
400 | invalid_request | field | Invalid record data (for example, a TXT value over 2,048 characters or missing parameters). Check details.field. |
403 | forbidden | owner_only | A Limited API key was used. You must use a full-access key or update the record via the console. |
404 | not_found | not_owned | The specified domain does not exist in your account. Check spelling with vibiz domains owned. |
409 | conflict | cname_conflict | Attempted to add a CNAME that shares a name with existing records. Remove conflicting records first. |
Next, verify your newly added records using vibiz domains records <domain> or query your domain directly from your terminal using dig.
Frequently asked questions
How long does it take for a newly added TXT record to propagate?
For domains bought through thelastapi, new DNS records usually publish and respond to queries within one to two minutes. You can verify propagation immediately by running `dig +short TXT <name>.<domain>` from your terminal.
Can I use a Limited API key to add DNS records?
No, modifying DNS records requires a full-access API key or an account owner performing the action in the console. Requests using a Limited key receive a `403 owner_only` response containing a direct link to the console page.
Why do I get a dns_elsewhere error when trying to add a record?
The `dns_elsewhere` error indicates that the domain was connected from another provider rather than bought directly through thelastapi. Because thelastapi does not host the nameservers for external domains, you must add the TXT record in the DNS dashboard of the registrar where the domain was purchased.
What is the maximum character limit for a TXT record value?
Thelastapi supports TXT record values up to 2,048 characters in length. If your verification string exceeds this limit, the API returns a `400 invalid_request` error naming the invalid field.