---
title: "corestack_deployments_template_environments_reset"
url: https://docs.corefinity.com/mcp/tools/corestack_deployments_template_environments_reset
type: tool
last_updated: 2026-11-13
feature: deployment-templates
related:
  - https://docs.corefinity.com/api/reference/deployments/reset-deploy-template-environments.md
  - https://docs.corefinity.com/guides/sites/code-and-deployments/deployment-templates.md
---
# corestack_deployments_template_environments_reset

**Reset environments to their template.** Make stages of several environments follow your company's deployment template again: the template's content is written into each now, all or nothing. Call it with dry_run first. Scope: write. Also needs exec when the deployment pipeline gains a custom line.

- Scope: `write`
- Also needs `exec` when a target gains custom lines it does not run now
- Confirmation: `confirm_production`, `confirm_count`
- Runs as a task: no

## When to use it

Make stages of several environments follow your company's deployment template again (`stages`, or `["all"]`, per target): the template's content is written into each now, all or nothing, and each environment's previous version stays restorable. Call it with `dry_run: true` first. Production targets need `confirm_production: true` and `confirm_count` = their count. Your access must cover every target; a target that gains commands it does not run now also needs exec.

The same action in the public REST API, with the same checks, refusals and scope: `POST /api/corestack/companies/{company}/deploy-templates/{platform}/usage/reset`.

## Inputs

- `platform` (string, required)
- `targets` (array of {site_id, stages}, 1 to 200 items, required)
- `dry_run` (boolean): Answer what changes per target; write nothing.
- `confirm_production` (boolean)
- `confirm_count` (integer, ≥ 0): The production count of the dry run.

### Input schema

```json
{
  "additionalProperties": false,
  "properties": {
    "confirm_count": {
      "description": "The production count of the dry run.",
      "minimum": 0,
      "type": "integer"
    },
    "confirm_production": {
      "type": "boolean"
    },
    "dry_run": {
      "description": "Answer what changes per target; write nothing.",
      "type": "boolean"
    },
    "platform": {
      "enum": [
        "magento2",
        "laravel",
        "wordpress",
        "shopware5"
      ],
      "type": "string"
    },
    "targets": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "site_id": {
            "minimum": 1,
            "type": "integer"
          },
          "stages": {
            "description": "The stages, or [\"all\"].",
            "items": {
              "enum": [
                "build",
                "database",
                "post_deploy",
                "settings",
                "all"
              ],
              "type": "string"
            },
            "maxItems": 4,
            "minItems": 1,
            "type": "array"
          }
        },
        "required": [
          "site_id",
          "stages"
        ],
        "type": "object"
      },
      "maxItems": 200,
      "minItems": 1,
      "type": "array"
    }
  },
  "required": [
    "platform",
    "targets"
  ],
  "type": "object"
}
```

## Refusals

- `forbidden`: the person's role lacks the Edit Environment Deployment Pipeline permission, which every change to the
  company's templates, variables and registry secrets needs (they reach every environment that follows the template). The
  message names it and says an owner of the company can grant it in Roles; `details.permission` is
  `editEnvironmentDeploymentPipeline`. Nothing is changed.
- `confirm`: production targets are named; send `confirm_production: true` and their count.
- `reach_changed`: the production targets' count no longer matches; run the dry run again.
- `template_refused_on`: a target cannot take it (`details` names the target and its reason); nothing was written.
- `pipeline_classic`: a target still runs its classic pipeline.
- `not_reached`: a target does not follow this template.
- `managed_elsewhere` (message: "This site is managed by another control panel"): another control panel manages this site, so use that control panel for it. This is refused before anything else about the site, as in the Control Panel and the API. Nothing was done.
- The refusals every tool can answer: `invalid_arguments`, `tenant_mismatch`, `scope_required`, `pin_refused`, `rate_limited`, `temporarily_unavailable`, `internal_error` (corestack://guides/how-this-server-works).

## Example

```json
{
  "name": "corestack_deployments_template_environments_reset",
  "arguments": {
    "platform": "magento2",
    "targets": [
      {
        "site_id": 4212,
        "stages": [
          "post_deploy"
        ]
      }
    ],
    "dry_run": true
  }
}
```

## Prompt

```text
Using the Corefinity MCP server, call corestack_deployments_template_environments_reset with platform magento2, targets [{"site_id":4212,"stages":["post_deploy"]}], dry_run true. (Reset environments to their template.) Tell me what it returned.
```

## The same task elsewhere

- Endpoint: [POST /api/corestack/companies/{company}/deploy-templates/{platform}/usage/reset](https://docs.corefinity.com/api/reference/deployments/reset-deploy-template-environments.md)
- Guide: [Deployment templates](https://docs.corefinity.com/guides/sites/code-and-deployments/deployment-templates.md)
