Skip to content

HTTP API

Every route the control plane serves, generated from openapi.yaml — the route list of record. A test fails when the code serves a route the document does not describe, and every host also serves the document itself at /api/openapi.yaml.

Call a route with a bearer token, or run it through the CLI: every route is a pstack api command.

Terminal window
curl -H "Authorization: Bearer $PSTACK_TOKEN" https://api.<domain>/api/deployments
pstack api deployments list

111 routes in 20 groups.

Submit, deploy, tear down, sleep, share and inspect a preview stack.

Every deployment, with its busy/running state.

pstack api deployments list

Forget a deployment. Refused while its containers exist.

pstack api deployments delete --id

One deployment’s meta and spec summary.

pstack api deployments get --id

Submit or replace a deployment. The spec is parsed before it is stored.

pstack api deployments put --id

Stop everything this stack has outstanding — running and queued.

pstack api deployments cancel --id

POST /api/deployments/{id}/containers/{name}/{action}

Section titled “POST /api/deployments/{id}/containers/{name}/{action}”

Start, stop or restart one container.

pstack api deployments containers act --action (start | stop | restart) --id --name

Tear down. Preempts whatever the stack is doing.

pstack api deployments down --force? --forget? --id --verify?

A slice of container logs, redacted.

pstack api deployments logs get --id --service? --tail?

The readiness verdict, optionally waiting for one.

pstack api deployments readiness get --id --refresh? (1) --timeout? --wait?

Containers, routes, findings, the host’s ACME challenge mode, and declaredServices: the services the compose logs to Loki, read from the file. Not on a share link.

pstack api deployments runtime get --id

Mint a read-only link to one deployment.

pstack api deployments share create --id --ttl? --views? (details | logs)

Take the project down, keeping every volume and axis.

pstack api deployments sleep --id

The stored spec and compose file, as submitted.

pstack api deployments source get --id

Each service with a generated host: { service, host, subdomains, from }, subdomains one, any or null, from spec, host or null. Viewer.

pstack api deployments subdomains ls --id

Serve *.<host> for one service with a generated host, stored on this host (a CI redeploy keeps it). Applies on the next deploy. A service the spec sets is 409. Developer.

pstack api deployments subdomains set --depth (one | any | off) --id --service

Deploy. 202 with a job — queued when the stack is busy.

pstack api deployments up --id

Run every assert_gone and report what survived.

pstack api deployments verify --id

Bring a sleeping deployment back.

pstack api deployments wake --id

What the host is doing, or just did. In memory, newest 50.

The last 50 jobs, newest first. In memory — a restart loses them.

pstack api jobs list

One job — state, transcript and outcome.

pstack api jobs get --job-id

Stop one running job. Partial state is left as it is.

pstack api jobs cancel --job-id

Named specs, stored on the host and referenced by a deployment.

Every named spec.

pstack api specs list

pstack api specs delete --name

pstack api specs get --name

pstack api specs put --compose? --description? --name --spec

Traefik’s dynamic-config files, and what it is actually serving.

Traefik’s dynamic-config files.

pstack api routing list

pstack api routing delete --file

pstack api routing get --file

pstack api routing put --content --file

Every router Traefik currently knows about.

pstack api routing live

Stable aliases for a stack: route checkout makes web-<stack>.<domain> also answer on web-checkout.<domain>.

Every route: name, deployment, stack, the alias hosts it serves now, and blocked, each { host, by: { kind, name } } that a deployment (kind deployment) or an earlier route (kind route) serves instead. subdomains is one, any or null. deployment and stack are null when unassigned. Viewer.

pstack api custom-routes list

Create a route, unassigned or assigned to a deployment. Never moves one: an existing name is 409, and force is accepted and ignored. Developer.

pstack api custom-routes create --deployment? --force? --name

Delete a route; it stops serving at once. Developer.

pstack api custom-routes delete --name

DELETE /api/custom-routes/{name}/assignment

Section titled “DELETE /api/custom-routes/{name}/assignment”

Unassign a route. It is kept, serving nothing. Developer.

pstack api custom-routes unassign --name

Point a route at a deployment. Held by another one is 409 with assignedTo, unless force, which moves it in one step. A host something else serves is 409. No redeploy. Developer.

pstack api custom-routes assign --deployment --force? --name

Also serve *.<host> for each host the route mirrors. A host something else serves is 409. No redeploy. Developer.

pstack api custom-routes subdomains --depth (one | any | off) --name

The host’s certificate mode, and the bring-your-own wildcard (dns-persist-01).

The hostnames this host answers on: the primary init rendered, plus any added here. Maintainer.

pstack api tls domains

Replace the additional domains. Each gets control./api. routers and a wake catch-all in Traefik’s watched directory — no re-init, no restart, live in about two seconds. The primary is refused (it already has routers on the container’s labels). Point a deployment at a domain with PREVIEW_DOMAIN in its vars. Maintainer.

