Skip to main content

REST API

The same API serves both sides of Pagifier. Developers validate, deploy, inspect, and approve. Platform engineers manage connections, pipelines, roles, and tokens. RBAC decides which part each token may touch.

All /v1 endpoints except the schema and signed Git webhook receiver require a bearer token. The machine-readable spec lives at docs/api/openapi.yaml in the repository.

Deployments

POST /v1/applications/{app}/environments/{env}/deployments

Multipart upload creating a new immutable release.

FieldRequired
configyesThe project pagifier.yaml
archiveyesapp.zip (sources or prebuilt artifact)
signatureper policycosign sign-blob signature of the archive (base64)

Query wait=true streams NDJSON progress lines until the release is Available or Failed; the final line carries done, success, url, and the build log tail on failure.

Response 201 includes releaseId, the content-addressed image, artifactSha256, statusUrl, and configChanges — a human-readable diff of the resolved configuration versus the active release.

Errors: 400 invalid configuration (with the full problem list), 403 signing policy violations, 409 when the config's ingress (host, path) pair is already owned by another application — the response names the owner (host www.abc.com path / is already owned by acme/frontend in prod).

POST /v1/applications/{app}/environments/{env}/rollback

Points the application at a previous release — no rebuild, the existing image redeploys. Body {"releaseId": "..."} targets a specific release; an empty body targets the most recent superseded one. 409 when the target is already active or not deployable.

Validation & schema

POST /v1/validate

Dry run: resolves the posted pagifier.yaml (raw body or multipart config) against live platform templates. 200 returns {valid: true, resolved: {...}}; 400 returns every problem found.

GET /v1/schema/pagifier.json (public)

JSON Schema for project files — point yaml-language-server at it for editor autocomplete.

Inspection

EndpointReturns
GET /v1/applicationsThe caller's applications with live phase, URL, canary weight, active color
GET /v1/applications/{app}/environments/{env}Full status including the active release's phase, image, message, and build log
GET .../releases?limit=NDeployment history, newest first
GET .../releases/{id}One history record plus live phase
GET .../releases/{id}/configThe fully resolved configuration snapshot
GET .../eventsPlatform audit trail merged with Kubernetes events
GET .../logs?tailLines=NApplication pod logs, plain text

Git delivery

Developer-facing pipeline endpoints:

EndpointPurpose
GET /v1/pipeline-templatesList the installed control-manifest templates
POST /v1/pipeline-templates/{template}/renderRender a commit-ready version 2 pagifier.toml
GET /v1/pipelinesList active Git-observed pipelines
GET /v1/pipelines/{pipeline}Read one resolved pipeline and its manifest commit
GET /v1/pipeline-runs?pipelineId=...List build, approval, and deploy runs
GET /v1/pipeline-runs/{run}Read one run and its approvals
POST /v1/pipeline-runs/{run}/approvalApprove or reject a gated deployment
GET /v1/artifacts/{artifact}Read immutable build artifact metadata

Platform-managed endpoints:

EndpointPurpose
POST /v1/git-connectionsStore an encrypted GitHub, GitLab, or generic provider credential
GET /v1/git-connectionsList connection health without exposing credentials
POST /v1/git-connections/{connection}/testResolve a repository's protected ref
PUT /v1/git-connections/{connection}/credentialRotate the provider and optional webhook secret
POST /v1/pipelinesFetch, validate, snapshot, and activate a control manifest
POST /v1/hooks/git/{tenant}/{connection}Public signed provider webhook receiver

See Deploy from Git for the developer flow and Git integration for provider setup.

Tokens and roles

EndpointPurpose
POST /v1/tokensCreate an expiring token and scoped role bindings; secret returned once
GET /v1/tokensList token metadata, never secrets
DELETE /v1/tokens/{token}Revoke immediately
GET /v1/rolesList built-in and custom roles
PUT /v1/roles/{role}Create or replace a custom role
GET /v1/bindingsList principal bindings

Operational

Endpoint
GET /healthzLiveness
GET /readyzReadiness (checks the store)
GET /metricsPrometheus metrics
GET /consoleThe web console (public page; data calls authenticated)

Authentication

Authorization: Bearer <token>.

Normal tokens are opaque pgf_... credentials backed by a principal, expiry, revocation state, and role bindings. Bindings may target the tenant, one application, repository, application/environment, or infrastructure target. The API checks the required permission and resource scope on every call.

Legacy tokens from PAGIFIER_API_TOKENS remain tenant bootstrap administrators during migration. Invalid or missing tokens get 401; valid tokens outside their allowed scope get 403.