Verify a Custom Domain
Verify ownership of and start managing custom domains via Freestyle API
Domain Verification is the process for you to prove that you own a domain. It is useful not just for managing to your domains, but for managing your user's domains. Once you have verified ownership of a domain, you can deploy to it or any of its subdomains, provision certificates for it, and manage its DNS through the Freestyle API.
It runs through a 3 step process: First, you create a domain verification request, this creates a request token — you (or your users) add that DNS record to their DNS, then you tell us you completed the challenge, we check it, and assuming its correct, you have the ability to use that domain.
Install the Freestyle Sandboxes package
npm i freestyle-sandboxes
pnpm i freestyle-sandboxes
bun i freestyle-sandboxes
yarn add freestyle-sandboxes
pip install freestyle
Get your API key
Go to the Freestyle Dashboard and get your API key
Create a Domain Verification Request
import { FreestyleSandboxes } from "freestyle-sandboxes";
const api = new FreestyleSandboxes({
apiKey: process.env.FREESTYLE_API_KEY!, // make sure to set this
});
const domainVerificationRequset = api.createDomainVerificationRequest("yourdomain.com") // this also works for subdomains
.then((result) => {
console.log("Domain verification request created @ ", result);
/* The result looks like: {
verificationCode: string;
domain: string;
} */
});
import freestyle
client = freestyle.Freestyle("YOUR_FREESTYLE_API_KEY")
verification_request = client.create_domain_verification_request(
domain="yourdomain.com" # this also works for subdomains
)
print("Domain verification request created successfully!")
print(f"Domain: {verification_request.domain}")
print(f"Verification Code: {verification_request.verification_code}")
print(f"Id: {verification_request.id}")
You can also view your domain verification request in the Freestyle Dashboard
Add the record
Add the following DNS record to your domain's DNS settings:
Type: TXT
Name: _freestyle_custom_hostname.{yourdomain.com}
Value: {verificationCode}
You can check if its propagated by running the following command:
dig TXT _freestyle_custom_hostname.{yourdomain.com}
Verify the domain
import { FreestyleSandboxes } from "freestyle-sandboxes";
const api = new FreestyleSandboxes({
apiKey: process.env.FREESTYLE_API_KEY!, // make sure to set this
});
const domainVerificationRequset = api
.verifyDomain("yourdomain.com") // this also works for subdomains
.then((result) => {
if (result.domain) {
console.log("Domain verified @ ", result.domain);
} else {
console.log("Domain verification failed", result.message);
}
});
import freestyle
client = freestyle.Freestyle("YOUR_FREESTYLE_API_KEY")
domain_verification_result = client.verify_domain("yourdomain.com") # this also works for subdomains
if domain_verification_result.domain:
print("Domain verified @ ", domain_verification_result.domain)
else:
print("Domain verification failed", domain_verification_result.message)
You can see if the domain is verified in the Domains section of the Freestyle Dashboard