LogoFreestyle

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

Get your API key

Go to the Freestyle Dashboard and get your API key

Create a Domain Verification Request

verifyDomain.ts
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;
} _/
});

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

verifyDomain.ts
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);
    }
  });

You can see if the domain is verified in the Domains section of the Freestyle Dashboard

Next Steps

On this page