API reference
Everything lives under /api/v1 on your dashboard's address and answers in JSON.
Authentication
Create an API token in the dashboard under Settings → Integrations, and send it as a bearer token. It can reach everything in the team that created it, including environment variables, so treat it like a password. Connecting to a database, and deleting or attaching databases and buckets, needs a token from skiff login instead, so a token kept in CI can't reach your data.
A token stops working when the member who made it leaves the team. Members can revoke their own tokens; only an owner can revoke someone else's.
curl https://dash.example.com/api/v1/apps \
-H "Authorization: Bearer $SKIFF_TOKEN"What a token can do
A token can do everything by default. Under Settings → Integrations, Limit what it can do, or to some projects narrows it, which suits CI and agents:
- Read apps, deploys, logs, workers, jobs and runs.
- Deploy and roll back, and open or close previews.
- Environment variables, which hold secrets, to read or change.
- Workers, jobs and runs: change them, and run commands.
- Data: databases, buckets and volumes.
Leaving out environment variables keeps a token from reading them through the API, but not through code it can run. A token that can deploy can ship code, or point an image project at another image, that prints its environment. One that can run commands can run printenv. So give deploy and run rights only where you'd give the app's secrets too.
A token limited to some projects can reach only them and their previews; other projects read as not found. It can't create, remove, attach or detach the team's databases and buckets, since attaching one gives an app its password. A request it can't make is refused with 403 and says why. Only a token that can change jobs sees a job's webhook secret.
Apps
| Method | Path | What it does |
|---|---|---|
| GET | /apps | List the team's apps. |
| GET | /apps/{name} | One app: state, address, replicas and latest commit. |
| GET | /apps/{name}/logs | Recent output from the app and its workers. Add ?lines= up to 2000, or ?follow=1 to stream it as plain text. |
| GET | /apps/{name}/insights | Traffic and uptime. Add ?range= with 1h, 24h or 7d. The default is 24h. |
| GET | /workloads | Everything the team runs, apps, previews, workers and scheduled jobs alike, in one shape: what runs, when, how it's reached, what it can use and where it came from. |
| GET | /metrics | The team's apps in Prometheus's text format, for any monitoring tool to scrape. See Metrics. |
Deploys
| Method | Path | What it does |
|---|---|---|
| POST | /apps/{name}/deploy | Deploy the newest commit. For an image project, send {"image": "..."} to change the image. |
| GET | /apps/{name}/deploys | The app's history, marking which can be rolled back to. |
| POST | /apps/{name}/rollback | Go back to an earlier deploy. Send {"deploy": "<id>"}. |
| GET | /deploys/{id} | A deploy's status: building, live, failed or canceled. |
| GET | /deploys/{id}/log | A deploy's status and the last 200 lines of its build log. |
Previews
| Method | Path | What it does |
|---|---|---|
| POST | /apps/{name}/previews | Create or redeploy a branch's preview. Send {"branch": "feat/login"}. |
| DELETE | /apps/{name}/previews?branch= | Remove a branch's preview. |
Workers
| Method | Path | What it does |
|---|---|---|
| GET | /apps/{name}/workers | List the app's workers, with how many are running. |
| PUT | /apps/{name}/workers/{worker} | Create the worker or change it. Send {"command": "node queue.js", "replicas": 2}. Replicas go from 1 to 10. |
| DELETE | /apps/{name}/workers/{worker} | Stop and remove the worker. |
Scheduled jobs
| Method | Path | What it does |
|---|---|---|
| GET | /apps/{name}/jobs | List the app's jobs, with when each last ran, whether it worked and when it runs next. |
| POST | /apps/{name}/jobs | Add a job. Send {"name": "report", "schedule": "0 3 * * *", "command": "node report.js"}. The schedule uses cron syntax, in the server's time zone. Optional: timeout in seconds (60 to 604800, a week, default 1800), retries (0 to 10), catchUp ("skip" drops runs missed while Skiff was down), webhook (true gives it an address and a signing secret, in the answer) and bucket with prefix (start it for each new file there). The schedule can be left out when there's a webhook or a bucket. |
| POST | /apps/{name}/jobs/{id}/run | Run the job now, once, and wait for it. Answers with ok, its status and its output. |
| GET | /apps/{name}/jobs/{id}/runs | The job's last 50 runs, newest first: trigger, attempt, status (ok, failed, timeout, skipped), exit code, start, finish and the end of its output. |
| DELETE | /apps/{name}/jobs/{id} | Remove the job and its history. |
One-off runs
Run a command once in a fresh container from the app's latest build, with its environment and limits, for migrations, backfills or CI steps. A team can have 3 runs going at once.
| Method | Path | What it does |
|---|---|---|
| POST | /apps/{name}/runs | Start a run and answer straight away with its id. Send {"command": "npm run migrate"}, and optionally timeout in seconds (60 to 604800, a week, default 1800), and isolation: "strong" to run it under gVisor's sandbox. |
| GET | /apps/{name}/runs/{id}/logs | Its output as plain text, streamed as it comes until the run ends. |
| GET | /apps/{name}/runs/{id} | The run: its command, status (running, ok, failed, timeout), exit code and the end of its output. |
| GET | /apps/{name}/runs | The app's last 100 runs, newest first. |
| DELETE | /apps/{name}/runs/{id} | Stop a run that's still going. |
Databases
| Method | Path | What it does |
|---|---|---|
| GET | /databases | List the team's databases: name, engine, state, port and the apps they're attached to. |
| POST | /databases | Create one. Send {"engine": "postgres", "name": "shop-db"}. The engine is postgres, mysql, mongodb or redis. |
| DELETE | /databases/{name} | Delete the database, its data and its backups. Needs a token from skiff login. |
| PUT | /databases/{name}/apps/{app} | Attach it to an app, which gets its address in a variable like DATABASE_URL on the next deploy. Needs a token from skiff login. |
| DELETE | /databases/{name}/apps/{app} | Detach it and remove the variable. Needs a token from skiff login. |
| GET | /databases/{name}/connection?port= | The connection address, including its password, for a tunnel on that local port. Needs a token from skiff login. |
| GET | /databases/{name}/tunnel | A WebSocket carrying one client connection to the database. Needs a token from skiff login. |
Buckets
| Method | Path | What it does |
|---|---|---|
| GET | /buckets | List the team's buckets, with the apps they're attached to. |
| POST | /buckets | Create one. Send {"name": "media"}, at least 3 lowercase letters, numbers or hyphens. |
| DELETE | /buckets/{name} | Delete the bucket and every file in it. Needs a token from skiff login. |
| PUT | /buckets/{name}/apps/{app} | Attach it to an app, which gets S3_ENDPOINT, S3_BUCKET and its keys on the next deploy. Needs a token from skiff login. |
| DELETE | /buckets/{name}/apps/{app} | Detach it and remove those variables. Needs a token from skiff login. |
Volumes
| Method | Path | What it does |
|---|---|---|
| GET | /apps/{name}/volumes | List the app's volumes, with their size. |
| POST | /apps/{name}/volumes | Add one. Send {"name": "data", "path": "/data"}. It's mounted on the next deploy. |
| DELETE | /apps/{name}/volumes/{volume} | Stop mounting it. Its data is deleted after the next deploy. |
Environment variables
| Method | Path | What it does |
|---|---|---|
| GET | /apps/{name}/env | Read the app's variables, including their values. |
| PUT | /apps/{name}/env | Replace all of them. Send {"vars": [{"key": "A", "value": "1", "build": false}]}. They apply on the next deploy. |
Deploying from a script
A deploy starts in the background. Starting one answers 202 with its ID, and you check it until it's no longer building.
curl -X POST https://dash.example.com/api/v1/apps/shop-api/deploy \
-H "Authorization: Bearer $SKIFF_TOKEN"
# {"app":"shop-api","id":"1793677298-2188f1","status":"building","url":"https://shop-api.example.com"}
curl https://dash.example.com/api/v1/deploys/1793677298-2188f1 \
-H "Authorization: Bearer $SKIFF_TOKEN"Errors
Errors answer with a status code and a message, like {"error": "app not found"}. A bad or missing token answers 401. Another team's app answers 404, the same as one that doesn't exist.
On GitHub, the Action does this for you. To let an AI agent use Skiff, see AI agents.