launchroom
API and CLI

REST API

Deploy, read status and logs, and manage variables and domains from scripts and CI with team-scoped API tokens that expire.

Everything the CLI does goes through a documented REST API that you can call yourself. It follows the same rules as the dashboard: a token can never do more than the person who created it, and it works inside one team only.

API tokens page: CLI install command and launchroom login, and a GitHub Actions token with read, deploy, env:read and env:write scopes and a Revoke button.API tokens page: CLI install command and launchroom login, and a GitHub Actions token with read, deploy, env:read and env:write scopes and a Revoke button.
Install the CLI, sign in without copying a token, and create scoped tokens for CI.

The reference on your dashboard

Your launchroom serves the full interactive reference at /docs/api on your dashboard (for example https://launchroom.example.com/docs/api) once you're signed in: every operation with its ability, parameters, request and response schemas, and a copyable curl. The raw OpenAPI 3.1 document is public at /api/v1/openapi.json. This page covers what you need to get started.

Tokens

Create a token under Settings → Tokens & CLI (in For you) with Create token.

  • One team. A token acts as you inside the team that was current when you created it. Everything in your other teams answers 404, as if it didn't exist.
  • Access narrows what the token can do. Pick Deploy (the default: read, deploy, env:read, env:write and fix), Read only, Full access or Custom to tick abilities one by one. The effective rights are your role in the team and the token's abilities, whichever is less.
  • Full access gives the token everything your role allows, including permissions launchroom adds in later versions. It never goes beyond your role, and if your role changes, the token follows. Because a full-access token gains new powers when you update launchroom, give CI jobs and AI agents a Custom token (or a robot token limited to one project) with only what they need. GET /me answers fullAccess: true and lists what that means today in abilities.
  • Expiry is mandatory: 7 days, 30 days, 90 days or 1 year. Each option shows the date the token stops working.
  • Shown once. Copy the token when it's shown. launchroom only keeps a hash. Tokens look like <id>|lr_pat_…. In CI, store it as LAUNCHROOM_TOKEN, which the CLI uses without launchroom login.
  • The token list shows each token's hint (its prefix and last four characters, such as lr_pat_…a1b2, so you can match it with the one in your CI settings), its access ("Full access", "Deploy", "Read only" or "Custom, 4 permissions"; a custom token stays custom even when it has every permission today), when and from which IP it was last used, and when it expires. Revoke ends a token at once. Tokens created before hints existed show none.
  • Removing someone from the team deletes their tokens for that team.

Abilities

AbilityAllowsTypical use
readProjects, environments, services, deployments, logs, servers and domains (always on)Status checks
deployDeploy a commit, apply staged changes, redeploy, roll back, cancel; deploy, restart, stop and start a serviceCI deploys
env:readVariable names and non-secret valuesLocal development
env:writeCreate, change and delete variables (staged until the next deploy)launchroom env set
secrets:readSecret values, each read auditedenv pull and run with secrets
domains:writeAdd and remove custom domainsAutomation
data:transferImport into databases and volumes, export and download their data, each auditedlaunchroom db import, db export
runRun one-off commands in a service's live version, follow and cancel them, each auditedlaunchroom exec, migrations in CI
fixApply the fix launchroom suggests for a failed deployment and redeploy. Needs deploy toolaunchroom fix
updateUpdate an app to a newer release launchroom found, after a backup of its data. Needs deploy toolaunchroom updates apply

Deploy grants read, deploy, env:read, env:write and fix (tokens made before fix existed keep their abilities). secrets:read, data:transfer, run and update are opt-in. secrets:read and data:transfer only work for owners and admins, run for people with Console access. No token can manage servers, members, the team, backup settings or open Console and Data sessions.

Actions taken with a token appear in the audit log like the same action in the dashboard, marked as done through that token.

Robot tokens

A personal token stops working when its owner leaves the team. For CI, create a robot token under Settings → Tokens & CLI (in For CI) instead: it belongs to the team and keeps working whoever comes and goes.

  • Owners and admins create, rotate and revoke them. Everyone in the team sees them, with who created each one, when it was last used and from where.
  • Access and expiry work like a personal token's. A robot never gets more than its abilities: it can't manage servers, members or the team. A full-access robot gets later permissions too, still only inside what it Reaches.
  • Reaches limits a robot to All projects, One project, or One service of a project. A limited token answers 403 with the code token_scope for anything outside its project or service, and for team-wide endpoints such as servers. Endpoints that take a service (such as POST /environments/{environment}/deployments or listing deployments) must name the robot's service. Lists only show what it reaches. Each operation in the OpenAPI document says the narrowest reach it serves in x-launchroom-scope (team, project, service, or own for /me). GET /me answers the reach as scope (projectId, projectName, serviceId, serviceName; null when the token reaches every project).
  • Rotate makes a new secret with the same name, access, reach and lifetime. The old one stops at once, so update your CI secret right after.
  • Deployments and audit entries show the robot's name. Creating, rotating and revoking are audited.

Basics

Base URLhttps://<your dashboard>/api/v1
AuthenticationAuthorization: Bearer <token>
FormatJSON in and out. Times are ISO 8601 in UTC
IDsPublic IDs with a prefix: prj_…, env_…, svc_…, dpl_…, var_…, dom_…, srv_…
Single objects{"data": {…}}
Lists{"data": […], "meta": {"nextCursor": "…"}}. Pass ?cursor= for the next page and ?limit= (up to 100)

Check your token and see what it can do:

curl -s https://launchroom.example.com/api/v1/me \
  -H "Authorization: Bearer $LAUNCHROOM_TOKEN"

Errors

Every error has the same shape:

{
  "error": {
    "code": "missing_ability",
    "message": "…",
    "ability": "deploy"
  }
}

Validation errors add fields with messages per field.

CodeStatusMeaning
unauthenticated401No token, an unknown token, or an expired one
forbidden403Your role doesn't allow it
missing_ability403The token lacks the ability named in ability
not_found404Doesn't exist, or belongs to another team
method_not_allowed405Wrong HTTP method
conflict409The current state doesn't allow it
idempotency_key_in_progress409A request with this key is still running
idempotency_key_reused422The key was used for a different request
validation_failed422Invalid input, details in fields
rule_violationvariesA launchroom rule refused it, for example rolling back to a deployment whose image is gone
rate_limited429Too many requests. Wait for Retry-After seconds
server_error500Something went wrong on our side. Safe to retry

Rate limits

LimitValue
Requests per token300 per minute
Changes (POST, PATCH, DELETE) per token60 per minute, on top

Responses carry X-RateLimit-* headers.

Idempotency

Creating requests (deployments, deploys of staged changes, variables, domains, rollbacks, redeploys, and a service's deploy, restart, stop and start) accept an Idempotency-Key header: 1 to 255 characters of letters, digits and _ . : -. Use it in CI so that a retried request never deploys twice:

  • The same key with the same request within 24 hours returns the stored response, with Idempotent-Replayed: true.
  • The same key with a different request is refused with 422 idempotency_key_reused.
  • A retry while the first request still runs gets 409 idempotency_key_in_progress.
  • Server errors (5xx) are not stored, so retrying them is safe.

Deploy a service at a specific commit:

curl -s -X POST https://launchroom.example.com/api/v1/environments/$ENV_ID/deployments \
  -H "Authorization: Bearer $LAUNCHROOM_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: ci-$GITHUB_RUN_ID" \
  -d '{"service": "'"$SERVICE_ID"'", "sha": "'"$GITHUB_SHA"'"}'

The body takes service and one of sha (a full 40-character commit), ref (a branch, main or refs/heads/main) or redeploy: true. Without any of them, the head of the service's tracked branch is deployed. The deployment uses the environment's last applied configuration, the same as a push. Staged changes stay staged. The answer is 202 with the deployment, including its status and dashboardUrl. Poll GET /deployments/{deployment} until finished is true, or follow its logs.

To apply an environment's staged changes instead, POST /environments/{environment}/deploy with an optional message.

Stop, start and restart a service

These are the buttons in the service panel's header (service actions), for one service in one environment. Each needs the deploy ability and your role's deploy permission there, and each is audited.

RequestWhat it doesAnswer
POST /environments/{environment}/services/{service}/deployDeploys the latest version: the latest commit of the tracked branch, or the image tag resolved again. Refused while the service is stopped or has staged changes202 with the deployment
POST …/services/{service}/restartNew containers of the running version, no build, one replica at a time202 with service and deployments
POST …/services/{service}/stopStops its containers. Domains show a stopped page; settings, domains, volumes and deployments stay200 with service and an empty deployments
POST …/services/{service}/startRuns the version that was live when it stopped202 with service and deployments

Restart, stop and start take an optional body {"processes": false} to leave an app's workers and crons as they are. By default they follow the app. A stopped service has status: "stopped" and stoppedAt in GET /environments/{environment}/services/{service}.

curl -s -X POST https://launchroom.example.com/api/v1/environments/$ENV_ID/services/$SERVICE_ID/stop \
  -H "Authorization: Bearer $LAUNCHROOM_TOKEN" \
  -H "Idempotency-Key: stop-$GITHUB_RUN_ID"

Follow logs

Logs stream as server-sent events. A deployment's stream runs until the deployment finishes:

curl -sN https://launchroom.example.com/api/v1/deployments/$DEPLOYMENT_ID/logs/stream \
  -H "Authorization: Bearer $LAUNCHROOM_TOKEN"
EventData
linesNew lines and a cursor. The event id is the cursor
statusThe deployment's status changed
endThe deployment finished with status. The stream closes
reconnectThe stream closes after 5 minutes. Reconnect with Last-Event-ID (or ?after=) and you lose nothing

A : ping comment arrives every 15 seconds. GET /environments/{environment}/logs/stream follows the runtime logs of a whole environment the same way, like Live in the Logs explorer, and GET /environments/{environment}/logs runs a search with range (15m, 1h, 24h, 7d, 30d) or a fixed window (from and to, epoch seconds, within the last 30 days), source (all, runtime, build), service and q. Its markers are the deploys of the window, each with a link to the deployment.

Explain and fix a failed deployment

GET /deployments/{deployment}/failure answers what the deployment's page says when it fails: the outcome (title, message, hint), the explanation of a known failure (cause and fix in plain words), the build's hints, the failingStep with its last lines (excerpt, numbered like the deployment's log, secrets masked, the line that reads like the error marked with error: true) and the fixes.

{
  "data": {
    "title": "Health check timed out",
    "explanation": { "key": "health_not_http", "title": "Your app doesn’t answer HTTP on its port", "cause": "…", "fix": "…" },
    "failingStep": "health",
    "errorLine": 41,
    "fixes": [
      { "code": "use_tcp_healthcheck", "label": "Check over TCP and redeploy", "oneClick": true,
        "command": "launchroom fix use_tcp_healthcheck --deployment dpl_…" }
    ]
  }
}

A fix with oneClick: true is applied with POST /deployments/{deployment}/fixes/{code}. It needs the deploy and fix abilities and your role's right to change the service's settings, the same as Fix and redeploy on the page. Only the fix launchroom suggests for that deployment is accepted. The answer says what happened: deploying (with the new deployment), staged (other changes were staged too, so review and deploy them together) or freeing_disk. Other fixes name the CLI command or dashboard page that applies them.

Previews

GET /projects/{project}/previews?pr=42 returns the preview of pull request 42 (without pr, the newest previews, open ones first): its status, health (building, live, failed, stopped or none), the full headSha, its urls and the current deployment of each service. A preview is ready for a commit when every deployment is finished and built from that commit. launchroom preview wait does this for you in CI.

Decode a ray

POST /traces/decode with {"value": "…"} (the X-Launchroom-Ray header value or the whole header line) returns what the Ray page shows: status, path, the time spent at the edge and in the app, the firewall's decision with its rules, the servers on the way and where the request ended, plus requestId with logsFrom and logsTo to search the service's logs for it. A ray that isn't from one of your team's services gets one answer, whatever the reason.

After a production rollback, auto-deploy is paused. POST /environments/{environment}/auto-deploy/resume (ability deploy) turns it back on.

Run a command

Commands need the run ability and Console access.

RequestWhat it does
GET /environments/{environment}/services/{service}/commandsThe service's listed commands: its framework's and the ones launchroom.json names
POST …/services/{service}/command-runsRuns {"argv": ["php", "artisan", "migrate:status"]} or {"name": "migrate"}, optional timeoutSeconds (10 to 3600). 201 with the run
GET …/services/{service}/command-runsRecent runs, newest first
GET /command-runs/{run}One run: status, exitCode, error, who ran it and when
GET /command-runs/{run}/output/streamThe output as server-sent events: lines, status, then end with the status and exit code
POST /command-runs/{run}/cancelStops it (the container gets 10 seconds to exit)

A run's status is queued, running, succeeded, failed (with exitCode), timed_out, cancelled or error (it couldn't run, error says why). argv runs without a shell.

Update an app

App updates of apps that run an image:

RequestWhat it does
GET /app-updatesApps with a newer release or an update in progress, ?project=prj_… for one project: what runs, the candidates launchroom found (biggest change first), the recommended one, a major with its releaseNotesUrl, the update in progress (run) and why an update can't start now (blocker)
POST /environments/{environment}/services/{service}/updateUpdates to {"tag": "v6.3.0"}, one of the candidates. A major needs "releaseNotesRead": true. 202 with the app's updates and the new run

It needs the deploy and update abilities and your role's right to change the app's settings. The update works like the Update button: a backup of the app's data first, then the new version, and back to the old one if it fails. It's refused while other changes are staged or a deployment is running.

What the API covers

AreaEndpoints
Who am IGET /me
Projects and environmentsList and read projects, their environments and services
ServicesDeploy the latest version, restart, stop, start
DeploymentsList, create, read; redeploy, roll back, cancel; logs and log streams; why one failed and its fix
PreviewsA project's previews, or one pull request's
RaysDecode an X-Launchroom-Ray header
App updatesList available updates, update an app
VariablesList, create, change, delete; read one value; the resolved env of a service (?secrets=1 to include secrets when allowed)
DomainsList, add, remove
ServersList and read
Import and exportUpload a file in parts, start and follow an import, start an export, make a one-use download link
launchroom.jsonExport an environment, validate a file, preview the changes it would make, see the last read

Secret values never appear in lists. They come back as null. Reading one needs secrets:read and is audited.

On this page