Admin API
The Admin API runs on a separate port (default 127.0.0.1:4001) and exposes endpoints for health checks, cache management, rendering, and metrics.
Authentication
Five endpoints are always unauthenticated — GET /health, GET /live, GET /ready, GET /ready/proxy and
GET /startup — because a kubelet probing them holds no credential.
Everything else requires a bearer token by default. The optional
admin.metrics_bearer_token is accepted only for GET /metrics; the full admin
token also works there. admin.insecure_no_auth = true permits unauthenticated
access only when no full token is configured; keep this listener private.
The token is not optional in practice: leave admin.bearer_token unset and
PRISM generates one at startup and logs it, and it refuses to start at all
if the admin API is bound to a non-loopback address without either a token or
an explicit insecure_no_auth = true. There is no configuration in which the
mutating endpoints are quietly open.
[admin]
address = "127.0.0.1:4001"
bearer_token = "your-secret-token"
Include the token in the Authorization header:
Authorization: Bearer your-secret-token
Token comparison uses constant-time equality to prevent timing attacks.
Endpoints
GET /health
Returns whether Chrome is responsive, by creating and closing a real page. No authentication required.
Returns 200 when Chrome is responsive, 503 when it is not. This is a
diagnostic: it is comparatively expensive, and it reports on the browser, not
on the proxy. Do not use it as a liveness probe — see /live —
or as a readiness check for traffic — see /ready/proxy.
curl http://127.0.0.1:4001/health
{"status": "ok"}
Unhealthy response (503):
{"status": "unhealthy", "reason": "chrome not responding"}
GET /live
Returns 200 with {"status":"alive"} whenever the process can answer. It
does not depend on Chrome, the origin or the licence.
Use this for anything that restarts the instance when it fails (a Kubernetes
liveness probe). /health asks Chrome, and a restart does nothing for Chrome
that PRISM does not already do itself — it only takes a working proxy away
from visitors. No authentication required.
GET /ready
Returns 200 with {"status":"ready"} when the pool can serve traffic.
Returns 503 with {"status":"draining"} during shutdown, or
{"status":"not_ready","reason":"chrome unavailable"} when Chrome is unavailable.
This probe reads local state and is suitable for frequent readiness checks.
No authentication required.
GET /ready/proxy
Returns 200 whenever the instance can take traffic: the proxy listener is
up and the instance is not draining. Returns 503 with
{"status":"draining"} during shutdown. The body reports Chrome separately —
{"status":"ready","chrome":"ready"} or {"status":"ready","chrome":"unavailable"} —
but the status code does not depend on it.
Use this, not /ready, for anything that decides whether the instance
receives traffic at all (a Kubernetes readiness probe, a load-balancer health
check). In bot-only mode most requests are proxied to the origin without
Chrome, so gating all traffic on Chrome's health turns a browser crash or
recycle into an outage for visitors. /ready remains the answer to "can this
instance render". No authentication required.
GET /startup
Returns 200 with {"status":"started"} when the browser pool is ready, or
503 with {"status":"starting"} otherwise. Use a generous startup probe
budget for Chromium initialization. No authentication required.
Neither probe establishes that rendering is authorized. Check licensed in
GET /status and test an actual bot request after deployment.
GET /status
Returns runtime statistics including uptime, cache state, pool size, and render counts.
curl -H "Authorization: Bearer your-secret-token" \
http://127.0.0.1:4001/status
{
"uptime_secs": 3600,
"version": "1.4.7",
"license": "trial",
"licensed": true,
"cache": {
"entries": 1482,
"memory_bytes": 52428800
},
"pool": {
"size": 8,
"available": 5,
"crashes": 0
},
"renders": {
"total": 4521,
"active": 3,
"queue_depth": 0
}
}
GET /metrics
Returns all metrics in Prometheus text exposition format (text/plain; version=0.0.4).
curl -H "Authorization: Bearer your-secret-token" \
http://127.0.0.1:4001/metrics
# HELP prism_requests_total Total requests by cache status
# TYPE prism_requests_total counter
prism_requests_total{status="hit"} 3200
prism_requests_total{status="miss"} 1321
...
See the Metrics Reference for a full list of exported metrics.
POST /purge/url
Purge a specific URL from the render cache.
curl -X POST \
-H "Authorization: Bearer your-secret-token" \
-H "Content-Type: application/json" \
-d '{"url": "/products/widget-pro"}' \
http://127.0.0.1:4001/purge/url
{"purged": true, "entries_removed": 2, "matched_url": "http://127.0.0.1:3000/products/widget-pro", "peers_purged": 1, "peers_failed": 0}
Entries are keyed by server.origin plus the path, so a path is resolved against
the origin. When server.public_base_url is set, you can also give the site's
public URL (https://www.example.com/products/widget-pro) and it is mapped onto
the origin. Scheme and host are compared case-insensitively, and an explicit
default port (:80 on http, :443 on https) is treated as absent, for the public
base URL and for the origin. A URL on any other host matches nothing.
matched_url is the canonical URL that was looked up. If purged is false,
check it against what you expected.
purged reports whether stored variants were removed; entries_removed counts
those variants. All purge operations also invalidate matching in-flight render
results, preventing late completion from repopulating purged content.
peers_purged and peers_failed report peer delivery results. A successful local
purge still returns HTTP 200 if a peer fails. There is no durable retry journal;
monitor failures and retry after restoring peer connectivity.
POST /purge/pattern
Purge all cached URLs matching a glob pattern.
A pattern beginning with / is resolved against the configured origin, because
entries are keyed by the rendered URL rather than by path. Give a pattern that
starts with a scheme, or with *, to match across origins. A pattern that starts
with the public base URL (server.public_base_url) is mapped onto the origin in
the same way as for /purge/url.
curl -X POST \
-H "Authorization: Bearer your-secret-token" \
-H "Content-Type: application/json" \
-d '{"pattern": "/products/*"}' \
http://127.0.0.1:4001/purge/pattern
{"purged_count": 47, "peers_purged": 1, "peers_failed": 0}
POST /purge/all
Purge the entire render cache.
curl -X POST \
-H "Authorization: Bearer your-secret-token" \
http://127.0.0.1:4001/purge/all
{"purged_count": 1482, "peers_purged": 1, "peers_failed": 0}
POST /render
Render or retrieve a URL through the normal cache pipeline. A fresh cache hit does not force a new browser render; purge the URL first if a fresh render is needed. Storage still depends on the effective cache policy. Requires a valid license.
curl -X POST \
-H "Authorization: Bearer your-secret-token" \
-H "Content-Type: application/json" \
-d '{"url": "/products/widget-pro"}' \
http://127.0.0.1:4001/render
Success response:
{
"status": "ok",
"cache_status": "MISS",
"render_time_ms": 1250,
"html_bytes": 48230,
"variants": [
{"device": "default", "cache_status": "MISS", "render_time_ms": 1250, "html_bytes": 48230}
]
}
With viewport rendering enabled, variants contains mobile and desktop results.
Top-level render fields mirror the last completed variant. A variant failure
returns HTTP 500 with device and variants_completed alongside error.
Configured route exclusions also apply to this endpoint.
Error responses:
- 403 — No valid license:
{"error": "rendering unavailable — license required"}
- 400 — Invalid URL or path traversal attempt
- 500 — Render failure (Chrome crash, timeout, etc.)
The url field accepts either a path (/page) or a full URL (https://example.com/page). Full URLs are parsed and only the path and query string are used.
POST /license/reload
Reverify the file at the configured license.path without restarting:
curl -X POST -H "Authorization: Bearer $TOKEN" \
http://127.0.0.1:4001/license/reload
Successful verification returns HTTP 200, for example:
{"status":"ok","license":"trial","licensed":true}
Check licensed, not just the HTTP status: a correctly signed but expired
licence can verify successfully while rendering remains disabled. A missing
configured path returns 400. A missing, corrupt, or invalid file returns 422
with error, license, licensed: false, and a note that rendering is disabled.
Failed reloads immediately clear the previous entitlement. There is no grace
period; install a valid file and reload to restore rendering.
POST /warmup
Start a cache warmup job by fetching and rendering all URLs from a sitemap. Requires a valid license.
curl -X POST \
-H "Authorization: Bearer your-secret-token" \
-H "Content-Type: application/json" \
-d '{"sitemap_url": "https://example.com/sitemap.xml"}' \
http://127.0.0.1:4001/warmup
{"status": "warmup started"}
Returns 202 Accepted when the background job is accepted, 409 Conflict
if another warmup is running. Acceptance does not mean the sitemap fetched or
all pages rendered successfully; poll /warmup/status. Invalid or expired
licences return 403 before the job starts, and running jobs check validity
before new browser work.
GET /warmup/status
Check the progress of a running warmup job.
curl -H "Authorization: Bearer your-secret-token" \
http://127.0.0.1:4001/warmup/status
{
"status": "running",
"total": 500,
"processed": 237,
"errors": 3,
"elapsed_secs": 45.2,
"error_message": null
}
The status field can be idle, running, complete or failed. The enum serialises Complete as complete, not completed, and failed means the warmup ran and gave up — distinct from idle, which means it never started.
Error Handling
All error responses use JSON:
{"error": "description of what went wrong"}
Common status codes:
| Code | Meaning |
|---|---|
| 400 | Invalid JSON body or bad request |
| 401 | Missing or invalid bearer token |
| 403 | License required for this endpoint |
| 404 | Unknown endpoint |
| 409 | Conflict (e.g., warmup already running) |
| 413 | Request body exceeds 1 MiB |
| 422 | Licence reload verification failed |
| 429 | Repeated failed authentication attempts; Retry-After: 1 |
| 500 | Internal server error |
Request bodies are limited to 1 MB.
GET /explain
Answers why did PRISM do that for one URL, without rendering or fetching from the origin. It inspects cached entries without promoting them in the LRU or counting a cache hit.
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:4001/explain?url=/products/widget"
Use it to inspect routing, stored variants, and a hypothetical origin cache policy before changing configuration.
Three answers, asked separately
routing — would a request for this path be rendered, and if not, which
condition stopped it. Add user_agent=... to ask as a specific crawler:
without one the answer assumes a human, which is why not_bot is the usual
reply in the default bot-only mode. Add authenticated=1 to ask as a request
carrying credentials (an Authorization header; in bot-only mode a cookie
alone does not change the cache behaviour).
cache — what is stored right now: its age, its lifetime, whether it still
counts as fresh, whether grace may serve it after that, and every variant
stored under the same canonical URL. Read without promoting the entry or
counting a hit — a diagnostic that moves the numbers it reports would raise the
hit rate of anyone debugging a low one.
policy — a hypothesis. Give it status and optionally cache_control as
your origin would send them, and it answers whether the result would be stored,
for how long, what would be announced downstream, and if it would not be
stored, why not, in a sentence:
curl -H "Authorization: Bearer $TOKEN" \
"http://localhost:4001/explain?url=/products/widget&status=200&cache_control=public,%20max-age=0"
{
"policy": {
"would_store": false,
"reason": "origin_lifetime_is_zero",
"why": "the origin gave this a lifetime of zero, so it is stale on arrival and reusing it would need a revalidation PRISM cannot perform"
}
}
reason is a stable token safe to key a dashboard on; why is the sentence for
a person. The four are origin_forbids_shared_caching,
origin_lifetime_is_zero, status_needs_explicit_permission and
error_caching_disabled.
Omit status and the policy section is null — PRISM will not guess what
your origin would have said.