OPNexusdocs

REST API: errors and conflicts

Errors are plain HTTP status codes with a JSON body. Application errors carry a stable, language-neutral code and its parameters, so scripts can react to the code and never have to parse a message:

json
{ "detail": { "code": "TOO_MANY_LOGIN_ATTEMPTS", "params": { "wait": 120 } } }
StatusMeaningTypical cause and what to do
400The request is not valid for the current stateA rule that is not allowed in that place, or a missing confirmation; the code names it
401Not authenticatedMissing, expired or revoked token (NICHT_AUTHENTIFIZIERT); send Authorization: Bearer opx_…
403Authenticated, but not allowedThe role lacks the permission (PERMISSION_MISSING, params.permission names it), or the token's scope does not cover the action (API_TOKEN_SCOPE_FORBIDDEN). The required permission of each endpoint is shown in the API reference
404The object does not existWrong id, or it was deleted meanwhile
409ConflictThe object changed since you read it (see below), a name is already taken, or another operation on the same firewall is still open
422The request body or a parameter is invalidThe body is a list of { "loc", "msg", "type" } entries that say where and why. Values you sent are never echoed back, so a secret does not end up in a log
429Too many attemptsToo many failed logins (params.wait is the number of seconds to wait), or another operation of the same kind is already running
502A firewall could not do itThe firewall did not answer, or it rejected the call (UPSTREAM_REJECTED, params.reason has the reason). Check the firewall and retry
503A part of OPNexus is not availableFor example the updater container for one-click updates is not running (UPDATER_UNAVAILABLE)

Conflicts on edit. Objects that people edit concurrently (for example rules, port forwards, VPN tunnels) carry an updated_at timestamp. An update must send it back as expected_updated_at. If the object changed in between, OPNexus answers 409 instead of silently overwriting the other change. Read the object again, apply your change to the fresh state and resend.

Codes are stable, texts are not. The web interface translates each code into the user's language. In scripts, test the code, not text, and treat unknown codes like any other error of the same status.