Skip to content

Add a custom domain

Attach a hostname and verify DNS.

Attach a hostname to an app, configure DNS using the returned records, then verify when propagation finishes.

Add the domain

Create the domain on your app. The response includes expectedDnsRecords / expected_dns_records to add at your DNS provider. Set isDefault / is_default if this should be the app’s primary hostname.

addAppDomain.jsdomains.py
const app = await client.apps.retrieve("da_XYZ");

const domain = await client.apps.domains.create({
  app: app.id,
  hostname: "www.example.com",
  isDefault: false, // true = primary hostname for this app
});
// Should return: {
console.log(domain.id, domain.state, domain.expectedDnsRecords);
domain = client.apps.domains.create(
    app="da_XYZ",
    hostname="www.example.com",
    is_default=False,  # True = primary hostname for this app
)
# Should return: {
print(domain.id, domain.state, domain.expected_dns_records)

Verify DNS

After DNS propagates, call verify with the domain id. Returns true when the hostname is verified.

addAppDomain.jsdomains.py
const verified = await client.apps.domains.verify(domain.id);
// Should return: true
console.log("verified:", verified);
verified = client.apps.domains.verify(domain.id)
# Should return: True
print("verified:", verified)

Source: stackmachine/sdks examples.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close