ServerBee

API Reference

ServerBee REST API overview, authentication, WebSocket endpoints, and Swagger UI interactive docs.

ServerBee exposes the same capabilities used by the web dashboard through REST and WebSocket APIs. The authoritative, schema-level reference is generated from OpenAPI annotations in the server binary.

Swagger UI

Open the built-in interactive documentation at:

https://your-server/swagger-ui/

Swagger UI lets you inspect request/response schemas, authentication requirements, and test requests against your own deployment. The raw OpenAPI document is available at:

https://your-server/api-docs/openapi.json

Response Format

Successful REST responses are wrapped as:

{
  "data": {}
}

Errors use:

{
  "error": "Error message describing what went wrong"
}

Authentication

Used by the web dashboard after login:

curl -X POST https://your-server/api/auth/login \
  -H "Content-Type: application/json" \
  -d '{"username":"admin","password":"your-password"}' \
  -c cookies.txt

curl https://your-server/api/servers -b cookies.txt

API Key

Use API keys for automation. Create them in Settings → API Keys.

curl https://your-server/api/servers \
  -H "X-API-Key: serverbee_your-api-key-here"

API keys use the serverbee_ prefix and are shown only once when created.

Bearer Session Token

Mobile flows use Bearer tokens for selected REST and WebSocket endpoints:

curl https://your-server/api/auth/me \
  -H "Authorization: Bearer <session-token>"

Public Endpoints

MethodPathDescription
POST/api/auth/loginWeb login
GET/api/auth/oauth/providersList enabled OAuth providers
GET/api/auth/oauth/{provider}OAuth authorization redirect
GET/api/auth/oauth/{provider}/callbackOAuth callback
POST/api/mobile/auth/loginMobile login
POST/api/mobile/auth/refreshRefresh a mobile session
POST/api/mobile/auth/pairRedeem a mobile pairing code
POST/api/agent/registerAgent registration using a one-time enrollment code (the code is consumed on first successful registration)
GET/api/statusDefault public status page data
GET/api/status/{slug}Configurable public status page data
GET/api/settings/brandPublic brand settings
GET/api/brand/logoServe uploaded logo
GET/api/brand/faviconServe uploaded favicon

Authenticated Read Endpoints

Read endpoints are available to Admin and Member users unless noted otherwise.

