---
title: "Deployment templates"
url: https://docs.corefinity.com/guides/sites/code-and-deployments/deployment-templates
type: guide
last_updated: 2026-11-13
feature: deployment-templates
related:
  - https://docs.corefinity.com/api/reference/deployments/list-company-deploy-secrets.md
  - https://docs.corefinity.com/api/reference/deployments/create-company-deploy-secret.md
  - https://docs.corefinity.com/api/reference/deployments/update-company-deploy-secret.md
  - https://docs.corefinity.com/api/reference/deployments/delete-company-deploy-secret.md
  - https://docs.corefinity.com/api/reference/deployments/list-deploy-templates.md
  - https://docs.corefinity.com/api/reference/deployments/get-deploy-template.md
  - https://docs.corefinity.com/mcp/tools/corestack_deployments_templates_list.md
  - https://docs.corefinity.com/mcp/tools/corestack_deployments_template_get.md
  - https://docs.corefinity.com/mcp/tools/corestack_deployments_template_versions_list.md
  - https://docs.corefinity.com/mcp/tools/corestack_deployments_template_stage_update.md
  - https://docs.corefinity.com/mcp/tools/corestack_deployments_template_restore.md
  - https://docs.corefinity.com/mcp/tools/corestack_deployments_template_usage_list.md
---
# Deployment templates

Set the pipeline stages for every site of a platform in your organisation, and see which environments follow them.

## Before you start

- You are an owner, or your role has **Edit Environment Deployment Pipeline**. Every user of the organisation can read its templates.
- A template holds the **Build**, **Database**, **After deploy** and **Settings** stages for one platform, such as Magento 2. Until you set a stage it comes from **Corefinity's default**.
- The repository, branch, Node.js version, variable values, registry tokens, shared paths and deployment options stay with each environment.

## Open a template

1. **Open the organisation's deployments**

   Go to **Organisation › Organisations**, choose your organisation, then **Deployments** under **Developers**. Under **Deployment templates**, choose **Open** beside the platform.

   _Screenshot: The Deployment templates card of an organisation: one row for each platform, each on Corefinity's default with the number of environments that follow it, and Open ringed on the Magento 2 row\._

2. **Read the template**

   **Where this comes from** shows the order a stage is taken from, ending with the environment. **Production** is used by every production environment, and **UAT** by every other environment, such as Staging.

   _Screenshot: The Magento 2 template of Northwind Digital: Where this comes from, with Corefinity's default, the organisation and one environment, the tabs Production, UAT, Where it's used and History, and the four stages, each inherited from Corefinity's default with an Edit button._

## Change a stage for every site

1. **Set the stage**

   Choose **Edit** on the stage, then **Set for** your organisation in place of **Inherit from**. Edit the stage as on a site: see [Pipeline](/guides/sites/code-and-deployments/pipeline-stages).

   _Screenshot: The After-deploy stage of the Magento 2 template with Set for Northwind Digital chosen, one cache flush command in the editor, Also apply to UAT, and the Review and save button._

2. **Review where it reaches**

   Choose **Review and save**. The dialog lists **What changes** and every environment the change reaches: tick **Keep the current stage here** to leave one as it is.

   _Screenshot: The Review and save dialog for the After-deploy stage: What changes, one production environment the change reaches with Keep the current stage here beside it, and the box to type 1 to change one production environment._

3. **Confirm and save**

   Under **Confirm the production change**, type the number of production environments, then choose **Save**.

Each environment runs the new stage from its next deployment. The change is recorded in **Activity** on every site it reaches, and in the template's **History**.

## See which environments follow a template

1. **Open Where it's used**

   Choose **Where it's used** on the template page.

   _Screenshot: Where it's used on the Magento 2 template page: one production environment that follows every stage, a search box with the filters Role, Stage and State, and the row for harbourandfinch.example reading Follows under Build, Database, After-deploy and Settings._

| State            | What it means                                                               |
| ---------------- | --------------------------------------------------------------------------- |
| **Follows**      | The stage is the template's and changes when the template is saved.         |
| **Changed here** | Someone set the stage on that environment. A template save leaves it alone. |
| **Kept**         | The environment kept its own stage when the template was saved.             |

To bring environments back to the template, tick them and choose **Reset to template…**. **History** lists every saved revision of the template: compare one with another, or restore it.

The same section holds your organisation's variables and registries: see [Variables](/guides/sites/code-and-deployments/variables-and-secrets) and [Private registries](/guides/sites/code-and-deployments/registry-secrets).

## Automate this

**API:** [Replace a stage of a deployment template](https://docs.corefinity.com/api/reference/deployments/replace-deploy-template-stage.md), scope `write`

```bash
curl -X PUT https://manage.corefinity.com/api/corestack/companies/1204/deploy-templates/magento2/production/stages/post_deploy \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_count": 1,
    "confirm_production": true,
    "confirm_targets": [
      1042
    ],
    "mode": "replace",
    "revision": 2,
    "value": {
      "lines": [
        "php bin/magento cache:flush",
        "php bin/magento cron:install"
      ]
    }
  }'
```

**MCP:** [`corestack_deployments_template_stage_update`](https://docs.corefinity.com/mcp/tools/corestack_deployments_template_stage_update.md), scope `write`

```json
{
  "name": "corestack_deployments_template_stage_update",
  "arguments": {
    "platform": "magento2",
    "config": "production",
    "stage": "post_deploy",
    "revision": 4,
    "mode": "replace",
    "value": {
      "lines": [
        "php bin/magento cache:flush"
      ]
    },
    "dry_run": true
  }
}
```

**Control Panel:** Organisation › Organisations › your organisation › Developers › Deployments ([https://manage.corefinity.com/go/deployment-templates](https://manage.corefinity.com/go/deployment-templates))

## Related

- [Pipeline](/guides/sites/code-and-deployments/pipeline-stages): Change what a deployment runs.
- [Rehearse a pipeline](/guides/sites/code-and-deployments/rehearse-a-pipeline): Try a pipeline on Staging first.
- [Variables](/guides/sites/code-and-deployments/variables-and-secrets): Give deployment commands a value.
