Replace a stage of a pipeline
Replaces one stage and answers the whole pipeline; the next deployment runs the saved stage. Send the revision you read: a pipeline that changed since is refused stale. Your role needs the Edit Environment Deployment Pipeline permission.
- Needs
execas well: The save brings a command the pipeline does not run now.
Path parameters
The id of a site row. A website's production site and each of its environments has its own id. Digits only. At least 1.
The id of one of the environment's pipelines, as the pipeline read answers it in binding_id and bindings[].id. Digits only. At least 1.
builddatabasepost_deployBody
Build only. Your own lines for each hook of a preset build.
The stage's commands, one a line, at most 200 of them. The database and after-deploy stages take these alone; the build stage takes them with mode custom.
Build only.
presetcustomDatabase only. How many of the lines run before the platform's own database step. At least 0.
Build only, with mode preset: platform, frontend (a list) and options, from the presets the pipeline read offers.
The pipeline revision you read.
Returns
200 The pipeline after the save.
Fields of the 200 answer
The pipeline this answer is about.
The environment's pipelines.
Fields of each item
Fields
The commands of a pipeline that does not have the three stages yet. Null for a three-stage pipeline.
Set while Corefinity has locked the pipeline, so it cannot be edited. Null when it can.
Fields
Why, in Corefinity's words.
Fields
Fields of each item
dirfileA path relative to the site's root. Up to 255 characters.
Where the path's data is kept between releases, relative to the shared folder, when that is not the default.
Laravel only, read only. The environment's own switch, which a pipeline whose run_migrations is null follows. Null on every other platform.
The paths the platform itself keeps between releases.
Fields of each item
dirfileA path relative to the site's root. Up to 255 characters.
Where the path's data is kept between releases, relative to the shared folder, when that is not the default.
Off (false), on (true), or on with the paths to request.
Magento 2 only. Whether Varnish is purged after the switch.
Off (false), on (true), or on with the paths to request.
What a build of this environment runs with, such as its Node.js version and whether it opens a tunnel.
The build presets this platform offers, and the ones found in the site's code.
Fields
Fields of each item
Send this with a save.
The last save. Null for a pipeline that has not been saved.
The settings. Null for a pipeline that does not have the three stages yet.
three_stage for a pipeline with the three stages. Null for one that still holds the commands it was carried over with.
The three stages. Null for a pipeline that does not have them yet.
The deployment template each stage follows or has left. Present while deployment templates are on for your company.
If it is refused
| Status | Reason | What to do |
|---|---|---|
401 | none | Send a valid token as Authorization: Bearer <token>. |
403 | company_unavailable | Your company is unavailable. |
403 | scope_required | Use a token with the scope named in scope. |
403 | forbidden | The person is not allowed to do this. |
403 | two_factor_required | Turn on two-factor on your account, then send again. |
404 | feature_off | This feature is not on for your organisation yet. |
409 | managed_elsewhere | This site is read-only here. Change it in the control panel that manages it. |
409 | pipeline_classic | Corefinity still runs this pipeline in its classic form, so it cannot be edited yet. |
409 | pipeline_locked | Corefinity has locked this pipeline: Held while a migration is checked. |
409 | stale | What you read has changed since you read it. Read it again, then send the change with its new version or quote. |
422 | confirm | The action needs an explicit confirmation field. Ask the person, then send it. |
422 | line_credentials | This line holds a credential. Move this value into a variable, then save again. |
422 | maintenance_policy_unavailable | Choose Always or Off: this platform has no pending-upgrade check. |
422 | invalid | Fix the field named in field; errors says why. |
422 | timeout_out_of_range | Choose a timeout between 60 and 3600 seconds. |
422 | version_unavailable | This version is not available here. |
429 | rate_limited | Wait for the seconds in Retry-After. |
Reasons are listed by name in Errors and refusals.
The same task elsewhere
curl -X PUT https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/stages/post_deploy \
-H "Authorization: Bearer $COREFINITY_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"lines": [
"php artisan queue:restart",
"php artisan config:cache"
],
"revision": "413c6ef3a8a3ffe9"
}'use Illuminate\Support\Facades\Http;
$response = Http::withToken(env('COREFINITY_TOKEN'))
->acceptJson()
->put('https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/stages/post_deploy', [
'lines' => [
'php artisan queue:restart',
'php artisan config:cache',
],
'revision' => '413c6ef3a8a3ffe9',
]);
$data = $response->json();const res = await fetch('https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/stages/post_deploy', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.COREFINITY_TOKEN}`,
Accept: 'application/json',
'Content-Type': 'application/json',
},
body: JSON.stringify({
lines: [
'php artisan queue:restart',
'php artisan config:cache',
],
revision: '413c6ef3a8a3ffe9',
}),
});
// An answer with no body (204) has nothing to parse.
const text = await res.text();
const data = text && JSON.parse(text);import os
import requests
res = requests.put(
"https://manage.corefinity.com/api/corestack/sites/1042/deployments/pipeline/2210/stages/post_deploy",
headers={
"Authorization": f"Bearer {os.environ['COREFINITY_TOKEN']}",
"Accept": "application/json",
},
json={
"lines": [
"php artisan queue:restart",
"php artisan config:cache",
],
"revision": "413c6ef3a8a3ffe9",
},
)
data = res.json() if res.content else None{
"binding_id": 2210,
"bindings": [
{
"id": 2210,
"is_default": false,
"label": "harbourandfinch.example.com",
"tag": null
}
],
"can": {
"edit": true,
"edit_code": null,
"edit_reason": null,
"rehearse": true,
"rehearse_code": null,
"rehearse_reason": null
},
"carry_over": null,
"classic": null,
"conversion": null,
"locked": null,
"options": {
"build_reads": [],
"cloudflare_purge": false,
"extra_shared_paths": [],
"migrate": false,
"platform_shared": [
{
"kind": "dir",
"path": "storage"
},
{
"kind": "file",
"path": ".env"
}
],
"pre_switch_check": false,
"snapshot_before_upgrade": false,
"warm_up": false
},
"origin": null,
"presets": {
"detected": [],
"offered": [
{
"key": "laravel_standard",
"kind": "platform",
"label": "Laravel standard"
},
{
"key": "none",
"kind": "platform",
"label": "No build"
},
{
"key": "vite",
"kind": "frontend",
"label": "Vite"
},
{
"key": "laravel_mix",
"kind": "frontend",
"label": "Laravel Mix"
}
]
},
"revision": "1537f080a2c1e2d9",
"saved": {
"at": "2026-11-09T10:42:07Z",
"by": {
"name": "Maya Okafor",
"token": null
},
"number": 1,
"source": "editor"
},
"settings": {
"keep_node_modules": false,
"maintenance_policy": "off",
"pause_crons": "auto",
"run_migrations": null,
"timeouts": {
"build": 3600,
"build_line": 3600,
"database_line": 600,
"post_line": 600
},
"tunnels": "auto"
},
"stage_model": "three_stage",
"stages": {
"build": {
"effective": [],
"hooks": [],
"lines": [],
"mode": "preset",
"preset": {
"frontend": [],
"options": [],
"platform": "none"
}
},
"database": {
"lines": [],
"platform_step_at": 0
},
"post_deploy": {
"lines": [
{
"badges": [],
"comments": [],
"origin": "custom",
"text": "php artisan queue:restart",
"verdict": "services"
},
{
"badges": [
{
"id": "replaced_by_platform",
"label": "Replaced by a CoreStack step",
"severity": "info"
}
],
"comments": [],
"origin": "custom",
"text": "php artisan config:cache",
"verdict": "platform_duplicate"
}
]
}
}
}{
"message": "Unauthenticated."
}{
"code": "company_unavailable",
"message": "Your company is unavailable.",
"reason": "company_unavailable"
}{
"code": "feature_off",
"message": "Not found.",
"reason": "feature_off"
}{
"code": "managed_elsewhere",
"message": "This site is managed by another control panel",
"reason": "managed_elsewhere"
}{
"code": "confirm",
"errors": {
"confirm_production": [
"Copying into production changes how it deploys. Confirm to continue."
]
},
"message": "Copying into production changes how it deploys. Confirm to continue.",
"reason": "confirm"
}{
"code": "rate_limited",
"message": "Too many requests. Try again in 60 seconds.",
"reason": "rate_limited",
"retry_after_seconds": 60
}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.