FamilyRepresentative endpoints
Current user and API keysGET /api/auth/me, PUT /api/auth/password, GET/POST /api/auth/api-keys, DELETE /api/auth/api-keys/{id}
2FA and OAuth accounts/api/auth/2fa/*, GET/DELETE /api/auth/oauth/accounts/*
Mobile devicesPOST /api/mobile/auth/logout, GET /api/mobile/auth/devices, DELETE /api/mobile/auth/devices/{id}
ServersGET /api/servers, GET /api/servers/{id}, GET /api/servers/{id}/records, GET /api/servers/{id}/gpu-records
Groups and tagsGET /api/server-groups, GET /api/server-tags
Uptime and trafficGET /api/servers/{id}/uptime-daily, GET /api/servers/{id}/traffic
GeoIPGET /api/geoip/status
Ping tasksGET /api/ping-tasks, GET /api/ping-tasks/{id}/records
Network probes/api/network-probes/*, /api/servers/{id}/network-probes/*
Traceroute resultsGET /api/servers/{id}/traceroute/{request_id}
Files, read-onlyPOST /api/files/{server_id}/list, stat, read, GET /api/files/transfers, GET /api/files/download/{transfer_id}
Docker, read-onlyGET /api/servers/{id}/docker/containers, stats, info, events, networks, volumes
Service monitorsGET /api/service-monitors, GET /api/service-monitors/{id}, GET /api/service-monitors/{id}/records
Status page configGET /api/status-pages
DashboardsGET /api/dashboards, GET /api/dashboards/default, GET /api/dashboards/{id}
ThemesGET /api/themes/*
Cost insightsGET /api/cost/overview, GET /api/servers/{id}/cost-insights
Alert eventsalert event read endpoints used by the dashboard

Admin Write and Management Endpoints

Admin role is required for write operations and system management.

FamilyRepresentative endpoints
Server managementPOST/PUT/DELETE /api/servers/*, PUT /api/servers/batch-capabilities, POST /api/servers/{id}/upgrade
Agent enrollmentPOST /api/agent/enrollments, GET /api/agent/enrollments, DELETE /api/agent/enrollments/{id}, POST /api/agent/{id}/rotate-token
Agent recoveryGET /api/servers/{target_id}/recovery-candidates, GET /api/servers/recovery-jobs/{job_id}, POST /api/servers/{target_id}/recover-merge
Groups and tagsCRUD /api/server-groups/*, CRUD /api/server-tags/*
Ping and network probesCRUD /api/ping-tasks/*, write endpoints under /api/network-probes/*
TraceroutePOST /api/servers/{id}/traceroute
FilesPOST /api/files/{server_id}/write, delete, mkdir, move, download, upload, DELETE /api/files/transfers/{transfer_id}
Docker actionsPOST /api/servers/{id}/docker/containers/{cid}/action
Service monitorsCRUD /api/service-monitors/*, POST /api/service-monitors/{id}/check
DashboardsPOST /api/dashboards, PUT/DELETE /api/dashboards/{id}
Themes and appearancetheme write endpoints, PUT /api/settings/brand, POST /api/settings/brand/logo, POST /api/settings/brand/favicon
Status pagesCRUD /api/status-pages/*
IncidentsCRUD /api/incidents/*, POST /api/incidents/{id}/updates
Maintenance windowsCRUD /api/maintenances/*
Alerts and notificationsCRUD /api/alert-rules/*, /api/notifications/*, /api/notification-groups/*
TasksGET/POST /api/tasks, GET/PUT/DELETE /api/tasks/{id}, GET /api/tasks/{id}/results, POST /api/tasks/{id}/run
UsersCRUD /api/users/*
Audit and settingsGET /api/audit-logs, /api/settings/*, backup/restore endpoints
GeoIPPOST /api/geoip/download
Mobile pushPOST /api/mobile/pair, POST /api/mobile/push/register, POST /api/mobile/push/unregister

Agent Enrollment Endpoints

All of these endpoints require the Admin role. Responses follow the standard { "data": ... } envelope.

POST /api/agent/enrollments -- Mint an enrollment code

Mints a one-time, short-lived enrollment code (default TTL 600 seconds / 10 minutes; single-use; consumed on the agent's first successful registration).

Response:

{
  "data": {
    "id": "01J...",
    "code": "<plaintext code, returned only once>",
    "expires_at": "2026-05-17T12:34:56Z"
  }
}

The plaintext code is returned only at mint time -- copy it immediately.

GET /api/agent/enrollments -- List enrollment codes

Lists issued enrollment codes with metadata. For security this endpoint never returns the plaintext code, only an 8-character prefix plus status/expiry metadata.

{
  "data": [
    {
      "id": "01J...",
      "code_prefix": "ab12cd34",
      "expires_at": "2026-05-17T12:34:56Z",
      "consumed_at": null
    }
  ]
}

DELETE /api/agent/enrollments/{id} -- Delete an enrollment code

Deletes an unused enrollment code, invalidating it immediately.

POST /api/agent/{id}/rotate-token -- Rotate/revoke a run token

Rotates (revokes) the agent run token for the given server. The old token is invalidated immediately and the affected agent is forced to disconnect and must reconnect with the new token.

WebSocket Endpoints

PathAuthDescription
/api/agent/ws?token=<agent_token>Agent token query parameterAgent metrics, commands, pings, files, Docker, traceroute
/api/ws/serversSession cookie, API key, or Bearer tokenBrowser/mobile real-time server updates
/api/ws/terminal/{server_id}Authenticated Admin + CAP_TERMINALWeb terminal proxy; terminal payloads use binary frames
/api/ws/docker/logs/{server_id}Authenticated + CAP_DOCKERPer-container Docker log streaming

Common Status Codes

CodeMeaning
400Bad request or invalid operation
401Not authenticated
403Forbidden: role, capability, or local agent policy blocks the operation
404Resource not found, server offline, or disabled public page
409Conflict, such as duplicate slug/name
422Validation error
429Rate limited
500Internal server error

On this page