---
url: https://docs.zenavo.app/api/overview
---

# REST API

The console is built on a JSON REST API at `https://zenavo.app/api`. Anything you can do in the console, you can do with it.

`GET https://zenavo.app/api/` needs no key: it returns the API's name, its base URL, links to these docs and the health check, and how to authenticate.

## Authentication

Send an [API key](https://docs.zenavo.app/account/api-keys) as a bearer token:

```sh
curl -H "Authorization: Bearer $ZENAVO_API_KEY" https://zenavo.app/api/auth/me
```

A key's [permission](https://docs.zenavo.app/account/api-keys#permissions) and [project limit](https://docs.zenavo.app/account/api-keys#limit-a-key-to-some-projects) decide which endpoints it may call; others answer `403`. Billing, team membership and `/api/account/*` are for browser sessions only.

Requests from a browser session also need the header `X-Zenavo-Request: 1` on anything other than `GET`; requests with a bearer token do not.

Requests need only a valid session or API key with the right role; no action asks for a second confirmation. Accounts that have not [verified their email](https://docs.zenavo.app/account/account#verify-your-email) get 403 with `{"email_unverified": true}` on changes outside their own account.

## Conventions

- Bodies are JSON. Times are Unix seconds.
- IDs are prefixed: `team_`, `srv_`, `proj_`, `job_`, `bak_`, `tok_`.
- Errors return a status code and `{"detail": …}`. Validation errors (422) list each field.
- When the team's plan does not include a feature, creating or turning on what it covers returns 402 with `{"detail": …, "plan_required": {"feature": "log_drains", "required_plan": "pro", "required_plan_name": "Pro", "plan": "free", "plan_name": "Free"}}`. Listing, changing, turning off and deleting what the team already has do not need the plan.
- Long operations (deploy, restart, backup) return a job: `{"id": "job_…"}`. Poll `GET /api/jobs/{id}` for `status` (`queued`, `running`, `succeeded`, `failed`, `cancelled`), `log` and per-service `progress`.

## Endpoints

### Account

| Method | Path | |
|---|---|---|
| `GET` | `/api/auth/me` | The signed-in user, their teams and `email_verified` |
| `PATCH` | `/api/account` | Name and avatar |
| `POST` | `/api/account/avatar` | Upload a profile picture (image as the request body, up to 512 KB). Browser session only |
| `GET` `POST` | `/api/account/tokens` | List or create API keys (browser session only). Create with `{name, days, scope, project_ids}`: `scope` is `read`, `deploy` or `full` (the default); `project_ids` limits the key to those projects (omit or `null` for all) |
| `DELETE` | `/api/account/tokens/{id}` | Delete an API key |
| `GET` | `/api/account/sessions` | Signed-in sessions |
| `POST` | `/api/auth/2fa` | Second sign-in step: `{code}` after `/api/auth/login` answered `{two_factor: true}` |
| `POST` | `/api/account/verify` | Confirm it's you: `{code}` with two-factor authentication, else `{password}`. No action requires it at the moment |
| `POST` | `/api/auth/verify-email` | Open an email verification link: `{token}` (works once, for 24 hours) |
| `POST` | `/api/account/email/verify` | Send a new verification link; `{verified: true}` when the address is verified already |
| `GET` | `/api/account/2fa` | Two-factor status: `enabled` (app or passkey), `totp`, recovery codes left, passkey count |
| `POST` | `/api/account/2fa/setup` `/enable` `/disable` `/recovery-codes` | Manage two-factor authentication (browser session only) |
| `POST` | `/api/auth/2fa/passkey/options` then `/api/auth/2fa/passkey` | Second sign-in step with a passkey: WebAuthn request options (`{options: null}` without passkeys) and whether the account has an authenticator app (`totp`), then `{credential}` |
| `GET` | `/api/account/passkeys` | Your passkeys: name, AAGUID, synced, created, last used |
| `POST` | `/api/account/passkeys/options` then `/api/account/passkeys` | Register a passkey: creation options, then `{name, credential}` (the account's first second factor also returns `recovery_codes`) |
| `DELETE` | `/api/account/passkeys/{id}` | Remove a passkey (removing the last second factor turns two-factor authentication off) |
| `GET` | `/api/account/audit?before=&limit=` | Your own security activity |
| `POST` | `/api/auth/device/code` | Start a CLI sign-in (device flow): `{client_name, scope, client}` → `{device_code, user_code, verification_uri, expires_in, interval}`. `scope` defaults to `full`; `client` is `cli` (default) or `mcp`, and names the key "CLI on …" or "MCP on …" |
| `POST` | `/api/auth/device/token` | Poll with `{device_code}`: 202 while waiting, 429 if polled faster than `interval`, 200 `{token, scope, project_ids}` once approved (the approver may have narrowed the scope) |

### Teams

| Method | Path | |
|---|---|---|
| `GET` `POST` | `/api/teams` | List or create teams |
| `PATCH` | `/api/teams/{tid}` | Rename |
| `GET` | `/api/teams/{tid}/members` | Members |
| `PATCH` `DELETE` | `/api/teams/{tid}/members/{uid}` | Change a role, remove a member |
| `GET` `POST` | `/api/teams/{tid}/invites` | Invitations |
| `DELETE` | `/api/teams/{tid}/invites/{iid}` | Revoke an invitation (admins, browser sessions only) |
| `POST` | `/api/teams/{tid}/invites/{iid}/resend` | Email a new link valid for 7 more days; the old link stops working (admins; an owner's invitation, owners only; browser sessions only) |
| `GET` | `/api/account/invites` | Invitations to your own address, once it is verified (browser sessions only) |
| `POST` `DELETE` | `/api/account/invites/{id}`, `…/{id}/accept` | Accept or decline one of them (browser sessions only) |
| `GET` | `/api/teams/{tid}/audit?before=&limit=` | [Audit log](https://docs.zenavo.app/account/audit-log) (admins) |
| `GET` `POST` | `/api/teams/{tid}/notification-channels` | [Notification channels](https://docs.zenavo.app/operations/notifications#channels) (admins). Create with `{kind, name, events, url}` (Slack, Discord, webhook) or `{kind: "telegram", name, events, bot_token, chat_id}`; a webhook's `secret` is returned once |
| `PATCH` `DELETE` | `/api/teams/{tid}/notification-channels/{cid}` | Change `name`, `events`, `enabled` or the destination; remove |
| `POST` | `/api/teams/{tid}/notification-channels/{cid}/test` | Send a test message now |
| `POST` | `/api/teams/{tid}/notification-channels/{cid}/secret` | A webhook's new signing secret (returned once) |
| `GET` `POST` | `/api/teams/{tid}/log-drains` | [Log drains](https://docs.zenavo.app/operations/log-drains) (admins; creating needs the Pro plan or up). Create with `{kind: "http", name, url}`, `{kind: "datadog", name, site, api_key}` or `{kind: "loki", name, url, username, password, tenant_id}`, plus `projects` (empty for all); an HTTP drain's `secret` is returned once |
| `PATCH` `DELETE` | `/api/teams/{tid}/log-drains/{did}` | Change `name`, `projects`, `enabled` or the destination; remove |
| `POST` | `/api/teams/{tid}/log-drains/{did}/test` | Send a test line now |
| `POST` | `/api/teams/{tid}/log-drains/{did}/secret` | An HTTP drain's new signing secret (returned once) |
| `GET` `POST` | `/api/teams/{tid}/alert-rules` | [Alert rules](https://docs.zenavo.app/operations/alert-rules) (admins; creating needs the Pro plan or up) |
| `PATCH` `DELETE` | `/api/teams/{tid}/alert-rules/{rid}` | Change a rule or `enabled`; remove |

### Usage and billing

| Method | Path | |
|---|---|---|
| `GET` | `/api/teams/{tid}/usage?period=YYYY-MM` | Plan limits, servers, members, build minutes by project, service and day |
| `GET` | `/api/teams/{tid}/usage/builds.csv?period=` | Every metered build of a month, as CSV |
| `GET` | `/api/teams/{tid}/transfer` | [Image transfer](https://docs.zenavo.app/account/image-transfer) this period: `bytes`, `included_bytes`, `overage_cents`, `limit_cents`, `blocked`, `percent` and the period's start and end |
| `GET` | `/api/teams/{tid}/billing` | Plan, subscription state, seats and the plan catalog (admins) |
| `GET` | `/api/teams/{tid}/billing/invoices` | Recent invoices with Stripe's page and PDF links (admins) |
| `POST` | `/api/teams/{tid}/billing/checkout` | Start a subscription: `{plan}` → `{url}` of Stripe Checkout (owners) |
| `POST` | `/api/teams/{tid}/billing/change` | Switch a subscription to another plan: `{plan}` (owners) |
| `POST` | `/api/teams/{tid}/billing/cancel` `/resume` | Cancel at the end of the period, or undo it (owners) |
| `PUT` | `/api/teams/{tid}/billing/spend-limit` | Set the [spending limit](https://docs.zenavo.app/account/image-transfer#spending-limit): `{cents}`, 0 to 1,000,000 (owners) |
| `POST` | `/api/teams/{tid}/billing/portal` | `{url}` of Stripe's Customer Portal for cards, billing details and invoices (owners) |

### Servers

| Method | Path | |
|---|---|---|
| `GET` | `/api/servers?team_id=` | List servers |
| `POST` | `/api/servers?team_id=` | Add a server: `{name, host, port, user, password \| private_key}` |
| `GET` `PATCH` | `/api/servers/{sid}` | Read, rename |
| `POST` | `/api/servers/{sid}/bootstrap` | Run setup again: `{password \| private_key}`, or an empty body within a day of a failed setup to reuse the credentials it kept |
| `GET` | `/api/servers/{sid}/usage?hours=` | CPU, memory and disk history |
| `GET` | `/api/servers/{sid}/system` | Platform components |
| `GET` | `/api/servers/{sid}/ports` | Port checks |
| `GET` | `/api/servers/{sid}/jobs` | Setup and other jobs |
| `POST` | `/api/servers/{sid}/delete` | Remove: `{confirmation: "<server name>"}` |
| `POST` | `/api/servers/{sid}/reinstall` | Uninstall K3s and set the server up from scratch: `{confirmation: "<server name>", password \| private_key}` (admins; the server must host no projects). Answers with the server, whose setup is queued |
| `GET` | `/api/servers/{sid}/ssh-logins?hours=&failed=` | [SSH login history](https://docs.zenavo.app/servers/agent#ssh-login-history) (members) |
| `POST` | `/api/servers/{sid}/agent` | Move a server added before the agent to it (admins) |
| `POST` | `/api/servers/{sid}/agent/update` | [Update the agent](https://docs.zenavo.app/servers/agent#update-the-agent) (admins; returns a job) |
| `GET` | `/api/servers/{sid}/firewall` | The ports to open in your provider's firewall for the server (members) |

### Projects

| Method | Path | |
|---|---|---|
| `GET` | `/api/projects?team_id=` | List projects |
| `GET` | `/api/projects?shared=true` | Projects shared with you from teams you are not in. Each project carries your `role`, and `shared` (with `team_name` and `server`) when it comes from another team |
| `POST` | `/api/projects` | Create: `{team_id, server_id, manifest}` |
| `GET` | `/api/projects/{pid}` | Summary, services and status |
| `GET` | `/api/projects/{pid}/manifest` | The full configuration, with variables |
| `PUT` | `/api/projects/{pid}` | Save the configuration: `{manifest, server_id, revision}` |
| `PUT` | `/api/projects/{pid}/icon` | Set the [project logo](https://docs.zenavo.app/operations/project-settings#project-logo): `{icon}`, a built-in icon key, an uploaded `custom:<id>` from `POST /api/icons`, or `""` for automatic |
| `PUT` | `/api/projects/{pid}/star` | Star the project for yourself (any role that can open it; an access token needs the `deploy` scope); lists then carry `starred: true` on it. `DELETE` the same path removes the star. Both can be repeated |
| `POST` | `/api/projects/{pid}/deploy` | Deploy all services (returns a job). While the project is busy the deploy is queued: the answer adds `behind` (`{id, kind}`, the job it waits for), and `coalesced: true` when it joined a deploy already queued |
| `POST` | `/api/projects/{pid}/deployments/{job}/cancel` | Cancel a deploy that has not started (`status` becomes `cancelled`) |
| `POST` | `/api/projects/{pid}/rollback` | `{target_job}` |
| `POST` | `/api/projects/{pid}/services/{service}/rollback` | `{target_job}`: return one service to that deployment; the others stay as deployed (returns a job) |
| `POST` | `/api/projects/{pid}/restart` `/stop` | Restart or stop every service |
| `GET` | `/api/projects/{pid}/runtime` | Live state of each service |
| `POST` | `/api/projects/{pid}/clone` `/transfer` | [Copy](https://docs.zenavo.app/operations/project-settings#clone-a-project): `{name, team_id, server_id}`; or move a never-deployed project to another team: `{team_id, server_id}` (admins of both teams) |
| `GET` `POST` | `/api/projects/{pid}/collaborators` | [Collaborators](https://docs.zenavo.app/operations/project-settings#collaborators) and, for admins, pending invitations; add one: `{email, role}` (admins, browser sessions only) |
| `PATCH` `DELETE` | `/api/projects/{pid}/collaborators/{uid}` | Change a collaborator's role (`{role}`) or remove them (admins; a collaborator may remove themselves; browser sessions only) |
| `DELETE` | `/api/projects/{pid}/invites/{iid}` | Revoke a pending invitation (admins, browser sessions only) |
| `POST` | `/api/projects/{pid}/invites/{iid}/resend` | Email a new link valid for 7 more days (admins, browser sessions only) |
| `GET` | `/api/projects/{pid}/move` | The latest [move to another server](https://docs.zenavo.app/operations/move-project) |
| `GET` | `/api/projects/{pid}/move/preflight?server_id=&team_id=` | Check a move without changing anything (admins) |
| `POST` | `/api/projects/{pid}/move` | Move, with its data, to another server of the team, or of another team you administer to [transfer it](https://docs.zenavo.app/operations/move-project#move-to-another-team): `{server_id, team_id, confirmation: "<project name>"}` (admins; returns a job) |
| `POST` | `/api/projects/{pid}/move/finish` `/move/rollback` | Delete the old copy, or return to the old server (admins; returns a job) |
| `POST` | `/api/projects/{pid}/delete` | `{confirmation: "<project name>"}` |
| `PUT` | `/api/projects/{pid}/checklist` | The [migration checklist](https://docs.zenavo.app/operations/project-settings#advanced): `{source_backup, data_restored, application_verified, dns_switched, rollback_ready}`, each `true` or `false` (members) |

### Services

`{service}` is the [service ID](https://docs.zenavo.app/networking/private#service-ids); its current name also works. In a project's configuration each service has an `id` and an optional `hostname`; leave both out for a new service and Zenavo gives it a random `svc-…` id and a hostname made from the name. A service's optional `icon` is one of the built-in keys the console draws, such as `nodejs`, `php` or `postgresql` (`zenavo service icon --list` lists them); anything else, a URL included, is refused. Without one the console infers it from the image, and the project's `services` list carries the icon it shows.

| Method | Path | |
|---|---|---|
| `POST` | `/api/projects/{pid}/services/{service}/deploy` | Deploy this service only; the others stay as deployed (returns a job) |
| `PUT` | `/api/projects/{pid}/services/{service}/source?create=&port=&deploy=&acknowledge_init=` | Upload a gzip-compressed tar of a directory (up to 500 MB) as the service's [source](https://docs.zenavo.app/deploy/local-directory) and deploy it (returns `{upload_id, service, created, job}`); `create=1` adds a missing service, `deploy=0` only stores it |
| `POST` | `/api/projects/{pid}/services/{service}/restart` `/suspend` `/resume` | |
| `POST` | `/api/projects/{pid}/services/{service}/exec` | Run a command in the container |
| `GET` | `/api/projects/{pid}/services/{service}/terminal` | WebSocket: an interactive [terminal](https://docs.zenavo.app/operations/terminal) (members). Binary frames carry input and output; text frames carry JSON: `{"type":"resize","cols","rows"}` from the client, `{"type":"exit","code"}` or `{"type":"error","message"}` from the server. Browsers must send the console's `Origin` |
| `GET` | `/api/projects/{pid}/services/{service}/files?path=` | List a folder in the container (members) |
| `GET` | `/api/projects/{pid}/services/{service}/files/content?path=` | First 256 KB of a file, as text |
| `GET` | `/api/projects/{pid}/services/{service}/files/download?path=` | Download a file (up to 500 MB) |
| `PUT` | `/api/projects/{pid}/services/{service}/files/upload?dir=&name=` | Upload the raw body (up to 50 MB, `Content-Length` required); `&overwrite=1` replaces |
| `POST` | `/api/projects/{pid}/services/{service}/files/mkdir` | Create a folder: `{"path"}` |
| `POST` | `/api/projects/{pid}/services/{service}/files/rename` | Rename in place: `{"path", "name"}` |
| `POST` | `/api/projects/{pid}/services/{service}/files/delete` | Delete a file or folder: `{"path"}` |
| `GET` | `/api/projects/{pid}/services/{service}/usage?hours=` | CPU and memory history |
| `GET` | `/api/projects/{pid}/logs/{service}` | Recent runtime logs |
| `GET` | `/api/projects/{pid}/logs/{service}/stream` | Live runtime logs (Server-Sent Events) |
| `GET` | `/api/projects/{pid}/logs/{service}/history?from=&to=&q=&cursor=&limit=` | Stored runtime logs, oldest first: lines containing `q` (any case) between `from` and `to` (RFC 3339 or Unix seconds; default the last hour). Pass `next` back as `cursor` for more |
| `GET` | `/api/projects/{pid}/logs/{service}/download?from=&to=&q=` | Stored runtime logs of a range as a text file |
| `GET` | `/api/projects/{pid}/log-search?from=&to=&q=&regex=1&exclude=&services=&cursor=` | [Search the stored logs of several services](https://docs.zenavo.app/operations/logs#project-log-search), merged in time order (Pro plan and up) |
| `POST` | `/api/projects/{pid}/services/{service}/domains` | Generate a domain |
| `DELETE` | `/api/projects/{pid}/domains/{domain}` | Remove a generated domain |
| `GET` | `/api/projects/{pid}/domains/access` | [IP rules](https://docs.zenavo.app/networking/domains#ip-access) |
| `PUT` | `/api/projects/{pid}/domains/{domain}/access` | `{"mode": "allow" or "deny", "sources": [...]}` |
| `DELETE` | `/api/projects/{pid}/domains/{domain}/access` | [IP rules](https://docs.zenavo.app/networking/domains#ip-access) |
| `POST` | `/api/projects/{pid}/gateway` | [Project gateway](https://docs.zenavo.app/networking/domains#ip-access) |
| `DELETE` | `/api/projects/{pid}/gateway` | [Project gateway](https://docs.zenavo.app/networking/domains#ip-access) |

### Database view

The [database view](https://docs.zenavo.app/deploy/databases#database-view) of a database service. Members may read; writes need a team admin. Each request runs inside the database container and is recorded in the audit log without its SQL, keys, values or documents. `…` is `/api/projects/{pid}/services/{service}`.

| Method | Path | |
|---|---|---|
| `GET` | `…/database/tables` | PostgreSQL, MySQL, MariaDB: tables and views, with estimated rows and columns |
| `GET` | `…/database/rows?schema=&table=&offset=&limit=` | A page of a table's rows |
| `POST` | `…/database/query` | Run one SQL statement: `{sql, allow_writes, max_rows}`. Read-only unless `allow_writes` (admins) |
| `GET` | `…/database/info` | Redis, Valkey: the server summary from `INFO`: version, memory, clients, keys per database |
| `POST` | `…/database/keys` | Redis, Valkey: list keys with `SCAN`: `{db, match, cursor, count}` |
| `POST` | `…/database/key` | One key's value: `{db, key, cursor, count}`, or `key_b64` for keys that are not UTF-8 |
| `POST` | `…/database/command` | Run one command: `{db, command, allow_writes}`. Read commands only unless `allow_writes` (admins) |
| `GET` | `…/database/collections` | MongoDB: databases and collections, with estimated document counts |
| `POST` | `…/database/find` | Find documents: `{db, collection, filter, sort, projection, skip, limit}`, all JSON strings; 50 a page by default |
| `POST` | `…/database/document` | Change one document: `{op, db, collection, filter, update, document}`, with `op` `insert`, `update` or `delete` (admins) |

### Backups

| Method | Path | |
|---|---|---|
| `GET` | `/api/backups?project_id=` | List backups |
| `POST` | `/api/projects/{pid}/backups` | Back up a service: `{service, engine}` |
| `GET` | `/api/backups/{bid}/download` | Download |
| `POST` | `/api/backups/{bid}/restore` | Restore: `{confirmation}`, as typed in the console |
| `POST` | `/api/projects/{pid}/jobs/{job}/cancel` | Cancel a queued or running backup or restore (members); a cancelled restore may have applied part of the dump |

### Removed services

| Method | Path | |
|---|---|---|
| `GET` | `/api/projects/{pid}/removed-services` | Removed services whose data is not deleted yet: `state` (`pending`, `purging`, `leftover`), `purge_after`, volumes, generated domains, backups |
| `POST` | `/api/projects/{pid}/removed-services/{service}/purge` | Delete a removed service's data now (admin, full token): `{confirmation}`, the service name. Returns the purge job |

### Git and GitHub

| Method | Path | |
|---|---|---|
| `POST` | `/api/git/refs` | Branches and tags of a public repository: `{url}` |
| `POST` | `/api/git/plan` | Build plan preview: `{team_id, url, ref, context}` |
| `GET` | `/api/github/repos?team_id=` | Repositories the team's GitHub installations can read |
| `GET` | `/api/github/branches?team_id=&repo=` | Branches of one of them |

### Images and domains

| Method | Path | |
|---|---|---|
| `GET` | `/api/images/ports?team_id=&image=` | The ports a public image `EXPOSE`s, read from its registry without pulling it |
| `GET` | `/api/images/mirror?image=` | Whether Zenavo's mirror for mainland China holds an image, and its address there |
| `GET` | `/api/images/mirror/search?q=` | Images the mirror holds whose name contains `q` |
| `GET` | `/api/domains/available?name=` | Whether a [generated domain](https://docs.zenavo.app/networking/domains#generated-domains) name is free: `{available, reason}` |

### Templates

| Method | Path | |
|---|---|---|
| `GET` | `/api/templates` | The [template gallery](https://docs.zenavo.app/deploy/templates) (public, no key needed) |
| `GET` | `/api/templates/{code}` | One template and its manifest (public) |
| `POST` | `/api/imports/preview` | Check a Zeabur template or Zenavo export: `{text, team_id, variables}`, or a gallery template: `{template, team_id, variables}` |
| `POST` | `/api/imports/{did}/commit` | Create the project: `{server_id}` |

## Example: deploy and wait

```sh
JOB=$(curl -s -X POST -H "Authorization: Bearer $ZENAVO_API_KEY" \
  -H "Content-Type: application/json" -d '{}' \
  https://zenavo.app/api/projects/$PROJECT/deploy | jq -r .id)

until curl -s -H "Authorization: Bearer $ZENAVO_API_KEY" https://zenavo.app/api/jobs/$JOB \
  | jq -e '.status == "succeeded" or .status == "failed"' >/dev/null; do sleep 5; done
```
