Skip to main content

Admin API Configuration

The [admin] section controls PRISM's administrative API, which provides health checks, metrics, cache management, and cache warming endpoints.

TOML Example​

[admin]
enabled = true
address = "127.0.0.1:4001"
bearer_token = "your-secret-token"

Parameters​

ParameterTypeDefaultDescription
enabledBooleantrueEnable or disable the admin API
addressString"127.0.0.1:4001"Socket address for the admin API
bearer_tokenString or nullnullFull-access token; generated at startup when unset unless unauthenticated mode is explicitly enabled
metrics_bearer_tokenString or nullnullAdditional token accepted only for GET /metrics
peersArray of Strings[]Peer admin base URLs receiving forwarded purges; requires an explicit shared bearer_token
insecure_no_authBooleanfalsePermit unauthenticated admin access when bearer_token is unset; keep the listener private

Detailed Explanation​

enabled​

When false, PRISM does not start the admin API listener. You lose access to health checks, metrics, and cache management endpoints.

address​

The admin API listens on a separate port from the main server. By default it binds to 127.0.0.1:4001, restricting access to localhost. In containerized deployments, you may want 0.0.0.0:4001 for health check probes from the orchestrator. The admin API speaks plain HTTP. When it listens on an address that is not loopback, PRISM logs one info line at startup as a reminder that the network has to restrict access to that address.

bearer_token​

When set, all admin API endpoints except GET /health, GET /ready, and GET /startup require an Authorization: Bearer <token> header. This secures cache purge, warmup, and other mutating operations.

When null (default), PRISM generates a token for the run — the API is never served unauthenticated. The token is not logged. PRISM writes it to a file that only its owner can read, named prism-admin-token, and logs the file's path and a short fingerprint of the token so you can tell which run a file belongs to. The generated token changes on every restart and the file is removed on shutdown, so set bearer_token to keep it stable.

The file goes in the first of these directories that exists and is writable: the one named by the RUNTIME_DIRECTORY environment variable (the first, if it lists several), then XDG_RUNTIME_DIR, then the system temporary directory. In practice:

  • Package install (systemd): /run/prism/prism-admin-token. Read it as root, or as the prism user: sudo cat /run/prism/prism-admin-token.
  • Container: /tmp/prism-admin-token inside the container: docker exec prism cat /tmp/prism-admin-token. With a read-only root filesystem, mount a writable /tmp.
  • Plain run: $XDG_RUNTIME_DIR/prism-admin-token when that variable is set, otherwise /tmp/prism-admin-token.

If the file cannot be written anywhere, PRISM logs a warning and carries on: the admin API is then unreachable, apart from the probes, until you set bearer_token.

Use a long random value, for example the output of openssl rand -hex 32. A token shorter than 16 characters is accepted, but PRISM logs a warning at startup because it is short enough to guess, and prism validate prints the same warning.

Using peers requires it: a generated token cannot be shared, so each replica would sign forwarded purges with its own and every peer would reject them. Startup refuses peers without a configured token rather than letting the fan-out fail silently.

GET /health, /ready and /startup never require a credential, so orchestrator probes work either way.

To run with no authentication at all, set insecure_no_auth = true.

metrics_bearer_token​

A read-only credential accepted only for GET /metrics. Give this one to Prometheus so the scrape credential cannot purge the fleet; every other path answers 401 to it. The full bearer_token keeps working on /metrics too. The same 16-character warning applies to this token.

[admin]
bearer_token = "admin-secret" # full control
metrics_bearer_token = "scrape-only" # GET /metrics and nothing else

Audit events​

Every mutating admin call (/purge/*, /render, /warmup, /license/reload) emits a structured info-level event on the audit tracing target: endpoint, caller IP, parameters, entries removed, and peer fan-out results. Route or retain them separately with an EnvFilter directive such as audit=info.

Licence visibility​

GET /status reports version, license (valid / trial / expired / no_license / invalid) and licensed; /metrics exposes prism_license_valid (alert when 0) and prism_license_info{status=...}.

Example Use Cases​

Kubernetes deployment with health checks​

[admin]
enabled = true
address = "0.0.0.0:4001"
bearer_token = "k8s-admin-secret-42"

Use GET /ready for readiness, GET /startup during boot, and GET /health for liveness. The health endpoint performs a Chrome round-trip; the other probes inspect local state. None of these probes requires authentication.

Disabled admin API​

[admin]
enabled = false

Local development​

[admin]
enabled = true
address = "127.0.0.1:4001"
# A token is generated at startup and written to prism-admin-token (see bearer_token)