Admin API Reference

Admin API Reference

Manage gateway resources through the JWT-protected REST API. Database and Control Plane modes are read/write; File, Data Plane, Mesh, and the optional Node Agent admin listener are always read-only.

Authentication

Send an HS256 JWT signed with FERRUM_ADMIN_JWT_SECRET (at least 32 characters) as Authorization: Bearer <token>. Required claims are iss, sub, iat, nbf, exp, jti, and a string role (viewer, operator, or admin). iss must match FERRUM_ADMIN_JWT_ISSUER (default ferrum-edge). Token lifetime is capped by FERRUM_ADMIN_JWT_MAX_TTL (default 3600 seconds). When FERRUM_ADMIN_JWT_AUDIENCE is set, tokens must carry a matching aud; when it is unset, tokens that carry aud are rejected.

The example below uses Node.js built-in crypto and the gateway's secret to issue a 15-minute admin token bounded to the ferrum namespace. X-Ferrum-Namespace selects the namespace for resource routes; omitting it selects ferrum. A token with an ns claim can address only the namespaces it lists and is refused on fleet-wide routes. FERRUM_ADMIN_REQUIRE_NAMESPACE_CLAIM=true makes the claim mandatory on namespace-scoped routes, and a multi-namespace control plane enforces it automatically.

bash
# Export FERRUM_ADMIN_JWT_SECRET with the same value used by your gateway.
export ADMIN_TOKEN=$(node <<'NODE'
const { createHmac, randomUUID } = require('node:crypto');
const secret = process.env.FERRUM_ADMIN_JWT_SECRET;
if (!secret || secret.length < 32) throw new Error('Set the gateway JWT secret (32+ characters)');
const now = Math.floor(Date.now() / 1000);
const claims = { iss: 'ferrum-edge', sub: 'website-example', role: 'admin',
  ns: ['ferrum'], iat: now, nbf: now, exp: now + 900, jti: randomUUID() };
const encode = value => Buffer.from(JSON.stringify(value)).toString('base64url');
const body = `${encode({ alg: 'HS256', typ: 'JWT' })}.${encode(claims)}`;
console.log(`${body}.${createHmac('sha256', secret).update(body).digest('base64url')}`);
NODE
)
curl -sS --max-time 10 -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "X-Ferrum-Namespace: ferrum" http://localhost:9000/proxies
RoleAccess
viewerReads: proxies, consumers (secrets redacted), plugin configs, upstreams, namespaces, API spec metadata, /config/export, metrics, cluster, backend capabilities, and mesh introspection
operatorViewer access plus proxy, upstream, and plugin config writes; TLS inventory, validation, and forced rotation; /config/apply-status; backend capability refresh
adminEverything, including consumers and credentials, namespaces, API spec writes, gateway trust bundles, TLS and ACME management, batch, backup, restore, and the audit log

For dashboards and drift detection, set FERRUM_ADMIN_JWT_VIEWER_SECRET (a second, distinct 32+ character secret). Tokens signed with it are always treated as viewer, whatever their role claim says, and FERRUM_ADMIN_JWT_VIEWER_NAMESPACES can cap the namespaces they read.

Authentication and namespace authorization reference

Probes and Metrics

EndpointAccess / purpose
GET /liveUnauthenticated liveness; 200 while the process/admin listener is alive
GET /health, /statusReadiness: status and ready without auth (503 until ready); tenant diagnostics with a namespace-bounded JWT; full diagnostics with an unbounded admin JWT, the metrics bearer token, or an allowed metrics CIDR
GET /overloadOverload level without auth (503 at critical); full pressure counters with the same authorization as /health
GET /metricsPrometheus text; requires an unbounded authorized admin JWT, separate metrics bearer token, or allowed metrics CIDR. Namespace-bounded JWTs receive 403 even from an allowed CIDR
GET /admin/metricsUnbounded authorized admin JWT; fleet-wide gateway metrics JSON. Namespace-bounded JWTs receive 403
GET /metrics/runtimeUnbounded authorized admin JWT; process/host state, traffic windows, pools, DNS, and overload. Namespace-bounded JWTs receive 403
GET /charges, /charges/sink/statusUnbounded authorized admin JWT; fleet-wide chargeback data and sink delivery status. Namespace-bounded JWTs receive 403

The namespace-bounded example token above is for tenant resources and receives 403 on fleet metrics; mint a token without an ns claim for those. Scrapers such as Nexus can use FERRUM_METRICS_BEARER_TOKEN (at least 32 characters), which authorizes metrics and diagnostics but grants no admin role. See the tenant health diagnostics reference.

Resource Endpoints

