Skip to content

API Reference ​

The REST API primarily uses /api/v1 and returns successful responses in this form:

json
{
  "success": true,
  "data": {}
}

Error responses use this form:

json
{
  "success": false,
  "error": {
    "code": "ERROR_CODE",
    "message": "Readable message",
    "detail": {}
  }
}

API Layers ​

WFM exposes four HTTP API layers rather than a single browser API:

LayerPrefixCallerNotes
Console API/api/v1Browser console and trusted external callersMain business API. Requires an administrator Bearer token by default.
Client API/api/clientwfmctl bindUsed only for one-time client binding and does not use the administrator session token.
Internal API/api/internalEMQX and other internal componentsIntended for containers or trusted networks and requires an internal shared key.
Dev API/api/v0Local development and automated testsRegistered only when WFM_ENABLE_DEV_TEST_API=true.

The MCP HTTP endpoint is /mcp. MCP tools must reuse the same service logic behind the console API rather than bypassing the business layer.

Calling Conventions ​

Administrator Session ​

Console business APIs normally use:

http
Authorization: Bearer <admin-session-token>

Login, setup, health checks, and a small number of other endpoints allow anonymous access. Download endpoints may also accept download-specific tokens.

Source Restrictions ​

In production, the backend validates the configured public origin and the proxied Host. Browser requests must come from an allowed origin; CLI and curl requests without an Origin are accepted only for the primary Host. Development mode may relax these checks.

Download Tokens ​

Client artifacts, bulk config packages, and snapshot exports can use five-minute single-file download tokens. A token can access only its bound resource and cannot call other APIs or download another file.

Business Writes ​

Write endpoints follow the same order:

  1. Validate input and permissions.
  2. Mutate business data inside a database transaction.
  3. Synchronize EMQX or dispatch MQTT when required.
  4. Publish SSE refresh events.
  5. Return a result that the frontend can display or use to refresh projections.

When an external system is unavailable, database semantics should remain explicit: persist operations that are safe to persist, and return a clear business error when consistency cannot be guaranteed.

Authentication API ​

MethodPathDescription
GET/api/v1/auth/stateRead setup and current-session state.
POST/api/v1/auth/setupInitialize the administrator password.
POST/api/v1/auth/loginSign in and return a Bearer token.
GET/api/v1/auth/sessionValidate the current Bearer token.
POST/api/v1/auth/logoutFrontend logout endpoint.
POST/api/v1/auth/passwordChange the administrator password.

Config API ​

MethodPathDescription
GET/api/v1/configsList configs.
POST/api/v1/configsCreate a config.
GET/api/v1/configs/{config_id}Read a config.
PUT/api/v1/configs/{config_id}Update a config.
DELETE/api/v1/configs/{config_id}Delete a config.
GET/api/v1/configs/{config_id}/overviewRead the config overview projection.
POST/api/v1/configs/awg/randomGenerate config-level AmneziaWG parameters.

Endpoint API ​

MethodPathDescription
GET/api/v1/configs/{config_id}/nodesList endpoints in a config.
POST/api/v1/configs/{config_id}/nodesCreate an endpoint.
GET/api/v1/nodes/{node_id}Read an endpoint.
PUT/api/v1/nodes/{node_id}Update an endpoint.
DELETE/api/v1/nodes/{node_id}Delete an endpoint.
POST/api/v1/configs/{config_id}/nodes/suggest-ipSuggest a virtual IP.
POST/api/v1/configs/{config_id}/nodes/validate-ipValidate a virtual IP.
POST/api/v1/nodes/keys/generateGenerate a WireGuard key pair.
POST/api/v1/nodes/keys/derive-publicDerive a public key from a private key.
POST/api/v1/nodes/awg/randomGenerate endpoint-level AmneziaWG parameters.

Tag API ​

MethodPathDescription
GET/api/v1/configs/{config_id}/tagsList tags and counts.
POST/api/v1/configs/{config_id}/tagsCreate a tag.
POST/api/v1/configs/{config_id}/tags/applyApply a tag to multiple endpoints.
DELETE/api/v1/configs/{config_id}/tags/{tag_name}Delete a config-level tag.
PUT/api/v1/nodes/{node_id}/tagsReplace endpoint tags.
DELETE/api/v1/nodes/{node_id}/tags/{tag_name}Remove a tag from an endpoint.

Mesh API ​

