This is the abridged developer documentation for kinstactl # kinstactl > Everything the Kinsta API can do, from your terminal: sites and environments by name, backups, cache, pushes, logs, and a typed client for your own scripts. ```sh kinstactl sites list kinstactl cache clear my-site --env live kinstactl backups create my-site --env live ``` # Authentication > Log in with a Kinsta API key, or provide credentials through environment variables. kinstactl needs a Kinsta API key and the ID of your company. `auth login` stores both for you. ```sh kinstactl auth login ``` The command prompts for the API key without echoing it, validates it against the Kinsta API (`GET /validate`), and stores the key together with the company ID that Kinsta reports for it. You never type the company ID yourself. Create the key in MyKinsta, in your company’s API key settings. ## Reading the key from stdin [Section titled “Reading the key from stdin”](#reading-the-key-from-stdin) A key passed as `--api-key ` ends up in your shell history. Pass `-` to read it from stdin instead, which is also the way to log in without a terminal: ```sh kinstactl auth login --api-key - < key.txt ``` Without a terminal and without `--api-key`, the command fails with a `USAGE` error rather than waiting for input. ## Checking and removing a login [Section titled “Checking and removing a login”](#checking-and-removing-a-login) ```sh kinstactl auth status kinstactl auth logout ``` `auth status` shows where the credentials come from (`env` or `profile`), the company ID, the key name, its status and when it expires. It validates the key against Kinsta, so it fails when the key is revoked. `auth logout` removes the stored profile. Neither command ever prints the key itself. ## Environment variables [Section titled “Environment variables”](#environment-variables) For CI and containers, export the credentials instead of logging in: ```sh export KINSTA_API_KEY= KINSTA_COMPANY_ID= ``` Both variables are required together. Setting only one fails with `AUTH_MISSING`. They win over the config file, unless you pass `--profile`, which always selects a stored profile (see [Profiles](/getting-started/profiles/)). ## Where the key is stored [Section titled “Where the key is stored”](#where-the-key-is-stored) `auth login` writes `~/.config/kinstactl/config.json`, or `$XDG_CONFIG_HOME/kinstactl/config.json` when `XDG_CONFIG_HOME` is set. The file is created with mode `0600`, so only your user can read it. The API key is stored in it in plain text. # Installation > Install kinstactl from npm, as a standalone binary or as a Docker image. kinstactl ships as an npm package, as standalone binaries and as a Docker image. They all run the same CLI. ```sh npm i -g kinstactl npx kinstactl --version ``` ## npm [Section titled “npm”](#npm) The package needs Node.js 22.12 or newer. Install it globally to get the `kinstactl` command, or run it once with `npx` without installing anything. ## Binaries [Section titled “Binaries”](#binaries) Every [release](https://github.com/rickklaasboer/kinstactl/releases) has a binary per platform, so you can run kinstactl without Node.js: * `kinstactl-darwin-arm64` * `kinstactl-darwin-x64` * `kinstactl-linux-x64` * `kinstactl-linux-arm64` * `kinstactl-windows-x64.exe` Each release also has a `SHA256SUMS` file. Verify the download before you run it. `--ignore-missing` skips the files you did not download. ```sh shasum -a 256 -c --ignore-missing SHA256SUMS && chmod +x kinstactl-darwin-arm64 && ./kinstactl-darwin-arm64 --version ``` On Linux, use `sha256sum` instead of `shasum -a 256` and the `kinstactl-linux-x64` file name. macOS quarantines a binary that you download through a browser. Clear the flag, or download with `curl -LO` instead: ```sh xattr -d com.apple.quarantine kinstactl-darwin-arm64 ``` The `darwin-x64` binary (Intel Macs) is built and attached to each release, but CI does not smoke-test it. Like the npm package, the binaries do not load a `.env` file or a `bunfig.toml` from the working directory. Credentials come from [`kinstactl auth login`](/getting-started/authentication/) or from exported environment variables. ## Docker [Section titled “Docker”](#docker) The image is based on the linux-x64 binary, so it is `linux/amd64` only. It has no entrypoint: pass the command to run. ```sh docker run --rm -e KINSTA_API_KEY -e KINSTA_COMPANY_ID ghcr.io/rickklaasboer/kinstactl kinstactl sites list ``` In GitLab CI, use it as the job image: ```yaml list-sites: image: ghcr.io/rickklaasboer/kinstactl script: kinstactl sites list ``` Provide `KINSTA_API_KEY` and `KINSTA_COMPANY_ID` as masked CI/CD variables. # Profiles > Store the credentials of several companies and switch between them. A profile is a named set of credentials. Use one per company when you work with more than one. ```sh kinstactl auth login --profile work kinstactl auth profiles kinstactl sites list --profile work ``` `auth login --profile ` stores the key under that name. `auth profiles` lists the stored profiles with their company ID, key name and which one is the default. `--profile` is a global flag, so it works on every command. ## Which profile is used [Section titled “Which profile is used”](#which-profile-is-used) kinstactl picks the profile in this order: 1. the `--profile` flag 2. the `KINSTA_PROFILE` environment variable 3. the `defaultProfile` in the config file 4. a profile named `default` The first `auth login` sets `defaultProfile` to the profile it stores, so later logins under another name do not change which one is the default. `auth logout` removes the selected profile by the same rules, and clears `defaultProfile` when it pointed at it. ```sh KINSTA_PROFILE=work kinstactl sites list ``` An unknown profile name fails with `AUTH_MISSING` and lists the profiles that exist. With a single company you never need any of this: `auth login` without `--profile` stores a profile called `default`, and every command uses it. # Sites and environments > Refer to sites and environments by name, display name or ID. Commands take a `` argument and, for environment-specific actions, an `--env ` flag. You use names; kinstactl looks up the IDs. ```sh kinstactl cache clear my-site --env live ``` ## Sites [Section titled “Sites”](#sites) `` accepts the site name, its display name or its ID. kinstactl matches exactly first, ignoring case. When nothing matches exactly, it accepts a prefix, as long as the prefix identifies one site. * No match fails with `SITE_NOT_FOUND`. The `hints` of the error list the closest site names. * A prefix that matches several sites fails with `SITE_AMBIGUOUS`, and the `hints` list the candidates. Without ``, a command on a terminal shows a searchable picker. In a script, `--no-input` or CI it fails with a `USAGE` error instead. ## Environments [Section titled “Environments”](#environments) `--env ` accepts the same three forms as a site: name, display name or ID, exact first and then an unambiguous prefix. When you leave `--env` out: * A site with one environment uses that one, and kinstactl says so. * On a terminal, you get a picker with the live environment first. * In a script, the command fails with `ENV_REQUIRED`, and the `hints` list one `--env ` suggestion per environment. Pass `--env` explicitly in scripts, so a command never depends on whether a terminal is attached. ## The site cache [Section titled “The site cache”](#the-site-cache) Looking up a name needs the list of your sites. kinstactl caches that list for five minutes in `~/.cache/kinstactl`, or in `$XDG_CACHE_HOME/kinstactl` when `XDG_CACHE_HOME` is set, with one file per company. ```sh kinstactl sites list --refresh ``` `--refresh` bypasses the cache and rewrites it. Commands that change something always resolve the site against fresh data, so a stale cache can never point a write at the wrong site. ## Shell completion [Section titled “Shell completion”](#shell-completion) Site and environment names complete in your shell once you install the completion script, for example `eval "$(kinstactl completion bash)"`. See [completion](/commands/completion/) for bash, zsh and fish. # For agents > Give a coding agent a prompt and a skill so it can operate Kinsta through kinstactl safely. Coding agents can run kinstactl without a terminal session. This page has the prompt to hand them and a skill file that carries the same text. ## Why the CLI is agent-safe [Section titled “Why the CLI is agent-safe”](#why-the-cli-is-agent-safe) * Without a TTY the CLI never prompts. With `--no-input` it fails instead of asking. * Errors are JSON on stderr with a `code`, a `message` and `hints` that say what to do next. * Every write supports `--dry-run`, which prints the resolved target and request and changes nothing. * Irreversible actions need `--confirm `, so an agent cannot trigger them by accident. * `kinstactl commands --json` lists every command, argument, flag and the API endpoints it calls. * The docs are published as plain text in [llms.txt](/llms.txt). ## The prompt [Section titled “The prompt”](#the-prompt) Paste this into your agent’s instructions. Use the copy button in the corner of the block. Prompt for your agent ```text You operate Kinsta hosting through the command line client kinstactl. Follow these rules. Install - Install the CLI with npm i -g kinstactl, or run it without installing through npx kinstactl. - Verify the install: kinstactl --version Authenticate - Credentials come from the KINSTA_API_KEY and KINSTA_COMPANY_ID environment variables, or from an existing profile (select one with --profile ). - Never print, log or echo the API key, and never put it in a command line, a file or a commit. Discover - List every command with its arguments, flags and the API endpoints it calls: kinstactl commands --json - Read the details of one command with its --help, for example: kinstactl sites delete --help Run commands - Always pass --json --no-input. Output is then machine-readable and the CLI fails instead of prompting. - On a non-zero exit, parse the error object on stderr. It has code, message and hints. Act on hints before you retry or give up. Make changes safely - Run every write first with --dry-run, and show the human what will change: kinstactl sites delete my-site --dry-run --json --no-input - After you show the dry run, wait for the human's go-ahead before you run the write itself, whatever its confirmation level. - Never pass --yes or --confirm without the human's explicit approval for that specific action. Approval for one action is not approval for the next. - --confirm exists only for irreversible actions, and takes the exact site name. - Treat passwords, login links and tokens that commands print (ssh password get, wp login, db login) like the API key: never log, echo or store them, and show them to the human only when that was the point of the request. Long operations - Prefer --no-wait. With --json the response has an operation_id; read it from the JSON, then wait for it: kinstactl operations wait --json --no-input - Use --timeout on the wait if the default of 30 is too short or too long. Documentation - The docs are at https://kinstactl.rickklaasboer.nl - A plain-text version for agents is at https://kinstactl.rickklaasboer.nl/llms.txt ``` ## Install as a skill [Section titled “Install as a skill”](#install-as-a-skill) The prompt is the body of a Claude Code skill. Install it once and the agent loads it when you ask for Kinsta work: ```sh mkdir -p ~/.claude/skills/kinstactl && curl -fsSL https://raw.githubusercontent.com/rickklaasboer/kinstactl/main/skills/kinstactl/SKILL.md -o ~/.claude/skills/kinstactl/SKILL.md ``` ## llms.txt [Section titled “llms.txt”](#llmstxt) The site publishes three files for language models: * [llms.txt](https://kinstactl.rickklaasboer.nl/llms.txt): an index that links to the two sets below and to a command reference (every command with its arguments, flags and the Kinsta API endpoints it calls). * [llms-small.txt](https://kinstactl.rickklaasboer.nl/llms-small.txt): the docs in condensed form. * [llms-full.txt](https://kinstactl.rickklaasboer.nl/llms-full.txt): the complete docs in one file. ## Not an MCP server [Section titled “Not an MCP server”](#not-an-mcp-server) kinstactl is a CLI, not an MCP server; the typed client in the package makes it cheap to add one later. # Scripting and CI > Run kinstactl from scripts and CI pipelines with JSON output, no prompts, dry runs, exit codes and environment variables. kinstactl is built to be called from scripts. Output is machine-readable on demand, nothing prompts when no one is there to answer, and every failure has a stable code and exit status. ## Machine-readable output [Section titled “Machine-readable output”](#machine-readable-output) Pass `--json` to get JSON on stdout. ```sh kinstactl sites list --json | jq -r '.[].name' ``` With `--json`, stdout holds only the result document. Human messages such as progress lines and hints go to stderr, and are left out entirely in JSON mode, so `stdout` is always safe to pipe into `jq`. Errors are printed to stderr as JSON too; see [Exit codes and the error object](#exit-codes-and-the-error-object). The JSON shapes are documented per command and kept stable. Changing a field name or removing one is a breaking change and ships as one. To discover every command, argument and flag programmatically, ask kinstactl itself: ```sh kinstactl commands --json ``` ## No prompts [Section titled “No prompts”](#no-prompts) A script must never wait for input. kinstactl prompts only when stdin and stdout are both a terminal, and not when any of these is true: * you pass `--json`, * you pass the global `--no-input` flag, * `KINSTACTL_NO_INPUT=1` is set, * `CI=true` is set (most CI systems set it). ```sh kinstactl backups create my-site --env live --no-input ``` When a command would have prompted, it fails instead, with the code that names what is missing. Pass every value a prompt would have asked for: * `--env ` is required when the site has more than one environment, otherwise the command fails with `ENV_REQUIRED`. A site with a single environment uses it without `--env`, but pass it anyway so the script keeps working when a second environment appears. * A missing `` argument fails with a `USAGE` error. * `auth login` needs `--api-key ` (or `--api-key -` for stdin) and fails with `USAGE` without it. * Confirmations are covered in the next section. kinstactl prints colour only on a terminal. Set `NO_COLOR=1` to turn it off there as well. ## Confirmations [Section titled “Confirmations”](#confirmations) Destructive commands ask before they act. In a script you answer in advance with a flag. ```sh kinstactl backups restore my-site 123456789 --env live --notify admin@example.com --yes kinstactl sites delete my-site --confirm my-site ``` Two levels exist, and `kinstactl --help` shows which flag a command takes: * `--yes` skips the confirmation of a command that is destructive but recoverable, such as `backups restore`. * `--confirm ` is required for irreversible commands, such as `sites delete`. `--yes` is deliberately not accepted there: you pass the name of the site, so a copy-pasted command cannot delete the wrong one. Without the flag, and without a terminal, the command fails with `CONFIRMATION_REQUIRED` (exit 5). A `--confirm` value that does not match the site also gives `CONFIRMATION_REQUIRED`. On a terminal, answering no gives `CONFIRMATION_DECLINED`, also exit 5. ## Dry runs [Section titled “Dry runs”](#dry-runs) `--dry-run` resolves everything and prints what would be sent, without sending it. ```sh kinstactl cache clear my-site --env live --dry-run --json ``` Every command that changes something takes `--dry-run`. The output is a single document: ```json { "dry_run": true, "target": { "site": {"id": "", "name": "my-site"}, "env": {"id": "", "name": "live"} }, "request": { "method": "POST", "path": "/sites/tools/clear-cache", "body": {"environment_id": ""} } } ``` `target` holds the resolved site and environment, and `request` the HTTP method, path, query and body. Secrets in the body, such as passwords and API keys, are redacted. A dry run happens before the confirmation, so it never asks for `--yes` or `--confirm`. Use it to check that a script points at the right site and environment before you let it run for real. ## Long operations [Section titled “Long operations”](#long-operations) Many commands start a Kinsta operation and wait for it to finish. In a script, you can start it and come back later. ```sh kinstactl backups create my-site --env live --no-wait --json kinstactl operations wait --timeout 10 ``` With `--json`, `--no-wait` prints `{"operation_id": "...", "status": "pending"}` on stdout. Without `--json` it prints a `Started ...` line on stdout and the operation ID only in the `Follow with: kinstactl operations wait ` hint on stderr, so use `--json` when a script has to capture the ID. Not every write command takes `--no-wait`. Commands that finish immediately, such as `ssh enable` or `security redirects add`, have no operation to wait for; `kinstactl --help` lists the flags. `operations wait` and the waiting commands take `--timeout ` (default 30). A failed operation exits with code 3 (`OPERATION_FAILED`). A wait that ends before the operation does exits with code 4 (`OPERATION_TIMEOUT`); the operation may still complete on Kinsta’s side, so check it with `kinstactl operations get ` instead of starting it again. ## Environment variables [Section titled “Environment variables”](#environment-variables) | Variable | Meaning | | -------------------- | -------------------------------------------------------------------------------- | | `KINSTA_API_KEY` | The Kinsta API key. Set it together with `KINSTA_COMPANY_ID`. | | `KINSTA_COMPANY_ID` | The ID of your company. Set it together with `KINSTA_API_KEY`. | | `KINSTA_PROFILE` | The stored profile to use when `--profile` is not given. | | `KINSTACTL_NO_INPUT` | Set to `1` to never prompt, like `--no-input`. | | `KINSTACTL_DEBUG` | Set to `1` to add the stack trace of unexpected errors to the JSON error object. | | `CI` | When `true`, kinstactl never prompts, like `--no-input`. | | `NO_COLOR` | Set to a non-empty value to turn off colour. | | `XDG_CONFIG_HOME` | Base directory of the config file, `~/.config` by default. | | `XDG_CACHE_HOME` | Base directory of the site cache, `~/.cache` by default. | `KINSTA_API_KEY` and `KINSTA_COMPANY_ID` win over the config file; see [Authentication](/getting-started/authentication/). `--profile` always selects a stored profile instead. ## Exit codes and the error object [Section titled “Exit codes and the error object”](#exit-codes-and-the-error-object) Every failure has a code, and the code decides the exit status. | Code | Exit | Meaning | | ----------------------- | ---- | ------------------------------------------------------------------------------------- | | `USAGE` | 2 | Unknown command or flag, or a required argument or value is missing. | | `AUTH_MISSING` | 2 | No credentials found, or only one of `KINSTA_API_KEY` and `KINSTA_COMPANY_ID` is set. | | `SITE_NOT_FOUND` | 2 | No site matches the name you gave. | | `SITE_AMBIGUOUS` | 2 | The name matches more than one site. | | `ENV_REQUIRED` | 2 | The site has several environments and `--env` was not given. | | `ENV_NOT_FOUND` | 2 | The site has no environment with that name, or the name matches several. | | `API_ERROR` | 1 | The Kinsta API rejected the request, or could not be reached. | | `INTERNAL` | 1 | An unexpected error in kinstactl itself. | | `AUTH_INVALID` | 1 | Kinsta rejected the API key (HTTP 401). | | `OPERATION_FAILED` | 3 | A Kinsta operation ended in failure. | | `OPERATION_TIMEOUT` | 4 | The wait for an operation ran out, or contact with Kinsta was lost while waiting. | | `CONFIRMATION_REQUIRED` | 5 | A destructive command needs `--yes` or `--confirm `. | | `CONFIRMATION_DECLINED` | 5 | The confirmation was answered with no. | A successful run exits 0. With `--json`, the error is a single object on stderr: ```json { "error": { "code": "ENV_REQUIRED", "message": "Site my-site has several environments; choose one", "hints": ["--env live", "--env staging"] } } ``` `code` is stable and meant for scripts. `message` is for people and may change. `hints` lists suggested fixes and is empty when there are none. Set `KINSTACTL_DEBUG=1` to add a `stack` field to `INTERNAL` errors. ## A GitHub Actions example [Section titled “A GitHub Actions example”](#a-github-actions-example) Store the credentials as repository secrets and install kinstactl from npm. ```yaml name: backup on: schedule: - cron: '0 3 * * *' jobs: backup: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: 22 - run: npm i -g kinstactl - run: kinstactl backups create my-site --env live --json --no-input env: KINSTA_API_KEY: ${{ secrets.KINSTA_API_KEY }} KINSTA_COMPANY_ID: ${{ secrets.KINSTA_COMPANY_ID }} ``` GitHub sets `CI=true`, so the `--no-input` flag is redundant there, but it states the intent and keeps the same command working elsewhere. A non-zero exit fails the step. The job waits for the backup to finish; add `--no-wait` to start it and move on. In GitLab CI, use the Docker image, which has no entrypoint: ```yaml list-sites: image: ghcr.io/rickklaasboer/kinstactl script: kinstactl sites list ``` `KINSTA_API_KEY` and `KINSTA_COMPANY_ID` come from masked CI/CD variables. # analytics > Traffic, bandwidth, disk space and bot protection analytics of an environment. The `analytics` command shows one metric of an environment over a period of time. ```sh kinstactl analytics visits my-site --env live kinstactl analytics top-countries my-site --env live --span 30d kinstactl analytics bot-traffic-flow my-site --env live --json ``` 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](/getting-started/sites-and-environments/). The command only reads, so it has no `--dry-run`, `--no-wait` or confirmation. ## analytics [Section titled “analytics”](#analytics) Show one analytics metric of an environment. ```sh kinstactl analytics visits my-site --env live --span 30d ``` ```sh kinstactl analytics [site] [options] ``` Traffic, bandwidth, disk and bot analytics of an environment #### Arguments | Argument | Description | | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `metric` | metric: visits, bandwidth, cdn-bandwidth, diskspace, top-countries, top-cities, top-ips, top-asns, top-browsers, top-hosts, top-referrers, top-user-agents, visits-dispersion, response-codes, bot-traffic-flow, bot-requests, bot-protection-results, bot-top-breakdown Choices: `visits`, `bandwidth`, `cdn-bandwidth`, `diskspace`, `top-countries`, `top-cities`, `top-ips`, `top-asns`, `top-browsers`, `top-hosts`, `top-referrers`, `top-user-agents`, `visits-dispersion`, `response-codes`, `bot-traffic-flow`, `bot-requests`, `bot-protection-results`, `bot-top-breakdown`. | | `site` | site name, display name or ID | #### Options | Option | Description | | ---------------------- | --------------------------------------------------------------- | | `--env ` | environment name or ID | | `--span ` | time span: 24h, 7d, 30d, 60d (default: 7d) | | `--from ` | start date (instead of --span) | | `--to ` | end date | | `--time-zone ` | UTC offset for diskspace, e.g. 02:00 (default: local time zone) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/analytics/visits`, `GET /sites/environments/{env_id}/analytics/bandwidth`, `GET /sites/environments/{env_id}/analytics/cdn-bandwidth`, `GET /sites/environments/{env_id}/analytics/top-countries`, `GET /sites/environments/{env_id}/analytics/top-cities`, `GET /sites/environments/{env_id}/analytics/top-client-ips`, `GET /sites/environments/{env_id}/analytics/top-asns`, `GET /sites/environments/{env_id}/analytics/top-browsers`, `GET /sites/environments/{env_id}/analytics/top-hosts`, `GET /sites/environments/{env_id}/analytics/top-referrers`, `GET /sites/environments/{env_id}/analytics/top-uas`, `GET /sites/environments/{env_id}/analytics/visits-dispersion`, `GET /sites/environments/{env_id}/analytics/response-codes`, `GET /sites/environments/{env_id}/analytics/bot-protection/traffic-flow`, `GET /sites/environments/{env_id}/analytics/bot-protection/requests`, `GET /sites/environments/{env_id}/analytics/bot-protection/protection-results`, `GET /sites/environments/{env_id}/analytics/bot-protection/top-breakdown`, `GET /sites/environments/{env_id}/analytics/diskspace` The first argument is the metric, and is one of the choices in the reference above. They fall in a few groups: * Over time: `visits`, `bandwidth`, `cdn-bandwidth`, `diskspace`, `response-codes`. * Top lists: `top-countries`, `top-cities`, `top-ips`, `top-asns`, `top-browsers`, `top-hosts`, `top-referrers`, `top-user-agents`. * Distribution of visits: `visits-dispersion`. * Bot protection: `bot-traffic-flow`, `bot-requests`, `bot-protection-results`, `bot-top-breakdown`. ### Choosing the period [Section titled “Choosing the period”](#choosing-the-period) `--span` takes `24h`, `7d`, `30d` or `60d`, and defaults to `7d`. For a custom period use `--from` and `--to` instead; the values are passed to the API as given, for example `2026-10-01` and `2026-10-31`. `--span` cannot be combined with `--from` or `--to`; the command fails with a `USAGE` error before it sends a request. The `diskspace` metric has no `24h` span, so use `7d`, `30d` or `60d` there. ```sh kinstactl analytics visits my-site --env live --from 2026-10-01 --to 2026-10-31 ``` ### Disk space and time zones [Section titled “Disk space and time zones”](#disk-space-and-time-zones) `--time-zone` only applies to `diskspace`; with any other metric the command fails with a `USAGE` error. It takes a whole-hour UTC offset such as `02:00` or `-05:00`, and defaults to the offset of your local time zone, rounded toward zero to whole hours. ```sh kinstactl analytics diskspace my-site --env live --time-zone 02:00 ``` ### Output [Section titled “Output”](#output) Without `--json` the command prints tables on stdout: a heading line and a key/value table per series for the metrics over time, and a table per list for the others. With `--json` it prints the raw API response and nothing else, which is the way to get the exact numbers into a script: ```sh kinstactl analytics visits my-site --env live --span 24h --json ``` # auth > Log in with a Kinsta API key, check the active credentials and manage stored profiles. The `auth` commands manage the credentials kinstactl uses to talk to the Kinsta API. They are stored per profile; see [Authentication](/getting-started/authentication/) for the full story, including the environment variables for CI. ```sh kinstactl auth login kinstactl auth status kinstactl auth profiles ``` ## auth login [Section titled “auth login”](#auth-login) Validate an API key and store it, together with your company ID, in a profile. ```sh kinstactl auth login --profile work --api-key - < key.txt ``` ```sh kinstactl auth login [options] ``` Validate an API key and store it in a profile #### Options | Option | Description | | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | `--api-key ` | API key (required when not interactive); "-" reads it from stdin. A literal key ends up in your shell history: prefer "--api-key -" or KINSTA_API_KEY | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /validate` The key is validated against Kinsta (`GET /validate`) before anything is stored, and the company ID is the one Kinsta reports for that key, so you never type it yourself. A key passed as a literal `--api-key ` ends up in your shell history. Pass `-` to read it from stdin instead. When stdin is not a terminal and no `--api-key` is given, the command fails with a `USAGE` error instead of prompting. Use the global `--profile ` to store the key under a named profile. ## auth status [Section titled “auth status”](#auth-status) Show the active credentials and validate them against Kinsta. ```sh kinstactl auth status ``` ```sh kinstactl auth status [options] ``` Show the active credentials and validate them against Kinsta Kinsta API: `GET /validate` The output names the source of the credentials (`env` for `KINSTA_API_KEY` and `KINSTA_COMPANY_ID`, `profile` for a stored profile), the profile, the company ID, the name and status of the key and when it expires. The key itself is never printed. Because the key is validated against Kinsta, the command fails when the key has been revoked, which makes it a quick check at the start of a CI job. ## auth logout [Section titled “auth logout”](#auth-logout) Remove a stored profile. ```sh kinstactl auth logout --profile work ``` ```sh kinstactl auth logout [options] ``` Remove a stored profile The profile is selected by the usual rules (`--profile`, `KINSTA_PROFILE`, the default profile), and the command fails with a `USAGE` error when that profile does not exist. Credentials that come from environment variables are not affected. ## auth profiles [Section titled “auth profiles”](#auth-profiles) List the stored profiles. ```sh kinstactl auth profiles ``` ```sh kinstactl auth profiles [options] ``` List stored profiles The table shows each profile with its company ID and key name, and marks the default profile. See [Profiles](/getting-started/profiles/) for working with more than one company. # backups > List, create, restore and delete backups, and create downloadable backup archives. The `backups` commands manage the backups Kinsta keeps of an environment, and the downloadable archives you can take off Kinsta. ```sh kinstactl backups list my-site --env live kinstactl backups create my-site --env live --tag "before plugin update" kinstactl backups restore my-site 123456789 --env live --notify rick@example.com ``` Backups belong to an environment. Without `--env`, the site’s only environment is used; see [Sites and environments](/getting-started/sites-and-environments/). Creating, restoring and deleting wait for Kinsta to finish by default, and accept `--no-wait`, `--timeout ` and `--dry-run`; see [operations](/commands/operations/). ## backups list [Section titled “backups list”](#backups-list) List the backups of an environment, newest first. ```sh kinstactl backups list my-site --env staging --type manual ``` ```sh kinstactl backups list [site] [options] ``` List the backups of an environment, newest first #### Arguments | Argument | Description | | -------- | --------------- | | `site` | site name or ID | #### Options | Option | Description | | --------------- | ------------------------------------------------------- | | `--env ` | environment (default: the only one) | | `--type ` | only this backup type, e.g. manual, scheduled or system | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites/environments/{env_id}/backups` The table shows the backup ID, its type, the note and when it was created. You need the ID for `backups restore` and `backups delete`. `--type` keeps only one kind of backup, for example `manual`, `scheduled` or `system`. ## backups create [Section titled “backups create”](#backups-create) Create a manual backup. ```sh kinstactl backups create my-site --env live --tag "before plugin update" ``` ```sh kinstactl backups create [site] [options] ``` Create a manual backup #### Arguments | Argument | Description | | -------- | --------------- | | `site` | site name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment (default: the only one) | | `--tag ` | label for the backup | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `POST /sites/environments/{env_id}/manual-backups` Take a manual backup before a risky change such as a plugin update or an [`env push`](/commands/env/#env-push). `--tag` labels the backup so you recognise it later. ## backups restore [Section titled “backups restore”](#backups-restore) Restore a backup, replacing the environment. ```sh kinstactl backups restore my-site 123456789 --notify rick@example.com ``` ```sh kinstactl backups restore [options] ``` Restore a backup, replacing the environment #### Arguments | Argument | Description | | ----------- | ---------------------------- | | `site` | site name or ID | | `backup-id` | backup ID, see: backups list | #### Options | Option | Description | | -------------------------- | ----------------------------------------------------- | | `--env ` | environment to restore to (default: the only one) | | `--from-env ` | environment the backup was taken on (default: --env) | | `--notify ` | company user to notify when the restore finishes | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites/environments/{env_id}/backups`, `GET /company/{id}/users`, `POST /sites/environments/{target_env_id}/backups/restore` Restoring replaces the content of the environment with the backup, so the command asks for confirmation. On a terminal you answer a prompt; in a script pass `--notify ` and `--yes`. Without `--notify` a script fails with `USAGE` (there is no user to notify), and without `--yes` it fails with `CONFIRMATION_REQUIRED` (exit code 5). `--notify` takes the email of a company user, who is notified when the restore finishes. By default the backup is restored onto the environment it was taken on. With `--from-env` you restore a backup taken on another environment of the same site onto `--env`, for example a staging backup onto live: ```sh kinstactl backups restore my-site 123456789 --from-env staging --env live --notify rick@example.com ``` The backup ID is looked up in `--from-env`, and the confirmation names both environments, so you can see that the content of `live` is about to be replaced by a backup from `staging`. ## backups delete [Section titled “backups delete”](#backups-delete) Delete a backup. ```sh kinstactl backups delete my-site 123456789 --env staging --yes ``` ```sh kinstactl backups delete [options] ``` Delete a backup #### Arguments | Argument | Description | | ----------- | ---------------------------- | | `site` | site name or ID | | `backup-id` | backup ID, see: backups list | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment (default: the only one) | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites/environments/{env_id}/backups`, `DELETE /sites/environments/backups/{backup_id}` The backup is looked up first, and the confirmation shows its ID and creation time. On a terminal you answer a prompt; in a script pass `--yes`. ## backups downloadable list [Section titled “backups downloadable list”](#backups-downloadable-list) List the downloadable backup archives of an environment. ```sh kinstactl backups downloadable list my-site --env live ``` ```sh kinstactl backups downloadable list [site] [options] ``` List the downloadable backup archives of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ---------------------- | | `--env ` | environment name or ID | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/downloadable-backups` A downloadable backup is an archive you can download from Kinsta, as opposed to the backups above, which you can only restore. The table shows when each archive was created and when it expires. ## backups downloadable create [Section titled “backups downloadable create”](#backups-downloadable-create) Create a downloadable backup archive. ```sh kinstactl backups downloadable create my-site --env live ``` ```sh kinstactl backups downloadable create [site] [options] ``` Create a downloadable backup archive #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/downloadable-backups`, `GET /sites/environments/{env_id}/downloadable-backups` When the archive is ready, the command prints its download link. With `--no-wait` it returns the operation ID instead, and you collect the link later with `backups downloadable list`. Kinsta limits how often you can create one; check that with `backups downloadable quota` first. ## backups downloadable quota [Section titled “backups downloadable quota”](#backups-downloadable-quota) Check whether a new downloadable backup can be created. ```sh kinstactl backups downloadable quota my-site --env live ``` ```sh kinstactl backups downloadable quota [site] [options] ``` Check whether a new downloadable backup can be created #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ---------------------- | | `--env ` | environment name or ID | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/next-downloadable-backup-available` The command prints `available` when you can create a new archive now, and otherwise when the next one becomes available. # cache > Clear the site, edge and CDN caches of an environment and switch edge caching and image optimization. Kinsta caches a site in three places: the site cache of the environment itself, the edge cache and the CDN. The `cache` commands clear each of them and control edge caching and CDN image optimization. ```sh kinstactl cache clear my-site --env live kinstactl cache edge clear my-site --env live kinstactl cache cdn clear my-site --env live ``` Clearing a cache is not destructive, so none of these commands asks for confirmation. They wait for Kinsta to finish by default, and accept `--no-wait`, `--timeout ` and `--dry-run`; see [operations](/commands/operations/). ## cache clear [Section titled “cache clear”](#cache-clear) Clear the site cache of an environment. ```sh kinstactl cache clear my-site --env live ``` ```sh kinstactl cache clear [site] [options] ``` Clear the site cache of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `POST /sites/tools/clear-cache` Use this after a deploy or a content import, when a page still shows old content. It clears the site cache of that one environment, not the edge cache or the CDN. ## cache edge clear [Section titled “cache edge clear”](#cache-edge-clear) Clear the edge cache of an environment. ```sh kinstactl cache edge clear my-site --env live --url https://example.com/blog/ --subdirectories ``` ```sh kinstactl cache edge clear [site] [options] ``` Clear the edge cache of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--url ` | clear only this URL | | `--subdirectories` | also clear the subdirectories of --url | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `POST /sites/edge-caching/clear` Without `--url`, the whole edge cache of the environment is cleared. With `--url` only that URL is cleared, and `--subdirectories` extends that to everything below it. ## cache edge enable [Section titled “cache edge enable”](#cache-edge-enable) Enable edge caching of an environment. ```sh kinstactl cache edge enable my-site --env live ``` ```sh kinstactl cache edge enable [site] [options] ``` Enable edge caching of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `PUT /sites/edge-caching/status` Edge caching is a setting per environment. Use this command and `cache edge disable` to switch it, for example to turn it off while you debug a caching problem and on again afterwards. ## cache edge disable [Section titled “cache edge disable”](#cache-edge-disable) Disable edge caching of an environment. ```sh kinstactl cache edge disable my-site --env live ``` ```sh kinstactl cache edge disable [site] [options] ``` Disable edge caching of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `PUT /sites/edge-caching/status` The counterpart of `cache edge enable`. ## cache cdn clear [Section titled “cache cdn clear”](#cache-cdn-clear) Clear the CDN cache of an environment. ```sh kinstactl cache cdn clear my-site --env live ``` ```sh kinstactl cache cdn clear [site] [options] ``` Clear the CDN cache of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites/{site_id}/environments`, `POST /sites/cdn/clear-cache` Use this when static files such as images, CSS or JavaScript are served stale from the CDN. ## cache cdn image-optimization [Section titled “cache cdn image-optimization”](#cache-cdn-image-optimization) Show or set the CDN image optimization of an environment. ```sh kinstactl cache cdn image-optimization my-site lossy --env live ``` ```sh kinstactl cache cdn image-optimization [type] [options] ``` Show or set the CDN image optimization of an environment #### Arguments | Argument | Description | | -------- | -------------------------------------------------------------------------------- | | `site` | site name, display name or ID | | `type` | set this type; omit to show the current one Choices: `off`, `lossy`, `lossless`. | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/{site_id}/environments`, `PUT /sites/cdn/image-optimization` Without a `type`, the command shows the current setting. With `off`, `lossy` or `lossless` it changes the setting; only that form is an operation that waits and accepts `--dry-run`. To read the current value: ```sh kinstactl cache cdn image-optimization my-site --env live ``` # commands > List every command with its arguments, options and API endpoints, for people and for scripts. The `commands` command prints the full command tree of kinstactl. It needs no credentials and makes no request. ```sh kinstactl commands kinstactl commands --json ``` ## commands [Section titled “commands”](#commands) List all commands, their options and the API endpoints they use. ```sh kinstactl commands ``` ```sh kinstactl commands [options] ``` List all commands, their options and the API endpoints they use Without `--json` the command prints the tree as indented text: one line per command with its arguments (`` for a required one, `[site]` for an optional one) and its description. Options are not part of this view; for those use `--help` on a command, or `--json`. ### The JSON tree [Section titled “The JSON tree”](#the-json-tree) With `--json` the command prints the whole tree as one JSON document, starting at the `kinstactl` program itself. Every node has the same shape: | Field | Meaning | | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | | `name` | The last word of the command, such as `list`. | | `path` | The full command, such as `backups downloadable list`; empty for the root. | | `description` | The one-line description. | | `arguments` | The positional arguments, each with `name`, `required`, `description` and, when the values are fixed, `choices`. | | `options` | The flags, each with `flags` and `description`. | | `destructive` | `"confirm"` when the command asks for confirmation (`--yes` skips it), `"irreversible"` when you must pass `--confirm `, or `null`. | | `endpoints` | The Kinsta API endpoints the command calls, such as `GET /sites`. | | `commands` | The child nodes. A node without children is a command you can run. | The root node lists the options that apply to every command (`--profile`, `--json`, `--no-input`), and every command node repeats them in its own `options`. The tree is generated from the same definitions that drive the commands, so it is always current. A script can use it to find the commands that change something, or the endpoints a command depends on: ```sh kinstactl commands --json | jq '[.. | objects | select(.destructive != null) | .path]' ``` # company > Manage company users and their roles, and list API keys, regions, activity, plugins and themes of the company. The `company` commands work on the company your API key belongs to: its users and their roles, its API keys, the regions you can create sites in, its activity log, and the plugins and themes in use across all its sites. ```sh kinstactl company users list kinstactl company activity --category siteActions --limit 25 kinstactl company plugins --updates --vulnerable ``` All of them are scoped to the company of the active profile; see [profiles](/getting-started/profiles/). The listing commands only read. The two role commands change something and accept `--dry-run`, `--no-wait` and `--timeout `; see [operations](/commands/operations/). Neither asks for confirmation. ## company users list [Section titled “company users list”](#company-users-list) List the users of the company with their roles. ```sh kinstactl company users list ``` ```sh kinstactl company users list [options] ``` List the users of the company with their roles Kinsta API: `GET /company/{id}/users` The table shows each user’s email, name, roles and ID. Use the email, the full name or the ID wherever another command asks for a ``. ## company users get [Section titled “company users get”](#company-users-get) Show a company user and the roles they hold. ```sh kinstactl company users get jan@example.com ``` ```sh kinstactl company users get [options] ``` Show a company user and the roles they hold #### Arguments | Argument | Description | | -------- | ----------------------------------------------- | | `user` | email, full name or ID, see: company users list | Kinsta API: `GET /company/{id}/users`, `GET /company/{id}/users/{id_user}` The user is looked up by exact email, ID or full name first, then by a unique prefix. If several users match, the command fails with a `USAGE` error that lists their emails; it never picks one for you. The output shows the email, name and two-factor setting, followed by a table with the roles of the user and the company or site each role applies to. ## company users role [Section titled “company users role”](#company-users-role) Set the company-wide role of a user. ```sh kinstactl company users role jan@example.com company-developer ``` ```sh kinstactl company users role [options] ``` Set the company-wide role of a user #### Arguments | Argument | Description | | -------- | ------------------------------------------------------------------------------ | | `user` | email, full name or ID, see: company users list | | `role` | company role Choices: `company-admin`, `company-developer`, `company-billing`. | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /company/{id}/users`, `POST /company/{company_id}/users/company-capabilities` The role is one of `company-admin`, `company-developer` or `company-billing`. On success the command prints ` is now `; with `--json` you get `user_id`, `role`, `status` and, when Kinsta started an operation, its `operation_id`. ## company users site-role [Section titled “company users site-role”](#company-users-site-role) Set the role of a user on one site. ```sh kinstactl company users site-role jan@example.com my-site site-developer ``` ```sh kinstactl company users site-role [options] ``` Set the role of a user on one site #### Arguments | Argument | Description | | -------- | -------------------------------------------------- | | `user` | email, full name or ID, see: company users list | | `site` | site name, display name or ID | | `role` | site role Choices: `site-admin`, `site-developer`. | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /company/{id}/users`, `GET /sites`, `POST /company/{company_id}/users/site-capabilities` The role is `site-admin` or `site-developer`, and applies to the one site. The site is resolved against fresh data, not the cache. See [Sites and environments](/getting-started/sites-and-environments/) for how a site is named. ## company api-keys [Section titled “company api-keys”](#company-api-keys) List the API keys of the company. ```sh kinstactl company api-keys ``` ```sh kinstactl company api-keys [options] ``` List the API keys of the company Kinsta API: `GET /company/{id}/api-keys` The table shows the name, status, expiry (`never` when the key does not expire) and ID of each key. The key itself is never shown. ## company regions [Section titled “company regions”](#company-regions) List the regions a site can be created in. ```sh kinstactl company regions ``` ```sh kinstactl company regions [options] ``` List the regions a site can be created in Kinsta API: `GET /company/{id}/available-regions` The table shows the region ID and its name. The ID is what [`sites create`](/commands/sites/) takes in `--region`. ## company activity [Section titled “company activity”](#company-activity) Show the activity log of the company. ```sh kinstactl company activity --category siteActions --site my-site --limit 25 ``` ```sh kinstactl company activity [options] ``` Show the activity log of the company #### Options | Option | Description | | ----------------------- | ------------------------------------------------------------------------------------------------------------- | | `--limit ` | number of entries | | `--offset ` | entries to skip | | `--category ` | one of: siteActions, kinstaDns, migrations, billing, notifications, userManagement, personalSettings, samlSso | | `--site ` | only entries of this site (name, display name or ID) | | `--language ` | language of the descriptions: da, de, en, es, fr, it, ja, nl, pt, sv | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /company/{id}/activity-logs` The command shows 10 entries by default; page through the log with `--limit` and `--offset`. The table shows the date, type, site ID, who started it (a user or an API key) and the status (`done`, `pending`, `warning` or `failed`). A line such as `10 of 340` goes to stderr. `--category` narrows the log to one of `siteActions`, `kinstaDns`, `migrations`, `billing`, `notifications`, `userManagement`, `personalSettings` or `samlSso`. `--site` keeps the entries of one site, by name, display name or ID. `--language` sets the language of the descriptions to one of `da`, `de`, `en`, `es`, `fr`, `it`, `ja`, `nl`, `pt` or `sv`. ## company plugins [Section titled “company plugins”](#company-plugins) List the plugins in use across the company. ```sh kinstactl company plugins --updates --vulnerable ``` ```sh kinstactl company plugins [options] ``` List the plugins in use across the company (filters apply client-side) #### Options | Option | Description | | -------------- | ----------------------------------------------- | | `--updates` | only plugins with an update available | | `--vulnerable` | only plugins whose latest version is vulnerable | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /company/{id}/wp-plugins` The table shows each plugin once, with its latest version, the number of environments that use it, the number of pending updates and whether the latest version is vulnerable. This is the company-wide inventory; for one environment use [`plugins list`](/commands/plugins/). `--updates` keeps plugins with at least one update available, and `--vulnerable` keeps plugins whose latest version is vulnerable. Both filters are applied by kinstactl after the full inventory is fetched, and combining them keeps only plugins that match both. When the inventory is empty, the command prints a message with the time it was last updated instead of a table. ## company themes [Section titled “company themes”](#company-themes) List the themes in use across the company. ```sh kinstactl company themes --updates ``` ```sh kinstactl company themes [options] ``` List the themes in use across the company (filters apply client-side) #### Options | Option | Description | | -------------- | ---------------------------------------------- | | `--updates` | only themes with an update available | | `--vulnerable` | only themes whose latest version is vulnerable | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /company/{id}/wp-themes` Works like `company plugins`, with the same table, the same `--updates` and `--vulnerable` filters and the same message for an empty inventory. For one environment use [`themes list`](/commands/themes/). # completion > Print the shell completion script for zsh, bash or fish. The `completion` commands print a completion script that makes your shell complete kinstactl commands, flags, site names and environment names. ```sh kinstactl completion zsh > "${fpath[1]}/_kinstactl" eval "$(kinstactl completion bash)" kinstactl completion fish > ~/.config/fish/completions/kinstactl.fish ``` Each command prints the script of one shell to stdout, so you install it by redirecting the output to the place your shell loads completions from, or by evaluating it. With `--json` the command prints an object with the `shell` and the `script`. Site and environment names come from the site cache; see [Sites and environments](/getting-started/sites-and-environments/). ## completion zsh [Section titled “completion zsh”](#completion-zsh) Print the zsh completion script. ```sh kinstactl completion zsh > "${fpath[1]}/_kinstactl" ``` ```sh kinstactl completion zsh [options] ``` Print the zsh completion script This writes the script to the first directory in your `fpath`, under the name `_kinstactl` that zsh looks for. Start a new shell to load it. ## completion bash [Section titled “completion bash”](#completion-bash) Print the bash completion script. ```sh eval "$(kinstactl completion bash)" ``` ```sh kinstactl completion bash [options] ``` Print the bash completion script Put the `eval` line in your `~/.bashrc` to load the script in every shell. ## completion fish [Section titled “completion fish”](#completion-fish) Print the fish completion script. ```sh kinstactl completion fish > ~/.config/fish/completions/kinstactl.fish ``` ```sh kinstactl completion fish [options] ``` Print the fish completion script Fish loads every file in `~/.config/fish/completions`, so the script is active in the next shell you start. ## completion sites [Section titled “completion sites”](#completion-sites) Print the site names for shell completion. ```sh kinstactl completion sites ``` ```sh kinstactl completion sites [options] ``` Print the site names for shell completion Kinsta API: `GET /sites` A helper that the completion scripts call to complete a `` argument; you do not run it yourself. It prints one site name per line from the site cache, and fetches the list from Kinsta only when the cache has expired. ## completion envs [Section titled “completion envs”](#completion-envs) Print the environment names of a site for shell completion. ```sh kinstactl completion envs my-site ``` ```sh kinstactl completion envs [site] [options] ``` Print the environment names of a site for shell completion #### Arguments | Argument | Description | | -------- | --------------- | | `site` | site name or ID | Kinsta API: `GET /sites` A helper that the completion scripts call to complete `--env`; you do not run it yourself. It prints one environment name of the site per line, from the site cache, and never opens the site picker. # db > Open the database of an environment in phpMyAdmin. The `db` command gives you access to the database of an environment through phpMyAdmin. For changing text in the database, see [search-replace](/commands/search-replace/). ```sh kinstactl db login my-site --env live ``` ## db login [Section titled “db login”](#db-login) Create a phpMyAdmin login link. ```sh kinstactl db login my-site --env live ``` ```sh kinstactl db login [site] [options] ``` Create a phpMyAdmin login link #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env ` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/pma-login-token` The command prints a URL on stdout. Open it in a browser to be logged in to phpMyAdmin without a password. With `--json` it prints `url` and `expires_at`, so a script can see how long the link is valid. Treat the URL like a password while it is valid. 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](/getting-started/sites-and-environments/). The command accepts `--dry-run`, but has no `--no-wait`. # dns > List the DNS zones of the company and manage the records in them. The `dns` commands manage the DNS zones Kinsta hosts for your company and the records inside them. They work on zones, not on sites, so they take no `--env`. ```sh kinstactl dns zones kinstactl dns records list example.com kinstactl dns records add example.com A www --value 203.0.113.10 ``` Wherever a command takes a ``, give the zone name or its ID; a unique prefix of the name also works, and an ambiguous one fails with the matching names. Records are identified by their `` and ``, for example `A` and `www`. Commands that change records wait for Kinsta to finish by default, and accept `--no-wait`, `--timeout ` and `--dry-run`; see [operations](/commands/operations/). ## dns zones [Section titled “dns zones”](#dns-zones) List the DNS zones of the company. ```sh kinstactl dns zones ``` ```sh kinstactl dns zones [options] ``` List the DNS zones of the company Kinsta API: `GET /domains` The table shows the name, ID and linked site of each zone, and whether it is active. Use it to find the zone name for the other commands. ## dns records list [Section titled “dns records list”](#dns-records-list) List the DNS records of a zone. ```sh kinstactl dns records list example.com ``` ```sh kinstactl dns records list [options] ``` List the DNS records of a zone #### Arguments | Argument | Description | | -------- | ------------------------------- | | `zone` | zone name or ID, see: dns zones | Kinsta API: `GET /domains`, `GET /domains/{domain_id}/dns-records` The table shows the type, name and TTL of each record, and its values. A record with several values, such as a round-robin `A` record, shows them comma-separated. ## dns records add [Section titled “dns records add”](#dns-records-add) Add a DNS record to a zone. ```sh kinstactl dns records add example.com A www --value 203.0.113.10 ``` ```sh kinstactl dns records add [options] ``` Add a DNS record to a zone #### Arguments | Argument | Description | | -------- | ---------------------------------- | | `zone` | zone name or ID, see: dns zones | | `type` | record type, e.g. A | | `name` | record name, e.g. www\.example.com | #### Options | Option | Description | | --------------------- | -------------------------------------------------------- | | `--value ` | record value; repeat the values for a round-robin record | | `--ttl ` | time to live in seconds, at least 300 | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /domains`, `POST /domains/{domain_id}/dns-records` `--value` is required; without it the command fails with a `USAGE` error, there is no prompt. Repeat the values after one `--value` to create a round-robin record, and set the TTL with `--ttl`: ```sh kinstactl dns records add example.com A @ --value 203.0.113.10 203.0.113.11 --ttl 600 ``` `--ttl` is in seconds, at least 300, which is also the default. ## dns records update [Section titled “dns records update”](#dns-records-update) Change the TTL or values of a DNS record. ```sh kinstactl dns records update example.com A www --ttl 600 ``` ```sh kinstactl dns records update [options] ``` Change the TTL or values of a DNS record #### Arguments | Argument | Description | | -------- | ---------------------------------- | | `zone` | zone name or ID, see: dns zones | | `type` | record type, e.g. A | | `name` | record name, e.g. www\.example.com | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--ttl ` | new time to live in seconds, at least 300 | | `--add ` | values to add to the record | | `--remove ` | values to remove from the record | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /domains`, `PUT /domains/{domain_id}/dns-records` Pass at least one of `--ttl`, `--add` and `--remove`; with none the command fails with `Nothing to change`. `--add` and `--remove` change the values of the record, each taking one or more values: ```sh kinstactl dns records update example.com A www --add 203.0.113.11 --remove 203.0.113.10 ``` ## dns records delete [Section titled “dns records delete”](#dns-records-delete) Delete a DNS record from a zone. ```sh kinstactl dns records delete example.com A www --yes ``` ```sh kinstactl dns records delete [options] ``` Delete a DNS record from a zone #### Arguments | Argument | Description | | -------- | ---------------------------------- | | `zone` | zone name or ID, see: dns zones | | `type` | record type, e.g. A | | `name` | record name, e.g. www\.example.com | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /domains`, `DELETE /domains/{domain_id}/dns-records` Deleting removes the record with all its values, 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 > List, add and remove the domains of an environment, change the primary domain and look up its DNS records. The `domains` commands manage the domains that point at an environment. To manage the DNS records of a zone hosted at Kinsta, see [dns](/commands/dns/). ```sh 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](/getting-started/sites-and-environments/). `domains add`, `domains remove` and `domains primary` wait for Kinsta to finish by default, and accept `--no-wait`, `--timeout ` and `--dry-run`; see [operations](/commands/operations/). Where a command takes a ``, you can give the domain name or its ID; a unique prefix of the name also works. ## domains list [Section titled “domains list”](#domains-list) List the domains of an environment. ```sh kinstactl domains list my-site --env staging ``` ```sh kinstactl 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 name or ID | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/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”](#domains-add) Add a domain to an environment. ```sh kinstactl domains add my-site example.com --env live ``` ```sh kinstactl domains add [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 name or ID | | `--with-www` | also add the www subdomain (requires --wildcard) | | `--wildcard` | also cover subdomains (clears is_wildcardless) | | `--setup-type ` | quick or avoid_downtime | | `--ssl-key ` | private key file of a custom SSL certificate | | `--ssl-cert ` | 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 ` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/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: ```sh 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”](#domains-remove) Remove a domain from an environment. ```sh kinstactl domains remove my-site example.com --env live --yes ``` ```sh kinstactl domains remove [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 name or ID | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. 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”](#domains-primary) Change the primary domain of an environment. ```sh kinstactl domains primary my-site example.com --env live ``` ```sh kinstactl domains primary [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 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 ` | 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. 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`. ```sh kinstactl domains primary my-site example.com --env live --search-replace --yes ``` ## domains verification [Section titled “domains verification”](#domains-verification) Show the DNS records that verify and point a domain. ```sh kinstactl domains verification my-site example.com --env live ``` ```sh kinstactl domains verification [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 name or ID | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/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`](/commands/dns/#dns-records-add). With `--json` you get the response as Kinsta returns it. # env > List, create, clone, push and delete the environments of a site. A site has a live environment and optionally one or more staging environments. The `env` commands manage those environments and move content between them. For actions on the whole site, see [sites](/commands/sites/). ```sh kinstactl env list my-site kinstactl env clone my-site dev --from live kinstactl env push my-site --from staging --to live ``` Commands that change an environment wait for Kinsta to finish by default, and accept `--no-wait`, `--timeout ` and `--dry-run`; see [operations](/commands/operations/). `--dry-run` prints the resolved target and the request that would be sent, and changes nothing. ## env list [Section titled “env list”](#env-list) List the environments of a site. ```sh kinstactl env list my-site ``` ```sh kinstactl env list [site] [options] ``` List the environments of a site #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | Kinsta API: `GET /sites`, `GET /sites/{site_id}/environments` Use it to find the names you pass to `--env` on other commands. ## env push [Section titled “env push”](#env-push) Push the database and/or files of one environment to another. ```sh kinstactl env push my-site --from staging --to live ``` ```sh kinstactl env push [site] [options] ``` Push the database and/or files of one environment to another #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--from ` | source environment | | `--to ` | target environment (gets overwritten) | | `--no-db` | do not push the database | | `--no-files` | do not push files | | `--no-search-replace` | do not run search and replace on the database | | `--path ` | push only these paths instead of all files | | `--dry-run` | print the resolved target and request; change nothing | | `--no-wait` | return the operation ID instead of waiting | | `--timeout ` | 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `PUT /sites/{site_id}/environments` `--to` is overwritten with the content of `--from`, so the command asks for confirmation first. On a terminal you answer a prompt. In a script, pass `--yes`, otherwise it fails with `CONFIRMATION_REQUIRED` (exit code 5). Without `--from` or `--to`, a terminal asks which environment you mean; in a script both are required, and they must be different environments. By default the database and all files are pushed, and a search and replace is run on the database. Narrow that down with the `--no-` options: ```sh kinstactl env push my-site --from staging --to live --no-db --path wp-content/themes --yes ``` * `--no-db` and `--no-files` skip one half of the push. Pushing neither is a `USAGE` error. * `--no-search-replace` skips that search and replace. * `--path` pushes only the given files or folders instead of all files, and cannot be combined with `--no-files`. ## env create [Section titled “env create”](#env-create) Create a new environment for a site. ```sh kinstactl env create my-site dev --admin-user admin --admin-email admin@example.com --admin-password - ``` ```sh kinstactl env create [options] ``` Create a new environment for a site #### Arguments | Argument | Description | | -------------- | ----------------------------------- | | `site` | site name, display name or ID | | `display-name` | display name of the new environment | #### Options | Option | Description | | ----------------------------- | -------------------------------------------------------- | | `--plain` | create an empty environment without WordPress | | `--premium` | create a premium staging environment | | `--admin-user ` | WordPress admin user name | | `--admin-email ` | WordPress admin email | | `--admin-password ` | "-" reads it from stdin; omitted on a TTY prompts for it | | `--title ` | site title (default: the display name) | | `--language <code>` | WordPress language | | `--multisite` | install WordPress as a multisite | | `--subdomain-multisite` | make the multisite use subdomains | | `--woocommerce` | install WooCommerce | | `--yoast` | install Yoast SEO | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/{site_id}/environments`, `POST /sites/{site_id}/environments/plain` By default the new environment gets a fresh WordPress install, so it needs the admin user, email and password, like [`sites create`](/commands/sites/#sites-create). Pass `--plain` for an empty environment without WordPress, and `--premium` for a premium staging environment. ## env clone [Section titled “env clone”](#env-clone) Clone an environment into a new environment of the same site. ```sh kinstactl env clone my-site dev --from live ``` ```sh kinstactl env clone <site> <display-name> [options] ``` Clone an environment into a new environment of the same site #### Arguments | Argument | Description | | -------------- | ----------------------------------- | | `site` | site name, display name or ID | | `display-name` | display name of the new environment | #### Options | Option | Description | | ---------------------- | ----------------------------------------------------- | | `--from <environment>` | environment to clone | | `--premium` | create a premium staging environment | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/{site_id}/environments/clone` This is the quickest way to get a staging copy of live. To clone into a new site instead of a new environment, use [`sites clone`](/commands/sites/#sites-clone). ## env delete [Section titled “env delete”](#env-delete) Delete an environment. ```sh kinstactl env delete my-site --env staging --confirm my-site ``` ```sh kinstactl env delete [site] [options] ``` Delete an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### 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) | | `--confirm <site-name>` | the site name, to confirm an irreversible action | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Danger Irreversible. Requires `--confirm <site-name>`, on a TTY and off it; `--yes` is not accepted. Kinsta API: `GET /sites`, `DELETE /sites/environments/{env_id}` Deleting an environment cannot be undone, so `--yes` is not accepted. Confirm by typing the site name when prompted, or pass it as `--confirm <site-name>` in a script. Run it with `--dry-run` first to check which environment is selected. ## env php-allocation [Section titled “env php-allocation”](#env-php-allocation) Change the PHP allocation of a premium staging environment. ```sh kinstactl env php-allocation my-site --env staging --threads 4 --memory 256 ``` ```sh kinstactl env php-allocation [site] [options] ``` Change the PHP allocation of a premium staging environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--threads <n>` | number of PHP threads | | `--memory <mb>` | memory per PHP thread in MB | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/change-environment-php-allocation` This is only for premium staging environments. The allocation of the live and the standard staging environment is changed per site with [`sites php-allocation`](/commands/sites/#sites-php-allocation). ## env webroot [Section titled “env webroot”](#env-webroot) Change the webroot subfolder of an environment. ```sh kinstactl env webroot my-site /public --env live ``` ```sh kinstactl env webroot <site> <subfolder> [options] ``` Change the webroot subfolder of an environment #### Arguments | Argument | Description | | ----------- | ------------------------------------ | | `site` | site name, display name or ID | | `subfolder` | webroot subfolder, e.g. /public or / | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--no-clear-cache` | do not clear all caches afterwards | | `--no-refresh` | do not refresh the plugin and theme inventory | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/change-webroot-subfolder` Use this when the site should be served from a subfolder such as `/public`. Pass `/` to serve from the root again. After the change kinstactl clears all caches and refreshes the plugin and theme inventory, unless you pass `--no-clear-cache` or `--no-refresh`. ## env files [Section titled “env files”](#env-files) Show the file tree of an environment. ```sh kinstactl env files my-site --env live ``` ```sh kinstactl env files [site] [options] ``` Show the file tree 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](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/file-list` Handy to check which paths exist before you use `--path` with `env push`. # logs > Read the error, access or cache log of an environment. `logs` prints the log of one environment straight to your terminal, so you can pipe it into `grep`, `less` or a file without opening MyKinsta. ```sh kinstactl logs my-site --env live kinstactl logs my-site access --env live --lines 200 --search wp-login ``` ## logs [Section titled “logs”](#logs) Read the error, access or cache log of an environment. ```sh kinstactl logs my-site access --env live --lines 200 --search wp-login ``` ```sh kinstactl logs <site> [type] [options] ``` Read the error, access or cache log of an environment #### Arguments | Argument | Description | | -------- | --------------------------------------------- | | `site` | site name, display name or ID | | `type` | log type Choices: `error`, `access`, `cache`. | #### Options | Option | Description | | --------------------- | ----------------------------------- | | `--env <environment>` | environment name or ID | | `--lines <n>` | number of lines (max 20000) | | `--search <text>` | only lines containing this text | | `--from <datetime>` | only lines from this date and time | | `--to <datetime>` | only lines up to this date and time | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites/environments/{env_id}/logs` The optional `type` argument is `error`, `access` or `cache` and defaults to `error`. `--lines` defaults to 1000 and accepts 1 to 20000. `--search` keeps only the lines that contain the text, and `--from` and `--to` limit the log to a window in time; Kinsta applies all of these filters, not kinstactl. Without `--env` the usual environment selection applies, see [Sites and environments](/getting-started/sites-and-environments/). The log is written to stdout as plain text, exactly as Kinsta returns it, with no table, colors or decoration, whether or not a terminal is attached. That makes it safe to pipe: ```sh kinstactl logs my-site access --env live --lines 5000 | grep " 500 " ``` With `--json` you get the complete API response instead of the bare text. # operations > Check on or wait for a long-running Kinsta operation by its ID. Many Kinsta actions, such as creating a site or pushing an environment, run in the background and return an operation ID. By default kinstactl waits for the operation to finish for you. The `operations` commands are for the other case: you started something with `--no-wait` and want to look at it or wait for it later. ```sh kinstactl cache clear my-site --env live --no-wait kinstactl operations get <operation-id> kinstactl operations wait <operation-id> ``` ## Operation IDs [Section titled “Operation IDs”](#operation-ids) Most commands that start an operation take `--no-wait` (commands that finish immediately, such as `ssh enable`, do not; `--help` lists the flags). It returns as soon as Kinsta has accepted the request. Without `--json` stdout gets a `Started …` line and the operation ID appears only in the `Follow with:` hint on stderr: ```text ✔ Started Clear cache Follow with: kinstactl operations wait 0e7b2d61-example ``` With `--json` stdout has the ID in the `operation_id` field, next to `status: "pending"`, so use `--json` when a script has to capture it. ## operations get [Section titled “operations get”](#operations-get) Show the current status of an operation. ```sh kinstactl operations get 0e7b2d61-example ``` ```sh kinstactl operations get <id> [options] ``` Show the current status of an operation #### Arguments | Argument | Description | | -------- | ------------ | | `id` | operation ID | Kinsta API: `GET /operations/{operation_id}` This asks Kinsta once and returns. It does not wait, so use it to peek at an operation that is still running. The status is `pending` or `completed`. An operation that Kinsta reports as failed makes the command exit with code 3, and an unknown ID fails with a `USAGE` error. ## operations wait [Section titled “operations wait”](#operations-wait) Wait until an operation has finished. ```sh kinstactl operations wait 0e7b2d61-example --timeout 10 ``` ```sh kinstactl operations wait <id> [options] ``` Wait until an operation has finished #### Arguments | Argument | Description | | -------- | ------------ | | `id` | operation ID | #### Options | Option | Description | | --------------------- | ---------------------------------------------------- | | `--timeout <minutes>` | give up waiting after this many minutes (default 30) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /operations/{operation_id}` The command polls the operation and prints a success line when it has completed. `--timeout` is in minutes and defaults to 30, the same as on every command that waits by itself. The exit code tells a script what happened: * `0`: the operation completed. * `3`: the operation failed (`OPERATION_FAILED`). * `4`: the timeout passed before the operation finished (`OPERATION_TIMEOUT`). The same codes apply to any command that waits for an operation without `--no-wait`. # php > Restart the PHP engine of an environment and show or change its PHP version. The `php` commands control the PHP engine of one environment. ```sh kinstactl php restart my-site --env live kinstactl php version my-site --env live kinstactl php version my-site 8.3 --env staging ``` Both commands act on one environment, so pass `--env` in scripts; see [Sites and environments](/getting-started/sites-and-environments/). Changes wait for Kinsta to finish by default, and accept `--no-wait`, `--timeout <minutes>` and `--dry-run`; see [operations](/commands/operations/). ## php restart [Section titled “php restart”](#php-restart) Restart the PHP engine of an environment. ```sh kinstactl php restart my-site --env live ``` ```sh kinstactl php restart [site] [options] ``` Restart the PHP engine of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `POST /sites/tools/restart-php` Restarting PHP drops the running PHP processes, for example to pick up a changed setting or to recover from stuck workers. It does not ask for confirmation. To change the number of PHP threads or the memory per thread instead, see [`sites php-allocation`](/commands/sites/#sites-php-allocation). ## php version [Section titled “php version”](#php-version) Show the PHP version of an environment, or change it. ```sh kinstactl php version my-site 8.3 --env staging ``` ```sh kinstactl php version <site> [version] [options] ``` Show the PHP version of an environment, or change it #### Arguments | Argument | Description | | --------- | ---------------------------------- | | `site` | site name, display name or ID | | `version` | PHP version to switch to, e.g. 8.3 | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--no-auto-update` | opt out of automatic PHP updates | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites/{site_id}/environments`, `PUT /sites/tools/modify-php-version` Without a `version`, the command prints the current PHP version of the environment, in the same form (`8.3`) that you pass to change it: ```sh kinstactl php version my-site --env live ``` With a `version`, the environment is switched to it. `--no-auto-update` opts the environment out of automatic PHP updates, and only makes sense together with a version: without one it fails with a `USAGE` error. Try a new version on a staging environment first, and use `--dry-run` to check the request. # plugins > List the plugins of an environment and update one or all of them. The `plugins` commands show the WordPress plugins of one environment and update them through Kinsta. The [themes](/commands/themes/) commands work the same way. To look across all sites of the company, see `kinstactl company plugins`. ```sh kinstactl plugins list my-site --env live kinstactl plugins list my-site --env live --updates kinstactl plugins update my-site --all --env live ``` ## plugins list [Section titled “plugins list”](#plugins-list) List the plugins of an environment. ```sh kinstactl plugins list my-site --env live --updates ``` ```sh kinstactl plugins list [site] [options] ``` List the plugins of an environment #### Arguments | Argument | Description | | -------- | --------------- | | `site` | site name or ID | #### Options | Option | Description | | ------------- | ------------------------------------- | | `--env <env>` | environment name or ID | | `--updates` | only plugins with an update available | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites/environments/{env_id}/wp-plugins` The table shows each plugin with its status, version, the version it can be updated to and whether the installed version is known to be vulnerable. `--updates` keeps only the plugins with an update available. ## plugins update [Section titled “plugins update”](#plugins-update) Update one plugin, or all plugins with an update. ```sh kinstactl plugins update my-site akismet --env live ``` ```sh kinstactl plugins update <site> [name] [options] ``` Update one plugin, or all plugins with an update #### Arguments | Argument | Description | | -------- | --------------- | | `site` | site name or ID | | `name` | plugin name | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <env>` | environment name or ID | | `--all` | update every plugin that has an update | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites/environments/{env_id}/wp-plugins`, `PUT /sites/environments/{env_id}/plugins`, `PUT /sites/environments/{env_id}/plugins/bulk-update` Pass either a plugin `name` as shown by `plugins list`, or `--all`, not both and not neither; both mistakes are `USAGE` errors. A plugin that is not installed or already up to date also fails with a `USAGE` error, while `--all` with nothing to update just reports that all plugins are up to date. Updates are not destructive and need no confirmation, but they do change a running site. Check what would be sent first with `--dry-run`: ```sh kinstactl plugins update my-site --all --env live --dry-run ``` Updating waits for Kinsta to finish by default, and accepts `--no-wait` and `--timeout <minutes>`; see [operations](/commands/operations/). # search-replace > Search and replace text in the database of an environment, as a dry run first. `search-replace` replaces text in the database of an environment, for example after moving a site to a new domain. It reports what would change unless you pass `--apply`. ```sh kinstactl search-replace my-site http://old.example https://new.example --env live kinstactl search-replace my-site http://old.example https://new.example --env live --apply --clear-cache --yes ``` ## search-replace [Section titled “search-replace”](#search-replace) Search and replace in the database. ```sh kinstactl search-replace my-site http://old.example https://new.example --env live ``` ```sh kinstactl search-replace <site> <search> <replace> [options] ``` Search and replace in the database (dry run unless --apply) #### Arguments | Argument | Description | | --------- | ----------------------------- | | `site` | site name, display name or ID | | `search` | text to search for | | `replace` | replacement text | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--apply` | perform the replacement instead of reporting matches | | `--clear-cache` | clear the cache after the replacement | | `--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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `POST /sites/tools/search-and-replace` Without `--apply` the replacement is not performed: Kinsta only reports the matches, and the command asks for no confirmation. Run it this way first and check the result. Add `--apply` to make the change. That changes content, so the command then asks for confirmation. On a terminal you answer a prompt; in a script pass `--yes`, otherwise it fails with `CONFIRMATION_REQUIRED` (exit code 5). ```sh kinstactl search-replace my-site http://old.example https://new.example --env live --apply --yes ``` `--clear-cache` clears the cache after the replacement. Take a [backup](/commands/backups/) before you apply. `--dry-run` is not the same as leaving out `--apply`: the default report is still a request to Kinsta, while `--dry-run` only prints the request that would be sent and sends nothing at all. 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](/getting-started/sites-and-environments/). The command waits for Kinsta to finish, and accepts `--no-wait` and `--timeout <minutes>`; see [operations](/commands/operations/). The report from Kinsta is the result of the operation and is what is printed on stdout. With `--json` you get one document with `operation_id`, `status`, `message` and `data`. With `--no-wait` the command returns right after the request is accepted: in human mode the operation ID appears only in the `Follow with:` hint on stderr, and with `--json` it is `operation_id` on stdout. # security > Force HTTPS, bot protection, denied IPs and redirect rules of an environment. The `security` commands show and change the security settings of an environment: how HTTPS is forced, bot protection, the list of denied IP addresses and the redirect rules. ```sh kinstactl security force-https my-site --env live kinstactl security bot-protection level my-site challenge-bots --env live kinstactl security redirects add my-site /old /new --env live ``` 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](/getting-started/sites-and-environments/). Commands that change something accept `--dry-run`, which prints the request and sends nothing; a dry run needs no confirmation. Commands marked below as asking for confirmation prompt on a terminal; in a script pass `--yes`, otherwise they fail with `CONFIRMATION_REQUIRED` (exit code 5). `--no-wait` and `--timeout <minutes>` exist on `force-https`, on the three `bot-protection` settings and on `bot-protection exceptions add` and `delete`; see [operations](/commands/operations/). The `denied-ips` and `redirects` commands have neither flag. ## security force-https [Section titled “security force-https”](#security-force-https) Show or change how an environment forces HTTPS. ```sh kinstactl security force-https my-site primary --env live ``` ```sh kinstactl security force-https <site> [mode] [options] ``` Show or change how an environment forces HTTPS (all, primary, off) #### Arguments | Argument | Description | | -------- | ------------------------------------------------------------------------------------------------------------------------------ | | `site` | site name, display name or ID | | `mode` | all: redirect every domain, primary: redirect to the primary domain, off: do not force HTTPS Choices: `all`, `primary`, `off`. | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/force-https-status`, `POST /sites/environments/{env_id}/force-https-status` Without a mode the command prints the current one. The mode is one of `all` (redirect every domain to HTTPS), `primary` (redirect to the primary domain) or `off` (do not force HTTPS). Changing it asks for no confirmation and waits for Kinsta to finish. ## security bot-protection level [Section titled “security bot-protection level”](#security-bot-protection-level) Show or set the bot protection level. ```sh kinstactl security bot-protection level my-site challenge-bots --env live ``` ```sh kinstactl security bot-protection level <site> [value] [options] ``` Show or set the bot protection level of an environment #### Arguments | Argument | Description | | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- | | `site` | site name, display name or ID | | `value` | new value; omit to show the current one Choices: `block-malicious-traffic`, `block-automations`, `challenge-bots`, `challenge-everyone`. | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/bot-protection/level`, `PUT /sites/environments/{env_id}/bot-protection/level` Without a value the command prints the current level, or `(not configured)` when the environment has no bot protection. The level is one of `block-malicious-traffic`, `block-automations`, `challenge-bots` or `challenge-everyone`. Setting it asks for no confirmation. ## security bot-protection ai-crawlers [Section titled “security bot-protection ai-crawlers”](#security-bot-protection-ai-crawlers) Show or set whether AI crawlers are blocked. ```sh kinstactl security bot-protection ai-crawlers my-site block --env live ``` ```sh kinstactl security bot-protection ai-crawlers <site> [value] [options] ``` Show or set whether AI crawlers are blocked #### Arguments | Argument | Description | | -------- | ------------------------------------------------------------------ | | `site` | site name, display name or ID | | `value` | new value; omit to show the current one Choices: `block`, `allow`. | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/bot-protection/ai-crawlers`, `PUT /sites/environments/{env_id}/bot-protection/ai-crawlers` The value is `block` or `allow`. Without a value the command prints the current one, or `(not configured)`. ## security bot-protection wp-automations [Section titled “security bot-protection wp-automations”](#security-bot-protection-wp-automations) Show or set whether WordPress automations are allowed. ```sh kinstactl security bot-protection wp-automations my-site allow --env live ``` ```sh kinstactl security bot-protection wp-automations <site> [value] [options] ``` Show or set whether WordPress automations are allowed #### Arguments | Argument | Description | | -------- | ------------------------------------------------------------------ | | `site` | site name, display name or ID | | `value` | new value; omit to show the current one Choices: `allow`, `block`. | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/bot-protection/wp-automations`, `PUT /sites/environments/{env_id}/bot-protection/wp-automations` The value is `allow` or `block`. Without a value the command prints the current one, or `(not configured)`. ## security bot-protection exceptions list [Section titled “security bot-protection exceptions list”](#security-bot-protection-exceptions-list) List the bot protection exception rules. ```sh kinstactl security bot-protection exceptions list my-site --env live ``` ```sh kinstactl security bot-protection exceptions list [site] [options] ``` List the bot protection exception rules 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](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/bot-protection/exception-rules` The table shows the ID, type, action and value of each rule. When the environment also has custom WAF rules, the command adds a line about that on stderr. The ID is what `exceptions delete` expects, and has the form `type:action:value`, for example `ip:skip:192.0.2.1`. ## security bot-protection exceptions add [Section titled “security bot-protection exceptions add”](#security-bot-protection-exceptions-add) Add a bot protection exception rule. ```sh kinstactl security bot-protection exceptions add my-site ip skip 192.0.2.1 --env live ``` ```sh kinstactl security bot-protection exceptions add <site> <type> <action> <value> [options] ``` Add a bot protection exception rule #### Arguments | Argument | Description | | -------- | ------------------------------------------------------------------------ | | `site` | site name, display name or ID | | `type` | what the rule matches on Choices: `ip`, `path`, `user_agent`, `country`. | | `action` | what to do with matching traffic Choices: `skip`, `challenge`, `block`. | | `value` | the value to match, e.g. an IP address | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/bot-protection/exception-rules` A rule has a type (`ip`, `path`, `user_agent` or `country`), an action (`skip`, `challenge` or `block`) and the value to match, such as an IP address or a country code. Adding needs no confirmation. ## security bot-protection exceptions delete [Section titled “security bot-protection exceptions delete”](#security-bot-protection-exceptions-delete) Delete a bot protection exception rule. ```sh kinstactl security bot-protection exceptions delete my-site ip:skip:192.0.2.1 --env live --yes ``` ```sh kinstactl security bot-protection exceptions delete <site> <rule-id> [options] ``` Delete a bot protection exception rule #### Arguments | Argument | Description | | --------- | ----------------------------------------------------- | | `site` | site name, display name or ID | | `rule-id` | rule ID, see: security bot-protection exceptions 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `DELETE /sites/environments/{env_id}/bot-protection/exception-rules` The rule is identified by its ID, as shown by `exceptions list`. The command asks for confirmation; in a script pass `--yes`. ## security denied-ips [Section titled “security denied-ips”](#security-denied-ips) Show or change the denied IP addresses of an environment. ```sh kinstactl security denied-ips my-site --env live ``` ```sh kinstactl security denied-ips [site] [options] ``` Show or change the denied IPs of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--add <ip...>` | IP addresses to deny | | `--remove <ip...>` | IP addresses to allow again | | `--clear` | remove every denied IP | | `--dry-run` | print the resolved target and request; change nothing | | `--yes` | skip the confirmation prompt | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `GET /sites/tools/denied-ips`, `PUT /sites/tools/denied-ips` Without `--add`, `--remove` or `--clear` the command prints the current list, one address per line. `--add` and `--remove` take one or more addresses; `--clear` empties the list: ```sh kinstactl security denied-ips my-site --env live --add 203.0.113.7 --yes kinstactl security denied-ips my-site --env live --remove 203.0.113.7 203.0.113.8 --yes kinstactl security denied-ips my-site --env live --clear --yes ``` Kinsta only accepts the complete list, so the command reads the current list, applies your change and sends the result, replacing the whole list. Every change therefore asks for confirmation; in a script pass `--yes`. The command fails with a `USAGE` error if you add an address that is already present, repeat one in `--add`, give the same address to `--add` and `--remove`, remove an address that is not in the list, or combine `--clear` with `--add` or `--remove`. ## security redirects list [Section titled “security redirects list”](#security-redirects-list) List the redirect rules of an environment. ```sh kinstactl security redirects list my-site --env live --search /blog --sort from --desc ``` ```sh kinstactl security redirects list [site] [options] ``` List the redirect rules of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ------------------------------ | | `--env <environment>` | environment name or ID | | `--limit <n>` | number of rules to show | | `--offset <n>` | number of rules to skip | | `--search <text>` | only rules matching this text | | `--regex` | treat --search as a regex | | `--sort <key>` | sort by domain, from, to, type | | `--desc` | sort descending | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/redirect-rules` The table shows the from path, the target, the type and the domain (`(all)` for a rule that applies to every domain). The command shows 10 rules by default; page through the rest with `--limit` and `--offset`. A line such as `10 of 42 rules` goes to stderr. `--search` keeps rules matching a text, or a regular expression with `--regex`. `--sort` takes `domain`, `from`, `to` or `type`, and `--desc` reverses the order. ## security redirects add [Section titled “security redirects add”](#security-redirects-add) Add a redirect rule. ```sh kinstactl security redirects add my-site /old /new --env live ``` ```sh kinstactl security redirects add <site> <from> <to> [options] ``` Add a redirect rule #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | | `from` | path to redirect from | | `to` | path or URL to redirect to | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--type <type>` | permanent (301) or redirect (302) | | `--domain <domain>` | only redirect this domain (default: all domains) | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/redirect-rules` The rule redirects the path `from` to a path or URL `to`. `--type` is `permanent` (301, the default) or `redirect` (302). Without `--domain` the rule applies to every domain. Adding needs no confirmation. ```sh kinstactl security redirects add my-site /old https://example.com/new --env live --type redirect --domain example.com ``` ## security redirects update [Section titled “security redirects update”](#security-redirects-update) Change a redirect rule. ```sh kinstactl security redirects update my-site /old --env live --to /newer --yes ``` ```sh kinstactl security redirects update <site> <from> [options] ``` Change a redirect rule #### Arguments | Argument | Description | | -------- | ----------------------------------- | | `site` | site name, display name or ID | | `from` | the from path of the rule to change | #### Options | Option | Description | | ----------------------- | ------------------------------------------------------ | | `--env <environment>` | environment name or ID | | `--to <to>` | new target path or URL | | `--type <type>` | new type: permanent (301) or redirect (302) | | `--domain <domain>` | select the rule of this domain when several share from | | `--new-domain <domain>` | move the rule to this domain | | `--dry-run` | print the resolved target and request; change nothing | | `--yes` | skip the confirmation prompt | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/redirect-rules`, `POST /sites/environments/{env_id}/redirect-rules` The rule is found by its from path. Pass at least one of `--to`, `--type` or `--new-domain`, otherwise the command fails with a `USAGE` error. When several rules share the same from path, the command fails and lists their domains; pick one with `--domain`. Updating asks for confirmation; in a script pass `--yes`. ## security redirects delete [Section titled “security redirects delete”](#security-redirects-delete) Delete a redirect rule, or all of them. ```sh kinstactl security redirects delete my-site /old --env live --yes ``` ```sh kinstactl security redirects delete <site> [from] [options] ``` Delete a redirect rule, or all of them #### Arguments | Argument | Description | | -------- | ----------------------------------- | | `site` | site name, display name or ID | | `from` | the from path of the rule to delete | #### Options | Option | Description | | --------------------- | ------------------------------------------------------ | | `--env <environment>` | environment name or ID | | `--domain <domain>` | select the rule of this domain when several share from | | `--all` | delete every redirect rule | | `--dry-run` | print the resolved target and request; change nothing | | `--yes` | skip the confirmation prompt | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/redirect-rules`, `POST /sites/environments/{env_id}/redirect-rules` Pass either the from path of one rule or `--all`, not both and not neither. `--domain` picks the rule when several share the from path, and cannot be combined with `--all`. Deleting asks for confirmation; in a script pass `--yes`. ```sh kinstactl security redirects delete my-site --env live --all --yes ``` # sftp-users > Manage the additional SFTP accounts of an environment. An environment can have additional SFTP accounts next to its main SSH and SFTP login, for example one per developer or one limited to the uploads folder. The `sftp-users` commands manage them. For the main login, see [ssh](/commands/ssh/). ```sh kinstactl sftp-users list my-site --env live kinstactl sftp-users add my-site deploy --env live --permission write kinstactl sftp-users delete my-site deploy --env live --yes ``` 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](/getting-started/sites-and-environments/). Commands that change something wait for Kinsta to finish by default, and accept `--no-wait`, `--timeout <minutes>` and `--dry-run`; see [operations](/commands/operations/). ## sftp-users list [Section titled “sftp-users list”](#sftp-users-list) List the additional SFTP accounts of an environment. ```sh kinstactl sftp-users list my-site --env staging ``` ```sh kinstactl sftp-users list [site] [options] ``` List the additional SFTP accounts 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](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/{site_id}/environments`, `GET /sites/environments/{env_id}/additional-sftp-accounts` The table shows the username, root directory, permission and ID of each account, and whether it is active. Below it, the command reports whether additional accounts are enabled for the environment and on which port. ## sftp-users add [Section titled “sftp-users add”](#sftp-users-add) Add an additional SFTP account to an environment. ```sh kinstactl sftp-users add my-site deploy --env live --permission write ``` ```sh kinstactl sftp-users add <site> <username> [options] ``` Add an additional SFTP account to an environment #### Arguments | Argument | Description | | ---------- | -------------------------------- | | `site` | site name, display name or ID | | `username` | username of the new SFTP account | #### Options | Option | Description | | ---------------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--password <password>` | "-" reads it from stdin; omitted on a TTY prompts | | `--root-directory <path>` | directory the account is restricted to | | `--permission <read\|write>` | access level of the account | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/additional-sftp-accounts` The account needs a password. On a terminal you are prompted for it, with hidden input. In a script there is no prompt, so pass `--password <value>`, or `--password -` to read it from stdin, which keeps it out of your shell history and the process list: ```sh cat password.txt | kinstactl sftp-users add my-site deploy --env live --password - --permission write ``` Without a password the command fails with a `USAGE` error. The password is never echoed back: `--dry-run` shows the request with it masked as `***`. `--permission` takes `read` or `write`. `--root-directory` restricts the account to a directory: ```sh cat password.txt | kinstactl sftp-users add my-site reader --env live --password - --root-directory /wp-content/uploads --permission read --dry-run ``` ## sftp-users enable [Section titled “sftp-users enable”](#sftp-users-enable) Enable the additional SFTP accounts of an environment. ```sh kinstactl sftp-users enable my-site --env live ``` ```sh kinstactl sftp-users enable [site] [options] ``` Enable the additional SFTP accounts of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `PUT /sites/environments/{env_id}/additional-sftp-accounts/toggle-status` This switches the feature on for the whole environment, not a single account. It needs no confirmation. ## sftp-users disable [Section titled “sftp-users disable”](#sftp-users-disable) Disable the additional SFTP accounts of an environment. ```sh kinstactl sftp-users disable my-site --env live ``` ```sh kinstactl sftp-users disable [site] [options] ``` Disable the additional SFTP accounts of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### 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) | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `PUT /sites/environments/{env_id}/additional-sftp-accounts/toggle-status` The accounts are kept, but they cannot log in until you run `sftp-users enable`. It needs no confirmation. ## sftp-users delete [Section titled “sftp-users delete”](#sftp-users-delete) Delete an additional SFTP account. ```sh kinstactl sftp-users delete my-site deploy --env live --yes ``` ```sh kinstactl sftp-users delete <site> <username> [options] ``` Delete an additional SFTP account #### Arguments | Argument | Description | | ---------- | -------------------------------------------------- | | `site` | site name, display name or ID | | `username` | username of the SFTP account, see: sftp-users 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/additional-sftp-accounts`, `DELETE /sites/environments/additional-sftp-accounts/{sftp_account_id}` The account is looked up by username, ignoring case, so a typo fails with the list of usernames the environment has. Deleting 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). # sites > List, create, clone, reset and delete Kinsta sites, and read their usage. The `sites` commands manage whole sites, that is a site with all its environments. For one environment of a site, see [env](/commands/env/). ```sh kinstactl sites list kinstactl sites get my-site kinstactl sites create "My Site" --region europe-west4 --plain ``` Creating, cloning, resetting, deleting and changing the PHP allocation of a site are long operations. Each of them waits for Kinsta to finish by default, and accepts `--no-wait`, `--timeout <minutes>` and `--dry-run`; see [operations](/commands/operations/). `--dry-run` prints the resolved site and the request that would be sent, and changes nothing. ## sites list [Section titled “sites list”](#sites-list) List the sites of the company. ```sh kinstactl sites list --refresh ``` ```sh kinstactl sites list [options] ``` List the sites of the company #### Options | Option | Description | | ----------- | --------------------------- | | `--refresh` | bypass the local site cache | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites` kinstactl caches the list of sites for five minutes to resolve site names quickly, see [Sites and environments](/getting-started/sites-and-environments/). Use `--refresh` after you created or removed a site in MyKinsta and the list is out of date. ## sites get [Section titled “sites get”](#sites-get) Show the details of a site. ```sh kinstactl sites get my-site ``` ```sh kinstactl sites get [site] [options] ``` Show the details of a site #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | Kinsta API: `GET /sites`, `GET /sites/{site_id}` Without `<site>`, a command on a terminal shows a picker. Add `--json` for the full API response. ## sites create [Section titled “sites create”](#sites-create) Create a new site. ```sh kinstactl sites create "My Site" --region europe-west4 --admin-user admin --admin-email admin@example.com --admin-password - ``` ```sh kinstactl sites create <display-name> [options] ``` Create a new site #### Arguments | Argument | Description | | -------------- | ---------------------------- | | `display-name` | display name of the new site | #### Options | Option | Description | | ----------------------------- | -------------------------------------------------------------------- | | `--region <region>` | Kinsta region, see: company regions; omitted on a TTY opens a picker | | `--plain` | create an empty environment without WordPress | | `--admin-user <name>` | WordPress admin user name | | `--admin-email <email>` | WordPress admin email | | `--admin-password <password>` | "-" reads it from stdin; omitted on a TTY prompts for it | | `--title <title>` | site title (default: the display name) | | `--language <code>` | WordPress language | | `--multisite` | install WordPress as a multisite | | `--subdomain-multisite` | make the multisite use subdomains | | `--woocommerce` | install WooCommerce | | `--yoast` | install Yoast SEO | | `--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](/scripting-and-ci/). Kinsta API: `GET /company/{id}/available-regions`, `POST /sites`, `POST /sites/plain` By default the new site gets a WordPress install, which needs the admin user, email and password. Pass `--plain` for an empty environment without WordPress; the WordPress options (`--admin-user`, `--title`, `--multisite`, `--woocommerce`, `--yoast` and so on) are for the default install. `--admin-password -` reads the password from stdin, so it stays out of your shell history. On a terminal, a missing region or password is asked for interactively. ```sh kinstactl sites create "My Site" --region europe-west4 --plain ``` Run `kinstactl company regions` to see the region IDs. ## sites clone [Section titled “sites clone”](#sites-clone) Clone an environment of a site into a new site. ```sh kinstactl sites clone my-site "My Other Site" --env live ``` ```sh kinstactl sites clone <site> <display-name> [options] ``` Clone an environment of a site into a new site #### Arguments | Argument | Description | | -------------- | ----------------------------- | | `site` | site name, display name or ID | | `display-name` | display name of the new site | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment to clone (default: the only one) | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/clone` The new site gets a copy of the chosen environment. Without `--env`, the site’s only environment is used. ## sites delete [Section titled “sites delete”](#sites-delete) Delete a site with all its environments. ```sh kinstactl sites delete my-site --confirm my-site ``` ```sh kinstactl sites delete [site] [options] ``` Delete a site with all its environments #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | ----------------------- | ----------------------------------------------------- | | `--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) | | `--confirm <site-name>` | the site name, to confirm an irreversible action | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Danger Irreversible. Requires `--confirm <site-name>`, on a TTY and off it; `--yes` is not accepted. Kinsta API: `GET /sites`, `DELETE /sites/{site_id}` Deleting a site cannot be undone, so `--yes` is not accepted here. You confirm by typing the site name when prompted, or by passing it as `--confirm <site-name>`, which is the way to do it in a script. A name that does not match fails with `CONFIRMATION_REQUIRED` (exit code 5), and so does a script that passes no `--confirm`. Run it with `--dry-run` first to see what would be deleted. ## sites reset [Section titled “sites reset”](#sites-reset) Reset a site to a fresh WordPress install, in all environments. ```sh kinstactl sites reset my-site --admin-password - --confirm my-site ``` ```sh kinstactl sites reset [site] [options] ``` Reset a site to a fresh WordPress install (all environments) #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | ----------------------------- | -------------------------------------------------------- | | `--admin-password <password>` | "-" reads it from stdin; omitted on a TTY prompts for it | | `--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) | | `--confirm <site-name>` | the site name, to confirm an irreversible action | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Danger Irreversible. Requires `--confirm <site-name>`, on a TTY and off it; `--yes` is not accepted. Kinsta API: `GET /sites`, `POST /sites/{site_id}/reset-site` Everything on the site is replaced by a clean WordPress install, in every environment. This cannot be undone either, so the same `--confirm <site-name>` rule as for `sites delete` applies. The admin password for the new install is read from stdin with `-`, or prompted for on a terminal. ## sites php-allocation [Section titled “sites php-allocation”](#sites-php-allocation) Change the PHP allocation of the live and standard staging environments. ```sh kinstactl sites php-allocation my-site --threads 4 --memory 256 ``` ```sh kinstactl sites php-allocation [site] [options] ``` Change the PHP allocation of the live and standard staging environments #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--threads <n>` | number of PHP threads | | `--memory <mb>` | memory per PHP thread in MB | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/{site_id}/change-site-php-allocation` `--threads` sets the number of PHP threads and `--memory` the memory per thread in MB. The change applies to the live environment and the standard staging environment of the site. For a premium staging environment, use [`env php-allocation`](/commands/env/#env-php-allocation). ## sites usage [Section titled “sites usage”](#sites-usage) Show the visits, bandwidth and CDN bandwidth of a site this month. ```sh kinstactl sites usage my-site ``` ```sh kinstactl sites usage [site] [options] ``` Visits, bandwidth and CDN bandwidth of a site this month #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | Kinsta API: `GET /sites`, `GET /sites/{site_id}/usage/visits/this-month`, `GET /sites/{site_id}/usage/bandwidth/this-month`, `GET /sites/{site_id}/usage/cdn-bandwidth/this-month` The numbers are for the current month. Use `--json` to feed them into a report. # ssh > Turn SSH and SFTP access on and off, show the connection details, manage the IP allowlist and the SSH password. The `ssh` commands control SSH and SFTP access to an environment. For extra SFTP accounts with their own credentials, see [sftp-users](/commands/sftp-users/). ```sh kinstactl ssh status my-site --env live kinstactl ssh config my-site --env live kinstactl ssh password get my-site --env live ``` 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](/getting-started/sites-and-environments/). Commands that change something accept `--dry-run`, which prints the request and sends nothing. The `--no-wait` and `--timeout` flags of [operations](/commands/operations/) do not exist here. ## ssh status [Section titled “ssh status”](#ssh-status) Show whether SSH and SFTP access is enabled. ```sh kinstactl ssh status my-site --env live ``` ```sh kinstactl ssh status [site] [options] ``` Show whether SSH and SFTP access is enabled #### 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](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/ssh/get-status` The command prints `enabled` or `disabled`. With `--json` it prints `site`, `environment` and `is_ssh_enabled`. ## ssh enable [Section titled “ssh enable”](#ssh-enable) Enable SSH and SFTP access of an environment. ```sh kinstactl ssh enable my-site --env live ``` ```sh kinstactl ssh enable [site] [options] ``` Enable SSH and SFTP access of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/ssh/set-status` Enabling needs no confirmation. On success the command prints `SSH enabled`. ## ssh disable [Section titled “ssh disable”](#ssh-disable) Disable SSH and SFTP access of an environment. ```sh kinstactl ssh disable my-site --env live ``` ```sh kinstactl ssh disable [site] [options] ``` Disable SSH and SFTP access of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/ssh/set-status` Disabling asks for no confirmation either. On success the command prints `SSH disabled`. ## ssh config [Section titled “ssh config”](#ssh-config) Show the SSH and SFTP connection details. ```sh kinstactl ssh config my-site --env live ``` ```sh kinstactl ssh config [site] [options] ``` Show the SSH/SFTP connection details #### 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](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/{site_id}/environments/{env_id}/ssh/config` The command prints the host, port and user, followed by a ready-to-run command line of the form `ssh <user>@<host> -p <port>`. It does not print a `~/.ssh/config` block, and no password. With `--json` you get `host`, `port`, `user` and `ssh_command`. If the environment has no connection details, the command fails with `API_ERROR`. ## ssh allowlist [Section titled “ssh allowlist”](#ssh-allowlist) Show or change the IP allowlist for SSH and SFTP access. ```sh kinstactl ssh allowlist my-site --env live ``` ```sh kinstactl ssh allowlist [site] [options] ``` Show or change the IP allowlist for SSH and SFTP access #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--add <ip...>` | IP addresses to add | | `--remove <ip...>` | IP addresses to remove | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/ssh/get-allowed-ips`, `POST /sites/environments/{env_id}/ssh/set-allowed-ips` Without `--add` or `--remove` the command prints the current allowlist, one address per line. `--add` and `--remove` take one or more addresses and change the list: ```sh kinstactl ssh allowlist my-site --env live --add 203.0.113.7 kinstactl ssh allowlist my-site --env live --remove 203.0.113.7 203.0.113.8 ``` The command checks the change against the current list before sending it. It fails with a `USAGE` error if you add an address that is already present, repeat one in `--add`, give the same address to `--add` and `--remove`, or remove an address that is not in the list. There is no option to clear the whole list; remove the addresses one by one. Changes need no confirmation. ## ssh password get [Section titled “ssh password get”](#ssh-password-get) Print the SSH and SFTP password of an environment. ```sh kinstactl ssh password get my-site --env live ``` ```sh kinstactl ssh password get [site] [options] ``` Print the SSH/SFTP password 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](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/ssh/password` The password is the only thing printed on stdout, so it can be captured in a script. With `--json` it is the field `sftp_password`. This is the only `ssh` command that prints a secret. ## ssh password generate [Section titled “ssh password generate”](#ssh-password-generate) Generate a new SSH and SFTP password. ```sh kinstactl ssh password generate my-site --env live ``` ```sh kinstactl ssh password generate [site] [options] ``` Generate a new SSH/SFTP password #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/ssh/generate-password` The new password replaces the old one, and is not printed. The command prints a message that tells you to run `ssh password get` to read it. ## ssh password enable [Section titled “ssh password enable”](#ssh-password-enable) Enable SSH and SFTP password login. ```sh kinstactl ssh password enable my-site --env live ``` ```sh kinstactl ssh password enable [site] [options] ``` Enable SSH/SFTP password login of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/ssh/set-password-status` On success the command prints `SSH password login enabled`. ## ssh password disable [Section titled “ssh password disable”](#ssh-password-disable) Disable SSH and SFTP password login. ```sh kinstactl ssh password disable my-site --env live ``` ```sh kinstactl ssh password disable [site] [options] ``` Disable SSH/SFTP password login of an environment #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/ssh/set-password-status` On success the command prints `SSH password login disabled`. Neither this command nor `ssh password enable` asks for confirmation. ## ssh password expiration [Section titled “ssh password expiration”](#ssh-password-expiration) Set how long the SSH and SFTP password stays valid. ```sh kinstactl ssh password expiration my-site 7d --env live ``` ```sh kinstactl ssh password expiration <site> <interval> [options] ``` Set how long the SSH/SFTP password stays valid #### Arguments | Argument | Description | | ---------- | --------------------------------------------------------------------- | | `site` | site name, display name or ID | | `interval` | validity of the password Choices: `24h`, `7d`, `30d`, `90d`, `never`. | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/ssh/change-expiration-interval` The interval is a required argument after the site, and one of `24h`, `7d`, `30d`, `90d` or `never`. On success the command prints `Password expiration set to <interval>`. # themes > List the themes of an environment and update one or all of them. The `themes` commands show the WordPress themes of one environment and update them through Kinsta. They work exactly like the [plugins](/commands/plugins/) commands. To look across all sites of the company, see `kinstactl company themes`. ```sh kinstactl themes list my-site --env live kinstactl themes list my-site --env live --updates kinstactl themes update my-site --all --env live ``` ## themes list [Section titled “themes list”](#themes-list) List the themes of an environment. ```sh kinstactl themes list my-site --env live --updates ``` ```sh kinstactl themes list [site] [options] ``` List the themes of an environment #### Arguments | Argument | Description | | -------- | --------------- | | `site` | site name or ID | #### Options | Option | Description | | ------------- | ------------------------------------ | | `--env <env>` | environment name or ID | | `--updates` | only themes with an update available | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites/environments/{env_id}/wp-themes` The table shows each theme with its status, version, the version it can be updated to and whether the installed version is known to be vulnerable. `--updates` keeps only the themes with an update available. ## themes update [Section titled “themes update”](#themes-update) Update one theme, or all themes with an update. ```sh kinstactl themes update my-site twentytwentyfour --env live ``` ```sh kinstactl themes update <site> [name] [options] ``` Update one theme, or all themes with an update #### Arguments | Argument | Description | | -------- | --------------- | | `site` | site name or ID | | `name` | theme name | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <env>` | environment name or ID | | `--all` | update every theme that has an update | | `--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](/scripting-and-ci/). Kinsta API: `GET /sites/environments/{env_id}/wp-themes`, `PUT /sites/environments/{env_id}/themes`, `PUT /sites/environments/{env_id}/themes/bulk-update` Pass either a theme `name` as shown by `themes list`, or `--all`, not both and not neither; both mistakes are `USAGE` errors. A theme that is not installed or already up to date also fails with a `USAGE` error, while `--all` with nothing to update just reports that all themes are up to date. Updates are not destructive and need no confirmation, but they do change a running site. Check what would be sent first with `--dry-run`: ```sh kinstactl themes update my-site --all --env live --dry-run ``` Updating waits for Kinsta to finish by default, and accepts `--no-wait` and `--timeout <minutes>`; see [operations](/commands/operations/). # wp > Run WP-CLI commands, create one-time admin login links and manage WordPress admin users. The `wp` commands act on the WordPress installation of an environment: run a WP-CLI command, get a one-time login link, and create or look up admin users. For the database, see [db](/commands/db/). ```sh kinstactl wp run my-site "wp plugin list" --env live --yes kinstactl wp login my-site --env live --email admin@example.com kinstactl wp user exists my-site ann@example.com --env live ``` 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](/getting-started/sites-and-environments/). ## wp run [Section titled “wp run”](#wp-run) Run a WP-CLI command in an environment. ```sh kinstactl wp run my-site "wp core version" --env live --yes ``` ```sh kinstactl wp run <site> <command> [options] ``` Run a WP-CLI command in an environment #### Arguments | Argument | Description | | --------- | --------------------------------------- | | `site` | site name, display name or ID | | `command` | the WP-CLI command, starting with "wp " | #### 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](/scripting-and-ci/). Caution Asks for confirmation on a TTY. Pass `--yes` to skip it; without a TTY and without `--yes` the command fails. Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/run-wp-cli-command` Pass the whole WP-CLI command as one quoted argument, starting with `wp `. Only letters, digits and the characters `-_./:=@'` are allowed, so pipes, redirects, `;` and `$(...)` are rejected with a `USAGE` error before anything is sent. A WP-CLI command can change anything, 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). `--dry-run` prints the request and does not ask. The command waits for Kinsta to finish, and accepts `--no-wait` and `--timeout <minutes>`; see [operations](/commands/operations/). The output of the WP-CLI command is the result of the operation and is the only thing printed on stdout. With `--json` you get one document with `operation_id`, `status`, `message` and `data`, where `data` holds the output. With `--no-wait` the command returns right after the request is accepted: in human mode the operation ID appears only in the `Follow with:` hint on stderr, and with `--json` it is `operation_id` on stdout. ## wp login [Section titled “wp login”](#wp-login) Create a one-time WordPress admin login link. ```sh kinstactl wp login my-site --env live --email admin@example.com ``` ```sh kinstactl wp login [site] [options] ``` Create a one-time WordPress admin login link #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--email <email>` | email of the WordPress admin user to log in as | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/wpa-login-url` `--email` is required and must be the email of an existing WordPress admin user; there is no prompt for it. Check that with [`wp user exists`](/commands/wp/#wp-user-exists). The command prints the login link on stdout, and nothing else. Treat the link like a password: anyone who opens it before it is used is logged in. This command has no `--no-wait`. ## wp user create [Section titled “wp user create”](#wp-user-create) Create a WordPress admin user. ```sh kinstactl wp user create my-site ann@example.com --env live --first-name Ann --last-name Lee ``` ```sh kinstactl wp user create <site> <email> [options] ``` Create a WordPress admin user #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | | `email` | email of the new user | #### Options | Option | Description | | --------------------- | ----------------------------------------------------- | | `--env <environment>` | environment name or ID | | `--first-name <name>` | first name of the user | | `--last-name <name>` | last name of the user | | `--dry-run` | print the resolved target and request; change nothing | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `POST /sites/environments/{env_id}/wpa-create-user` `--first-name` and `--last-name` are required; without them the command fails with a `USAGE` error, there is no prompt. The command takes no password and prints none: on success it prints `Created WordPress admin user <email>`, and with `--json` the response from Kinsta. If Kinsta reports that it did not create the user, the command fails with `API_ERROR`. This command has no `--no-wait`. ## wp user exists [Section titled “wp user exists”](#wp-user-exists) Check whether a WordPress admin user exists. ```sh kinstactl wp user exists my-site ann@example.com --env live ``` ```sh kinstactl wp user exists <site> <email> [options] ``` Check whether a WordPress admin user exists #### Arguments | Argument | Description | | -------- | ----------------------------- | | `site` | site name, display name or ID | | `email` | email of the user | #### Options | Option | Description | | --------------------- | ---------------------- | | `--env <environment>` | environment name or ID | Global options `--profile`, `--json` and `--no-input` apply too. See [scripting and CI](/scripting-and-ci/). Kinsta API: `GET /sites`, `GET /sites/environments/{env_id}/wpa-user-exists` The command prints `yes` or `no`. With `--json` it prints `email` and `has_wp_admin_user`, which is what to read in a script. # Using the client as a library > Call the Kinsta API from TypeScript with the typed client that ships in the kinstactl package. The kinstactl package is also a typed client for the Kinsta API. The CLI is built on it, and you can use it directly in your own scripts and services. ```sh npm i kinstactl ``` ```ts import {KinstaClient, sites} from 'kinstactl'; const client = new KinstaClient({ apiKey: process.env.KINSTA_API_KEY!, companyId: process.env.KINSTA_COMPANY_ID!, }); const result = await client.send( sites.listSites(client.companyId, {includeEnvironments: false}), ); ``` Endpoint builders such as `sites.listSites` only build a request description (method, path, query and body). `client.send(spec)` executes it and resolves with the parsed response body. Splitting the two keeps the builders free of I/O, so they are easy to test and to reuse. The builders are grouped by area, one namespace each; the table at the end lists them. ## Operations that run in the background [Section titled “Operations that run in the background”](#operations-that-run-in-the-background) Many Kinsta endpoints answer with an `operation_id` and finish later. `client.start(spec)` sends such a request and returns an `Operation`, which you can `wait()` on. ```ts import {KinstaClient, tools} from 'kinstactl'; const client = new KinstaClient({ apiKey: process.env.KINSTA_API_KEY!, companyId: process.env.KINSTA_COMPANY_ID!, }); const operation = await client.start(tools.clearCache('<environment-id>')); const result = await operation.wait({timeoutMs: 10 * 60_000}); console.log(operation.id, result.message); ``` `wait()` polls the operation with a growing interval and resolves with `{message, data}` once Kinsta reports it as done. `timeoutMs` defaults to 30 minutes. `start` throws a `KinstaApiError` when the response carries no operation ID. When you already have an ID, for example from a CLI run with `--no-wait`, `client.operation('<operation-id>')` gives you the same handle. Use `client.send` for endpoints that answer immediately, and `client.start` for the ones that start an operation. ## Errors [Section titled “Errors”](#errors) Every failure is one of three classes, all exported from the package. | Class | Thrown when | | ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `KinstaApiError` | Kinsta answered with an error status (`status` and `body` hold the details), or the request failed before an answer arrived (`status` is `0`). | | `OperationFailedError` | An operation ended in failure. `operationId` names it. | | `OperationTimeoutError` | `wait()` ran out of time, or lost contact with Kinsta while waiting. The operation may still complete on Kinsta’s side, so check it before you start it again. | ```ts import {KinstaApiError, OperationTimeoutError} from 'kinstactl'; try { await operation.wait(); } catch (e) { if (e instanceof OperationTimeoutError) console.error(e.operationId); else if (e instanceof KinstaApiError) console.error(e.status, e.body); else throw e; } ``` ## Rate limits and retries [Section titled “Rate limits and retries”](#rate-limits-and-retries) The client keeps to Kinsta’s rate limits for you: at most 100 requests per minute, and 4 per minute for requests that create something, and it pauses when Kinsta reports that no requests remain. A `429` answer is retried up to three times, waiting for the `Retry-After` period, or with a doubling delay when it is absent. `GET` requests are also retried up to three times on a gateway error (`502`, `503`, `504`). Other methods are never retried on a `5xx`, because the request may have been processed and repeating it could, for example, create a second backup. Each attempt times out after 120 seconds. ## Types [Section titled “Types”](#types) The package exports the types generated from Kinsta’s OpenAPI description as `paths` and `components`, so you can type request and response bodies without writing them out. ```ts import type {components} from 'kinstactl'; type ClearCacheBody = components['schemas']['ClearCacheRequestBody']; ``` `RequestSpec`, `KinstaClientOptions` and `WaitOpts` are exported as types too. ## Requirements [Section titled “Requirements”](#requirements) The package is ESM only: use `import`, not `require`. It needs Node.js 22.12 or newer. The client has no dependency on the CLI code, and none of the CLI’s libraries are loaded when you import it. ## Exports [Section titled “Exports”](#exports) | Export | What it is | | ----------------------- | ------------------------------------------------------------------------- | | `KinstaClient` | The client: `send`, `start`, `raw`, `operation` and `companyId`. | | `Operation` | The handle of a background operation, with `id` and `wait()`. | | `KinstaApiError` | Error for failed HTTP calls. | | `OperationFailedError` | Error for a failed operation. | | `OperationTimeoutError` | Error for an operation whose outcome is unknown. | | `account` | Endpoint builders for the company, its users, API keys and activity logs. | | `sites` | Endpoint builders for sites. | | `environments` | Endpoint builders for environments. | | `tools` | Endpoint builders for cache, PHP, search and replace and similar tools. | | `backups` | Endpoint builders for backups. | | `domains` | Endpoint builders for domains. | | `logs` | Endpoint builders for logs. | | `plugins` | Endpoint builders for plugins and themes. | | `dns` | Endpoint builders for DNS records. | | `wp` | Endpoint builders for WP-CLI, WordPress admin users and login links. | | `ssh` | Endpoint builders for SSH access. | | `sftp` | Endpoint builders for SFTP users. | | `security` | Endpoint builders for security settings. | | `analytics` | Endpoint builders for analytics. |