Admin panels

An admin panel puts your app's own admin in Pagebee: its users, orders, subscriptions or whatever it manages, in an Admin tab next to the site's analytics, support and errors. Your app serves a small JSON API that describes itself and does the work. Pagebee draws the pages, decides who may do what from their workspace role, and logs every action.

Pagebee stores none of your app's data. It reads it live from your app each time a page opens, with a token that says who is asking.

The contract is pagebee-admin/1. This page is the whole of it, so an agent can build a panel for any app in any language.

How it works

  1. Connect. Give Pagebee your admin API's base URL. It creates a signing key for this panel and gives you its JWKS URL.
  2. Build. Your agent adds five endpoints under that URL and checks every request's token against the JWKS URL.
  3. Ship. Once your app answers GET /manifest, the panel is connected and the Admin tab fills in.

Ask your agent:

text
Add a Pagebee admin panel to this app. Call connect_admin_panel for the site with base URL https://api.example.com/pagebee-admin/v1, then build pagebee-admin/1 from https://pagebee.ai/docs/admin-panels/raw.md: a users resource with search, a plan filter and an extend trial action, and a daily sign-ups metric. Check every token against the jwks_url it returns. Ship it, then call check_admin_panel until it says connected.

Connecting

In the dashboard: open the site, then its Admin tab, and enter the base URL. Workspace owners and admins can connect, move and disconnect a panel. The tab shows the JWKS URL to give your app.

Over MCP, with a dev key or a dev sign-in:

ToolWhat it does
connect_admin_panelsite_id and base_url. Connects the panel, reads the manifest once, and returns its jwks_url and next steps
check_admin_panelReads the manifest again now and returns the status, and the problem when it fails
list_admin_panelsEvery panel in the workspace, with status, URLs, and the tabs, resources, actions and metrics each holds
disconnect_admin_panelTakes the panel out of Pagebee. Its activity and its JWKS URL are kept

check_admin_panel and list_admin_panels work with any key. Agents set panels up and check them; they never browse records or run actions. That is for people.

The base URL must be https, public, and must not redirect. We suggest https://api.example.com/pagebee-admin/v1. Connecting again with a new URL moves the panel; the JWKS URL never changes for a site, even after a disconnect.

Status

StatusMeans
waitingThe app hasn't answered with a valid manifest yet. Usually it doesn't trust the panel's key yet, or isn't deployed. problem says what happened
connectedThe last read worked
unreachableThe last read failed. Pagebee keeps drawing the last good manifest and says why

Pagebee reads the manifest again when someone opens the panel and the copy it has is more than five minutes old.

The endpoints

All paths are under your base URL. Every request carries Authorization: Bearer <token> and expects JSON back.

RequestAnswer
GET /manifestThe manifest: what the app is and what it offers
GET /resources/:resourceA page of rows: { "rows": [...], "next_cursor": "..." or null, "total": 1234 }
GET /resources/:resource/:idOne record: { "record": { "id": "...", ... } }
POST /actions/:actionRuns an action. Body { "id": "..." or null, "input": { ... } }. Answer { "ok": true, "message": "..." }
GET /metrics/:metric?range=30d{ "kind": "stat", "value": 42 } or { "kind": "series", "points": [{ "t": "2026-11-01", "value": 3 }] }

Lists

GET /resources/:resource takes these query parameters. Ignore any you don't support.

ParameterMeaning
qSearch text, when the resource's list has search: true
sortA field from sorts: created_at ascending, -created_at descending
cursorThe next_cursor you returned for the previous page
limit1 to 100. Default to 50
where.<field>Equals this value. Sent for fields in filters, and for the via field of a related list

A row is an object with a string id and its fields' values. Return at most 200 rows. next_cursor is null on the last page; it can be anything you can read back (an offset, an encoded key). total is optional: send it when counting is cheap.

Records

GET /resources/:resource/:id answers { "record": { ... } }, the same shape as a row, usually with more fields. Answer 404 when there is no such record.

Actions

