PORTAL v2

Admin And Policy API

Operator endpoints are the control surface for a relay. They all return the standard JSON envelope described in API Reference, except for internal operational endpoints that are not part of the stable API.

/admin is reserved for the frontend route. Relay admin auth endpoints live under /api/admin, and enforcement settings live under /api/policy.

Auth Flow

  1. Set ADMIN_TOKEN on the relay.
  2. POST /api/admin/auth/login with { "token": "<admin-token>" }.
  3. Send the returned access_token as Authorization: Bearer <token>.
  4. POST /api/admin/auth/logout to clear the browser-stored token.

Admin bearer tokens are separate from SDK lease tokens.

Endpoints

MethodPathAuthBodyData
POST/api/admin/auth/loginNoneAdminAuthLoginRequestAdminAuthLoginResponse
GET/api/admin/auth/statusOptional bearernoneAdminAuthStatusResponse
POST/api/admin/auth/logoutBearernone{}
GET/api/policyBearernonePolicySettings
POST/api/policyBearerPolicySettingsPolicySettings
GET/api/policy/stateBearernonePolicyStateResponse
POST/api/policy/leasesBearerLeasePolicyUpdate{}

Auth Payloads

AdminAuthLoginRequest:

FieldTypeRequired
tokenstringyes

AdminAuthLoginResponse:

FieldType
access_tokenstring

AdminAuthStatusResponse:

FieldTypeNotes
authenticatedbooleantrue only when a valid bearer token was sent

State

GET /api/policy/state returns the full policy view:

FieldType
policyPolicySettings
leasesPolicyLease[]

PolicyLease uses the shared Lease fields from API Reference and adds:

FieldTypeNotes
identity_keystringnormalized name:address key
addressstringnormalized Ethereum address
bpsnumberbytes per second limit, 0 means unlimited
client_ipstringrelay-observed client IP
reported_ipstringclient-reported public IP, when present
is_approvedbooleaneffective approval result
is_bannedbooleanidentity is banned
is_deniedbooleanidentity is denied

Policy

Policy settings are written as one object through POST /api/policy and returned in the same shape:

{
  "approval_mode": "manual",
  "landing_page_enabled": false,
  "udp": {
    "enabled": true,
    "max_leases": 10
  },
  "tcp_port": {
    "enabled": false,
    "max_leases": 0
  }
}

max_leases must be non-negative. 0 means unlimited.

Supported modes:

ModeBehavior
autoactive leases can route unless banned or denied
manualactive leases route only after approval

Lease Policy

POST /api/policy/leases accepts a partial policy update for one identity:

FieldTypeEffect
identity_keystringnormalized name:address key
is_bannedbooleanblock or unblock routing for the identity
is_approvedbooleanapprove or revoke explicit approval
is_deniedbooleandeny or remove denial; true also revokes approval
bpsnumberset bytes-per-second limit; 0 removes the limit

Lease policy updates persist to policy.json and return {} on success.