CorefinityCorefinityDocs
Open the Control PanelControl Panel
Deployment templates · 7 of 15

Restore a version of a deployment template

Puts the template back to a kept revision (version_id), or every stage back to Corefinity's default (version corefinity), as a new revision, and writes the change through to the environments that follow it. Send exactly one of version_id and version. It is confirmed exactly as a stage save is.

POST/api/corestack/companies/{company}/deploy-templates/{platform}/restore

Path parameters

companyintegerRequired

The id of a company you belong to or manage. Digits only. At least 1.

platformstringRequired

The platform the template is for, such as magento2, laravel or wordpress. The list answers the ones your company can have.

Body

confirm_countinteger

The dry run's reach.production_count. At least 0.

confirm_productionboolean

True to confirm a change that reaches production environments.

confirm_targetsarray of integers

The site_id of every production environment in the dry run's reach.production.

dry_runboolean

Answer the reach and write nothing.

keep_onarray of integers

The site_ids of environments that keep their own stage. Every environment the reach lists under cannot_take must be named.

revisionintegerRequired

The template revision you read. At least 0.

versionstring

Instead of version_id, corefinity puts every stage back to Corefinity's default.

corefinity
version_idinteger

The revision to restore, as the versions list answers it. At least 1.

Returns

200 The template, with the reach of the restore and, when it was made, what was written.

Fields of the 200 answer
canobjectRequired
Fields
editbooleanRequired

Whether you may save this template.

edit_reasonstring or nullRequired

Why not, when you may not.

chain_notestring or null

A sentence about the chains the template sits in, when there is more than one.

companyobjectRequired
Fields
idintegerRequired

At least 1.

namestringRequired
compareobject

Present with compare_to. Each stage that differs between the two revisions, with its entry before and after.

Fields
revisionintegerRequired

The revision compared with.

stagesobjectRequired

By configuration, then by stage. An empty list when the two revisions hold the same content. Up to 0 items.

configsobjectRequired

What the company's template sets, for production environments and for the others.

Fields
productionobjectRequired
Fields
buildobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
databaseobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
post_deployobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
settingsobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
uatobjectRequired
Fields
buildobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
databaseobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
post_deployobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
settingsobjectRequired

What the template sets for one stage.

Fields
modestringRequired

inherit takes the stage from the level above; replace sets it to value.

inheritreplace
valueobject

A stage's content, in the shape the site pipeline's stage and settings endpoints take. The database and after-deploy stages hold lines; the build stage holds mode with a preset or its own lines; the settings stage holds the pipeline's settings, each one optional.

Fields
hooksobject

Build only. Your own lines for each hook of a preset build, when they are not inside preset. An empty list when there are none.

keep_node_modulesboolean
linesarray of strings or string

The stage's commands, one a line, as a list or as one string.

maintenance_policystring

Settings only, as each of the settings below.

when_neededalwaysoff
modestring

Build only.

presetcustom
pause_cronsstring or null
autooffnull
platform_step_atinteger or null

Database only. How many of the lines run before the platform's own database step. At least 0.

presetobject

Build only, with mode preset: platform, frontend (a preset or a list of them), their options and optional hooks.

repository_contentsstring

On a WordPress template, what a repository connected from now on holds. It never changes a repository already connected. While site content repositories are paused, a save of site_content is refused feature_off: a 422, not the 404 a switched-off endpoint answers.

whole_sitesite_content
repository_target_pathstring or null

Where in the site that content goes. Null is wp-content, or web/app on Bedrock.

run_migrationsboolean or null

Laravel only.

timeoutsobject

Whole seconds for a stage or line key (build, build_line, database_line, post_line), or null. A save takes 60 to 3600 for each and no other key. An empty list when none is set.

tunnelsstring
autoonoff
lockedobject or nullRequired

Set while Corefinity has locked the template, so it cannot be edited. Null when it can.

Fields
reasonstringRequired

Why, in Corefinity's words.

platformstringRequired
presetsobjectRequired
Fields
offeredarray of objectsRequired

The build presets this platform offers.

Fields of each item
keystringRequired
kindstringRequired
platformfrontend
labelstringRequired
node_floorinteger or null

The lowest Node.js major version the preset needs.

node_floor_whenobject or null

The lowest Node.js major version an option of the preset needs, by option.

revisionintegerRequired

Send this with a save or a restore.

template_idinteger or nullRequired
upstreamsarray of objectsRequired

What each stage inherits and what is in effect, once for each chain the template sits in: none for the company's own environments, and one for each agency that manages some of them.

Fields of each item
agencyobject or any or nullRequired
chainarray of objectsRequired

The levels a stage is inherited through, from Corefinity's default down to this company.

Fields of each item
companyobject or any or nullRequired
levelstringRequired

Such as corefinity, agency or owner.

revisionintegerRequired
template_idinteger or nullRequired
environmentsobjectRequired
Fields
productionintegerRequired
totalintegerRequired
stagesobjectRequired

By configuration (production, uat), then by stage: inherited (the level, company and revision the stage comes from, with its value), effective (the content in effect) and differs_from_none.

upstreamstringRequired

none, or agency: and the id of the agency whose template sits above this one.

dry_runbooleanRequired
reachobject or any or nullRequired

The environments the change reaches. Null when the request changes nothing in the template: a dry run then answers reach and written null, and a save answers reach null and written with zeros, leaving the revision as it was.

writtenobject or any or nullRequired

What was written. Null for a dry run.

If it is refused

StatusReasonWhat to do
401noneSend a valid token as Authorization: Bearer <token>.
403company_unavailableYour company is unavailable.
403scope_requiredUse a token with the scope named in scope.
403forbiddenThe person is not allowed to do this.
403two_factor_requiredTurn on two-factor on your account, then send again.
404feature_offThis feature is not on for your organisation yet.
409reach_changedThe environments this change reaches have changed since you reviewed it. Review them again, then confirm.
409staleWhat you read has changed since you read it. Read it again, then send the change with its new version or quote.
409template_lockedCorefinity has locked this template: Held while a change is reviewed.
422confirmThe action needs an explicit confirmation field. Ask the person, then send it.
422invalidFix the field named in field; errors says why.
422feature_offThis feature is not on for your organisation yet.
422timeout_out_of_rangeChoose a timeout between 60 and 3600 seconds.
422version_unavailableThis version is not available here.
429rate_limitedWait for the seconds in Retry-After.

Reasons are listed by name in Errors and refusals.

The same task elsewhere

curl -X POST https://manage.corefinity.com/api/corestack/companies/1204/deploy-templates/magento2/restore \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_count": 1,
    "confirm_production": true,
    "confirm_targets": [
      1042
    ],
    "revision": 2,
    "version_id": 1
  }'
{
  "can": {
    "edit": true,
    "edit_reason": null
  },
  "chain_note": null,
  "company": {
    "id": 1180,
    "name": "Northwind Digital"
  },
  "configs": {
    "production": {
      "build": {
        "mode": "inherit"
      },
      "database": {
        "mode": "inherit"
      },
      "post_deploy": {
        "mode": "replace",
        "value": {
          "lines": [
            "php bin/magento cache:flush",
            "php bin/magento cron:install"
          ]
        }
      },
      "settings": {
        "mode": "inherit"
      }
    },
    "uat": {
      "build": {
        "mode": "inherit"
      },
      "database": {
        "mode": "inherit"
      },
      "post_deploy": {
        "mode": "inherit"
      },
      "settings": {
        "mode": "inherit"
      }
    }
  },
  "dry_run": false,
  "locked": null,
  "platform": "magento2",
  "presets": {
    "offered": []
  },
  "reach": {
    "cannot_take": [],
    "confirm": {
      "count": 1,
      "required": true
    },
    "digest": "3b50f766bb040794",
    "environments": 1,
    "in_flight": [],
    "list_max": 50,
    "not_reached": [],
    "production": [
      {
        "binding_id": 2210,
        "environment": {
          "name": "Production",
          "slug": "production"
        },
        "site": {
          "domain": "harbourandfinch.example.com",
          "id": 1042
        },
        "site_id": 1042,
        "stages": [
          "post_deploy"
        ]
      }
    ],
    "production_count": 1,
    "tunnels": {
      "access_update": [],
      "runtime_needed": []
    },
    "uat": [],
    "uat_count": 0,
    "unchanged": 0
  },
  "revision": 3,
  "template_id": 12,
  "upstreams": [],
  "written": {
    "environments": 1,
    "kept": 0,
    "revisions": 1,
    "tunnel_access_started": []
  }
}
Try it

Try it is off for this endpointIt overwrites data that cannot be brought back. Copy the request and run it yourself when you are sure.

Was this helpful?
Open in ClaudeOpen in ChatGPT