POST /actions/:action gets { "id": "u_123", "input": { "days": 14 } }. id is the record for a record action and null for an app action. input holds the form's values, or {}.

Answer { "ok": true, "message": "Trial extended to 8 December" }. message is shown to the person as it is, up to 500 characters. To refuse with a reason, answer { "ok": false, "message": "This account has no trial" } with a 200.

Metrics

GET /metrics/:metric?range= where range is 7d, 30d, 90d or 12m.

  • A stat answers { "kind": "stat", "value": 1280 }. value may be null, and an optional previous holds the period before.
  • A series answers { "kind": "series", "points": [{ "t": "2026-11-01", "value": 12 }] }, oldest first, t the first day of each day, week or month. At most 400 points.

Errors

Answer a non-2xx status with { "error": "A sentence for the person" }. Pagebee shows the sentence.

StatusWhen
400The request doesn't make sense: a bad input, a record action without an id
401The token is missing, expired, for another app or badly signed
403The person's level doesn't allow it
404No such resource, record, action or metric
409The record changed and the action no longer applies
500Something broke in the app

Pagebee waits 10 seconds for an answer and reads at most 2 MB.

The manifest

json
{
  "protocol": "pagebee-admin/1",
  "app": { "key": "tally", "name": "Tally", "icon_url": "https://tally.app/icon.png", "description": "Habit tracker" },
  "tabs": [],
  "resources": {},
  "actions": {},
  "metrics": {}
}

