Admin panel
The admin panel is where you manage a running server: users, apps, email, storage, limits and billing. It lives under /admin/. This page covers how to turn it on, what each page does, and the JSON API for scripts.
Turn it on
The panel is off until you set at least one of these environment variables. You can set both.
| Variable | Who it is for | How they sign in |
|---|---|---|
CIVILITY_ADMIN_EMAILS |
People | Their normal account sign-in |
CIVILITY_ADMIN_TOKEN |
Scripts | An Authorization: Bearer <token> header per call |
With neither set, every /admin/* route returns 404.
Admin accounts
List the email addresses of the accounts that may open the panel, separated by commas.
CIVILITY_ADMIN_EMAILS=you@example.org,other@example.org civ api start
- The account's email must be verified. Matching ignores case.
- A signed-in user who is not on the list gets a 404.
- Only a browser session opens the panel. An admin's API keys and app tokens do not.
- Removing an email from the list takes effect when you restart the server with the new value.
Admin token
Generate a token, then start the server with it.
civ admin token
CIVILITY_ADMIN_TOKEN=<token> civ api start
The token gives full access to all user data. Keep it in a secret manager or an environment file, not in source control. To replace it, restart the server with a new value; the old one stops working.
The token is not a browser login, and HTTP Basic auth is not accepted. On a server that only has CIVILITY_ADMIN_TOKEN, a request without the token gets a plain 401.
Check that it is on
The server prints the panel address when it starts:
Admin panel: http://localhost:3848/admin/
Operators: you@example.org (dashboard sign-in)
Scripts: Authorization: Bearer <your admin token>
Open the panel
- Sign in at
/loginwith an account listed inCIVILITY_ADMIN_EMAILS. - Open the account menu and choose Admin, or go to
/admin/.
If you are signed out, /admin/ sends you to the sign-in page.
The Overview page shows a warning until your account has a second sign-in factor. Its Enable MFA link opens the section of Settings where you turn one on. See Sign-in and MFA.
Pages
Overview
/admin/ shows the number of users and apps, total change data and blob storage in use, the server version, and uptime.
Users
/admin/users lists every account with its change-data use, blob use, number of active grants, and sign-up date. Click a column heading to sort. Detail opens one user.
The user page (/admin/users/:id) has these cards:
| Card | What it does |
|---|---|
| Storage | Shows change-data and blob use against the user's limit. |
| Active grants | Lists the access each app has to this user's data. Revoke removes one grant. |
| Apps | Lists the apps the user has registered. |
| Account backup | Build backup makes a full backup of the account. See Operations. |
| Limit overrides | Sets limits for this one user. |
Limit overrides has four fields:
| Field | Meaning |
|---|---|
| Tier | The ID of a tier, for example pro. Blank means none. |
| DB limit (bytes) | Change-data quota. 0 uses the server or tier value. |
| Blob limit (bytes) | Blob storage quota. 0 uses the server or tier value. |
| Blob upload rate limit (requests/min) | Uploads per minute. 0 uses the server or tier value. |
The form saves all four fields together. The storage bars on this page compare use against the user override or the server default; they do not include the tier's value.
Apps
/admin/apps has two parts:
- Run blob GC. Runs one blob cleanup sweep now. The button appears when blob storage is available. See Maintenance.
- Registered apps. One row per account's copy of an app, with its account, change count, data size and active grants. Several accounts using the same app appear as several rows.
- Retention (days) sets how long this app's change history is kept. Leave it blank to use the server, tier or user value.
- Delete removes the app and all its sync data, and gives the space back to the owner's quota. An app with active grants shows Force delete instead, because deleting it also removes those grants.
Logs
/admin/logs is the audit log. Filter by user ID, app ID, action and date range. The CSV and JSON links export the filtered entries, up to 10,000 rows.
Invites
/admin/invites controls who can sign up.
- Tick Require an invite to sign up and save. It is off by default.
- Under Mint invite, add an optional note and an optional expiry in days, then create the invite.
- Copy the token or the
/signup?invite=<token>link. It is shown once.
The table shows each invite's status (active, used, revoked or expired) and the account that used it. Revoke cancels an active invite.
Deleting an account frees the invite it used, so the invite works again. Revoke the invite as well if that is not what you want.
/admin/email sets how the server sends password-reset, verification and sign-in emails.
Until you save a provider here, the server sends nothing. It prints each link or code to the server log, and new accounts count as verified.
- Choose a provider: SMTP or Resend. Disabled goes back to printing links in the log.
- Fill in the fields for that provider.
- Click Save email settings.
- Enter an address under Send test email and click Send test. The test uses the saved settings, so save first.
| Field | Provider | Notes |
|---|---|---|
| From address | Both | Required for Resend, on a domain verified in your Resend account. For SMTP, blank means noreply@<SMTP host>. Accepts Name <email@your-domain.com>. |
| Contact address | Both | Where people can reach you. Shown under About in the account menu. Leave blank to show nothing. |
| Host | SMTP | Required. |
| Port | SMTP | 1 to 65535. |
| Use TLS | SMTP | Tick for port 465. Leave off for STARTTLS on port 587. |
| Username | SMTP | |
| Password | SMTP | Leave blank to keep the stored value. |
| API key | Resend | Required the first time. Leave blank to keep the stored value. |
Advanced Resend options are optional. Blank uses the default.
| Field | Allowed values |
|---|---|
| API base URL | An HTTPS URL. HTTP is allowed only for a loopback address. Your API key is sent to this address. |
| Request timeout (milliseconds) | 1 to 120000 |
| Transient-failure retries | 0 to 5. 0 turns retries off. |
Passwords and API keys are encrypted with CIVILITY_AUTH_SECRET and are never shown again. Changes apply to the next email sent.
Other pages
| Page | Path | Documented in |
|---|---|---|
| Storage | /admin/storage |
Blob storage |
| Services | /admin/services |
Services |
| Server limits | /admin/limits |
Limits |
| Maintenance | /admin/maintenance |
Maintenance |
| Billing | /admin/billing |
Billing and Tiers |
JSON API
Scripts can call these routes with the admin token. Responses use the standard shape { status, data, message }.
curl -X DELETE \
-H "Authorization: Bearer $CIVILITY_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
http://localhost:3848/admin/apps/USER_ID/APP_ID
Send Content-Type: application/json on every call that is not a GET, even when there is no body. Without it the request is treated as a browser form post and can be rejected.
| Method | Path | What it does |
|---|---|---|
PATCH |
/admin/users/:id/limits |
Set one user's tier and limit overrides. |
PATCH |
/admin/users/:id/tier |
Set one user's tier ({ "tier": "pro" }) and keep their limit overrides. |
DELETE |
/admin/users/:id/grants/:grantId |
Revoke one grant. |
POST |
/admin/users/:id/backup |
Start building a backup of the account. Returns 202 with the backup ID. |
GET |
/admin/users/:id/backups/:backupId/download |
Download a finished backup as a zip. |
PATCH |
/admin/apps/:userId/:id |
Set the retention of one account's copy of an app: { "changeRetentionDays": 30 }, or null to clear. |
DELETE |
/admin/apps/:userId/:id |
Delete one account's copy of an app. Returns 409 if it has active grants; add ?force=1 to delete anyway. |
POST |
/admin/blob-gc/run |
Run one blob cleanup sweep. Optional body { "userId": "..." } limits it to one account. |
POST |
/admin/invites |
Create an invite. Body: { "note": "...", "expiresInDays": 7 } or { "expiresAt": "<ISO date>" }. All fields are optional. |
DELETE |
/admin/invites/:token |
Revoke an invite by its ID or its token. |
POST |
/admin/invites/config |
Turn the invite requirement on or off: { "required": true }. |
GET |
/admin/logs?format=json |
Export the audit log. Also format=csv. Filters: userId, appId, action, from, to. |
Notes:
expiresInDaysmust be a number above zero.requiredmust be a JSON boolean; the string"true"is rejected.- Revoke invites by ID where you can. A token in the URL ends up in access logs.
PATCH /admin/users/:id/limits
{
"tier": "pro",
"limits": {
"maxDbBytesPerUser": 52428800,
"maxBlobBytesPerUser": 5368709120
},
"rateLimits": {
"blobUpload": { "windowMs": 60000, "maxRequests": 300 }
}
}
limitsandrateLimitsreplace the user's stored overrides on every call. If you leave one out, those overrides are cleared.tierchanges only when the body includes it.- The limit names are listed in Limits.
Security
Turn on MFA for every account in
CIVILITY_ADMIN_EMAILS. Each operator does this for their own account: sign in, open Settings, and use Two-Factor Authentication (/settings#mfa). See How a user turns on MFA.Admin routes have no rate limiting. On a public server, restrict
/admin/*to trusted addresses with a firewall or your reverse proxy:location /admin/ { allow 10.0.0.0/8; deny all; proxy_pass http://localhost:3848; }If the admin token leaks, restart the server with a new one.