OPNexusdocs

Automation: API tokens, Prometheus, AI assistants

Under System › API tokens you create personal tokens. With a token, scripts, CI jobs, Prometheus and AI assistants talk to the OPNexus API without logging in:

curl -H "Authorization: Bearer opx_…" https://opnexus.example/api/hosts

A token belongs to your account and never has more privileges than you. It is displayed only once and stored only as a hash. You need your password to create one. The default lifetime is 90 days; you can revoke any token at any time, and a password reset of the account revokes all its tokens. At most 50 tokens per user.

ScopeMay
ReadView everything (GET), except things with secrets: raw download of the configuration backups and the notification settings. For dashboards, Prometheus, AI assistants.
DeployAdditionally deploy and maintain: rules, aliases, NAT, VPN, certificates, maintenance, security check. Not: users, settings, notifications, creating or deleting hosts, OPNexus update.
AdminEverything your account may do, including the things above.

Plan and export of configuration as code already work with "Read"; applying only with "Admin".

For every scope: managing tokens and your own account (password, two-factor) works only in a normal login, never with a token. A read-only account can create only "Read" tokens; if the account is demoted, all its tokens immediately become read-only. In the audit log, changes made via token appear as "User (API: name)".

API description: the OpenAPI schema is at /api/openapi.json (retrievable with login or token) and can be loaded into Postman, a code generator or an assistant. There is no interactive page. Errors arrive as {"detail": {"code": "…", "params": {…}}} with a stable code.

In this chapter#

  • Configuration as code (YAML, Git, CI) — Under System › Configuration as code (or via opnexus export / opnexus apply) all centrally maintained objects can be exported as a single YAML file and imported again: de
  • Prometheus — GET /api/metrics delivers the state in Prometheus text format. The response comes only from the OPNexus database (no requests to the firewalls), so frequent scraping puts
  • AI assistants (MCP) — OPNexus speaks the Model Context Protocol so that an AI assistant can look at the fleet, read-only: it cannot change anything. Example for Claude Code: