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

Reset environments to their template

Makes the named stages of each target environment follow the template again, replacing what the environment holds for them. Send dry_run true first to see what would change; a reset that includes production environments is then confirmed with confirm_production true and confirm_count, the dry run's production_count.

POST/api/corestack/companies/{company}/deploy-templates/{platform}/usage/reset
  • Needs exec as well: A target environment gains a command it does not run now (never for a dry run).

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 production_count. At least 0.

confirm_productionboolean
dry_runboolean

Answer what would change for each target and write nothing.

targetsarray of objectsRequired

Up to 200 items.

Fields of each item
site_idintegerRequired

At least 1.

stagesarray of stringsRequired

The stages to reset, or ["all"]. Up to 4 items.

builddatabasepost_deploysettingsall

Returns

200 The targets and, when the reset was made, what was written.

Fields of the 200 answer
dry_runbooleanRequired
production_countintegerRequired

The number to send as confirm_count.

refusedarray of objectsRequired

Targets that cannot be reset, each with why. A dry run lists them; a reset that names one is refused template_refused_on.

Fields of each item
productionbooleanRequired
reasonstringRequired

Such as not_reached, pipeline_classic, pipeline_review_pending or pipeline_locked.

site_idintegerRequired

At least 1.

targetsarray of objectsRequired
Fields of each item
productionbooleanRequired
site_idintegerRequired
stagesarray of stringsRequired
writtenobject or any or nullRequired

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 production environments of this reset have changed. Review the selection again.
422confirmThe action needs an explicit confirmation field. Ask the person, then send it.
422invalidFix the field named in field; errors says why.
422template_refused_onSome environments cannot be reset. Deselect them, then reset the rest.
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/usage/reset \
  -H "Authorization: Bearer $COREFINITY_TOKEN" \
  -H "Accept: application/json" \
  -H "Content-Type: application/json" \
  -d '{
    "confirm_count": 1,
    "confirm_production": true,
    "targets": [
      {
        "site_id": 1042,
        "stages": [
          "all"
        ]
      }
    ]
  }'
{
  "dry_run": true,
  "production_count": 1,
  "refused": [],
  "targets": [
    {
      "production": true,
      "site_id": 1042,
      "stages": [
        "post_deploy"
      ]
    }
  ],
  "written": null
}
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