Kinsta is a cloud platform designed to help companies and dev teams ship and manage their web projects faster and more efficiently.
Kinsta provides developers and users with an API to manage their WordPress sites programmatically.
The Kinsta API can be used to automate tasks, retrieve data, and integrate Kinsta with other applications without accessing MyKinsta. To access the API, you need an API key. This article explains the process of creating and using a Kinsta API key.
How to create an API key
To use Kinsta’s API, you must have an account with 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. To generate an API key:
- Go to your MyKinsta dashboard.
- Navigate to the API Keys page (Your name > Company settings > API Keys).
- 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 unique name.
- Click Generate.

When you create an API key, copy it and store it somewhere safe, as this is the only time you can see it. You can generate multiple API keys—they will be listed on the API Keys page. If you need to revoke an API key, click Revoke next to the one you want to revoke.
How to use Kinsta API with your API key
Once you have the API key, you can interact with almost everything in MyKinsta via the Kinsta API.
For example, to get a list of company sites in your MyKinsta, the endpoint is /sites. The API key will serve as your authorization header; you will also add the company ID (required parameter). Here’s how to make this API request using cURL:
curl -i -X GET \
'https://api.kinsta.com/v2/sites?company=<YOUR_COMPANY_ID_HERE>' \
-H 'Authorization: Bearer <YOUR_API_KEY_HERE>'
Replace YOUR_API_KEY_HERE with the actual API key you generated and
COMPANY_ID_HERE with your unique company ID. This will return a JSON response of all the company sites in your DevKinsta dashboard:
{
"company": {
"sites": [
{
"id": "YOUR_SITE_ID",
"name": "my-test-site",
"display_name": "Test site",
"status": "live",
"site_labels": []
}
]
}
}
Another example, suppose you want to fetch a specific site by ID (GET request). You can use the /sites/{site_id} endpoint. {site_id} will be replaced with the unique ID of the specific site you want to fetch. Here’s how to make this API request using NodeJS:
import fetch from 'node-fetch';
async function fetchSite() {
const siteId = 'YOUR_SITE_ID';
const response = await fetch(
`https://api.kinsta.com/v2/sites/${siteId}`,
{
method: 'GET',
headers: {
Authorization: 'Bearer
}
}
);
const data = await response.json();
console.log(data);
}
fetchSite();
There is more to what you can do with the Kinsta API. For full details on available API endpoints and the parameters needed, to download our OpenAPI specification, and to try out endpoints, see our API Reference.
Permissions
API access permissions for Kinsta depend on the user’s role within the company, as company owners, administrators, and developers can create API keys.
For example, an API key generated by a developer will not have the same level of access as a key generated by a company owner or administrator. The specific permissions associated with each user role ensure appropriate access control and security for the Kinsta API.
Summary
The Kinsta API key lets you easily automate tasks, retrieve data, and integrate Kinsta with other applications. Remember to keep your access key secure.
Now you can leverage the power of the Kinsta API to make some reportings, schedule tasks, create WordPress sites, and automate various activities.
What endpoint would you love to see added to the Kinsta API next? Let us know in the comments.