> automation & ci

Everything for scripting PlanetScale: service tokens as the credential, --format json as the output contract, the raw API escape hatch for endpoints the CLI doesn't wrap, webhooks pushing branch and deploy-request events into your systems, and audit logs for compliance. This is how deploy requests end up created by CI instead of by hand.

// automation & ci

10 commands

// faq

What can a service token actually do?

Only what you grant it. A fresh token has no access — add scoped permissions per database with `pscale service-token add-access <token-id> create_branch read_branch --database <db>`, or org-level grants like create_databases. List a token's grants anytime with show-access, and prefer one narrowly-scoped token per pipeline.

How do I get machine-readable output in scripts?

Every pscale command accepts --format json (or csv). Pipe through jq to extract fields: `pscale branch list mydb --format json | jq -r '.[].name'`. Exit codes are meaningful, so `pscale branch show` doubles as an existence check in shell scripts.

Which events can webhooks notify me about?

Database webhooks fire on branch lifecycle and deploy-request activity — branch ready, deploy request opened, queued, deployed, errored — so you can trigger CI, post to Slack, or auto-run migrations when a branch goes live. Create one with `pscale webhook create --url ... --events ...` and verify delivery with webhook test.