Skip to content

domains

The domains commands manage the domains that point at an environment. To manage the DNS records of a zone hosted at Kinsta, see dns.

Terminal window
kinstactl domains list my-site --env live
kinstactl domains add my-site example.com --env live
kinstactl domains primary my-site example.com --env live

Domains belong to an environment. Without --env, a site with one environment uses it; a site with several gets a picker on a terminal and fails with ENV_REQUIRED in a script. See Sites and environments. domains add, domains remove and domains primary wait for Kinsta to finish by default, and accept --no-wait, --timeout <minutes> and --dry-run; see operations. Where a command takes a <domain>, you can give the domain name or its ID; a unique prefix of the name also works.

List the domains of an environment.

Terminal window
kinstactl domains list my-site --env staging
kinstactl domains list [site] [options]

List the domains of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID

Options

OptionDescription
--env <environment>environment name or ID

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, GET /sites/environments/{env_id}/domains

The table shows the name and ID of each domain, and whether it uses Cloudflare DNS.

Add a domain to an environment.

Terminal window
kinstactl domains add my-site example.com --env live
kinstactl domains add <site> <domain> [options]

Add a domain to an environment

Arguments

ArgumentDescription
sitesite name, display name or ID
domaindomain name to add

Options

OptionDescription
--env <environment>environment name or ID
--with-wwwalso add the www subdomain (requires --wildcard)
--wildcardalso cover subdomains (clears is_wildcardless)
--setup-type <type>quick or avoid_downtime
--ssl-key <file>private key file of a custom SSL certificate
--ssl-cert <file>certificate file of a custom SSL certificate
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, POST /sites/environments/{env_id}/domains

By default the domain is added without wildcard support. Two flags widen that:

  • --wildcard also covers subdomains.
  • --with-www also adds the www subdomain. It requires --wildcard; without it the command fails with a USAGE error before anything is sent.

--setup-type takes quick or avoid_downtime.

To use your own certificate instead of the one Kinsta issues, pass the certificate and its private key as files:

Terminal window
kinstactl domains add my-site example.com --env live --wildcard --with-www --ssl-cert cert.pem --ssl-key key.pem

--ssl-cert and --ssl-key must be given together, and both files must be readable and not empty. The key is sent to Kinsta and never echoed back: --dry-run shows the request with the key masked as ***.

Remove a domain from an environment.

Terminal window
kinstactl domains remove my-site example.com --env live --yes
kinstactl domains remove <site> <domain> [options]

Remove a domain from an environment

Arguments

ArgumentDescription
sitesite name, display name or ID
domaindomain name or ID, see: domains list

Options

OptionDescription
--env <environment>environment name or ID
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)
--yesskip the confirmation prompt

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, GET /sites/environments/{env_id}/domains, DELETE /sites/environments/{env_id}/domains

The domain is looked up first, so a typo fails with the list of domains the environment has. Removing is destructive, so the command asks for confirmation. On a terminal you answer a prompt; in a script pass --yes, otherwise it fails with CONFIRMATION_REQUIRED (exit code 5).

Change the primary domain of an environment.

Terminal window
kinstactl domains primary my-site example.com --env live
kinstactl domains primary <site> <domain> [options]

Change the primary domain of an environment

Arguments

ArgumentDescription
sitesite name, display name or ID
domaindomain name or ID, see: domains list

Options

OptionDescription
--env <environment>environment name or ID
--search-replacealso rewrite the old URL in the database
--dry-runprint the resolved target and request; change nothing
--no-waitreturn the operation ID instead of waiting
--timeout <minutes>give up waiting after this many minutes (default 30)
--yesskip the confirmation prompt

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, GET /sites/environments/{env_id}/domains, PUT /sites/environments/{env_id}/change-primary-domain

The primary domain is the one the site is served on. Changing it alone needs no confirmation.

With --search-replace, Kinsta also rewrites the old URL in the database to the new one. That changes content, so the command then asks for confirmation. On a terminal you answer a prompt; in a script pass --yes.

Terminal window
kinstactl domains primary my-site example.com --env live --search-replace --yes

Show the DNS records that verify and point a domain.

Terminal window
kinstactl domains verification my-site example.com --env live
kinstactl domains verification <site> <domain> [options]

Show the DNS records that verify and point a domain

Arguments

ArgumentDescription
sitesite name, display name or ID
domaindomain name or ID, see: domains list

Options

OptionDescription
--env <environment>environment name or ID

Global options --profile, --json and --no-input apply too. See scripting and CI.

Kinsta API: GET /sites, GET /sites/environments/{env_id}/domains, GET /sites/environments/domains/{site_domain_id}/verification-records

The output has two tables, each with a type, name and value. Add the verification records to the domain’s DNS so Kinsta can confirm you own it, and the pointing records so the domain resolves to the environment. If the zone is hosted at Kinsta you can create them with dns records add. With --json you get the response as Kinsta returns it.