API tokens and CI
An API token lets a script or a CI pipeline use Orbit's API without a person's account, for example to deploy the image a pipeline just built. Each token belongs to a workspace, acts with one role in it, and shows its name in the activity for everything it does.
An AI agent such as Claude Code or Cursor can use a token too: see AI agents (MCP).
Creating a token
- In Settings → API tokens, give the token a name that says where it is used, such as
GitHub Actions, and pick its role and when it expires: in 30 days, 90 days, a year, or never. - Copy the token right away and keep it in your CI's secrets. It starts with
orbit_, it is shown once, and Orbit keeps only a hash of it.
- Who creates tokens: owners and admins, for the admin, developer and viewer roles. Tokens are never owners.
- The list shows each token's role, who created it, when it expires and when it was last used, so a token nobody uses any more is easy to spot.
What a token can do
A token acts like a member with its role, under the same checks. See Members and roles.
- Developer is the role for CI: it deploys and rolls back, but cannot reveal credentials, restore backups or delete anything.
- Viewer fits dashboards and scripts that only read.
- Admin can do everything an admin does in the workspace, so keep it for automation that really needs it.
Some things always need a person signed in to the console, whatever the token's role: managing members and invitations, and creating or revoking tokens. A token gets 403 signInRequired there. Servers, Orbit updates and new workspaces stay with Orbit's administrator, so a token gets 403 administratorRequired for them.
Deploy from GitHub Actions
Every application shows this under its Settings tab, with its own ID and address filled in. Save the token as the ORBIT_TOKEN secret of the repository, then add a step after the image is pushed:
name: Release
on:
push:
branches: [main]
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/build-push-action@v6
with:
push: true
tags: ghcr.io/acme/shop:${{ github.sha }}
- name: Deploy to Orbit
env:
ORBIT_URL: https://orbit.example.com
ORBIT_TOKEN: ${{ secrets.ORBIT_TOKEN }}
run: |
curl -fsSL https://github.com/getcortexlabs/orbit-releases/releases/latest/download/orbit-linux-amd64.tar.gz | tar -xz orbit
./orbit deploy svc_0123456789ab --image ghcr.io/acme/shop:${{ github.sha }}- The image stays in the application's repository. A deploy from CI changes only the tag or the digest, and the new reference becomes the application's image. Another repository answers
422 imageOutsideRepository, so a leaked developer token cannot run someone else's image with your application's variables. An admin moves the application to another repository in its settings. - A private registry needs the registry credential saved on the application, which an admin adds once.
- Applications built from a repository deploy a commit instead:
./orbit deploy svc_0123456789ab --commit "$GITHUB_SHA". Orbit builds that commit of the connected branch, the same way a push would.
orbit deploy
orbit deploy is part of the same orbit binary that runs on your server, from the Linux builds of every release. It reads ORBIT_URL (the console's address) and ORBIT_TOKEN from the environment, starts the deployment and follows it, printing each step and the logs.
| Flag | Does |
|---|---|
--image reference | Deploy this tag or digest of the application's image |
--commit sha | Deploy this commit, for an application built from a repository |
--no-wait | Start the deployment and return without following it |
--timeout 30m | Stop following after this long; the deployment goes on |
--url address | The console's address, instead of ORBIT_URL |
It exits with 0 when the new version is live, and with 1 when the deployment fails, is cancelled or is refused, after printing why. A dropped connection while it starts the deployment is retried with the same idempotency key, so the deployment never starts twice.
With curl
Any HTTP client works. Send the token in the Authorization header and an Idempotency-Key that stays the same if the step is retried:
curl -fsS -X POST "$ORBIT_URL/api/v1/services/svc_0123456789ab/deployments" \
-H "Authorization: Bearer $ORBIT_TOKEN" \
-H "Idempotency-Key: deploy-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" \
-H "Content-Type: application/json" \
-d '{"image":"ghcr.io/acme/shop:'"$GITHUB_SHA"'"}'The answer is 202 Accepted with the operation. Follow it at GET /api/v1/operations/{id} until its phase is succeeded, failed or cancelled.
Revoking and expiry
- Revoking a token in Settings → API tokens stops it at once: its next request gets
401 apiTokenInvalid. - An expired token gets
401 apiTokenExpired. Create a new one and replace the secret in your CI. - Tokens belong to the workspace, not to the person who created them, so they keep working when that person leaves. Review the list when someone leaves, and revoke what they set up if it should stop.