API reference
This page summarizes the alpha HTTP surface that operators, CI jobs, and the CLI use. The CLI wraps most of these routes; call the API directly when you are debugging or integrating a custom workflow.
Local defaults:
| Service | URL |
|---|---|
| Gateway | http://localhost:4873 |
| Admin | http://localhost:3000 |
| Local admin token | local-dev-token |
Protected routes require the admin token. Services prefer MEZAIR_ADMIN_TOKEN and still accept the legacy ADMIN_TOKEN alias; the local Compose stack sets ADMIN_TOKEN to local-dev-token by default.
Health
GET /-/healthUse this for process liveness. A healthy response means the HTTP service can answer.
Example:
curl http://localhost:4873/-/health
curl http://localhost:3000/-/healthThe gateway health route is served by Fastify. The Admin health route is served by the Next.js Admin service.
Readiness
GET /-/readyUse this before routing install traffic. Readiness should check runtime dependencies such as persistence, object storage, queueing, and upstream registry configuration.
Example:
curl http://localhost:4873/-/readyHealth can pass while readiness fails. That is useful, not a contradiction.
Metadata
GET /:packageName
GET /@:scope/:packageNameMetadata routes return npm-compatible package metadata after Mezair has applied cheap policy checks, filtered versions where configured, rewritten dist-tags, and rewritten tarball URLs through the gateway.
Examples:
curl http://localhost:4873/react
curl http://localhost:4873/@types/nodePackage managers encode scoped names differently across requests, so test scoped metadata with real npm-compatible clients as well as curl.
Tarballs
GET /:packageName/-/:tarballName
GET /@:scope/:packageName/-/:tarballNameTarball routes check policy decisions for the resolved package identity, serve cached allowed tarballs when possible, and fetch from upstream when needed.
Blocked or quarantined tarball requests return JSON explaining the decision so you can diagnose the failed install.
Explain
POST /-/mezair/explainExplain returns the current decision and evidence for a package version.
Example payload:
{
"name": "react",
"version": "latest"
}Use the CLI for the normal path:
MEZAIR_REGISTRY_URL=http://localhost:4873 mezair registry explain react@latestExplain output should include the decision action, policy version, triggering signals, analysis state, override state, and any review context that is enabled.
Policy
GET /-/mezair/policyReturns the active policy view for operators and CI tools. Use this to confirm the runtime mode and policy version a decision is using.
CLI example:
MEZAIR_REGISTRY_URL=http://localhost:4873 mezair registry policyLLM review
POST /-/mezair/llm-review
Authorization: Bearer <admin-token>
Content-Type: application/jsonQueues optional model review context for one package version or a deduplicated set of targets. The route is available only when LLM review is enabled, and it does not approve packages or bypass deterministic policy.
Example payload:
{
"name": "react",
"version": "18.3.1",
"requestedBy": "security-review",
"priority": "high"
}CLI example:
MEZAIR_REGISTRY_URL=http://localhost:4873 \
MEZAIR_ADMIN_TOKEN=local-dev-token \
mezair registry llm-review react@18.3.1 --requested-by security-review --priority highSee LLM integration for provider setup, schema expectations, and privacy controls.
Overrides
POST /-/mezair/overrideCreates an explicit override for a package decision. Overrides should be version-specific, reasoned, audited, and preferably expiring.
Required concepts:
- Package name.
- Version.
- Desired action.
- Human reason.
- Reviewer identity when available.
- Expiry when the override is temporary.
CLI example:
MEZAIR_REGISTRY_URL=http://localhost:4873 \
MEZAIR_ADMIN_TOKEN=local-dev-token \
mezair override approve react@18.3.1 --reason "Reviewed package identity and reports"Do not use overrides as a junk drawer for making CI green. That drawer fills up fast, then catches fire.
Reports
Analysis reports are available through the Next.js Admin route-handler API:
GET /api/reports?limit=100
GET /api/reports?packageName=react&version=18.3.1
GET /api/reports/:packageName/:versionThe list route is useful for smokes and operator checks after worker queue processing. The package route returns the latest matching immutable report identity, with optional integrity, shasum, and analyser query filters.
CLI example:
MEZAIR_ADMIN_URL=http://localhost:3000 \
MEZAIR_ADMIN_TOKEN=local-dev-token \
mezair registry reports react@18.3.1Node Base reports can be submitted to Admin so reviewers can inspect local install evidence with registry decisions.
CLI example:
MEZAIR_REGISTRY_URL=http://localhost:4873 \
MEZAIR_ADMIN_TOKEN=local-dev-token \
MEZAIR_PROJECT_NAME=my-project \
MEZAIR_REPORT_SOURCE=ci \
mezair-submit-report .mezair/reports/ioc-report.json iocReport types include:
| Type | Meaning |
|---|---|
lifecycle |
Safe-mode lifecycle script report. |
dependency |
Dependency tree report. |
ioc |
Observed install indicators of compromise report. |
network |
Network monitor report. |
Queue operations
Queue operations are normally driven through the CLI.
Examples:
MEZAIR_REGISTRY_URL=http://localhost:4873 \
MEZAIR_ADMIN_TOKEN=local-dev-token \
mezair registry queue status
MEZAIR_REGISTRY_URL=http://localhost:4873 \
MEZAIR_ADMIN_TOKEN=local-dev-token \
mezair registry queue failed --limit 20
MEZAIR_REGISTRY_URL=http://localhost:4873 \
MEZAIR_ADMIN_TOKEN=local-dev-token \
mezair registry warm ./pnpm-lock.yamlmezair registry warm queues exact package versions from lockfiles and records the reason as lockfile_scan. BullMQ deployments also support selected failed-job retries and explicit, audited removal through queue retry and queue remove ... --confirm.
Authentication model
The alpha admin surface uses an environment admin token where protected operations need it. Full auth is intentionally not described as finished.
Use:
export MEZAIR_ADMIN_TOKEN=local-dev-tokenFor hosted deployments, set a real secret. Do not expose admin tokens through NEXT_PUBLIC_*, client-side code, logs, readiness output, or screenshots in issues. Future you deserves at least this much kindness.