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.
kinstactl domains list my-site --env livekinstactl domains add my-site example.com --env livekinstactl domains primary my-site example.com --env liveDomains 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.
domains list
Section titled “domains list”List the domains of an environment.
kinstactl domains list my-site --env stagingkinstactl domains list [site] [options]List the domains of an environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
Options
| Option | Description |
|---|---|
--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.
domains add
Section titled “domains add”Add a domain to an environment.
kinstactl domains add my-site example.com --env livekinstactl domains add <site> <domain> [options]Add a domain to an environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
domain | domain name to add |
Options
| Option | Description |
|---|---|
--env <environment> | environment name or ID |
--with-www | also add the www subdomain (requires --wildcard) |
--wildcard | also 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-run | print the resolved target and request; change nothing |
--no-wait | return 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:
--wildcardalso covers subdomains.--with-wwwalso adds thewwwsubdomain. It requires--wildcard; without it the command fails with aUSAGEerror 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:
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 ***.
domains remove
Section titled “domains remove”Remove a domain from an environment.
kinstactl domains remove my-site example.com --env live --yeskinstactl domains remove <site> <domain> [options]Remove a domain from an environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
domain | domain name or ID, see: domains list |
Options
| Option | Description |
|---|---|
--env <environment> | environment name or ID |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
--yes | skip 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).
domains primary
Section titled “domains primary”Change the primary domain of an environment.
kinstactl domains primary my-site example.com --env livekinstactl domains primary <site> <domain> [options]Change the primary domain of an environment
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
domain | domain name or ID, see: domains list |
Options
| Option | Description |
|---|---|
--env <environment> | environment name or ID |
--search-replace | also rewrite the old URL in the database |
--dry-run | print the resolved target and request; change nothing |
--no-wait | return the operation ID instead of waiting |
--timeout <minutes> | give up waiting after this many minutes (default 30) |
--yes | skip 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.
kinstactl domains primary my-site example.com --env live --search-replace --yesdomains verification
Section titled “domains verification”Show the DNS records that verify and point a domain.
kinstactl domains verification my-site example.com --env livekinstactl domains verification <site> <domain> [options]Show the DNS records that verify and point a domain
Arguments
| Argument | Description |
|---|---|
site | site name, display name or ID |
domain | domain name or ID, see: domains list |
Options
| Option | Description |
|---|---|
--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.