pstack api tls domains-set --domains

The host’s certificate mode, derived from its artifacts: dns-persist-01 when a wildcard is stored, else what Traefik’s own flags say. Includes the stored certificate’s public facts — never the key. Maintainer.

pstack api tls status

Redeploy every awake stack so its router labels regenerate for the current mode — the migration loop from the TLS playbook, server-side. Asleep stacks are skipped (their labels regenerate on wake, and a redeploy would BE a wake). Each redeploy queues like any job. Maintainer.

pstack api tls redeploy

Remove the stored wildcard — back to Traefik-native resolution. Stacks deployed under it then have no certificate until redeployed. Admin.

pstack api tls wildcard-remove

Store a wildcard certificate pair and point Traefik at it — enters dns-persist-01 with no init and no restart. The pair is validated (match, dates, covers *.); the key has no read path. Existing stacks need one redeploy (see redeploy). Admin, for blast radius: it changes what every hostname on this host presents.

pstack api tls wildcard-set --cert --key

Loki’s settings: chunks, retention, storage.

Loki’s settings as saved, and the limits pstack enforces. enabled is null when docker did not answer. Never the S3 secret: secretSet only. Maintainer.

pstack api logging get

Retention and chunks, every field. 202 carries the loki-apply job, which restarts Loki. An unchanged body on an idle host is 200 {changed: false}. 409 when Loki is not on this host. Maintainer.

pstack api logging set

Filesystem, or S3 from a future cutover date. One-way: once S3 is saved, only the keys change. The keys are probed with a PUT and a DELETE first. Admin.

pstack api logging storage-set --access-key-id? --bucket? --cutover? --endpoint? --path-style? --region? --secret-access-key? --type (filesystem | s3)

Private-registry logins, used when a deploy pulls.

Private-registry logins. Hostnames only, never a credential.

pstack api registries list

pstack api registries delete --host

pstack api registries put --host --password --username

Webhook and chat notifiers, their deliveries, and redelivery.

pstack api notifiers list

pstack api notifiers create

pstack api notifiers delete --notifier-id

pstack api notifiers get --notifier-id

pstack api notifiers update --notifier-id

GET /api/notifiers/{notifierId}/deliveries

Section titled “GET /api/notifiers/{notifierId}/deliveries”

pstack api notifiers deliveries list --notifier-id

POST /api/notifiers/{notifierId}/deliveries/{deliveryId}/redeliver

Section titled “POST /api/notifiers/{notifierId}/deliveries/{deliveryId}/redeliver”

Send the stored envelope again, byte for byte.

pstack api notifiers deliveries redeliver --delivery-id --notifier-id

Send one delivery now, straight to this notifier. It carries test: true.

pstack api notifiers test --notifier-id

Every event name a notifier may subscribe to, and each type’s config shape.

pstack api notifiers meta

Host variables and secrets, shared by every deployment.

Every host variable. A secret’s NAME, never its value.

pstack api host-vars list

pstack api host-vars delete --name

pstack api host-vars put --name --secret? --value

Accounts, roles and passwords.

Who this credential is, and at what role.

pstack api users me

pstack api users list

Admin only. An absent role means the host’s default_role.

pstack api users create --email? --password --role? (viewer | developer | maintainer | admin) --username

Admin only. Refused on the last user and the last admin.

pstack api users delete --user-id

Admin only. Refused on demoting the last admin.

pstack api users set-role --role (viewer | developer | maintainer | admin) --user-id

Your own at any role; anybody else’s is admin only. Revokes their sessions.

pstack api users password set --password --user-id

Personal API tokens.

Your personal API tokens. Hashes are never returned.

pstack api tokens list

Mint one. The token itself appears in this response and nowhere else, ever.

pstack api tokens create --name? --ttl?

pstack api tokens delete --token-id

The host settings changeable at runtime, without a restart: the job cap, the default role, the node pressure thresholds and the image prune age.

Every runtime setting, resolved, each saying which layer it came from.

pstack api settings list

The role an account gets when nothing names one. Admin only.

pstack api settings set-default-role --value (viewer | developer | maintainer | admin)

Hours an unused image is kept before the prune removes it. Admin only.

pstack api settings set-image-prune-after-h --value

How many jobs run at once, host-wide. Maintainer. In force immediately: raising it dispatches what was waiting, lowering it cancels nothing.

pstack api settings set-max-jobs --value

5-minute load per core that puts a node in pressure. Admin only.

pstack api settings set-pressure-cpu-load --value

Disk used % that puts a node in pressure. Admin only.

pstack api settings set-pressure-disk-pct --value

Available memory % at or below which a node is in pressure. Admin only.

pstack api settings set-pressure-mem-pct --value

