Before a custom domain can route to a Freestyle VM, verify that you own it. Verification creates a TXT record challenge for the domain.
You can verify domains in the Freestyle Dashboard or through the SDK.
Create A Verification
import { freestyle } from "freestyle";
const { verificationId, record, instructions } =
await freestyle.domains.verifications.create({
domain: "example.com",
});
console.log(verificationId);
console.log(record);
console.log(instructions);
Freestyle returns a TXT record like this:
{
type: "TXT",
name: "_freestyle_custom_hostname.example.com",
value: "<verification-code>",
}
Add that TXT record in your DNS provider. Some providers automatically append the domain name, so if _freestyle_custom_hostname.example.com does not verify, try _freestyle_custom_hostname as the record name.
Complete Verification
After adding the TXT record, complete verification by domain:
await freestyle.domains.verifications.complete({
domain: "example.com",
});
Or complete verification by ID:
await freestyle.domains.verifications.complete({
verificationId,
});
List Verifications
const verifications = await freestyle.domains.verifications.list();
for (const verification of verifications) {
console.log(verification.domain, verification.verificationCode);
}
Cancel A Verification
await freestyle.domains.verifications.cancel({
domain: "example.com",
verificationCode: "<verification-code>",
});
List Verified Domains
const domains = await freestyle.domains.list({
limit: 50,
});
for (const domain of domains) {
console.log(domain.domain, domain.verifiedDns);
}
Verification proves ownership. It does not point the domain at Freestyle or route traffic to a VM. After verification, configure DNS and create a domain mapping.