API

API reference

Every endpoint you need to manage apps, deploys, logs, databases and secrets — for CI, scripts, or AI agents.

Base URL & authentication

  • Base URL: https://api.example.com. All app/app routes are tenant-scoped under /tenants/<tenantId>/…
  • Auth: send a personal access token as a bearer header — Authorization: Bearer shpat_… A token acts as you, scoped to your workspace only (no platform-admin routes). The browser console uses a session cookie instead; both resolve to the same permissions.
  • Content type: application/json for request bodies. Responses are JSON; log streams are Server-Sent Events (text/event-stream).

Resolve your IDs first:

GET /auth/me                                  # → memberships[0].tenantId
GET /tenants/<tenantId>/apps              # → app ids
GET /tenants/<tenantId>/apps/<appId>  # → environments[].id
  • Every route is also served under /v1 (https://api.example.com/v1/tenants/…). Use /v1 in scripts: an address under /v1 will not be removed or changed in meaning without notice. When one is replaced, the old one keeps working for a period and answers with Deprecation and Sunset headers naming the date it stops.
  • GET /auth/token — the token you are calling with: { name, prefix, scopes, expiresAt, lastUsedAt, allows: { read, deploy, secrets, everything } }. Never the token itself. Call it first, so a script learns it lacks a scope before it starts rather than halfway through.

Every route, from the server itself

The API describes itself as an OpenAPI 3.1 document at GET /openapi.json (no token needed). It is generated from the server’s own route definitions, so it lists exactly what is live: every route a token can call, its query parameters and request body with required fields and fixed values, the token scopes that may call it (x-token-scopes) and the permission its owner’s role needs (x-required-permissions). Point a client generator or a coding agent at it rather than at this page.

curl -s https://api.example.com/openapi.json

The shape of answers is not in the document yet: read a real answer, or the sections below. The list here is that document, as it is right now. A “?” marks a field that may be left out.

Loading the route list…

Notices — pass them on

  • Some answers carry a "notices" list: things the platform needs the workspace to know and act on. Today there is one kind, old_address_in_use — an app has a new address and its old one, which is retiring, is still being used.
  • Where: the answer to triggering a deploy, GET /tenants/<t>/deployments/<id>, GET /tenants/<t>/apps/<p>, and GET /auth/token (everything outstanding in the workspaces the token can see). The same text is written as the last lines of the deploy log, starting with "NOTICE:".
  • Each notice has code, message (what is the matter and by when), action (exactly what to do), docs, and details { domainId, oldAddress, newAddress, retiresAt, successfulRequests, markedAsMoved, markMoved }.
  • An empty list means there is nothing to tell.
If you are a coding agent or a script acting for someone: whenever an answer or a deploy log carries a notice, tell the person in your reply — the message, the date, and what you propose to do — even when they asked for something else. Do not drop it because the deploy succeeded. Then offer to fix it: search the repository and the app’s variables for the old address, change them to the new one, and list what only they can change (an OAuth provider’s redirect URIs, another team’s webhook). Once nothing uses the old address and the person confirms they have finished, call details.markMoved to say so; a deploy-scope token may.

What each token scope may call

  • Any token, whatever its scope, may call every GET route below. What it sees is limited to the workspaces its owner belongs to, and to what its owner’s role may see.
  • deploy — also: POST …/environments/<e>/deployments, …/pause, …/resume, …/restart, …/promote · POST /deployments/<id>/cancel and /retry · POST /rollback · POST /jobs/<id>/runs · POST /domains/<id>/moved (say an old address is no longer used).
  • secrets — also: create, change and delete under /tenants/<t>/secrets.
  • full — everything its owner may do in the workspace. No token can call platform-administration routes.
  • A request outside the token’s scope is refused with 403 and a sentence naming the scopes the token has.

Apps & configuration

  • GET /tenants/<t>/apps — list apps (supports ?search=&status=&page=).
  • POST /tenants/<t>/apps — create an app { name, type: static|react|node|python, repositoryConnectionId, rootDirectory?, productionBranch?, runsServer?, config? }.
  • A name or slug containing a stage word (staging, stage, stg, preprod, prod, production, dev, develop, development, test, testing, qa, uat) is refused with 400: an app is created once and has an environment per stage. To reach production, deploy or promote to the production environment of the same app — do not create another app.
  • POST /tenants/<t>/apps/detect — inspect a connected repo { repositoryConnectionId, branch?, rootDirectory? } → suggested { type, runsServer, install/build/start, framework, evidence, confidence }.
  • GET /tenants/<t>/apps/<p> — app detail (incl. environments, build + runtime config).
  • PATCH /tenants/<t>/apps/<p> — update name/description/rootDirectory/status.
  • PATCH /tenants/<t>/apps/<p>/build-config — install/build/output/rootDirectory/nodeVersion/packageManager.
  • PATCH /tenants/<t>/apps/<p>/runtime-config — runtimeType (static|node|python)/startCommand/port/healthCheckPath/limits/instances/backgroundWorker (true for an app that serves no requests).

Deployments

  • POST /tenants/<t>/apps/<p>/environments/<e>/deployments — trigger a deploy { branch?, commitSha?, note? }. Returns the deployment (incl. its DEP-#### ref).
  • commitSha deploys exactly that commit instead of the newest one on the branch — use it to ship the commit you tested. Give the full 40-character hash; the commit must be in the connected repository. If it is not, the deploy fails at the first step with "Commit … was not found".
  • POST /tenants/<t>/apps/<p>/environments/<e>/pause — stop the app and show a "paused" page on its addresses; the release is kept. POST …/resume — start it again without rebuilding. Both are safe to repeat.
  • POST /tenants/<t>/apps/<p>/environments/<e>/restart — start the same release in a new container, without rebuilding. The new container takes over only once it passes its health check, so visitors are not cut off; if it never becomes healthy the old one keeps serving and the operation fails. Refused with 409 while the environment is paused (resume it) or a deployment is in progress, and with 400 for a static site (there is no container).
  • POST /tenants/<t>/apps/<p>/environments/<e>/promote { releaseId } — run in environment <e> a release that was already built for another environment of the same app, without rebuilding: the build you tested, not a new one from the same commit. Give the release id of the source environment (its activeRelease.id from GET …/environments/<source>). The files start in a new container with <e>’s own variables and take over once healthy. Answers 202 with { state: "promoting", operationId, deploymentId, releaseId, warnings }.
  • Promote is refused with 400 when the release belongs to another app, was built for this same environment (use rollback), did not build successfully, has had its files cleaned up, or is already what <e> runs; and with 409 while a deployment is in progress there.
  • warnings on a promote names variables that are written into the files at build time (NEXT_PUBLIC_, VITE_, REACT_APP_, NUXT_PUBLIC_, GATSBY_, PUBLIC_, EXPO_PUBLIC_). A promoted build keeps the values the source environment had for those; if they must differ, deploy the environment instead.
  • Pause, resume and restart answer 202 with { state, operationId, deploymentId } when there is work still being done — state is pausing, resuming or restarting — and 200 with state paused or running when there was nothing to do. Follow the operation (below) to learn how it ended.
  • Deployment status is one of: queued, claimed, cloning, installing, building, packaging, publishing, starting_candidate, health_checking, promoting, deploying (in progress) · active, succeeded (done) · failed, cancelled, rolled_back, superseded (ended). Use the same words in ?status=.
  • GET /tenants/<t>/apps/<p>/deployments — list deployments (?environmentId=&status=&page=).
  • GET /tenants/<t>/deployments/<id> — deployment detail (status, error, release, events).
  • GET /tenants/<t>/deployments/<id>/logs?after=<seq> — historical build logs.
  • GET (SSE) /tenants/<t>/deployments/<id>/stream — live build logs + status.
  • POST /tenants/<t>/deployments/<id>/cancel · POST /tenants/<t>/deployments/<id>/retry.
  • POST /tenants/<t>/rollback { releaseId, reason? } — re-activate a previous release (no rebuild).

Operations — did it actually finish?

Some actions are carried out after the request has been answered: pausing, resuming and restarting an environment, stopping and starting a database. They answer 202 with the state they are moving to and an operationId.

  • GET /tenants/<t>/operations/<operationId> — { kind, status, transition, error, deploymentId, createdAt, finishedAt }. status is pending, succeeded or failed; error says why it failed.
  • kind is one of: environment.pause, environment.resume, environment.restart, environment.promote, database.stop, database.start. While pending, transition is pausing, resuming, restarting, promoting, stopping or starting.
  • POST /tenants/<t>/databases/<id>/stop and …/start answer 202 with the database, its status shown as stopping or starting, and an operationId. Reading the database shows the same until the work is done.
  • A resume or restart also carries a deploymentId: its log (GET /deployments/<id>/logs) shows the new container starting and its health check.
  • An operation that has no result after 15 minutes is reported as failed, so a script never waits for ever. A newer action on the same thing replaces one still pending.
Restart and wait for the result
OP=$(curl -s -X POST -H "Authorization: Bearer $SHIPYARD_TOKEN" "$SHIPYARD_API/tenants/<t>/apps/<a>/environments/<e>/restart" | jq -r .operationId)
while :; do
  S=$(curl -s -H "Authorization: Bearer $SHIPYARD_TOKEN" "$SHIPYARD_API/tenants/<t>/operations/$OP")
  [ "$(echo "$S" | jq -r .status)" != pending ] && break
  sleep 5
done
echo "$S" | jq "{status, error}"

Events — why did it restart?

  • GET /tenants/<t>/apps/<p>/environments/<e>/events?since=<ISO time>&limit= — what happened to the environment, newest first. Without since it covers the last 7 days.
  • Each event has: at, type, summary (one plain sentence), actor { type, label } — who or what caused it — restartedApp (did the container stop or get replaced because of this), and details.
  • type is one of: deploy.started, deploy.succeeded, deploy.failed, deploy.cancelled, paused, resumed, restart.requested, promote.requested, container.restarted, secret.changed, settings.changed, platform.service_restarted.
  • container.restarted means the container stopped and was started again automatically, with nobody asking: details carries exitCode and outOfMemory. Out of memory means the app needs a higher memory limit or uses too much; any other exit code is the app’s own crash — read the runtime logs just before that time.
  • platform.service_restarted is the platform updating itself. The app keeps running and is not restarted; in the runtime logs it appears as "[log capture re-attached after a platform service restart …]".
  • secret.changed carries the variable’s name and level, never its value. A changed variable reaches a container only on its next deploy or restart.
Automatic restarts are recorded from the moment this was switched on (containerRestartsRecordedSince in the answer); earlier ones are not known. Everything else — deploys, pauses, variable changes — goes back as far as the audit log does.

Releases, runtime & logs

  • GET /tenants/<t>/apps/<p>/releases?environmentId=<e> — release history (rollback targets).
  • GET /tenants/<t>/apps/<p>/environments/<e> — one environment: branch, autoDeployEnabled, pausedAt and pauseReason, its address, runtime (start command, port, health check, limits) and activeRelease { id, commitSha, deploymentRef, readyAt }.
  • GET /tenants/<t>/apps/<p>/environments/<e>/variables — the NAMES of the variables the next container will be given, never a value. Each has "from" (tenant, app, environment or platform) and "overrides" (where else the name is set and loses). This answers "is the variable missing in production?".
  • GET /tenants/<t>/apps/<p>/environments/<e>/runtime — live URLs, active release, runtime instance, routes, domains.
  • GET /tenants/<t>/apps/<p>/environments/<e>/logs — runtime logs (?tail=&since=&q=&stream=&after=). GET …/requests?days=7 — status codes per day and the most frequent failing requests. Both are described under “Where to see logs”.
  • GET /tenants/<t>/apps/<p>/environments/<e>/metrics?since=24h&step=5m — CPU (percent of one core) and memory (MB) over time: per step the average and the peak. since is 15m, 2h, 7d or an ISO date-time; step is between 30s and 1d and is widened by itself for a long period (the answer says which step was used). A stretch with no container running has no points.
  • GET /tenants/<t>/releases/<releaseId>/runtime-logs?after=<seq> and (SSE) /runtime-logs/stream — Node/Python container logs.
  • GET /tenants/<t>/apps/<p>/environments/<e>/access-logs?after=<id> and (SSE) /access-logs/stream — Static/React access log (4xx/5xx + non-GET).

What a running app is told about itself

  • Every Node or Python container is started with these variables, so an app can report exactly which build it is (for example on its /health route):
  • SHIPYARD_COMMIT_SHA — the commit it was built from.
  • SHIPYARD_RELEASE_ID — the release it is running; the same id the API uses.
  • SHIPYARD_DEPLOYMENT_REF — the deployment that built it, e.g. DEP-1042.
  • SHIPYARD_ENVIRONMENT — the environment’s name, e.g. production.
  • PORT — the port to listen on.
  • These are set by the platform and cannot be replaced by a variable of the same name. A container started before this was introduced gets them at its next deploy. Static and React apps run no process, so they have none.

Usage, activity, projects & jobs

  • GET /tenants/<t>/usage/apps — requests, errors and last-seen per app over 7 days, keyed by app id. Each entry has appId. (It also has environmentId holding the same app id, kept only so older scripts do not break; do not rely on it.)
  • GET /tenants/<t>/usage/traffic?days=14 — requests and errors per app per day. GET /tenants/<t>/usage/idle — what is unused, paused or answering nothing.
  • GET /tenants/<t>/audit-logs — who did what (?action=&resourceType=&resourceId=&actorUserId=&from=&to=&page=). Deploys, pauses, rollbacks and secret changes are all here, with the person or token owner behind each.
  • GET /tenants/<t>/projects — the folders apps, databases and jobs are grouped into.
  • GET /tenants/<t>/jobs · GET /tenants/<t>/jobs/<id> · POST /tenants/<t>/jobs/<id>/runs (start a run now) · GET /tenants/<t>/jobs/<id>/runs.

Secrets, databases, domains & tokens

  • Secrets: GET/POST /tenants/<t>/secrets · PATCH/DELETE /tenants/<t>/secrets/<id> (scope: app, environment, or whole workspace). Listing needs to be told which: ?scopeType=tenant, or ?scopeType=app&scopeId=<appId>, or ?scopeType=environment&scopeId=<environmentId>. Names and dates only; a value is never returned.
  • Managed databases: GET/POST /tenants/<t>/databases · GET /tenants/<t>/databases/<id> · POST .../start|stop|attach · DELETE; backups under .../backups.
  • Which apps use a database: "usedBy" on each database lists every place its connection string was handed to — { scope: app|tenant, appId, appName, key }. (The separate "appId" field is only filled for a SQLite database, which lives inside one app.)
  • Start and stop are carried out in the background: the answer shows the database as it was when you asked. Read GET /tenants/<t>/databases/<id> until "status" becomes stopped or running.
  • Database logs: POST /tenants/<t>/databases/<id>/logs { tail?: 1..5000 } → { requestId }, then GET /tenants/<t>/databases/<id>/logs/<requestId> until it is no longer pending.
  • Custom domains: GET/POST /tenants/<t>/apps/<p>/domains · POST .../<domainId>/verify · DELETE.
  • API tokens: GET/POST /account/api-tokens · DELETE /account/api-tokens/<id> (session-only; manage your own tokens).

Notes & conventions

  • Errors: non-2xx responses carry { statusCode, error, message }. For a request that was filled in wrongly (400), message is a list with one line per problem, each starting with the name of the field; a field that only takes fixed values lists them. A failed deploy also exposes a human-readable error field on GET /deployments/<id> and folds the failing output into the build log.
  • Quotas: deploys are rate-limited per workspace per day (429/403 when exceeded).
  • SSE: connect with EventSource; each message is a JSON frame { type: "log"|"status"|"done", … }. Reconnect from the last seq/cursor.
  • Full deploy walkthrough + troubleshooting: see “Deploy with the API (CLI, CI & AI agents)”.