Automate
API, CLI and CI
Unrent’s REST API is https://api.unrent.dev/v1 (OpenAPI 3.1 at https://api.unrent.dev/v1/openapi.json). The unrent CLI signs in with a code you confirm in the console, and GitHub Actions deploy by exchanging the job’s own OIDC token for a ten-minute token, so CI stores no Unrent secret.
Install the CLI on your computer
Run the installer in a terminal on your own computer. The CLI connects to Unrent’s API without SSH or an agent on your computer. macOS, Linux and Windows are available for amd64 and arm64.
curl -fsSL https://get.unrent.dev/install-cli.sh | shOn macOS and Linux, the installer puts unrent in ~/.local/bin. If the command isn’t found, run the line below and add it to your shell startup file to keep it for new terminals.
export PATH="$HOME/.local/bin:$PATH"irm https://get.unrent.dev/install-cli.ps1 | iexOn Windows, open a new PowerShell window after installing.
Sign in and check the connection
unrent loginCompare the terminal code with the one in the browser, choose one organisation, and approve the scopes you need. If the browser doesn’t open, paste the full link printed in the terminal. Use unrent login --no-browser to skip opening it automatically.
unrent whoamiRun unrent logout to sign out, or revoke the session from Settings → Access → Connected apps. Use Automation under Access to manage API tokens and GitHub Actions links.
The CLI covers deploys, logs, variables, database backups and restores, environments, sandboxes and console verification. Add --json to remote commands for machine-readable output.
unrent deploy production/web --image ghcr.io/acme/web:1.4 --wait
unrent logs production/web -fDeploy from GitHub Actions without a secret
- 01
Link the repository
In Settings → Access → Automation, an admin links the repository by its numeric ID to one environment, with the branches or tags allowed to deploy and, optionally, a required GitHub environment.
- 02
Let the job ask for a token
Give the workflow
permissions: id-token: write. - 03
Exchange and deploy
unrent login --github-actions --org <id> --env productionexchanges the job’s GitHub token for an Unrent token that lasts ten minutes and works only in that environment.
Unrent checks GitHub’s signature, issuer, audience, expiry, the repository id (never the name, so a renamed or re-created repository cannot deploy), the branch or tag and the GitHub environment. Each GitHub token is accepted once.
Tokens
| Token | From | Lifetime |
|---|---|---|
OAuth (unr_at_…) | The CLI’s device sign-in, or an app with OAuth 2.1 and PKCE | 1 hour, refreshed. Revoke in Settings → Access → Connected apps. |
CI (unr_ci_…) | GitHub Actions OIDC exchange | 10 minutes, one environment |
Personal (unr_pat_…) | API tokens in Settings → Access → Automation | You choose, at most a year. Pause, roll or revoke it. |
Every token belongs to one organisation and acts with your current role, checked on each request. Scopes: read, deploy (deploy, roll back, variables), operate (restart, stop, start, database backups, drills and restores) and manage (create, change and delete resources, for Terraform and OpenTofu).
Approvals and secrets
A change that needs a passkey (a rollback, restart, config change or delete in an environment with an approval floor, and every destructive job) answers 202 with status: "approval_required", the approve_url and the SHA-256 the approver signs. A deploy of a new image answers 201 first: the server pulls the image, then the deployment waits in pending_approval; GET /orgs/{org}/jobs/{job} gives its approve_url, and unrent deploy … --wait prints it. unrent approve <job> opens that page.
The API never returns a secret value or its ciphertext. unrent env set … --secret seals the value on your machine to the server’s public key before it is sent.
Questions
Is there an OpenAPI document?
Yes: https://api.unrent.dev/v1/openapi.json, OpenAPI 3.1, generated from the same table the API is served from.
Can a CI token reach other environments?
No. It answers 404 for anything outside the environment its repository is linked to, and it cannot list servers.
Is there a rate limit?
Yes: 600 requests per minute per token, then 429 with Retry-After.
Updated . This page as Markdown.