Minutes a stack sits idle before pressure may sleep it. Admin only.

pstack api settings set-pressure-sleep-idle-min --value

Single sign-on providers.

Forget the only provider. Accounts it created stay.

pstack api sso config delete

Every provider, the callback URL to paste, and the presets. Never a client secret.

pstack api sso config get

Create or replace one provider. Admin only.

pstack api sso config put

pstack api sso provider delete --key

The swarm, and what a new worker runs to join it.

What the swarm looks like now — every node with its task count, and every task docker would not place.

pstack api swarm signals

The swarm’s nodes and the manager address. Never the join token.

pstack api swarm get

What a new worker runs. THE OUTPUT IS A SECRET — every shape embeds the join token.

pstack api swarm join --distro? --format? (token | command | script | cloud-config)

Forget a node whose machine is gone. Refused unless docker reports it down and drained.

pstack api swarm node-remove --id

Take a node out of the running — swarm stops placing work on it and moves what is there. Refused (409) for the manager the API runs on; use POST /api/swarm/previews/workers.

pstack api swarm node-drain --id

Put a drained node back into the running.

pstack api swarm node-undrain --id

Where previews run. workers labels this manager pstack.previews=off, which every preview’s placement excludes; any labels it on.

pstack api swarm previews --where (workers | any)

The whole portable configuration: export it, apply one.

THE WHOLE PORTABLE CONFIGURATION IN PLAINTEXT: password hashes, token hashes, host secrets. Root token only, and it emits an event.

pstack api config export

Apply such a document, create-or-skip. It can add but never repoint.

pstack api config import

Apply a sealed export, unsealed with a passphrase. Admin only.

pstack api config import-sealed

Where this host forwards deploys and unserved visitors, while it is being retired.

Stop forwarding. Applies to the next request. Admin.

pstack api forward off

Where this host forwards deploys and unserved visitors: { to, via, establishedAt, lastOkAt }, or null when off. Never the token. Maintainer.

pstack api forward get

Forward to another pstack (B). Checked first: B’s GET /api/auth/me answers 200 for the token, which is not root and is developer or higher; to is not this host’s own API (unless via is given). Any failure is a 400 naming the check, and nothing is saved. Admin: it decides where every deploy runs.

pstack api forward set --to --token --via?

The worker scaler: its settings, credential keys, Tofu presets and last report.

The scaler settings, credential keys as { KEY: true } (never a value), the last report or null, and enabled (true/false, null when docker did not answer). Maintainer.

pstack api scaler get

Replace the scaler settings. Absent fields take the defaults (min 0, max 3, cooldownMin 5, graceMin 15). A credential sent empty, omitted or as the mask keeps its value; null deletes it. 409 while the scaler owns workers and the change differs from the locked preset or shared vars, or deletes a credential. Admin.

pstack api scaler set

Everything the scaler needs: settings, credential values and the preset’s files. Root only (PSTACK_TOKEN), never an admin session.

pstack api scaler config

Every preset, built-in and custom: [{ name, builtin, preset, locked }]. Maintainer.

pstack api scaler presets

Delete a custom preset. 409 on the locked preset. Admin.

pstack api scaler preset-delete --name

One preset with its files: { name, builtin, files, preset, locked }. Maintainer.

pstack api scaler preset --name

Store a custom preset: main.tf (more .tf files allowed) and an optional .terraform.lock.hcl. Built-ins are read-only. 409 on the locked preset unless the files are unchanged. Admin.

pstack api scaler preset-set --name

The scaler’s status, and at most one scaler.* event to emit. Owned workers and the locked config are stored; the rest is kept in memory. Root only.

pstack api scaler report

The host itself — health, the control stack, terminal history, the probe.

The control stack’s own containers. Read-only, never actionable.

pstack api host control

Restart one control service by name (from control-runtime). pstack itself is always refused — it is the container answering this request. Restarting traefik severs in-flight connections for a few seconds, this response possibly included. Maintainer.

pstack api host control-restart --service

The control stack as an operator debugs it: per container, restart count, OOM-killed flag and memory limit beside the usual state. A restarting Traefik silently loses in-flight certificate issuance — this page is where that stops being invisible. Maintainer.

pstack api host control-runtime

Liveness, whether auth is enforced, whether any account exists, and the version. No token needed.

pstack api host health

This document as JSON, key order preserved. No token needed.

pstack api host openapi-json

This document, byte for byte. No token needed.

pstack api host openapi

Is this preview serving? No token, no body — the answer is the status code and x-pstack-probe.

pstack api host probe --id --service?

Who opened a container shell, when, and against what.

pstack api host terminal-sessions

What each node’s pstack-agent last reported, and the stacks using it. In memory; unknown values are null.

Each node’s disk, memory and load from its agent, an hour of samples, and CPU and memory per stack. Unknown is null.

pstack api stats get