Every key (the app's key, and the keys of tabs, resources, fields, actions and metrics) is lower_snake_case: a lower-case letter, then letters, digits or underscores, up to 63 characters. Every key the manifest points at must be one it declares, or Pagebee rejects the manifest and says which.

Tabs

Up to 12. Each is one page in the Admin tab.

FieldMeaning
key, labelIts key and its name, up to 40 characters
metricsUp to 12 metric keys, drawn as tiles (stats) and charts (series) across the top
resourceA resource whose list fills the page under them
actionsUp to 6 app actions (scope app) on the tab's bar

Resources

json
"users": {
  "label": "Users",
  "title_field": "email",
  "subtitle_field": "name",
  "fields": {
    "email": { "type": "email" },
    "name": { "type": "text" },
    "plan": { "type": "enum", "options": [{ "value": "free", "label": "Free" }, { "value": "pro", "label": "Pro", "tone": "success" }] },
    "created_at": { "type": "datetime", "label": "Joined" }
  },
  "list": { "columns": ["email", "plan", "created_at"], "search": true, "filters": ["plan"], "sorts": ["created_at"] },
  "related": [{ "resource": "orders", "via": "user_id", "label": "Orders" }],
  "actions": ["extend_trial", "delete_user"]
}
FieldMeaning
labelIts name, up to 80 characters
title_fieldThe field a record is called by: its link in a list and its page's title
subtitle_fieldOptional, shown under the title
fieldsEvery field Pagebee may show, by key
list.columns1 to 12 fields shown as columns
list.searchThe list takes q
list.filtersUp to 8 fields the list can be narrowed by. Enum and boolean fields get a picker
list.sortsUp to 12 fields the list can be ordered by
relatedUp to 8 lists on a record's page: rows of resource whose via field holds this record's id
actionsUp to 12 record actions offered on its records

Field types

A field is { "type": "...", "label": "..." }; label is optional and defaults to the key.

TypeValueNotes
textstring
emailstring
urlstring
numbernumber
moneynumber in major units (12.5, not 1250)currency: an ISO code, default USD
datetimeISO 8601 string, with a time zone
dateYYYY-MM-DD
enumstringoptions: up to 100, each a string or { "value", "label", "tone" }. tone is neutral, success, warning or danger
booleantrue or false
imageURL string
jsonany JSON value
referencethe id of another recordresource: which resource, so the cell links to it

Actions

json
"extend_trial": {
  "label": "Extend trial",
  "level": "operate",
  "scope": "record",
  "input": {
    "type": "object",
    "properties": { "days": { "type": "integer", "title": "Days", "minimum": 1, "maximum": 30, "default": 14 } },
    "required": ["days"]
  }
},
"delete_user": {
  "label": "Delete account",
  "level": "danger",
  "confirm": "This deletes the account and its habits for good."
}
FieldMeaning
labelThe button, up to 60 characters
leveloperate for everyday support work, danger for anything that locks someone out, deletes or costs money
scoperecord (the default) runs on one record and gets its id; app runs on the app as a whole and gets null
confirmThe sentence the confirmation shows, saying exactly what will happen. Required for danger
inputA form, as a flat JSON Schema object

input.properties are flat: each has type (string, integer, number or boolean) and optionally title, description, enum (a list of strings, drawn as a picker), minimum, maximum and default. required lists the ones that must be filled. Validate the input again in your app.

Metrics

json
"signups": { "label": "Sign-ups", "kind": "series", "unit": "count", "interval": "day" },
"mrr": { "label": "MRR", "kind": "stat", "unit": "usd" }
FieldMeaning
labelUp to 60 characters
kindstat, one number drawn as a tile, or series, a number per interval drawn as a chart
unitcount (default), usd, percent or hours
intervalFor a series: day, week or month

Who can do what

Each person's level in a panel comes from their workspace role. Each level includes the one before it.

RoleLevelCan
ViewerviewBrowse lists, records and metrics
MemberoperateAlso run operate actions
Admin, ownerfullAlso run danger actions, and connect or disconnect the panel

Pagebee only offers an action to people whose level allows it and checks again before calling your app. Your app must check too: you are the one acting.

Every action is logged in the panel's Activity: who ran it, on which record, the input, and what your app answered, including refusals and failures. Don't ask for secrets in an action's input.

The token

Every request carries a JWT signed by Pagebee with EdDSA (Ed25519), using this panel's own key.

text
Authorization: Bearer eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCIsImtpZCI6InBhZ2ViZWUtLi4uIn0.eyJpc3MiOi...

The header is { "alg": "EdDSA", "typ": "JWT", "kid": "pagebee-..." }. The claims:

ClaimMeaning
isshttps://api.pagebee.ai
audYour app's key from the manifest. "*" only on GET /manifest, which Pagebee always addresses to "*"
subThe Pagebee person's id. key:<id> when an agent's key is checking the panel
email, nameThe person. Use them for your own audit log
levelview, operate or full
iat, expIssued and expiry, 60 seconds apart
jtiA unique id for this token

The public key is at the panel's JWKS URL, https://api.pagebee.ai/admin-panels/<panel id>/jwks.json, as an OKP key with crv Ed25519. connect_admin_panel returns it as jwks_url, and the Admin tab shows it. Cache the keys and fetch again when a token names a kid you don't have.

On every request, your app must:

  1. Read the bearer token and split it into header, claims and signature.
  2. Check the header's alg is EdDSA and its kid is in the JWKS.
  3. Verify the signature over header.claims with that key.
  4. Check exp is in the future (allow a few seconds of clock skew) and iss is https://api.pagebee.ai.
  5. Check aud is your app's key, or "*" and the request is GET /manifest.
  6. Before an action, check level: operate actions need operate or full; danger actions need full.

Answer 401 with an error when any check fails.

Why a key per panel

Anyone can sign up to Pagebee and add a site. If one key signed for every workspace, someone could connect your admin URL to their own site and Pagebee would sign their requests. With a key per panel, your app trusts exactly the one panel whose JWKS URL you gave it, and nothing else Pagebee signs works there.

A complete example

A minimal Express app in TypeScript with one resource, one action and one metric, checking tokens with nothing but node:crypto. Swap the array for your database.

admin.ts
import crypto from "node:crypto";
import express from "express";

// From connect_admin_panel, or the site's Admin tab in Pagebee.
const JWKS_URL = process.env.PAGEBEE_ADMIN_JWKS_URL!;
const ISSUER = "https://api.pagebee.ai";
const APP_KEY = "tally";

type Level = "view" | "operate" | "full";
type Claims = { iss: string; aud: string; sub: string; email: string; name: string | null; level: Level; exp: number };

// ── The token ──────────────────────────────────────────────

let keys = new Map<string, crypto.KeyObject>();
let fetchedAt = 0;

async function loadKeys() {
  if (keys.size && Date.now() - fetchedAt < 60_000) return; // at most once a minute
  const res = await fetch(JWKS_URL);
  if (!res.ok) throw new Error(`Pagebee's keys answered ${res.status}`);
  const jwks = (await res.json()) as { keys: { kid: string; kty: string; crv: string; x: string }[] };
  keys = new Map(
    jwks.keys
      .filter((k) => k.kty === "OKP" && k.crv === "Ed25519")
      .map((k) => [k.kid, crypto.createPublicKey({ key: { kty: "OKP", crv: "Ed25519", x: k.x }, format: "jwk" })]),
  );
  fetchedAt = Date.now();
}

async function verify(authorization: string | undefined, isManifest: boolean): Promise<Claims> {
  const [h, p, s] = /^Bearer (.+)$/.exec(authorization ?? "")?.[1]?.split(".") ?? [];
  if (!h || !p || !s) throw new Error("Not signed by Pagebee");
  const head = JSON.parse(Buffer.from(h, "base64url").toString()) as { alg?: string; kid?: string };
  if (head.alg !== "EdDSA" || !head.kid) throw new Error("Unexpected token algorithm");
  if (!keys.has(head.kid)) await loadKeys();
  const key = keys.get(head.kid);
  if (!key) throw new Error("Signed with a key this panel doesn't publish");
  if (!crypto.verify(null, Buffer.from(`${h}.${p}`), key, Buffer.from(s, "base64url"))) throw new Error("Bad signature");
  const claims = JSON.parse(Buffer.from(p, "base64url").toString()) as Claims;
  if (claims.exp < Date.now() / 1000 - 5) throw new Error("Token expired");
  if (claims.iss !== ISSUER) throw new Error("Token from another issuer");
  if (claims.aud !== APP_KEY && !(isManifest && claims.aud === "*")) throw new Error("Token for another app");
  if (!["view", "operate", "full"].includes(claims.level)) throw new Error("Unknown level");
  return claims;
}

const allows = (level: Level, needs: "operate" | "danger") => level === "full" || (level === "operate" && needs === "operate");

// ── What the app manages ───────────────────────────────────

type User = { id: string; email: string; name: string; plan: "free" | "pro"; trial_ends: string | null; created_at: string };
const users: User[] = [
  { id: "u_1", email: "sam@example.com", name: "Sam", plan: "pro", trial_ends: null, created_at: "2026-11-02T09:14:00Z" },
  { id: "u_2", email: "priya@example.com", name: "Priya", plan: "free", trial_ends: "2026-11-30", created_at: "2026-11-20T16:40:00Z" },
];

const manifest = {
  protocol: "pagebee-admin/1",
  app: { key: APP_KEY, name: "Tally" },
  tabs: [{ key: "users", label: "Users", metrics: ["signups"], resource: "users" }],
  resources: {
    users: {
      label: "Users",
      title_field: "email",
      subtitle_field: "name",
      fields: {
        email: { type: "email" },
        name: { type: "text" },
        plan: { type: "enum", options: [{ value: "free", label: "Free" }, { value: "pro", label: "Pro", tone: "success" }] },
        trial_ends: { type: "date", label: "Trial ends" },
        created_at: { type: "datetime", label: "Joined" },
      },
      list: { columns: ["email", "plan", "trial_ends", "created_at"], search: true, filters: ["plan"], sorts: ["created_at"] },
      actions: ["extend_trial"],
    },
  },
  actions: {
    extend_trial: {
      label: "Extend trial",
      level: "operate",
      scope: "record",
      input: {
        type: "object",
        properties: { days: { type: "integer", title: "Days", minimum: 1, maximum: 30, default: 14 } },
        required: ["days"],
      },
    },
  },
  metrics: { signups: { label: "Sign-ups", kind: "series", unit: "count", interval: "day" } },
};

// ── The five endpoints ─────────────────────────────────────

const admin = express.Router();
admin.use(express.json());

admin.use(async (req, res, next) => {
  try {
    res.locals.claims = await verify(req.headers.authorization, req.method === "GET" && req.path === "/manifest");
    next();
  } catch (err) {
    res.status(401).json({ error: err instanceof Error ? err.message : "Not signed by Pagebee" });
  }
});

admin.get("/manifest", (_req, res) => {
  res.json(manifest);
});

admin.get("/resources/users", (req, res) => {
  const q = String(req.query.q ?? "").toLowerCase();
  const plan = req.query["where.plan"];
  const sort = String(req.query.sort ?? "-created_at");
  const limit = Math.min(100, Math.max(1, Number(req.query.limit) || 50));
  const offset = Number(req.query.cursor) || 0;
  const rows = users
    .filter((u) => !q || u.email.includes(q) || u.name.toLowerCase().includes(q))
    .filter((u) => !plan || u.plan === plan)
    .sort((a, b) => a.created_at.localeCompare(b.created_at) * (sort.startsWith("-") ? -1 : 1));
  res.json({
    rows: rows.slice(offset, offset + limit),
    next_cursor: offset + limit < rows.length ? String(offset + limit) : null,
    total: rows.length,
  });
});

admin.get("/resources/users/:id", (req, res) => {
  const user = users.find((u) => u.id === req.params.id);
  if (!user) return void res.status(404).json({ error: "No such user" });
  res.json({ record: user });
});

admin.post("/actions/extend_trial", (req, res) => {
  const claims = res.locals.claims as Claims;
  if (!allows(claims.level, "operate")) return void res.status(403).json({ error: "Viewers can't extend trials" });
  const user = users.find((u) => u.id === req.body?.id);
  if (!user) return void res.status(404).json({ error: "No such user" });
  const days = Number(req.body?.input?.days);
  if (!Number.isInteger(days) || days < 1 || days > 30) return void res.status(400).json({ error: "Pick 1 to 30 days" });
  if (user.plan === "pro") return void res.json({ ok: false, message: "This account is already on Pro" });
  const from = user.trial_ends ? new Date(user.trial_ends) : new Date();
  user.trial_ends = new Date(from.getTime() + days * 86_400_000).toISOString().slice(0, 10);
  console.log(`${claims.email} extended ${user.email}'s trial by ${days} days`);
  res.json({ ok: true, message: `Trial now ends on ${user.trial_ends}` });
});

admin.get("/metrics/signups", (req, res) => {
  const days = ({ "7d": 7, "30d": 30, "90d": 90, "12m": 365 } as Record<string, number>)[String(req.query.range)] ?? 30;
  const points = Array.from({ length: days }, (_, i) => {
    const t = new Date(Date.now() - (days - 1 - i) * 86_400_000).toISOString().slice(0, 10);
    return { t, value: users.filter((u) => u.created_at.startsWith(t)).length };
  });
  res.json({ kind: "series", points });
});

admin.use((_req, res) => {
  res.status(404).json({ error: "Not part of pagebee-admin/1" });
});

const app = express();
app.use("/pagebee-admin/v1", admin);
app.listen(3000);

The base URL for this app is https://your-host/pagebee-admin/v1. Set PAGEBEE_ADMIN_JWKS_URL to the panel's JWKS URL before you deploy.

Apps built for nbs-console/1

nbs-console/1, the Never Before Seen platform's console protocol, is the same wire format under an older name. An app that serves it connects unchanged: its manifest can keep "protocol": "nbs-console/1". Point it at the new panel's JWKS URL instead of the platform's, and set the issuer it checks to https://api.pagebee.ai.

Price

Admin panels are on every plan, including Free, at no extra cost. Reading a panel and running actions never count as events.