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.
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.
Authentication and User Access
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.
- Choose an expiration or set a custom start date and number of hours for the key to expire.
- Give the key a name.
- 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.
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 60. There is an exception for Site creation, which is limited to 5 requests per minute.
To see your current rate limit status, check the RateLimit headers in the most recent API response:
RateLimit-Limit: 60
RateLimit-Remaining: 50
RateLimit-Reset: 60
Currently, it is not 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.