Skip to Content
Docs

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.

shell
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

MethodPathWhat it does
GET/appsList the team's apps.
GET/apps/{name}One app: state, address, replicas and latest commit.
GET/apps/{name}/logsRecent output from the app and its workers. Add ?lines= up to 2000, or ?follow=1 to stream it as plain text.
GET/apps/{name}/insightsTraffic and uptime. Add ?range= with 1h, 24h or 7d. The default is 24h.
GET/workloadsEverything 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/metricsThe team's apps in Prometheus's text format, for any monitoring tool to scrape. See Metrics.

Deploys

MethodPathWhat it does
POST/apps/{name}/deployDeploy the newest commit. For an image project, send {"image": "..."} to change the image.
GET/apps/{name}/deploysThe app's history, marking which can be rolled back to.
POST/apps/{name}/rollbackGo back to an earlier deploy. Send {"deploy": "<id>"}.
GET/deploys/{id}A deploy's status: building, live, failed or canceled.
GET/deploys/{id}/logA deploy's status and the last 200 lines of its build log.

Previews

MethodPathWhat it does
POST/apps/{name}/previewsCreate or redeploy a branch's preview. Send {"branch": "feat/login"}.
DELETE/apps/{name}/previews?branch=Remove a branch's preview.

Workers

MethodPathWhat it does
GET/apps/{name}/workersList 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

MethodPathWhat it does
GET/apps/{name}/jobsList the app's jobs, with when each last ran, whether it worked and when it runs next.
POST/apps/{name}/jobsAdd 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}/runRun the job now, once, and wait for it. Answers with ok, its status and its output.
GET/apps/{name}/jobs/{id}/runsThe 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.

MethodPathWhat it does
POST/apps/{name}/runsStart 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}/logsIts 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}/runsThe app's last 100 runs, newest first.
DELETE/apps/{name}/runs/{id}Stop a run that's still going.

Databases

MethodPathWhat it does
GET/databasesList the team's databases: name, engine, state, port and the apps they're attached to.
POST/databasesCreate 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}/tunnelA WebSocket carrying one client connection to the database. Needs a token from skiff login.

Buckets

MethodPathWhat it does
GET/bucketsList the team's buckets, with the apps they're attached to.
POST/bucketsCreate 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

MethodPathWhat it does
GET/apps/{name}/volumesList the app's volumes, with their size.
POST/apps/{name}/volumesAdd 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

MethodPathWhat it does
GET/apps/{name}/envRead the app's variables, including their values.
PUT/apps/{name}/envReplace 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.

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

On this page