MethodPathDescription
GET/api/v1/configs/{config_id}/peer-linksList Mesh pairs.
GET/api/v1/configs/{config_id}/nodes/{node_id}/mesh-workspaceRead an endpoint Mesh workspace.
GET/api/v1/configs/{config_id}/nodes/{node_id}/peer-link-draftBuild a Mesh pair draft.
POST/api/v1/configs/{config_id}/peer-linksCreate a bidirectional Mesh pair.
PUT/api/v1/peer-links/{group_id}Update a bidirectional Mesh pair.
DELETE/api/v1/peer-links/{group_id}Delete a bidirectional Mesh pair.
POST/api/v1/peer-links/psk/generateGenerate a PSK.
POST/api/v1/configs/{config_id}/mesh/validateValidate the Mesh topology.
POST/api/v1/configs/{config_id}/mesh/quick-generateDelete and regenerate Mesh pairs using Quick Mesh.
GET/api/v1/configs/{config_id}/nodes/{node_id}/wg-previewPreview the generated WG/AWG config.

Config Apply and Endpoint Control API ​

MethodPathDescription
GET/api/v1/configs/{config_id}/sync-statusRead sync states for all endpoints in a config.
GET/api/v1/configs/{config_id}/nodes/{node_id}/sync-statusRead one endpoint sync state.
GET/api/v1/configs/{config_id}/nodes/{node_id}/applied-confRead applied config text.
PUT/api/v1/configs/{config_id}/nodes/{node_id}/applied-confSave applied config text.
POST/api/v1/configs/{config_id}/nodes/{node_id}/syncSync one endpoint.
POST/api/v1/configs/{config_id}/sync-allSync all eligible endpoints in a config.
GET/api/v1/configs/{config_id}/endpoint/runtime-snapshotRead the runtime snapshot.
GET/api/v1/configs/{config_id}/nodes/{node_id}/endpoint/statusRead endpoint runtime status.
POST/api/v1/configs/{config_id}/nodes/{node_id}/bind-commandCreate a client bind command.
POST/api/v1/configs/{config_id}/nodes/{node_id}/reset-clientReset client binding and MQTT credentials.
GET/api/v1/configs/{config_id}/nodes/{node_id}/endpoint/logsRead endpoint control logs.
POST/api/v1/configs/{config_id}/nodes/{node_id}/endpoint/controlSend start, stop, push_config, or wg_show.
POST/api/v1/configs/{config_id}/endpoint/probe-batchProbe endpoints in a batch.

Tools API ​

MethodPathDescription
GET/api/v1/tools/download/client-optionsRead client build options.
POST/api/v1/tools/download/client-artifacts/buildBuild or locate a client artifact.
POST/api/v1/tools/download/client-artifacts/download-grantCreate a five-minute single-file token for a local-build client artifact; Release artifacts do not use this endpoint.
GET/api/v1/tools/download/client-artifacts/{artifact_id}Download a client artifact.
GET/api/v1/tools/download/config-bulk/optionsRead bulk config download options.
POST/api/v1/tools/download/config-bulk/packageCreate a bulk config package.
GET/api/v1/tools/download/config-bulk/package/{package_id}Download a bulk config package.
GET/api/v1/tools/port-forwards/configs/{config_id}List port-forward rules.
POST/api/v1/tools/port-forwards/configs/{config_id}Create a port-forward rule.
PUT/api/v1/tools/port-forwards/{rule_id}/enabledEnable or disable a port-forward rule.
DELETE/api/v1/tools/port-forwards/{rule_id}Delete a port-forward rule.

Backup API ​

MethodPathDescription
POST/api/v1/backups/snapshotCreate a snapshot.
GET/api/v1/backups/listList snapshots.
GET/api/v1/backups/download/{snapshot_id}Download a snapshot.
GET/api/v1/backups/export/{snapshot_id}Export a snapshot.
POST/api/v1/backups/restore/{snapshot_id}Restore a snapshot.
POST/api/v1/backups/uploadUpload and import a snapshot.
POST/api/v1/backups/importUpload and import a snapshot.
DELETE/api/v1/backups/{snapshot_id}Delete a snapshot.
PUT/api/v1/backups/{snapshot_id}/noteUpdate a snapshot note.

Settings and System API ​

MethodPathDescription
GET/api/v1/settings/uiRead UI settings.
PUT/api/v1/settings/uiUpdate UI settings.
GET/api/v1/settings/mqttRead the client-facing MQTT address.
PUT/api/v1/settings/mqttUpdate the client-facing MQTT address.
POST/api/v1/settings/mqtt/resetReset MQTT settings to environment defaults.
POST/api/v1/settings/mqtt/testTest MQTT access settings.
POST/api/v1/settings/passwordChange the administrator password.
GET/api/v1/system/healthHealth check.
GET/api/v1/system/timezoneRead the configured timezone.
GET/api/v1/system/statusRead system status.
GET/api/v1/events/streamSSE realtime event stream.

Client and Internal API ​

MethodPathDescription
POST/api/client/bindExchange a bind token for a profile, MQTT credentials, and config.
POST/api/internal/emqx/authzInternal-only EMQX HTTP AuthZ callback.
POST/api/v0/dev/reset-bootstrapDev/test endpoint registered only when WFM_ENABLE_DEV_TEST_API=true.