Developer & API keys
Nội dung này hiện chưa có sẵn bằng ngôn ngữ của bạn.
The Developer page (/developer) is where you set up programmatic access to your
fleet: scoped API tokens for your AI client (MCP), scripts and CI/CD, webhook
endpoints that push signed events to your systems, and an API reference with
ready-to-copy client config and a playground. MCP access for AI clients, the REST API and the
event feed are on every plan (on Free, writes through API tokens are a 30-day
trial, then read-only); developer webhooks need the Pro plan or higher.
Create an API token, step by step
Section titled “Create an API token, step by step”-
In the API tokens card, click Create token to open the create drawer.
-
Enter a Label — a human name so you can recognise and revoke the token later (e.g.
My laptop — Claude Code). -
Pick an Ability: Read only (inspect only), Deploy (for AI coding agents: deploy, redeploy, env vars and database attach on Docker apps, plus delete and roll back only the apps this token deployed), Operate (day-2 ops such as service control, cache purge, SSL renew, updates — nothing destructive; the default) or Full (everything your own role allows, with every extra permission below except mailbox access). Custom shows the permission level (
read,deploy,operate,full) and the extra permissions so you can set them yourself. -
Choose Servers — All servers, or Choose specific boxes for an allowlist.
-
Under Custom, tick any Extra permissions (opt-in). These are never implied by the permission level:
Scope Allows servers:enrollAdd servers (mint install tokens) servers:deleteRemove servers from the fleet sites:deleteDelete sites, apps and stacks data:deleteDrop databases, delete backups and records, purge data backups:restoreOverwrite live data (restore, rollback, push-to-live, moves) files:writeWrite and delete files through the File Manager system:adminOS users, SSH, firewall, cron, reboot and other root-level settings team:adminInvite and remove members, change roles tokens:adminMint and revoke API tokens webhooks:adminOutbound webhooks and integration credentials (Git, DNS, registries, alert channels, backup destinations) mail:read,mail:send,mail:modifyRead, send, or change messages in box mailboxes (with an optional mailbox allowlist) apps:ownDelete and roll back only the Docker apps this token deployed (part of the Deploy ability) secrets:readSee passwords, tokens and secret env values in job output unmasked (masked for every other token) -
Optional: fill Allowed IPs — one IPv4/IPv6 address or CIDR block per line, up to 20 — to accept the token only from those addresses (your office, CI runners, a Prometheus server). Leave it empty to allow any address.
-
Set an expiry if you want one, then click Create token. The full token (
mzmcp_…) is shown once — copy it into a secret manager or your AI client config immediately.
What else you can do
Section titled “What else you can do”- Edit permission & servers — change a token’s ability, level, extra permissions,
server scope and allowed IPs later without changing its value. The row badge shows the
ability (
Operate,Deploy, …) or<level> · custom; a network chip shows the allowed IPs when the token has some. - Scrape fleet metrics — a Read only token works with the
Prometheus metrics endpoint (
GET /v1/api/metrics/prometheus). - Regenerate or revoke a token — regenerate keeps the scope and issues a new value; revoke removes it. Either way, the old value immediately stops working.
- Connect an AI client — the Docs & reference card gives copy-paste config for
Claude Code, Cursor / Claude Desktop / VS Code (
mcp.json) and a rawcurlcall against the MCP endpointhttps://mcp.mzpanel.com. - Browse and try the REST API — the reference is generated from the OpenAPI spec
(
GET https://api.mzpanel.com/v1/openapi.json), and the playground runs aGETagainst/v1/api/*with your token. - Add a webhook endpoint (Pro+) — enter an HTTPS URL and pick which
events to subscribe to. Optionally limit it to some servers (
serverIds, API and MCP). On save, a per-endpoint signing secret is shown once. - Browse and try the REST API — the OpenAPI spec link opens
GET https://api.mzpanel.com/v1/openapi.json(the whole API, generated from the operation registry; import it into Postman, n8n, Make or Pipedream), and the playground runs aGETagainst/v1/api/*with your token. - Add a webhook endpoint (Pro+) — enter an HTTPS URL and pick which events to
subscribe to:
server.online,server.offline,deploy.succeeded,deploy.failed,backup.completed,ssl.renewed,site.down,mail.received. On save, a per-endpoint signing secret is shown once. - Send a test ping — POSTs a
test.pingevent so you can confirm your receiver is reachable. - View recent deliveries — each event’s delivery with its state (
delivered,pendingwith the next retry time,gone,failed,cancelled), attempts, and the last HTTP status, so you can see at a glance whether an endpoint is healthy or failing. - Enable / disable, re-filter or delete an endpoint — pause deliveries, change the events or servers it receives, or stop it for good.
How it works
Section titled “How it works”This is a control-plane feature, not something the agent runs:
- One token, two doors. An API token authenticates both the remote MCP server
(
https://mcp.mzpanel.com, the same endpoint asPOST https://api.mzpanel.com/mcp) and the REST API underhttps://api.mzpanel.com/v1/api/, sent asAuthorization: Bearer mzmcp_…. Tokens are stored hashed, and a token can only narrow the access of the user who minted it, never widen it. - Rate limits are per token and grow with the plan; REST and MCP calls share the same budget.
- One event source. Everything that happens (a job finishes, a monitor goes down, a certificate nears expiry…) is recorded once as an event with a stable id and kept 30 days. Webhooks push those events to you; the event feed lets you poll them.
- Webhooks are the push direction: when a subscribed event fires, the control plane
POSTs
{id, event, at, data}to your endpoint, signed with the per-endpoint secret (see Verify a webhook). A failed delivery is retried with backoff. - Mutations are audited — every action taken through MCP or the REST API lands in the audit log like a dashboard action.
Events
Section titled “Events”The same events feed both webhooks and the polling feed. Each has a type, an optional
serverId, a subject (domain, job id, monitor id…) and a data object.
| Event | When it fires |
|---|---|
server.online / server.offline | A server’s agent connects after being offline / disconnects |
deploy.succeeded / deploy.failed | A Docker app or stack deploy, update, build, rebuild, rollback or pull finished |
backup.completed / backup.failed | A backup run finished or failed (also runs the box made on its own while MZPanel was unreachable) |
ssl.renewed | A certificate was issued or renewed |
ssl.expiring | A certificate has 14 days or less left (once at 14 days, once at 3 days) |
site.created / site.deleted | A site of any type was created / deleted |
site.down | An uptime monitor pointing at one of your sites went down |
uptime.down / uptime.up | Any uptime monitor went down (2 failed checks in a row) / recovered |
job.completed / job.failed | Any job on a server finished; job.failed carries data.failure {code, hint} when the cause is known (full disk, DNS not pointing, apt lock…) |
resource.cap | A site is at 90 % of its memory or disk cap, or the kernel enforced a cap (out-of-memory kill, memory or process limit) |
update.available | OS package updates became pending on a server (data.kind: "os"), or a newer agent release is out ("agent") |
cron.failed | A scheduled run of an MZPanel-managed cron job failed: a non-zero exit, or an output check (fail pattern matched / success pattern missing). At most once per job per hour |
mail.received | A mailbox on one of your mail servers received a message |
Events are kept 30 days (mail.received one day).
Verify a webhook
Section titled “Verify a webhook”Every delivery is a POST with a JSON body:
{ "id": "evt_01KB7Q9X3V4M2C8H5N6P0R1S2T", "event": "job.failed", "at": "2026-11-29T08:00:00.000Z", "data": { "server_id": "…", "job_id": "…", "job_type": "app.rebuild", "status": "failed", "exit_code": 1, "duration_ms": 5321, "error": null, "failure": { "code": "disk_full", "hint": "The disk (or the site's quota) is full…" } }}Headers: X-MZ-Event, X-MZ-Event-Id, X-MZ-Delivery, X-MZ-Attempt (1–6),
X-MZ-Timestamp (unix seconds), and X-MZ-Signature-V2: sha256=<hex> = HMAC-SHA256 of
<X-MZ-Timestamp>.<raw body> with your endpoint secret. Recompute it over the raw bytes,
compare in constant time, and reject a timestamp more than 5 minutes off — that stops a
captured request from being replayed. Then dedupe on id (a retry carries the same id and
at).
import crypto from 'node:crypto';
export function verifyMzWebhook(secret, rawBody, headers) { const ts = headers['x-mz-timestamp']; const got = (headers['x-mz-signature-v2'] || '').replace(/^sha256=/, ''); const want = crypto.createHmac('sha256', secret).update(`${ts}.${rawBody}`).digest('hex'); const fresh = Math.abs(Date.now() / 1000 - Number(ts)) <= 300; return fresh && got.length === want.length && crypto.timingSafeEqual(Buffer.from(got), Buffer.from(want));}import hmac, hashlib, time
def verify_mz_webhook(secret: str, raw_body: bytes, headers) -> bool: ts = headers["X-MZ-Timestamp"] got = headers.get("X-MZ-Signature-V2", "").removeprefix("sha256=") want = hmac.new(secret.encode(), ts.encode() + b"." + raw_body, hashlib.sha256).hexdigest() return abs(time.time() - int(ts)) <= 300 and hmac.compare_digest(got, want)The older X-MZ-Signature: sha256=<HMAC of the body only> header is still sent for receivers
written before the timestamped signature; it does not protect against replays, so prefer V2.
Poll events (every plan)
Section titled “Poll events (every plan)”GET https://api.mzpanel.com/v1/events returns the same events without a webhook receiver —
on every plan, with any API token (Read only is enough).
# Newest first (what Zapier and Make polling triggers expect)curl "https://api.mzpanel.com/v1/events?types=job.failed,uptime.down&limit=20" \ -H "Authorization: Bearer mzmcp_YOUR_TOKEN"
# Only what is new since the last call: oldest first after a cursorcurl "https://api.mzpanel.com/v1/events?after=evt_01KB7Q9X3V4M2C8H5N6P0R1S2T" \ -H "Authorization: Bearer mzmcp_YOUR_TOKEN"The answer is {events: [{id, type, serverId, subject, data, createdAt}], order, nextCursor}.
- Without a cursor you get the latest events, newest first (
?limit=1–200, default 50). Page back with?before=<nextCursor>. - With
?after=<id>you get only newer events, oldest first, andnextCursoris always set: store it and send it asafternext time. Events show up here about 2 seconds after they happen. - Filters:
?types=(comma list of the events above),?serverId=. - A token limited to some servers only sees those servers’ events;
mail.receivedneeds a token with themail:readpermission.
Recipes: n8n, Zapier, Make
Section titled “Recipes: n8n, Zapier, Make”- Zapier — Webhooks by Zapier → Retrieve Poll: URL
https://api.mzpanel.com/v1/events?types=job.failed, headerAuthorization: Bearer mzmcp_…, keyevents. Zapier dedupes on each item’sid, so new events trigger the Zap once. - Make — HTTP → Make a request on a schedule (GET, same URL and header, parse response),
then an Iterator over
events; filter onidgreater than the last one you stored in a data store, or use theaftercursor. - n8n — Schedule Trigger → HTTP Request (GET
https://api.mzpanel.com/v1/events?after={{$getWorkflowStaticData('global').cursor}}, header auth) → Code node that savesnextCursorback to the static data → Split Outevents. Start the cursor from the newestidof a first un-cursored call. - On Pro, point the same tools’ webhook trigger at a webhook endpoint instead and verify the signature as above.
API & automation
Section titled “API & automation”mz runs on a single VPS, so it does not apply to this account-level page.
Programmatic control of the whole fleet goes through the REST API or MCP with a
token from this page:
curl https://api.mzpanel.com/v1/api/servers \ -H "Authorization: Bearer mzmcp_YOUR_TOKEN" \ -H "Accept: application/json"Discover what a token can do with GET /v1/api/operations (every operation, its MCP
tool name, level, scope, min_tier and allowed_for_this_token) and
GET /v1/api/job-kinds/{type} (the JSON Schema of an on-box job). Over MCP the same
discovery is jobs_schema. Webhook endpoints are managed with dev_webhooks_list,
dev_webhooks_deliveries, dev_webhooks_create / _update / _delete / _test
(Pro, and webhooks:admin for changes). The event feed is events_list
(GET /v1/events, any token level, every plan).
See Control plane API for the auth model and the error shape, and For AI agents for connecting an MCP client. For driving an individual box from its shell, see The mz CLI.
Gotchas & troubleshooting
Section titled “Gotchas & troubleshooting”- REST API and MCP are on every plan. One API token works over MCP (your AI client) and
the REST API on every plan, Free included. On Free, writes through a token are a 30-day
trial from the workspace’s creation; after it reads keep working and writes answer
402 automation_trial_ended(upgrade to Plus, or make the change in the dashboard). Developer webhooks need Pro or Max; lower tiers get atier_requirederror. - Know the refusal codes.
403 access_level= the token’s level is too low (details.required_level);403 scope_required= an opt-in scope is missing (details.required_scope);403 tier_required= the plan doesn’t include the feature;403 forbidden= the token’s creator has no access to that resource or is no longer a member;403 token_ip_denied= the token has Allowed IPs and the request came from another address (the message names it; edit the token to add it);429= the per-token rate limit (60, 120, 300 or 600 requests a minute by plan). - “You can’t manage access tokens here.” Only members with access-management rights in the organization can create tokens; ask the owner or an admin.
- Tokens are shown once. Copy the full value at creation; there’s no re-reveal. Lost token → regenerate or revoke and reissue.
- Webhooks must be HTTPS. The endpoint URL has to start with
https://; the form rejects plain HTTP. - Retries, and how to stop them. A non-
2xxanswer (or a timeout after 10 s) is retried after 1 min, 5 min, 30 min, 2 h and 12 h, then markedfailed. Answer2xxquickly and do the work afterwards; answer410 Goneto stop retries of that delivery. Because of retries a receiver can see the same event twice: dedupe on the body’sid. Send test ping is never retried. site.downneeds an uptime monitor. It fires when an uptime monitor whose URL points at one of your sites goes down. A site without a monitor never raises it.- Signatures fail after a proxy rewrote the body. Verify over the raw request bytes, not re-serialized JSON, and check the clock of the receiver (5-minute window).
- Scope minimally. Grant only the permission and servers an integration needs (prefer Read-only where possible) so a leaked token has the smallest blast radius.
Related
Section titled “Related”- Control plane API — the REST surface, auth, and error shape.
- The mz CLI — driving a single box from its shell.
- Git connections — another integration surface in the Advanced hub.