Working with environments just got easier. This Kinsta API update introduces new ways to fetch file structure data, perform selective file pushes between environments, and retrieve all environments in a single request when listing sites.

These additions are designed to reduce the number of calls you need to make, so your deployments and dev tools are faster and more efficient.

Get file list for an environment

You can now retrieve the full directory structure of a WordPress environment using the Kinsta API. This new endpoint returns a recursive list of folders and subfolders, giving you a clear view of what’s inside each environment — no SSH logins required.

This is especially useful when building internal tools, validating file paths before selective deployments, or automating environment tasks with precision.

You can send a GET request to:

GET /sites/environments/{env_id}/file-list

Here’s a sample request using curl:

curl -i -X GET \
  'https://api.kinsta.com/v2/sites/environments/{env_id}/file-list' \
  -H 'Authorization: Bearer '

The response includes nested objects representing directories like:

  • wp-content/
  • wp-content/plugins/
  • wp-content/themes/
  • wp-content/uploads/

Each folder contains its name, path, and any children, making it easy to map or visualize.

Selective file push between environments

The existing Push Environment endpoint now supports a more flexible way to manage file transfers. With two new optional fields, you can push either the full environment or target specific directories — perfect for workflows where you don’t want to sync everything.

You can send a PUT request to:

PUT /sites/{site_id}/environments

Use the following fields to control which files are included:

  • push_files_option: Choose between "ALL_FILES" or "SPECIFIC_FILES"
  • file_list: Provide a list of directory paths you want to push

Here’s an example using curl to push only selected folders from one environment to another:

curl -i -X PUT \
  'https://api.kinsta.com/v2/sites/{site_id}/environments' \
  -H 'Authorization: Bearer ' \
  -H 'Content-Type: application/json' \
  -d '{
    "source_env_id": "your-source-env-id",
    "target_env_id": "your-target-env-id",
    "push_db": true,
    "push_files": true,
    "run_search_and_replace": true,
    "push_files_option": "SPECIFIC_FILES",
    "file_list": [
      "wp-content/plugins",
      "wp-content/themes",
      "wp-content/uploads"
    ]
  }'

This selective approach helps:

  • Reduce deployment time by syncing only what has changed
  • Avoid overwriting other assets or uploads
  • Improve control when pushing changes from staging to production

If you don’t include push_files_option, it defaults to "ALL_FILES", maintaining backward compatibility.

List sites and their environments in one call

You can now fetch all of a company’s sites and their environments with a single API call. By adding the include_environments=true query parameter to the GET /sites endpoint, the response includes each site’s associated environments — no need for separate follow-up requests.

This is especially useful for agencies or teams managing a large number of sites, where minimizing API calls and speeding up environment audits can make a big difference.

GET /sites?company=your-company-id&include_environments=true

Here’s a sample curl request:

curl -i -X GET \
'https://api.kinsta.com/v2/sites?company=your-company-id&include_environments=true' \
  -H 'Authorization: Bearer '

The response includes site metadata (name, ID, etc.) and a nested list of environments (staging, production, etc.).

Kinsta API: Built for teams managing at scale

These API enhancements are designed to save time and reduce complexity, especially for developers and agencies managing dozens (or hundreds) of WordPress sites.

Whether you’re syncing selected plugin files, building internal tools, or auditing environments across a portfolio, these improvements help streamline the work you’d otherwise have to do manually in the dashboard.

You can explore these new capabilities in the Kinsta API documentation or jump straight into MyKinsta to generate your access token and start building.