Docs
Open the console →
API reference

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.

GET/api/pipelinesSession

List your org's pipelines with kind, source/target and last-run state.

Example response
json
{ "pipelines": [ { "id": 2, "name": "provision-web-tier", "kind": "infrastructure",
  "targetWorkspaceId": 7, "targetWorkspaceName": "web-tier", "criticality": "production",
  "lastRun": { "number": 1, "state": "succeeded" } } ] }
Errors
StatusWhen
401Not signed in.
POST/api/pipelinesmutate_infra

Create a pipeline. An application pipeline needs an application-type git connection + repo; an infrastructure pipeline needs a target workspace (no app source). Returns 201.

Parameters
NameInRequiredDescription
namebodyyesPipeline name.
kindbodynoapplication (default) | infrastructure.
appGitConnectionId / appRepobodynoApplication source (kind application; the connection must be repo_type=application).
targetWorkspaceIdbodynoTerraform workspace (required for kind infrastructure; optional deploy target for application).
strategybodynoDeploy strategy label (e.g. rolling).
Errors
StatusWhen
400Wrong source type for the kind, or a missing required field.
403Role lacks mutate_infra (Viewer).
404Cross-org connection/workspace ids.
POST/api/pipelines/{id}/runmutate_infra

Run 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.

Example response
json
{ "run": { "id": 9, "number": 2, "state": "running", "awaitingApproval": true, "stages": [ … ] } }
Errors
StatusWhen
403Role lacks mutate_infra.
404No such pipeline in your org.
POST/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.

Errors
StatusWhen
403The approver is the plan's author (production), or the role lacks mutate_infra.
404No 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.