PathOperations
/proxies, /consumers, /upstreamsGET list, POST create; GET/PUT/DELETE on /{id}
/pluginsGET the built-in plugin type catalog
/plugins/configGET list, POST create; GET/PUT/DELETE on /{id}
/consumers/{id}/credentials/{type}POST append, PUT replace, DELETE a credential type; DELETE /{index} removes one rotation entry
/consumers/{id}/verificationGET credential verification status
/proxies/{id}/mcp/toolsGET the tool catalog of an mcp_gateway proxy
/api-specsImport (POST), list, get, replace, and delete OpenAPI-managed resources; /api-specs/by-proxy/{proxy_id} looks up by proxy
/namespacesGET list, POST create; GET/PUT (rename)/DELETE on /{name}
/gateway-trust-bundles, /gateway-trust/statusManage gateway trust bundles and read trust status
/backup, /restore?confirm=trueGET a namespace export; POST replaces the namespace configuration and requires confirm=true
/batchPOST an atomic, additive resource graph (proxies, consumers, plugin configs, upstreams); nothing is applied if any item fails
/config/export, /deployment-snapshotGET a fingerprinted read-only configuration export or deployment snapshot
/config/apply-statusGET whether accepted database writes are live; used with ?apply=async
/audit, /clusterAdmin audit log; CP/DP topology and data plane status
/admin/tls/*TLS inventory, events, validation, forced rotation, ACME orders and certificates, and managed certificates, CA bundles, CRLs, OCSP responses, and JWKS
/backend-egress-policy, /backend-capabilitiesEffective backend egress policy; backend capability registry and POST /backend-capabilities/refresh
/mesh/*, /node-waypoint/identities, /service-waypoint/servicesMesh introspection: service graph, config and slice drift, egress scope (with POST /mesh/egress-scope/test), federation, remote clusters, runtime overlay, and recent policy denies
/diagnostics/v1/refs/{ref}Resolve a diagnostic reference from an error response

List routes return {"data": [...], "pagination": {"offset", "limit", "total"}} and accept limit (default 100, maximum 1000) and offset. GET /api-specs and GET /audit use their own envelopes. Single-resource GETs return a strong ETag; send it as If-Match on PUT or DELETE and the write is refused with 412 if someone else changed the resource first. In database mode, add ?apply=async to a write for bulk provisioning: it returns 202 once committed, and GET /config/apply-status reports when it is live.

Set FERRUM_ADMIN_READ_ONLY=true to block every configuration write in database or CP mode with 403 while reads and operational actions (TLS rotation, capability refresh, egress-scope tests) keep working. For request/response schemas, permissions, and the complete endpoint inventory, use the OpenAPI specification and full Admin API reference.

Create a Proxy

bash
curl -X POST http://localhost:9000/proxies \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "X-Ferrum-Namespace: ferrum" \
  -H "Content-Type: application/json" \
  -d '{
    "listen_path": "/my-api",
    "backend_scheme": "http",
    "backend_host": "localhost",
    "backend_port": 3000,
    "strip_listen_path": true,
    "labels": {"provisioned-by": "website-example"}
  }'

Save the returned id. Plugin associations use plugins: [{"plugin_config_id": "…"}]. Creating a proxy-scoped plugin as below attaches it automatically. Labels are informational key/value metadata for ownership and attribution.

Attach API-Key Authentication

bash
# Replace YOUR_PROXY_ID with the returned proxy ID.
curl -X POST http://localhost:9000/plugins/config \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "X-Ferrum-Namespace: ferrum" \
  -H "Content-Type: application/json" \
  -d '{
    "plugin_name": "key_auth",
    "scope": "proxy",
    "proxy_id": "YOUR_PROXY_ID",
    "config": {"key_location": "header:X-API-Key"}
  }'

The Admin API adds the plugin to the proxy’s plugins list in the same transaction. In file mode, list the plugin in the proxy’s plugins yourself: proxy_id alone does not attach it. Global plugins need no proxy association.

Create a Consumer

bash
curl -X POST http://localhost:9000/consumers \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "X-Ferrum-Namespace: ferrum" \
  -H "Content-Type: application/json" \
  -d '{
    "username": "mobile-app",
    "custom_id": "app-v2",
    "credentials": {
      "keyauth": [{"key": "replace-with-a-random-client-api-key"}]
    }
  }'

Credential map keys are keyauth, basicauth, jwt, hmac_auth, and mtls_auth. Values are rotation arrays. JWT/HMAC entries contain secret, not subject. Ordinary reads redact secrets and omit Basic credentials.

Create an Upstream

bash
curl -X POST http://localhost:9000/upstreams \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "X-Ferrum-Namespace: ferrum" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "api-backend-pool",
    "algorithm": "least_connections",
    "targets": [
      {"host": "api-1.internal", "port": 3000, "weight": 100},
      {"host": "api-2.internal", "port": 3000, "weight": 50}
    ]
  }'

Set a proxy’s upstream_id to the returned ID to use the pool. Active/passive health checks use the schema in the upstream reference.

Batch Create

bash
curl -X POST http://localhost:9000/batch \
  -H "Authorization: Bearer $ADMIN_TOKEN" \
  -H "X-Ferrum-Namespace: ferrum" \
  -H "Content-Type: application/json" \
  -d '{
    "proxies": [{
      "id": "batch-api", "listen_path": "/batch-api",
      "backend_scheme": "http", "backend_host": "localhost", "backend_port": 3000
    }],
    "consumers": [{"username": "batch-client"}],
    "plugin_configs": [],
    "upstreams": []
  }'

Batch schema and atomicity · Backup and restore semantics

Error Handling

StatusMeaning
400Malformed input, unknown fields, or validation failure; POST /restore without confirm=true
401Missing or invalid token
403Role/namespace denied, or read-only mode
404Resource does not exist
409Conflicting resource or state, such as a duplicate username or listen path
412If-Match no longer matches the stored resource
413Request body exceeds the route's size limit (1 MiB by default)
503Unavailable dependency or admission guard; inspect the response before retrying a mutation
json
{"error": "description of the rejected request"}