Kinsta API

Kinsta’s REST API (Application Programming Interface) is a powerful tool designed to allow developers to easily access and interact with your Kinsta account and projects. Our API provides a streamlined and efficient way to work with our platform, allowing you to efficiently retrieve data, perform actions, and automate tasks.

​​

For full details on available API endpoints, to download our OpenAPI specification, and to try out endpoints, see our API reference.

To connect with other developers and find in-depth tutorials, tips, and best practices for using Kinsta’s REST API, check out the Kinsta API category of our Kinsta Community forum.

Prerequisites

To use Kinsta’s API, you must have an account and at least one WordPress site, application, or database in MyKinsta. You’ll also need to generate an API key to authenticate and access your account through the API.

Authentication and user access (API key)

To access and use the API with your account, you will first need to generate an API key in MyKinsta. To get started, go to the API Keys page (Your name > Company settings > API Keys) and click Create API Key.

  1. Choose an expiration or set a custom start date and number of hours for the key to expire.
  2. Give the key a name.
  3. Click Generate.

When the API key is provided, this is the only time you can see it. Make sure you copy it and store it somewhere safe.

Company owners, company administrators, and company developers can create API keys. The level of access to the API will depend on the user’s access. For example, an API key generated by a company developer will not have the same access as a key generated by a company owner or administrator.

You can generate multiple API keys, which are listed on the API Keys page. If you need to revoke an API key, click Revoke next to the one you want to revoke.

API endpoints

With Kinsta’s API, you can perform the following actions:

WordPress Hosting

  • Get a list of your company’s WordPress sites, details about a specific site, and details about a site’s environment.
  • Create a new WordPress site, clone an existing site, create an empty site without WordPress, and delete a site.
  • Create a new staging site, push a staging environment to live, and delete a staging environment.
  • Clear a site’s cache, restart and update the PHP, and get a list of denied IP addresses.
  • Get a list of your site’s plugins and themes and update them.
  • Add or remove a domain.
  • Clear the edge cache and CDN cache on your site.
  • Get a list of your site’s backups and a list of downloadable backups, restore a backup to your site, and delete a backup.
  • Get the site’s log files.

Static Site Hosting

  • Get a list of your company’s static sites and details about a specific site, update your site’s settings, and delete a site.
  • Get the deployment details of a static site and manually or programmatically deploy your site.

Application Hosting

  • Get a list of your company’s applications and details about a specific application, including the deployment details and processes, update the application’s settings, and delete an application.
  • Get the deployment details of an application and manually or programmatically deploy your application.
  • Get information from your application’s analytics.
  • Create an internal connection between your application and database.
  • Enable CDN and edge caching and clear the cache for both.

Database Hosting

  • Get a list of your company’s databases and details about a specific database, create a new database, update the database settings, and delete a database.

Company

  • Get a list of your company’s users, including their email address, full name, and a link to their profile picture.

Common use cases

Reporting

APIs can be used to read data so you can create your own reports or integrate Kinsta Services into your internal tracking systems. For example, if you run an agency and use an application that lists all of your clients, you can use the API to list all of the Kinsta-hosted WordPress sites, applications, and databases belonging to each client.

Scheduled tasks

You can create your own application to schedule tasks overnight that may impact your site’s performance or cause downtime. For example, clearing the site cache overnight can help minimize disruption for your site visitors.

Site management

Using Node.js with the API, you can create a site management Slackbot to save you time and help you manage your sites more efficiently. You can use the Slackbot for tasks like checking site status, clearing a site’s cache, and restarting a site’s PHP engine.

WordPress site creation

You can add a new WordPress site/install automatically using the API. For example, if you run an agency and want to be able to automate the site creation process without having to log in to MyKinsta each time, you can use the API to create the site and install WooCommerce, Yoast SEO, and Easy Digital Downloads.

You also have the option to create a WordPress Multisite installation (is_multisite TRUE) and configure a subdomain (is_subdomain_multisite TRUE) or subdirectory (is_subdomain_multisite FALSE) installation.

To check the status of site creation, use the Operations endpoint.

Check operation status

For potentially long-running operations (e.g. site creation, clearing cache, restarting PHP, etc.) the API does not immediately respond with the result. This helps prevent a potential blocked server thread or gateway timeout due to an operation taking a long time.

To check the status of an operation, use the /operations endpoint. When you start an operation, the immediate response from the API will include an operation_id to use with the /operations endpoint. For more details and examples, see the Operations reference.

Rate limit

To protect our API from being flooded with too many requests, the number of requests per minute is limited to The following:

  • 120 requests per minute per company ID identified from the API key.
  • 1000 requests per minute per IP address. This would come into force if you have access to multiple companies.
  • 5 requests per minute for resource creation, for example, creating a WordPress site.

To see your current rate limit status, check the RateLimit headers in the most recent API response. It is not currently possible to increase the rate limit.

Troubleshooting

If you make a request to an endpoint that your API key doesn’t have access to, you will receive an error message to let you know you do not have access. If you need access to that endpoint, a company owner or administrator will need to generate an API key for you.

API reference

For full details on available API endpoints, to download our OpenAPI specification, and to try out endpoints, see our API reference.

Was this article helpful?