Management API
Get the API contract
The server's management listener serves the running build's OpenAPI 3.1 contract at GET /api/v1/openapi.json. Use the frontend Nginx HTTPS address in browsers and scripts. Within a trusted network, you can also use HTTP on gateway port 9650/TCP. This endpoint can be read directly.
The website provides an OpenAPI 3.1.0 document for management API v1. When integrating with a specific gateway, use the contract served by that gateway. Download OpenAPI JSON
With the matching server binary, export the same contract offline. The following command works in a POSIX shell or PowerShell 7.
./server export-openapi > openapi.jsonOn Windows, use ./server.exe. The contract's servers[0].url is /api/v1, so a path such as /clients resolves to GET /api/v1/clients and other methods listed for that path. Initial device enrollment uses a separate HTTP/3 endpoint on 9650/UDP. See the quick start for its setup. Quick start
Login sessions and permissions
| Use case | Request |
|---|---|
| Management console and API | Send the xigexb_session cookie after signing in. Write operations with a request guard also require X-Xigexb-Request: 1. |
| System administration | The admin account manages user accounts, User role grants, GeoX, system download proxies, and backups. |
| Sensitive operations | Confirm with a code when two-factor authentication is enabled. Other accounts confirm with the current password. The API also enforces account permissions and resource ownership. |
The administrator can read the User role configuration with GET /api/v1/role-permissions. The role details report default_enabled as false, and the role starts with no grants. To update the role, send enabled, grants, and the revision you read with PUT /api/v1/role-permissions/user. Disabling the role revokes existing User sessions and blocks new sign-ins. Each account has its own independent switch.
An account with client read permission can use a saved session to list the clients it can access. The following command reads an existing cookie file. Restrict access to that file to the account running the command.
curl --fail-with-body --cookie ./session.cookies 'https://console.example.com/api/v1/clients'Single-use credential challenges
For requests marked x-credential-encryption in OpenAPI, request a challenge from POST /api/v1/credential-challenges. The path starts with /, omits /api/v1, and includes the target request's query string. A challenge is valid for 60 seconds, can be used once, and is bound to the source IP and current session. A login challenge can be requested before a session exists. Other challenges require a valid session.
The target operation's CredentialEnvelope describes the outer body. Its x-encrypted-payload-schema describes the enclosed request fields, and x-credential-encryption specifies the encryption parameters. The credential envelope uses P-256 ECDH, HKDF-SHA256, and AES-256-GCM. Frontend Nginx terminates HTTPS for the public management API.
Two-factor authentication
Account two-factor authentication uses RFC 6238 TOTP. Codes use six ASCII digits and change every 30 seconds. Once enabled, the server verifies the password first, then checks an authenticator code or a single-use recovery code. It creates a session after verifying both factors.
| Request | Purpose |
|---|---|
GET /api/v1/two-factor | Read enabled and remaining_recovery_codes for the signed-in account. |
POST /api/v1/two-factor/setup | Submit the current password to receive setup_id, secret, and uri. The setup is valid for 5 minutes in the same login session. |
POST /api/v1/two-factor/enable | Submit setup_id and the authenticator code to complete enrollment. This response returns 10 single-use codes in recovery_codes. |
DELETE /api/v1/two-factor | Submit the authenticator code to remove the enrollment and invalidate the remaining recovery codes. |
POST /api/v1/login accepts a recovery code in recovery_code. When the optional reset_two_factor is true, the same sign-in consumes that code and removes the previous enrollment and its remaining recovery codes. These password and authenticator fields go in the encrypted envelope for a single-use credential challenge. Sensitive operations require an authenticator code or current password according to the account's settings. Consult each endpoint in OpenAPI for its request fields. Verification covers password changes, user account changes, device access changes, device identity revocation, certificate downloads, and backup restore. Only accounts without two-factor authentication can briefly reuse password confirmation for certificate downloads in the same session.
Responses and live data
The standard management API error body has code, trace_id, error, and field_errors. Handle failures using the HTTP status and code. Keep the trace_id when diagnosing an error. Check the running build's contract and permission configuration for each endpoint's request fields, response statuses, and permissions.
Query runtime status with GET /api/v1/status. Subscribe to console snapshots with GET /api/v1/events, which responds with text/event-stream. Both snapshot and reset carry a full snapshot. current indicates unchanged content. On access_changed, recheck the session and its permissions. On snapshot_limit, switch to regular queries.
Runtime monitoring and traffic history
GET /api/v1/monitoring/runtime requires runtime monitoring access and returns resource usage, gateway status, management request statistics, and relay throughput. minutes accepts 1 through 1440 and defaults to 60. Samples remain in the current instance's memory for up to 24 hours. Management request statistics exclude monitoring queries and event streams. Latency percentiles are estimates based on histogram buckets.
GET /api/v1/history/traffic uses period, from, and until to define the reporting window. from is inclusive and until is exclusive. Both are Unix timestamps in milliseconds. Supply limit to enable cursor pagination and pass the previous response's next_cursor while keeping filters, sort order, and authorization scope consistent. Use /api/v1/history/traffic.csv to export matching rows as CSV.
Client editing API
PATCH /api/v1/clients/{id} accepts label and requires clients.configure. The trimmed name must be 1 to 120 UTF-8 bytes. A successful request returns {"updated":true}.
PUT /api/v1/clients/{id}/key requires clients.key. Request a one-time credential challenge bound to the relative path /clients/{id}/key. In the encrypted envelope, include client_key and either password or code for this operation. Reusing the current key or another client's key returns 409. Console steps
Active links API
| Request | Purpose |
|---|---|
GET /api/v1/active-links | Filter and paginate by kind, keyword, path, page, and page_size. Returns the active links and sample time. |
GET /api/v1/active-links/{id} | Read one active link. |
PUT /api/v1/active-links/{id}/bandwidth | Set ingress and egress with bytes_per_second and burst_bytes. Set a direction to null to restore its default. |
DELETE /api/v1/active-links/{id} | Request disconnection of the selected link. A successful request returns {"closed":true}. |
An ended link can return 404. Changing the limit of a closing link or a link that lacks rate control returns 409. Permissions and usage
Test notifications and IP ban rules
POST /api/v1/notification-channels/{id}/test uses the saved channel configuration. HTTP 202 and the returned operation_id indicate that the test was queued. Check its delivery record for the result.
GET /api/v1/login-security/ban-rules/test?ip=203.0.113.18 lets a system administrator look up active rules for a single address. The response includes the normalized ip and matches. Notification setup · Management ingress IP bans
Device certificate recovery API
POST /api/v1/clients/{id}/certificate/recover issues a recovery ZIP for a device owned by the current account whose access remains enabled and whose active certificate has expired. It requires a management session, the clients.key and rotation.manage permissions, and fresh confirmation with the current password or two-factor code. A successful response uses application/zip. The gateway activates the recovery certificate after mutual authentication by the original device. A missing device or one owned by another account returns 404. A still-valid certificate, blocked access, or a changed certificate generation returns 409. Recovery steps
MQTT relay activity
GET /api/v1/mqtt-relays lists relays visible to the account with search, page, and page_size. enabled reports the configured state, and activity reports observations from the current gateway process. For enabled relays, activity contains online_devices, waiting_devices, connecting_devices, retrying_devices, observed_at, last_connected_at, and last_failure. Disabled relays return activity: null. Timestamps use Unix seconds. last_failure contains stage and at. The observation time, last connection time, and last failure can be null. Configure MQTT relays · Troubleshoot relay activity
System backup API
Backup endpoints require a signed-in system administrator and a single gateway with exclusive use of its database.
| Request | Purpose |
|---|---|
GET /api/v1/system/backup | Read settings, records, and restore status. |
POST /api/v1/system/backup/settings | Save all settings or update the schedule or S3-compatible object storage with section: "schedule" or section: "storage". |
POST /api/v1/system/backup/test | Test access to S3 storage. |
POST /api/v1/system/backup/records | Submit a manual backup job. |
GET /api/v1/system/backup/records/{id}/download | Download the application/gzip archive. |
DELETE /api/v1/system/backup/records/{id} | Delete the object in storage, then remove the record. Returns 503 and keeps the record if the storage request fails. |
POST /api/v1/system/backup/records/{id}/restore | Submit a restore job. |
HTTP 202 confirms that the server accepted a manual backup or restore job. Query the backup endpoint for its final result. Confirm restoration with the current administrator's two-factor code, or with password if two-factor authentication is off. Restoration revokes existing login sessions. Once the gateway returns, sign in with the administrator credentials from the archive. Backup and restore