Kinsta API + Claude: Automate Your WordPress Site Ops

Kinsta API + Claude: Automate Your WordPress Site Ops

Some links on this page are affiliate links. If you buy through one, we may earn a commission at no extra cost to you. It never changes a recommendation. How this works.

Kinsta’s REST API, in public beta and available to all Kinsta customers as of October 2026, can run WP-CLI commands, update plugins, push staging to live, take manual backups, clear caches and report usage, which makes it a good target for scripts Claude writes. This guide builds three automations on it: bulk plugin updates across every site you run, a backup-push-and-clear-cache deploy step, and a weekly usage report.

The endpoints below come from Kinsta’s API documentation and its API reference (OpenAPI specification version 1.111.0), checked in October 2026; this guide does not include our own tests.

Kinsta’s reference is the authority here, and endpoints can change while the API is in beta. Each automation below names the endpoint it uses, so you can paste the matching reference page into Claude and have it confirm the current shape before you run anything.

Why the Kinsta API is interesting

The Kinsta API covers WordPress sites and environments, backups, site and edge caches, the CDN, analytics, domains and DNS. It can also run WP-CLI commands over HTTP, through POST /sites/environments/{env_id}/run-wp-cli-command. That last piece means you’re not limited to the buttons in MyKinsta: WP-CLI, which WordPress.org says can do “anything you can do in the WordPress admin,” becomes something a script can run on any of your sites. One limit to know: the API only accepts commands that start with wp and use letters, numbers, spaces and a few punctuation marks, so no pipes or chained shell commands.

Pair that with Claude writing the scripts and you get what this site calls AI agent hosting. If that phrase is new to you, the primer on what AI agent hosting actually means is the place to start. The short version: the host provides clean, documented control surfaces; the agent does the tedious work; you review and approve.

For context, Kinsta plans start at $35 a month for one site, Kinsta routes traffic through Cloudflare with Enterprise DDoS protection, and it now operates on Oracle Cloud Infrastructure, which replaced its previous Google Cloud setup. Kinsta says its API is available to all customers while it remains in public beta, which is not true of every managed host.

What you need before you start

  • A Kinsta API key. In MyKinsta, go to your username > Company settings > API Keys, click Create API Key, choose an expiration, name it and generate it. Kinsta shows the key only once. Company owners, administrators and developers can create keys, and a key’s access depends on the user who creates it. Keep it in an environment variable, never in a script you commit.
  • Your company ID. The site-listing call needs it as a parameter. It’s the idCompany value in the MyKinsta URL when you open a site, and the environment ID appears in the same URL after the site ID.
  • A terminal with curl and jq. That’s the whole toolchain. The API takes and returns JSON, so no SDK is required.
  • Claude. Claude Code can run and debug the scripts itself; the chat interface works fine if you’d rather paste code around.
  • A staging environment to practice on. Non-negotiable. Give every automation below its first run against staging, not a live client site.

One workflow note: everything below matches Kinsta’s specification as of October 2026, but the API is in beta. Paste the relevant reference page into Claude and let it confirm the current shape before you run anything.

Automation 1: bulk plugin updates across every site

This is the one that pays for the setup time. The WP-CLI endpoint takes an environment ID in the path and a wp_command in the body, and returns an operation_id because execution is asynchronous. The core loop looks like this:

# set KINSTA_KEY in your shell first; never commit it
API="https://api.kinsta.com/v2"

# every environment you want to patch
ENVS="ENV_ID_ONE ENV_ID_TWO ENV_ID_THREE"

for ENV in $ENVS; do
  curl -s -X POST "$API/sites/environments/$ENV/run-wp-cli-command" -H "Authorization: Bearer $KINSTA_KEY" -H "Content-Type: application/json" -d '{"wp_command": "wp plugin update --all"}' | jq -r '.operation_id'
done

A prompt along these lines gets Claude to build the rest: “Write a bash script that runs wp plugin update –all on these Kinsta environment IDs via the run-wp-cli-command endpoint, polls each operation until it finishes, and prints a pass/fail table.” Ask for rate-limit handling up front. Kinsta allows 120 requests per minute per company and 5 per minute for resource creation, reports your status in RateLimit response headers, and says the limit can’t currently be raised. When you poll GET /operations/{operation_id}, a 202 means still running, a 200 means finished, and a 500 means the operation failed. Expect to review and iterate on the first draft.

For an urgent security fix, swap the command for a single plugin, wp plugin update the-vulnerable-one, and the same loop patches every site in the list. Kinsta also has a dedicated endpoint, PUT /sites/environments/{env_id}/plugins/bulk-update, that takes a list of plugin names if you’d rather not go through WP-CLI.

Automation 2: backup, staging push and cache clear on demand

The usual manual routine is: update on staging, check it, push to live in MyKinsta, then remember to clear the cache. The API removes the remembering. Clearing the site cache is a single call; note that the environment ID goes in the request body, not the path:

curl -s -X POST "$API/sites/tools/clear-cache" -H "Authorization: Bearer $KINSTA_KEY" -H "Content-Type: application/json" -d '{"environment_id": "'"$ENV"'"}'

A sensible deploy script chains four documented steps. Take a manual backup of the live environment with POST /sites/environments/{env_id}/manual-backups (an optional tag labels it). Push staging to live with PUT /sites/{site_id}/environments, passing source_env_id and target_env_id; by default the push copies the database and files and runs search and replace. Poll /operations until each step returns 200. Then clear the live cache. The backup step matters: a push is the one action in this post that can overwrite your live site, and the manual backup gives you a restore point through POST /sites/environments/{target_env_id}/backups/restore. Put a confirmation prompt in the middle; automation doesn’t mean removing the human, it means removing the busywork around the human.

Automation 3: the Monday usage report

Schedule a weekly cron job that pulls the site list for your company ID (GET /sites?company=...), then this month’s visits and server bandwidth for each site (GET /sites/{site_id}/usage/visits/this-month and /usage/bandwidth/this-month), writes a Markdown table, and hands it to Claude to summarize into three bullet points. jq does the formatting. Per-environment analytics endpoints add top client IPs and a response-code breakdown if you want more detail.

Boring? Completely. But Kinsta plans are billed on either visits or server bandwidth, and on visit-based plans Kinsta charges $0.50 per 1,000 visits over the cap. A weekly report shows a site drifting toward its allowance before the overage lands on an invoice, and the top client IPs endpoint helps you spot a single source hammering a site. Kinsta’s own plan limit alerts email you at 80% and 100% of usage; the report adds the trend.

Where Claude fits in: two modes

Everything above is mode one: Claude writes scripts, you run them on a schedule or on demand. It’s the right default because the output is inspectable: you can read a bash script before it touches production.

Mode two is letting Claude drive your sites conversationally through an MCP server, where you type “update the plugins on the Henderson site and clear the cache” and it happens. That’s a bigger topic with its own trade-offs, covered separately in managing WordPress with Claude and MCP. If MCP is an unfamiliar acronym, start with the plain-English explainer. A sensible rule: scripts for anything destructive, conversation for anything read-only, and no unsupervised environment pushes.

Downsides

  • Everything is asynchronous. Long-running actions return an operation ID you have to poll. Claude handles the boilerplate, but your scripts are longer and slower than you’d expect.
  • Key access follows the person who creates it. Kinsta says a key’s access depends on the creating user’s role, so a key made by an owner or administrator can do what they can, including deleting sites. Have a company developer create keys where that’s enough, set an expiration, and revoke keys when someone leaves the company.
  • Rate limits are real. 120 requests a minute per company is plenty for a short loop, and worth engineering around if you manage hundreds of sites.
  • Premium pricing, no email. At $35 a month for one site ($350 a year on annual billing), Kinsta only makes sense if the automation saves real billable hours, and Kinsta says “we don’t provide email as part of our hosting plans,” so budget for email separately.

If the price is the blocker, Cloudways starts at $24 a month for the 2GB server it recommends for live sites, its Copilot assistant monitors server health and explains problems in plain terms, and Cloudways documents its own MCP server. Cloudways vs Kinsta compares the two directly, and the Copilot guide shows what Copilot does day to day. For the wider field, the best AI web hosting roundup compares hosts on how ready they are for agent workflows.

Frequently asked questions

Can the Kinsta API run WP-CLI commands?

Yes. POST /sites/environments/{env_id}/run-wp-cli-command takes a wp_command (for example wp core version), starts it asynchronously, and returns an operation ID you poll at /operations. Commands must start with wp and use a limited set of characters, so shell pipes and chained commands aren’t accepted.

Is the Kinsta API free to use?

The API costs nothing extra. Kinsta lists it under “Premium features included in all plans,” which start at $35 a month for one site, or $350 a year billed annually, as of October 2026. It’s in public beta and available to all Kinsta customers. You’re paying for the hosting; the automation surface comes with it.

Do I need to know how to code to automate Kinsta with Claude?

You need to be able to read a short bash script and run commands in a terminal; that’s the realistic floor. Claude writes the code, but you should understand roughly what a script does before pointing it at production. If you can follow the examples in this post, you’re ready.

Is it safe to run these automations on production sites?

With guardrails, yes. Run every automation on staging first, take a manual backup before anything destructive, and put a human confirmation step inside any script that pushes environments. Read-only automations like the usage report carry little risk beyond keeping the key safe.

What’s the difference between the Kinsta API and an MCP server?

The API is the raw HTTP surface: you or your scripts call it directly. An MCP server is a translation layer that lets an AI assistant call capabilities conversationally. Scripts are more auditable; MCP is more convenient. You can use both: scripts for changes, conversation for questions.

Last checked: October 2026. Prices and plans change; check the vendor’s page before you buy.

Want the guided version? Our free video courses are in production, starting with “Launch Your First Website with Claude.”