API reference: Pipelines
Snowtrol pipelines API: application build/deploy pipelines and infrastructure pipelines that drive the real Terraform lifecycle, with runs, stages, logs and the second-operator approval handoff.
The deploy control plane. A pipeline carries a kind: an application pipeline builds an application Git repo and deploys it to an optional Terraform workspace (source → build → deploy, deterministic runner); an infrastructure pipeline drives its target workspace's REAL Terraform lifecycle (plan → approve → apply through the same engine, honoring the runner mode and the workspace's approval policy). Every Terraform workspace auto-creates an infrastructure pipeline (provision-<workspace>), and every apply attempt on the workspace is reflected 1:1 as a pipeline run — success and failure — so the two views line up. Reads are open to members; create/run/approve/delete need mutate_infra; cross-org ids 404.
/api/pipelinesSessionList your org's pipelines with kind, source/target and last-run state.
{ "pipelines": [ { "id": 2, "name": "provision-web-tier", "kind": "infrastructure",
"targetWorkspaceId": 7, "targetWorkspaceName": "web-tier", "criticality": "production",
"lastRun": { "number": 1, "state": "succeeded" } } ] }| Status | When |
|---|---|
401 | Not signed in. |
/api/pipelinesmutate_infraCreate a pipeline. An application pipeline needs an application-type git connection + repo; an infrastructure pipeline needs a target workspace (no app source). Returns 201.
| Name | In | Required | Description |
|---|---|---|---|
name | body | yes | Pipeline name. |
kind | body | no | application (default) | infrastructure. |
appGitConnectionId / appRepo | body | no | Application source (kind application; the connection must be repo_type=application). |
targetWorkspaceId | body | no | Terraform workspace (required for kind infrastructure; optional deploy target for application). |
strategy | body | no | Deploy strategy label (e.g. rolling). |
| Status | When |
|---|---|
400 | Wrong source type for the kind, or a missing required field. |
403 | Role lacks mutate_infra (Viewer). |
404 | Cross-org connection/workspace ids. |
/api/pipelines/{id}/runmutate_infraRun the pipeline. Application: source → build → deploy with per-stage logs. Infrastructure: plan (policy/cost gates — a failure ends the run at the plan stage) → approve (a standard workspace self-approves; a PRODUCTION workspace pauses awaiting a second operator) → apply. Optional { vars } override the plan variables for an infrastructure run.
{ "run": { "id": 9, "number": 2, "state": "running", "awaitingApproval": true, "stages": [ … ] } }| Status | When |
|---|---|
403 | Role lacks mutate_infra. |
404 | No such pipeline in your org. |
/api/pipelines/{id}/runs/{runId}/approvemutate_infra (approver ≠ author on production)Complete a paused production-workspace run: a SECOND operator approves the underlying Terraform run (separation of duties is never bypassed — the plan author gets 403) and the apply proceeds.
| Status | When |
|---|---|
403 | The approver is the plan's author (production), or the role lacks mutate_infra. |
404 | No such pipeline/run in your org. |
GET /api/pipelines/{id} returns the pipeline with its runs and per-stage {seq,level,line} logs; DELETE /api/pipelines/{id} removes it. Audits: pipeline.created/run_started/awaiting_approval/run_succeeded/run_failed/deleted.